all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Deniz Dogan <deniz@dogan.se>
Cc: emacs-devel@gnu.org
Subject: Re: wdired autoload instructions
Date: Sun, 08 May 2011 22:37:53 +0200	[thread overview]
Message-ID: <87aaex3p3y.fsf@ambire.localdomain> (raw)
In-Reply-To: <4DC6F045.50908@dogan.se> (Deniz Dogan's message of "Sun, 08 May 2011 21:34:29 +0200")

() Deniz Dogan <deniz@dogan.se>
() 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 ‘autoload’, its INTERACTIVE 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 ‘eval-after-load’ 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, ‘C-x C-q’ runs a command
that calls ‘wdired-change-to-wdired-mode’ so perhaps you can simplify
your customizations to use that command directly.



  reply	other threads:[~2011-05-08 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08 19:34 wdired autoload instructions Deniz Dogan
2011-05-08 20:37 ` Thien-Thi Nguyen [this message]
2011-05-08 20:45   ` Deniz Dogan
2011-05-09 14:00     ` Davis Herring
2011-05-09 14:24     ` 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

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

  git send-email \
    --in-reply-to=87aaex3p3y.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=deniz@dogan.se \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.