]> code.delx.au - gnu-emacs/commitdiff
(ibuffer-mouse-popup-menu): Set point before popping
authorJohn Paul Wallington <jpw@pobox.com>
Tue, 29 Oct 2002 04:21:03 +0000 (04:21 +0000)
committerJohn Paul Wallington <jpw@pobox.com>
Tue, 29 Oct 2002 04:21:03 +0000 (04:21 +0000)
up filter groups menu.  Preserve point unless a menu command has
moved it from point clicked.

lisp/ibuffer.el

index d37d5c6f644305cd5190690b8a9e21ad92267f75..464961cc41780be936ee4db0a9f45001837ad303 100644 (file)
@@ -869,12 +869,13 @@ width and the longest string in LIST."
 (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 @@ width and the longest string in LIST."
               (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))