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

Re: gEDA-user: gschem: customizing keymaps



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

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


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