From: Colin Walters Date: Thu, 25 Jul 2002 06:25:51 +0000 (+0000) Subject: (ibuffer-mouse-popup-menu): Allow point to be moved by menu functions. X-Git-Tag: ttn-vms-21-2-B4~13866 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=51922c041c2a91cec1764e07c1513efb4baf4610;p=emacs.git (ibuffer-mouse-popup-menu): Allow point to be moved by menu functions. --- diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c622606f31d..058a85ce82d 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -861,26 +861,23 @@ width and the longest string in LIST." (defun ibuffer-mouse-popup-menu (event) "Display a menu of operations." (interactive "e") - (let ((origline (count-lines (point-min) (point)))) + (let ((eventpt (save-excursion + (mouse-set-point event) + (point)))) (unwind-protect - (progn - (mouse-set-point event) - (if (get-text-property (point) 'ibuffer-filter-group-name) - (save-excursion - (popup-menu ibuffer-mode-groups-popup)) - (setq buffer-read-only nil) + (if (get-text-property eventpt 'ibuffer-filter-group-name) + (popup-menu ibuffer-mode-groups-popup) + (let ((inhibit-read-only t)) (ibuffer-save-marks - ;; hm. we could probably do this in a better fashion - (ibuffer-unmark-all ?\r) - (setq buffer-read-only nil) - (ibuffer-set-mark ibuffer-marked-char) - (setq buffer-read-only nil) - (save-excursion - (popup-menu ibuffer-mode-operate-map))))) - (progn - (setq buffer-read-only t) - (goto-line (1+ origline)))))) - + ;; hm. we could probably do this in a better fashion + (ibuffer-unmark-all ?\r) + (save-excursion + (goto-char eventpt) + (ibuffer-set-mark ibuffer-marked-char)) + (save-excursion + (popup-menu ibuffer-mode-operate-map))))) + (setq buffer-read-only t)))) + (defun ibuffer-skip-properties (props direction) (while (and (not (eobp)) (let ((hit nil))