unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Leon <sdl.web@gmail.com>
Subject: Re: Tidying up some elisp
Date: Tue, 29 Aug 2006 13:35:48 +0100	[thread overview]
Message-ID: <m2y7t7en2z.fsf@sl392.st-edmunds.cam.ac.uk> (raw)
In-Reply-To: 87r6z0pgxc.fsf@mail.com

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

  reply	other threads:[~2006-08-29 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-28 23:41 Tidying up some elisp Hadron Quark
2006-08-29 12:35 ` Leon [this message]
     [not found] ` <mailman.5904.1156854982.9609.help-gnu-emacs@gnu.org>
2006-08-29 13:14   ` Hadron Quark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2y7t7en2z.fsf@sl392.st-edmunds.cam.ac.uk \
    --to=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).