help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: what does 'eval-after-load' what 'add-hook' doesn't do?


From: Leo
Subject: Re: what does 'eval-after-load' what 'add-hook' doesn't do?
Date: Thu, 3 Jul 2003 14:31:21 +1000

thanks kevin

without quoting it works (but NOT in the dired-load-hook; i have to use the
dired-mode-hook)

cheers, leooo

"Kevin Rodgers" <ihs_4664@yahoo.com> wrote in message
3F02FD08.9040003@yahoo.com">news:3F02FD08.9040003@yahoo.com...
> Leo wrote:
>
> > hi there
> >
> > in for xemacs i want to bind a key in the dired-mode-map:
> >
> > i tried:
> >
> > (add-hook 'dired-load-hook
> >    (lambda ()
> >      '(define-key dired-mode-map "j" 'w32-shellex-dired-on-objects)
> >    ))
> >
> > that doesn't work.
>
>
> Because by quoting the (define-key ...) form, you prevent it from being
> evaluated when the anonymous hook function is called.
>
>
> > now i found:
> >
> > (eval-after-load
> >     "dired"
> >   '(define-key dired-mode-map "j" 'w32-shellex-dired-on-objects))
> >
> > what works fine.
> >
> > but why???
>
> Because eval-after-load is a function, it's FORM argument has to be
> quoted to prevent it from being evaluated when eval-after-load is
> called.  (You want the form evaluated later, after the "dired" library
> has been loaded.)  (lambda ..) effectively quotes the (define-key ...)
> FORM for add-hook.
>
>
> --
> <a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>
>




reply via email to

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