[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: gschem: customizing keymaps



Am Mittwoch, 12. Dezember 2007 schrieb Dean Ferreyra:
> Thomas Franke wrote:
> > I know that gschem keymaps can be customized by making a
> > copy of the original keymap definition list to my local
> > gschemrc file and edit to my needs.
> >
> > However, can anyone of the scheme experts tell me a
> > shorthand how to change just a single element of that list
> > without the need to make this tedious copy of the things I
> > didn't want to change?
> >
> > E.g. change ("r" . view-redraw) from the global keymap list
> > to ("F5" . view-redraw).
>
> Hi Thomas,
>
> I haven't tried this in gschem's resource file, but I've tried
> them in Guile, so they might work for you.
>
> This might work, though technically it's not proper Scheme
> code because view-keymap is usually defined as a constant:
>
>   (set-car! (assoc "r" view-keymap) "F5")
Yes, I've tried. This works also from gschem's resource file!

> If that doesn't work, this one should:
>
>   (set! view-keymap
>         (map (lambda (pair)
>                (if (equal? (car pair) "r")
>                    (cons "F5" (cdr pair))
>                    pair))
>              view-keymap))
>
> and if you have a lot of these to do you can try this pattern:
>
>   (set! view-keymap
>         (map (lambda (pair)
>                (cond ((equal? (car pair) "r")
>                       (cons "F5" (cdr pair)))
>                      ((equal? (car pair) "b")
>                       (cons "F6" (cdr pair)))
>                      (else
>                       pair)))
>              view-keymap))
>
> Dean
Hm! This look more verbose than I expected. Anyway I will play 
around with it and see. Thanks Dean!
-- 
Man liest sich,

    Thomas Franke


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user