summaryrefslogtreecommitdiff
path: root/lisp/menu-bar.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2017-07-11 21:09:10 -0400
committerNoam Postavsky <npostavs@gmail.com>2017-07-18 06:31:39 -0400
commita2ee81911bdf0f37b992989a9d36bb4d2ba14052 (patch)
treea94f056cc0eac84316a0451ebc2df76b1340687b /lisp/menu-bar.el
parent1a62721f2d82f7a35a9fc84864f6df0ede2c05c5 (diff)
downloademacs-a2ee81911bdf0f37b992989a9d36bb4d2ba14052.tar.gz
emacs-a2ee81911bdf0f37b992989a9d36bb4d2ba14052.tar.bz2
emacs-a2ee81911bdf0f37b992989a9d36bb4d2ba14052.zip
Let delete-selection-mode work with popup-menu commands (Bug#27569)
* lisp/menu-bar.el (popup-menu): Run `pre-command-hook' with `this-command' set to the selected command.
Diffstat (limited to 'lisp/menu-bar.el')
-rw-r--r--lisp/menu-bar.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 3ca7d1b5b3d..4a569783293 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -2375,6 +2375,10 @@ FROM-MENU-BAR, if non-nil, means we are dropping one of menu-bar's menus."
;; `setup-specified-language-environment', for instance,
;; expects this to be set from a menu keymap.
(setq last-command-event (car (last event)))
+ ;; Update `this-command' and run `pre-command-hook' so that
+ ;; things like `delete-selection-pre-hook' will work correctly.
+ (setq this-command cmd)
+ (run-hooks 'pre-command-hook)
;; mouse-major-mode-menu was using `command-execute' instead.
(call-interactively cmd))))