emacs-devel
[Top][All Lists]
Advanced

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

Re: Longlines mode in menu


From: David Reitter
Subject: Re: Longlines mode in menu
Date: Wed, 18 Jun 2008 21:59:07 +0100

On 18 Jun 2008, at 21:50, Lennart Borgman (gmail) wrote:
Could you show me exactly how and what you bind. I want to test and I had some trouble with bindings like this

   (define-key map [down] 'osxkeys-visual-line-down-in-buffers)


I'm binding this:

    (define-key map '[(up)] 'visual-line-up)
    (define-key map '[(down)] 'visual-line-down)

I'm actually binding this in my mode's "low priority keymap" so that other minor modes can override.
I use the code below.

That said, it should work from the normal minor mode keymap as well.

- D


(defun aquamacs-install-low-priority-global-key-map (keymap &optional target)
  "Install keys from keymap keymap into the target (or global) map."
  (let ((target (or target (current-global-map)))
        (overwritten (make-sparse-keymap)))
    (map-keymap
   (lambda (key command)
     (let ((old (lookup-key  target `[,key])))
       (if (keymapp command)  ; key is a prefix key
           (if (keymapp old)
               ;; recurse
               (setq old (aquamacs-install-low-priority-global-key-map
                          command old)))
         (define-key target `[,key] command))
         ;; also save "nil" entries for unassigned keys
       (define-key overwritten `[,key] old)))
   keymap)
    overwritten))

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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