From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: wdired autoload instructions Date: Sun, 08 May 2011 22:37:53 +0200 Message-ID: <87aaex3p3y.fsf@ambire.localdomain> References: <4DC6F045.50908@dogan.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1304887153 31406 80.91.229.12 (8 May 2011 20:39:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 8 May 2011 20:39:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Deniz Dogan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 08 22:39:10 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QJAku-0001yk-Js for ged-emacs-devel@m.gmane.org; Sun, 08 May 2011 22:39:08 +0200 Original-Received: from localhost ([::1]:37047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJAku-0003Ik-6Z for ged-emacs-devel@m.gmane.org; Sun, 08 May 2011 16:39:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJAkq-0003Ib-Uk for emacs-devel@gnu.org; Sun, 08 May 2011 16:39:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJAkp-0004Vq-TJ for emacs-devel@gnu.org; Sun, 08 May 2011 16:39:04 -0400 Original-Received: from smtp205.alice.it ([82.57.200.101]:40366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJAkp-0004Ve-FO for emacs-devel@gnu.org; Sun, 08 May 2011 16:39:03 -0400 Original-Received: from ambire.localdomain (80.180.3.75) by smtp205.alice.it (8.5.124.08) id 4DB13A490155CC2B; Sun, 8 May 2011 22:38:55 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1QJAjh-0002PY-Ur; Sun, 08 May 2011 22:37:53 +0200 In-Reply-To: <4DC6F045.50908@dogan.se> (Deniz Dogan's message of "Sun, 08 May 2011 21:34:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.101 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:139229 Archived-At: () Deniz Dogan () Sun, 08 May 2011 21:34:29 +0200 ;; (autoload 'wdired-change-to-wdired-mode "wdired") ;; (eval-after-load "dired" ;; '(lambda () ;; (define-key dired-mode-map "r" 'wdired-change-to-wdired-= mode) ;; (define-key dired-mode-map ;; [menu-bar immediate wdired-change-to-wdired-mode] ;; '("Edit File Names" . wdired-change-to-wdired-mode)))) This is what I put in my init file: (autoload 'wdired-change-to-wdired-mode "wdired") (eval-after-load "dired" '(lambda () (define-key dired-mode-map "r" 'wdired-change-to-wdired-mode))) Now when I start dired, "r" is still undefined and `wdired-changeto-wdired-mode' is not recognized as a command (but is of = course a function). 1. Is this a documentation bug? Yes (in as much as the Commentary is a valid form of documentation). To mark a function as a command to =E2=80=98autoload=E2=80=99, its INTERACT= IVE arg must be non-nil. 2. Is the quoting of `lambda' necessary? No, in two senses. First, because lambda forms are self-quoting. Second, because =E2=80=98eval-after-load=E2=80=99 takes a form, not a thunk. Evaluating a self-quoting lambda form only yields an anonymous function, which is not what is desired in this case. Unless the form is to be computed, normally it should be quoted, so quoting is indeed necessary (just not of a lambda form). In sum, a better blurb would be: (autoload 'wdired-change-to-wdired-mode "wdired" "Switch to Wdired mode." t) (eval-after-load "dired" '(progn (define-key dired-mode-map "r" 'wdired-change-to-wdired-mode) (define-key dired-mode-map [menu-bar immediate wdired-change-to-wdired-mode] '("Edit File Names" . wdired-change-to-wdired-mode)))) Anyway, it seems that in in Dired mode, =E2=80=98C-x C-q=E2=80=99 runs a co= mmand that calls =E2=80=98wdired-change-to-wdired-mode=E2=80=99 so perhaps you ca= n simplify your customizations to use that command directly.