From: sigurd@12move.de (Karl Pflästerer)
Subject: Re: "variable [in .emacs] is void"
Date: Mon, 22 Dec 2003 17:01:55 +0100 [thread overview]
Message-ID: <m3ad5kj1go.fsf@hamster.pflaesterer.de> (raw)
In-Reply-To: mailman.471.1072109811.868.help-gnu-emacs@gnu.org
An unnamed person wrote:
> Great. That works. Now, I have some other functions which also use
> mail-mode-map. Can I wrap them in the same '(add-hook ...? Or do I
> need to duplicate the lines for each? ... like this?
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map mail-foo...
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map mail-bar...
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map foo-be-do-be-do...
That depends on what you want to achive; to have multiple functions in a
hook you can wrap them in a lambda form or you can add them each
separately to the hook.
So either:
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-foo...))
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-bar...))
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map foo-be-do-be-do...)))
or:
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
(lambda ()
(define-key mail-mode-map mail-foo...)
(define-key mail-mode-map mail-bar...)
(define-key mail-mode-map foo-be-do-be-do...))))
You needn't duplicate the `eval-after-load' macro.
> Even tidier and more readable, can I put all the sendmail-dependent
> defines in a separate (possibly byte-compiled) file and then have
> something like an "include" in my emacs evaluate them all subject to an
> (eval-after-load "sendmail" ...)?
Yes. That's the way a lot of people prefer. Like that you don't lose
the oversight over your config files.
(eval-after-load "sendmail"
(load "privhooks"))
;; privhooks.el
(add-hook 'mail-setup-hook
(lambda ()
(define-key mail-mode-map mail-foo...)
(define-key mail-mode-map mail-bar...)
(define-key mail-mode-map foo-be-do-be-do...))))
To byte-compile it you might need an
(eval-when-compile
(require 'sendmail))
in the top of your privhooks.el.
KP
--
"Lisp is worth learning for the profound enlightenment experience you
will have when you finally get it; that experience will make you a
better programmer for the rest of your days, even if you never
actually use Lisp itself a lot." -- Eric S. Raymond
next parent reply other threads:[~2003-12-22 16:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.471.1072109811.868.help-gnu-emacs@gnu.org>
2003-12-22 16:01 ` Karl Pflästerer [this message]
2003-12-22 18:28 ` "variable [in .emacs] is void" Karl Pflästerer
2003-12-23 3:11 ` gebser
[not found] <mailman.501.1072152815.868.help-gnu-emacs@gnu.org>
2003-12-23 17:39 ` Kevin Rodgers
2004-01-02 14:53 ` gebser
[not found] <mailman.498.1072144317.868.help-gnu-emacs@gnu.org>
2003-12-23 17:27 ` Kevin Rodgers
[not found] <mailman.431.1072038664.868.help-gnu-emacs@gnu.org>
2003-12-21 20:07 ` Karl Pflästerer
2003-12-22 15:14 ` gebser
2003-12-22 19:27 ` Kevin Rodgers
2003-12-23 0:49 ` gebser
[not found] <mailman.415.1071963863.868.help-gnu-emacs@gnu.org>
2003-12-21 17:18 ` Karl Pflästerer
2003-12-21 19:28 ` gebser
[not found] <mailman.408.1071929942.868.help-gnu-emacs@gnu.org>
2003-12-20 15:29 ` Tim McNamara
2003-12-20 23:58 ` gebser
2003-12-20 16:24 ` Karl Pflästerer
2003-12-20 22:42 ` gebser
2003-12-20 13:16 gebser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ad5kj1go.fsf@hamster.pflaesterer.de \
--to=sigurd@12move.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.