GNU bug report logs -
#28631
25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Thu, 28 Sep 2017 08:04:01 UTC
Severity: normal
Tags: patch
Found in version 25.3.50
Done: Tino Calancha <tino.calancha <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
Thank you very much for the comments. I have updated
the patch following your suggestion (see below).
>> To reproduce the problem:
>> emacs -Q -eval '(winner-mode 1)' \
>> -eval "(customize-set-variable 'select-enable-clipboard nil)" \
>> -eval "(customize-set-variable 'select-enable-primary t)"
>>
>> < C-TAB M-f M-f ; `yank' would insert ";; This buffer"
>
> That should be 'M-< C-SPC M-f M-f' I guess.
Absolutely.
>> C-x C-b C-x 0
>
> C-x o, not C-x 0.
I think is OK. After C-x C-b you are in *scratch* buffer and the window
is splited horizontally. C-x 0 brings you at *Buffer List*.
>> I don't see a good reason why visiting a buffer with `C-x b' or
>> `winner-undo' makes a difference in the primary selection.
>
> It's because winner-undo tries to restore marks.
I see, thank you.
>
>> How about the following patch?
>>
>> Set mark at point after keyboard-quit
>>
>> * lisp/simple.el (deactivate-mark): In transient-mark-mode
>> always set the mark at point after keyboard-quit (Bug#28631).
>
> That seems quite disruptive. Perhaps instead deactivate-mark could be
> changed so that it would not update the selection on winner-undo?
Yeah, my patch is kinda of lazy. What you are suggesting sounds better.
Following one works to me
--8<-----------------------------cut here---------------start------------->8---
commit 6e4e47062daf54923928f6db096d4578bcecd6e2
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date: Thu Oct 12 11:41:44 2017 +0900
Dont update primary selection with winner-undo
* lisp/simple.el (deactivate-mark):
Dont update primary selection if deactivate-mark is
called by winner-undo (Bug#28631).
diff --git a/lisp/simple.el b/lisp/simple.el
index 5ef511ce0a..faedad4675 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5332,6 +5332,8 @@ deactivate-mark
(if (gui-backend-selection-owner-p 'PRIMARY)
(gui-set-selection 'PRIMARY saved-region-selection))
(setq saved-region-selection nil))
+ ;; `winner-undo' shouldn't update the selection (Bug#28631).
+ ((eq this-command 'winner-undo) nil)
;; If another program has acquired the selection, region
;; deactivation should not clobber it (Bug#11772).
((and (/= (region-beginning) (region-end))
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-10-12
Repository revision: 349c1f93021e49c63f076b602d3d228324105fd6
This bug report was last modified 7 years and 276 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.