changeset 48058:7dab1d891656

(ibuffer-mouse-popup-menu): Set point before popping up filter groups menu. Preserve point unless a menu command has moved it from point clicked.
author John Paul Wallington <jpw@pobox.com>
date Tue, 29 Oct 2002 04:21:03 +0000
parents 7ba2f62fefd3
children e638758d969d
files lisp/ibuffer.el
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ibuffer.el	Tue Oct 29 01:39:26 2002 +0000
+++ b/lisp/ibuffer.el	Tue Oct 29 04:21:03 2002 +0000
@@ -869,12 +869,13 @@
 (defun ibuffer-mouse-popup-menu (event)
   "Display a menu of operations."
   (interactive "e")
-  (let ((eventpt (save-excursion
-		   (mouse-set-point event)
-		   (point))))
+  (let ((eventpt (posn-point (event-end event)))
+	(origpt (point)))
     (unwind-protect
 	(if (get-text-property eventpt 'ibuffer-filter-group-name)
-	    (popup-menu ibuffer-mode-groups-popup)
+	    (progn
+	      (goto-char eventpt)
+	      (popup-menu ibuffer-mode-groups-popup))
 	  (let ((inhibit-read-only t))
 	    (ibuffer-save-marks
 	     ;; hm.  we could probably do this in a better fashion
@@ -884,7 +885,9 @@
 	       (ibuffer-set-mark ibuffer-marked-char))
 	     (save-excursion
 	       (popup-menu ibuffer-mode-operate-map)))))
-      (setq buffer-read-only t))))
+      (setq buffer-read-only t)
+      (if (eq eventpt (point))
+	  (goto-char origpt)))))
 
 (defun ibuffer-skip-properties (props direction)
   (while (and (not (eobp))