[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VC Development
From: |
Stefan Monnier |
Subject: |
Re: VC Development |
Date: |
Wed, 04 Feb 2009 14:31:54 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
>> Better yet: use the `keymap' property rather than the `local-map'
>> property, so the keymap can just contains the `mouse-2' binding without
>> having to explicitly copy and/or inherit from the local map.
> Like below?
That looks OK, yes.
You may want to wrap the code of vc-dir-find-file-other-window inside
a save-selected-window since posn-set-point may change the window.
Also I'd use last-nonmenu-event since that's what is used by
interactive's "e" code. IIUC that would allow it work if the command is
put on a contextual pop-up menu.
Stefan
> 2009-02-04 Nick Roberts <address@hidden>
> * vc-dir.el (vc-dir-find-file-other-window): Allow mouse events.
> (vc-dir-mouse-map): New keymap.
> (vc-default-dir-printer): Use it locally.
> --- vc-dir.el 01 Feb 2009 12:10:10 +1300 1.34
> +++ vc-dir.el 04 Feb 2009 22:31:53 +1300
> @@ -689,9 +689,10 @@ that share the same state."
> (interactive)
> (find-file (vc-dir-current-file)))
> -(defun vc-dir-find-file-other-window ()
> +(defun vc-dir-find-file-other-window (&optional event)
> "Find the file on the current line, in another window."
> - (interactive)
> + (interactive (list last-input-event))
> + (if event (posn-set-point (event-end event)))
> (find-file-other-window (vc-dir-current-file)))
> (defun vc-dir-isearch ()
> @@ -1145,6 +1146,12 @@ Interactively, a prefix argument means t
> (propertize "Please add backend specific headers here. It's easy!"
> 'face 'font-lock-warning-face)))
> +(defvar vc-dir-mouse-map
> + (let ((map (make-sparse-keymap)))
> + (define-key map [mouse-2] 'vc-dir-find-file-other-window)
> + map)
> + "Local keymap for visiting a file.")
> +
> (defun vc-default-dir-printer (backend fileentry)
> "Pretty print FILEENTRY."
> ;; If you change the layout here, change vc-dir-move-to-goal-column.
> @@ -1171,7 +1178,8 @@ Interactively, a prefix argument means t
> (if isdir
> "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu"
> "File\nmouse-3: Pop-up menu")
> - 'mouse-face 'highlight))))
> + 'mouse-face 'highlight
> + 'keymap vc-dir-mouse-map))))
> (defun vc-default-extra-status-menu (backend)
> nil)
Re: VC Development, Stefan Monnier, 2009/02/02