emacs-devel
[Top][All Lists]
Advanced

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

Re: wdired autoload instructions


From: Deniz Dogan
Subject: Re: wdired autoload instructions
Date: Sun, 08 May 2011 22:45:36 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

On 2011-05-08 22:37, Thien-Thi Nguyen wrote:
() 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))))


Would anyone, for any reason, mind if we change the comment to recommend this instead?

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.


Thanks, I did not know that.



reply via email to

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