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

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

Re: Tidying up some elisp


From: Hadron Quark
Subject: Re: Tidying up some elisp
Date: Tue, 29 Aug 2006 15:14:32 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Leon <sdl.web@gmail.com> 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.


reply via email to

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