unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: superword-mode
Date: Tue, 26 Mar 2013 21:23:18 -0400	[thread overview]
Message-ID: <jwvsj3hfxzn.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87zjxqt21y.fsf_-_@lifelogs.com> (Ted Zlatanov's message of "Tue,  26 Mar 2013 15:04:57 -0400")

> 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	other threads:[~2013-03-27  1:23 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1UIiBH-0005sm-Vy@vcs.savannah.gnu.org>
2013-03-21 23:44 ` [Emacs-diffs] /srv/bzr/emacs/trunk r112104: * progmodes/cfengine.el (cfengine-common-syntax): Add "_" to word syntax Stefan Monnier
2013-03-21 23:49   ` Ted Zlatanov
2013-03-22  1:32     ` Stefan Monnier
2013-03-22 13:03       ` Ted Zlatanov
2013-03-22 13:14         ` Tom Tromey
2013-03-22 13:38           ` Ted Zlatanov
2013-03-22 14:18             ` Stefan Monnier
2013-03-22 14:46               ` Ted Zlatanov
2013-03-22 17:30                 ` Stefan Monnier
2013-03-22 19:13                   ` Ted Zlatanov
2013-03-23 16:01                     ` Stefan Monnier
2013-03-26  9:17                       ` Ted Zlatanov
2013-03-26 17:06                         ` Stefan Monnier
2013-03-26 19:04                           ` superword-mode (was: [Emacs-diffs] /srv/bzr/emacs/trunk r112104: * progmodes/cfengine.el (cfengine-common-syntax): Add "_" to word syntax.) Ted Zlatanov
2013-03-27  1:23                             ` Stefan Monnier [this message]
2013-03-27  3:18                               ` superword-mode Masatake YAMATO
2013-03-27  9:31                                 ` superword-mode Andreas Schwab
2013-03-27 13:06                                 ` superword-mode Ted Zlatanov
2013-03-27 13:14                                 ` superword-mode Stefan Monnier
2013-03-27 13:04                               ` superword-mode Ted Zlatanov
2013-03-27 13:50                                 ` superword-mode Stefan Monnier
2013-03-27 14:06                                   ` superword-mode Ted Zlatanov
2013-03-27 15:03                             ` superword-mode Davis Herring
2013-03-27 15:19                               ` superword-mode Ted Zlatanov
2013-03-27 15:33                                 ` superword-mode Ted Zlatanov
2013-03-27 16:33                                   ` superword-mode Stefan Monnier
2013-03-27 19:31                                     ` superword-mode Ted Zlatanov
2013-03-27 22:23                                       ` superword-mode Stefan Monnier
2013-03-28 23:00                             ` superword-mode Ted Zlatanov
2013-03-29 13:26                               ` superword-mode Ted Zlatanov
2013-03-29 16:23                                 ` superword-mode Andreas Röhler
2013-03-29 16:43                                   ` superword-mode Ted Zlatanov
2013-03-29 17:49                                     ` superword-mode Andreas Röhler
2013-03-29 18:10                                       ` superword-mode Ted Zlatanov
2013-03-29 18:50                                         ` superword-mode Andreas Röhler
2013-03-29 19:04                                           ` superword-mode Ted Zlatanov
2013-03-29 20:16                                 ` superword-mode Davis Herring
2013-03-29 21:18                               ` superword-mode Stefan Monnier
2013-03-30  1:34                                 ` superword-mode Ted Zlatanov
2013-03-30  1:36                                   ` superword-mode Ted Zlatanov
2013-03-30  6:28                                 ` superword-mode Andreas Röhler
2013-03-22 14:13         ` [Emacs-diffs] /srv/bzr/emacs/trunk r112104: * progmodes/cfengine.el (cfengine-common-syntax): Add "_" to word syntax Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvsj3hfxzn.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).