* how to use "dolist" if it's elements are also list
@ 2009-11-04 4:31 Chris
2009-11-04 5:00 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Chris @ 2009-11-04 4:31 UTC (permalink / raw)
To: help-gnu-emacs
Hello the group.
I want to add a function to several hooks using dolist, but it doesn't
work as I thought. I know the reason is that the hook in the list is not
recgonized as a list, but I don't know how to fix it. Any help?
(dolist
(the-hook
'(c-mode-common-hook
java-mode-hook
perl-mode-hook
php-mode-hook
emacs-lisp-mode-hook))
(add-hook 'the-hook 'my-common-key-binding))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to use "dolist" if it's elements are also list
[not found] <mailman.10024.1257309084.2239.help-gnu-emacs@gnu.org>
@ 2009-11-04 4:56 ` Pascal J. Bourguignon
0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2009-11-04 4:56 UTC (permalink / raw)
To: help-gnu-emacs
Chris <bbshliu@gmail.com> writes:
> Hello the group.
>
> I want to add a function to several hooks using dolist, but it doesn't
> work as I thought. I know the reason is that the hook in the list is
> not recgonized as a list, but I don't know how to fix it. Any help?
>
> (dolist
> (the-hook
> '(c-mode-common-hook
> java-mode-hook
> perl-mode-hook
> php-mode-hook
> emacs-lisp-mode-hook))
> (add-hook 'the-hook 'my-common-key-binding))
(setf my-common-key-binding (append my-common-key-binding
c-mode-common-hook
java-mode-hook
perl-mode-hook
php-mode-hook
emacs-lisp-mode-hook))
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: how to use "dolist" if it's elements are also list
2009-11-04 4:31 Chris
@ 2009-11-04 5:00 ` Drew Adams
2009-11-04 5:54 ` Chris
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2009-11-04 5:00 UTC (permalink / raw)
To: 'Chris', help-gnu-emacs
> (dolist
> (the-hook
> '(c-mode-common-hook
> java-mode-hook
> perl-mode-hook
> php-mode-hook
> emacs-lisp-mode-hook))
> (add-hook 'the-hook 'my-common-key-binding))
Don't quote the-hook. You want its value. The value of 'the-hook is the symbol
the-hook itself, not the value of that symbol.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to use "dolist" if it's elements are also list
2009-11-04 5:00 ` Drew Adams
@ 2009-11-04 5:54 ` Chris
0 siblings, 0 replies; 4+ messages in thread
From: Chris @ 2009-11-04 5:54 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
Drew Adams wrote:
>> (dolist
>> (the-hook
>> '(c-mode-common-hook
>> java-mode-hook
>> perl-mode-hook
>> php-mode-hook
>> emacs-lisp-mode-hook))
>> (add-hook 'the-hook 'my-common-key-binding))
>>
>
>
> Don't quote the-hook. You want its value. The value of 'the-hook is the symbol
> the-hook itself, not the value of that symbol.
>
>
thanks for your help. it now works.
[-- Attachment #2: Type: text/html, Size: 793 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-04 5:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.10024.1257309084.2239.help-gnu-emacs@gnu.org>
2009-11-04 4:56 ` how to use "dolist" if it's elements are also list Pascal J. Bourguignon
2009-11-04 4:31 Chris
2009-11-04 5:00 ` Drew Adams
2009-11-04 5:54 ` Chris
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).