emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: superword-mode


From: Stefan Monnier
Subject: Re: superword-mode
Date: Tue, 26 Mar 2013 21:23:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> OK; see attached.  Implemented by looking at the `superword-mode'
> variable in the internal `subword-mode' commands.

Looks good, see comments below.

> Included and done for both `subword-mode' and `superword-mode'.

BTW, this needs an entry in etc/NEWS, of course.

> +;; (add-hook 'c-mode-common-hook
> +;;     (lambda () (superword-mode 1)))

This should be simply

   +;; (add-hook 'c-mode-common-hook 'superword-mode)

> +    :lighter " ,"
> +    nil
> +    nil
> +    subword-mode-map

The "three args" are only used if there's no :keyword arg.
So the above is the same as

> +    :lighter " ,"
> +    (progn nil
> +           nil
> +           subword-mode-map)

The subword-mode-map should be used by default anyway, so you can just
remove those 3 expressions.

I'm not sure we want to add a :lighter, by the way.
 
> +(defun subword-right (&optional arg)
> +  (interactive "p")
> +  (subword-forward arg))

Why not (defalias 'subword-right 'subword-forward)?
Else, please add a docstring.

> +(defun subword-left (&optional arg)
> +  (interactive "p")
> +  (subword-backward arg))

Same here.

> +(defvar superword-mode-map
> +  (let ((map (make-sparse-keymap)))
> +    (dolist (cmd '(forward-word backward-word mark-word kill-word
> +                             backward-kill-word transpose-words
> +                                capitalize-word upcase-word downcase-word
> +                                left-word right-word))
> +      (let ((othercmd (let ((name (symbol-name cmd)))
> +                        (string-match "\\([[:alpha:]-]+\\)-word[s]?" name)
> +                        (intern (concat "subword-" (match-string 1 name))))))
> +        (define-key map (vector 'remap cmd) othercmd)))
> +    map)

Why not (defvar superword-mode-map subword-mode-map)?


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]