unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* wdired autoload instructions
@ 2011-05-08 19:34 Deniz Dogan
  2011-05-08 20:37 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Deniz Dogan @ 2011-05-08 19:34 UTC (permalink / raw)
  To: emacs-devel

I read the following in wdired.el:

;; This is the recommended way for faster Emacs startup time and lower
;; memory consumption:
;;
;; (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?
2. Is the quoting of `lambda' necessary?


Thanks,
Deniz Dogan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wdired autoload instructions
  2011-05-08 19:34 wdired autoload instructions Deniz Dogan
@ 2011-05-08 20:37 ` Thien-Thi Nguyen
  2011-05-08 20:45   ` Deniz Dogan
  0 siblings, 1 reply; 5+ messages in thread
From: Thien-Thi Nguyen @ 2011-05-08 20:37 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wdired autoload instructions
  2011-05-08 20:37 ` Thien-Thi Nguyen
@ 2011-05-08 20:45   ` Deniz Dogan
  2011-05-09 14:00     ` Davis Herring
  2011-05-09 14:24     ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Deniz Dogan @ 2011-05-08 20:45 UTC (permalink / raw)
  To: emacs-devel

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

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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wdired autoload instructions
  2011-05-08 20:45   ` Deniz Dogan
@ 2011-05-09 14:00     ` Davis Herring
  2011-05-09 14:24     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Davis Herring @ 2011-05-09 14:00 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: emacs-devel

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

Given the presence of the C-x C-q command, I suppose we should just
delete the comment entirely.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wdired autoload instructions
  2011-05-08 20:45   ` Deniz Dogan
  2011-05-09 14:00     ` Davis Herring
@ 2011-05-09 14:24     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-05-09 14:24 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: emacs-devel

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

Please change this broken and out-of-date comment by removing it
altogether and mentioning that wdired is activated by C-x C-q.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-09 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-08 19:34 wdired autoload instructions Deniz Dogan
2011-05-08 20:37 ` Thien-Thi Nguyen
2011-05-08 20:45   ` Deniz Dogan
2011-05-09 14:00     ` Davis Herring
2011-05-09 14:24     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).