Let delete-selection-mode work with popup-menu commands (Bug#27569)
authorNoam Postavsky <npostavs@gmail.com>
Wed, 12 Jul 2017 01:09:10 +0000 (21:09 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Tue, 18 Jul 2017 10:31:39 +0000 (06:31 -0400)
* lisp/menu-bar.el (popup-menu): Run `pre-command-hook' with
`this-command' set to the selected command.

lisp/menu-bar.el

index 3ca7d1b5b3d21f5f681782ec8a0ae57e26ce0c0a..4a569783293cb518aeb07248a350b0b331f32a02 100644 (file)
@@ -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))))