() 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))))