[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27569: delete-selection on yank via popup-menu
From: |
Tak Kunihiro |
Subject: |
bug#27569: delete-selection on yank via popup-menu |
Date: |
Wed, 05 Jul 2017 08:11:28 +0900 (JST) |
>> I want to yank via popup-menu with delete-selection-mode.
>> Problem is yanking via popup-menu does not delete region.
>>
>> emacs -Q
>> (defun popup-edit-menu ()
>> (interactive)
>> (popup-menu menu-bar-edit-menu))
>> (define-key global-map [mouse-3] 'popup-edit-menu)
>> (delete-selection-mode 1)
>>
>> 1. kill something
>> 2. select text (activate region) to be replaced
>> 3. choose yank in popup-menu via mouse-3
>>
>> Problem: Selected text by (2) is not deleted.
>>
>> I barely see problem is that on delete-selection-pre-hook,
>> this-command is `popup-edit-menu' instead `yank'.
>>
>> Is there a way to solve the problem?
>
> This seems to work, though I'm not sure if it's the right way. Perhaps
> `this-command' should be setq instead of let-bound? Will running
> pre-command-hook twice be a problem? etc...
>
> --- i/lisp/menu-bar.el
> +++ w/lisp/menu-bar.el
> @@ -2360,6 +2360,8 @@ (defun popup-menu (menu &optional position prefix
> from-menu-bar)
> ;; `setup-specified-language-environment', for instance,
> ;; expects this to be set from a menu keymap.
> (setq last-command-event (car (last event)))
> + (let ((this-command cmd))
> + (run-hooks 'pre-command-hook))
> ;; mouse-major-mode-menu was using `command-execute' instead.
> (call-interactively cmd))))
Although I cannot comment on what you worry, it works well for me.
Thank you for the fix.
- bug#27569: delete-selection on yank via popup-menu, Tak Kunihiro, 2017/07/03
- bug#27569: delete-selection on yank via popup-menu, npostavs, 2017/07/03
- bug#27569: delete-selection on yank via popup-menu,
Tak Kunihiro <=
- bug#27569: delete-selection on yank via popup-menu, Tak Kunihiro, 2017/07/11
- bug#27569: delete-selection on yank via popup-menu, npostavs, 2017/07/11
- bug#27569: delete-selection on yank via popup-menu, Tak Kunihiro, 2017/07/18
- bug#27569: delete-selection on yank via popup-menu, npostavs, 2017/07/18
- bug#27569: delete-selection on yank via popup-menu, npostavs, 2017/07/22