emacs-devel
[Top][All Lists]
Advanced

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

Re: wdired autoload instructions


From: Thien-Thi Nguyen
Subject: Re: wdired autoload instructions
Date: Sun, 08 May 2011 22:37:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

() Deniz Dogan <address@hidden>
() 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 via email to

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