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

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

Re: emacs init and mode-maps


From: Andreas Roehler
Subject: Re: emacs init and mode-maps
Date: Thu, 22 Jun 2006 15:58:39 +0200
User-agent: KNode/0.9.2

Reiner Steib wrote:

> On Thu, Jun 22 2006, David Kastrup wrote:
> 
>> Reiner Steib <address@hidden> writes:
>>> Use `eval-after-load' or a mode hook.
>>
>> (add-hook 'sh-mode-hook (lambda nil
>>    (define-key sh-mode-map "\M-#" 'variable-anlegen)))
>>
>> Would be sort of the usual way to do this.  eval-after-load is
>> rather an emergency measure and not desirable here.
> 
> My understanding was that `eval-after-load' is discouraged in
> programs, but okay for user init files:
> 
> ,----[ (info "(elisp)Hooks for Loading") ]
> | You can ask for code to be executed if and when a particular
> | library is loaded, by calling `eval-after-load'.
> |
> | [...]
> |
> |    In general, well-designed Lisp programs should not use
> |    this feature.
> | [...]
> | 
> |    But it is OK to use `eval-after-load' in your personal
> | customizations if you don't feel they must meet the design
> | standards for programs meant for wider use.
> `----
> 
> Bye, Reiner.

OK. Thanks to all responding my question. Obviously
there are several ways to do it.

As the question aimed towards usability here still a
draft of the situation a beginner is in - after reading
the tutorial and some further introductions:

He probably knows that 

- there are modes to adapt the behavior

- there are keys to assign and beside `global-keys' it's
  possible to specify mode-specific keys

- an init file ".emacs" reads in customizations


All the stuff with `eval-after-load' and even hooks are 
too much at the beginning.

On the other side it should be possible with a
mode-name to assign a key on that level without deeper
knowledge.

An assignment as 

(define-key sh-mode-map "\M-#" 'do-something)

should work instantly, as soon as sh-mode is activated.

Suggest to post the question to emacs-devel after the
forthcoming release, should it not be done then.

__
Andreas Roehler

PS: I would lobby to keep the shown names in the
mode-line the same as the real modes - major- and/or minor; 
presently Shell-script[bash] i.e. is given at the mode-line when
`sh-mode' is on as major-mode. But that's a further question. 




reply via email to

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