From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: superword-mode Date: Tue, 26 Mar 2013 21:23:18 -0400 Message-ID: References: <87wqt0xqiy.fsf@lifelogs.com> <87sj3ny4ca.fsf@lifelogs.com> <87ehf7zid3.fsf@fleche.redhat.com> <87obeby2ph.fsf@lifelogs.com> <878v5fxzjg.fsf@lifelogs.com> <871ub7xn7e.fsf@lifelogs.com> <87r4j2v7t8.fsf@lifelogs.com> <87zjxqt21y.fsf_-_@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1364347405 7047 80.91.229.3 (27 Mar 2013 01:23:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Mar 2013 01:23:25 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 27 02:23:52 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UKf5j-0002iL-Mt for ged-emacs-devel@m.gmane.org; Wed, 27 Mar 2013 02:23:51 +0100 Original-Received: from localhost ([::1]:38309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKf5L-0005Xf-OF for ged-emacs-devel@m.gmane.org; Tue, 26 Mar 2013 21:23:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKf5I-0005Xa-Bo for emacs-devel@gnu.org; Tue, 26 Mar 2013 21:23:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKf5H-0001Hh-9b for emacs-devel@gnu.org; Tue, 26 Mar 2013 21:23:24 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:58530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKf5H-0001Hd-4l for emacs-devel@gnu.org; Tue, 26 Mar 2013 21:23:23 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxLSu/2dsb2JhbABEvw4Xc4IeAQEEAVYoCws0EhQYDVGHcQaxH5AOjWGDKQOkeoFegxM X-IPAS-Result: Av4EABK/CFFFxLSu/2dsb2JhbABEvw4Xc4IeAQEEAVYoCws0EhQYDVGHcQaxH5AOjWGDKQOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="5874586" Original-Received: from 69-196-180-174.dsl.teksavvy.com (HELO pastel.home) ([69.196.180.174]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Mar 2013 21:23:19 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 07D7F6789F; Tue, 26 Mar 2013 21:23:18 -0400 (EDT) In-Reply-To: <87zjxqt21y.fsf_-_@lifelogs.com> (Ted Zlatanov's message of "Tue, 26 Mar 2013 15:04:57 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158255 Archived-At: > 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