unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tidying up some elisp
@ 2006-08-28 23:41 Hadron Quark
  2006-08-29 12:35 ` Leon
       [not found] ` <mailman.5904.1156854982.9609.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Hadron Quark @ 2006-08-28 23:41 UTC (permalink / raw)



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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Tidying up some elisp
  2006-08-28 23:41 Tidying up some elisp Hadron Quark
@ 2006-08-29 12:35 ` Leon
       [not found] ` <mailman.5904.1156854982.9609.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Leon @ 2006-08-29 12:35 UTC (permalink / raw)


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))))

-- 
Leon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Tidying up some elisp
       [not found] ` <mailman.5904.1156854982.9609.help-gnu-emacs@gnu.org>
@ 2006-08-29 13:14   ` Hadron Quark
  0 siblings, 0 replies; 3+ messages in thread
From: Hadron Quark @ 2006-08-29 13:14 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-29 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 23:41 Tidying up some elisp Hadron Quark
2006-08-29 12:35 ` Leon
     [not found] ` <mailman.5904.1156854982.9609.help-gnu-emacs@gnu.org>
2006-08-29 13:14   ` Hadron Quark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).