From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.help Subject: Re: emacs init and mode-maps Date: Thu, 22 Jun 2006 15:58:39 +0200 Organization: 1&1 Internet AG Message-ID: References: <85d5d1sfy4.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: sea.gmane.org 1150987295 31515 80.91.229.2 (22 Jun 2006 14:41:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 22 Jun 2006 14:41:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 22 16:41:28 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FtQN3-00040W-J4 for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jun 2006 16:41:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FtQN3-0002cl-1J for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jun 2006 10:41:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 75 Original-NNTP-Posting-Host: p54beb265.dip0.t-ipconnect.de Original-X-Trace: online.de 1150984242 22273 84.190.178.101 (22 Jun 2006 13:50:42 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Thu, 22 Jun 2006 13:50:42 +0000 (UTC) User-Agent: KNode/0.9.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:139973 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35597 Archived-At: Reiner Steib wrote: > On Thu, Jun 22 2006, David Kastrup wrote: > >> Reiner Steib 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.