From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hadron Quark Newsgroups: gmane.emacs.help Subject: Re: Tidying up some elisp Date: Tue, 29 Aug 2006 15:14:32 +0200 Message-ID: <874pvv1y6f.fsf@mail.com> References: <87r6z0pgxc.fsf@mail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1156858861 27191 80.91.229.2 (29 Aug 2006 13:41:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 Aug 2006 13:41:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 29 15:40:59 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 1GI3pl-0000rE-45 for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Aug 2006 15:40:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GI3pk-0007iJ-KG for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Aug 2006 09:40:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-X-Trace: individual.net rU891iEMdJRX6DCZVw4fAQ//36KdXTmco46Hm9LCJMk4w4VbJG X-Orig-Path: news.ibm.net!news X-Face: 2h#||Cd#d%F*NCm59[_6/{1a@jy%; |j>{D~4^gKg(^i%7j0IK?+,/GmW&:CD5fEKb_! User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:TxEweeGopNlQbhu4QQf70v4+Z5E= Original-Xref: shelby.stanford.edu gnu.emacs.help:141414 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:37034 Archived-At: Leon writes: > On Tue, 29 Aug 2006 01:41:03 +0200, Hadron Quark wrote: > >> I was just tidying up my .emacs to make things a little bit more modular >> and mode specific. I changed a load og global-set-key calls to the >> following so that after I loaded a c file, the other bufefrs werent >> accessing these c specific key bindings: >> >> (define-key c-mode-map [f5] 'find-tag-noconfirm) >> (define-key c-mode-map [f6] 'find-tag-repeat) >> (define-key c-mode-map [f7] 'pop-tag-mark) >> >> (define-key c-mode-map [f2] 'gdb-restore-windows) >> (define-key c-mode-map [f10] 'compile) >> (define-key c-mode-map [(f11)] 'next-error) >> (define-key c-mode-map [(f12)] 'gdba) >> >> >> Is there some kind of "with" statement or "Lisp approach" which would >> make this more "Lisp"y? Something like an array of pairs and a loop to >> call define key for this mode? >> >> Something like >> >> for(all in arr) >> define-key c-mode-map @index @value >> >> if you get my meaning. Am beginning so am looking for pointers in how to >> approach things or "think" in order to best use Lisp. > > For example: > > (let ((dl '( > ([f5] . find-tag) > ([f6] . find-tag-other-window)))) > (dolist (i dl) > (define-key c-mode-map (car i) (cdr i)))) Something else new. Thanks a lot. CAR and CDR. Wow. Interesting terminology.