bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-sele


From: Tino Calancha
Subject: bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection
Date: Fri, 13 Oct 2017 17:06:53 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Noam Postavsky <npostavs@users.sourceforge.net>
>> Date: Thu, 12 Oct 2017 20:46:54 -0400
>> Cc: 28631@debbugs.gnu.org
>> 
>> --- i/lisp/simple.el
>> +++ w/lisp/simple.el
>> @@ -5336,7 +5336,9 @@ deactivate-mark
>>          ;; deactivation should not clobber it (Bug#11772).
>>          ((and (/= (region-beginning) (region-end))
>>                (or (gui-backend-selection-owner-p 'PRIMARY)
>> -                  (null (gui-backend-selection-exists-p 'PRIMARY))))
>> +                      (null (gui-backend-selection-exists-p 'PRIMARY)))
>> +                  ;; `winner-undo' shouldn't update the selection 
>> (Bug#28631).
>> +                  (not (eq this-command 'winner-undo)))
>>           (gui-set-selection 'PRIMARY
>>                                  (funcall region-extract-function nil)))))
>>      (when mark-active (force-mode-line-update)) ;Refresh toolbar 
>> (bug#16382).
>> 
>> Either way, I think it's okay to push emacs-26, but wait a bit in case
>> someone else thinks otherwise.
>
> Is there really no way to solve this in winner?  It seems like a
> winner bug/misfeature, and I'm worried by the possible effect of this
> patch on use cases that have nothing to do with the specific scenario
> of this bug.  deactivate-mark is used a lot in places and ways we
> cannot possibly predict.
I agree it's better if it is handled inside winner.
I am not a winner guru, just an user so sorry if the following patch
is not right.

--8<-----------------------------cut here---------------start------------->8---
commit 3420c8089f3c3d2dc22472dddfa938a2bd044a27
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Fri Oct 13 16:56:55 2017 +0900

    Dont update primary selection with winner-undo
    
    * lisp/winner.el (winner-set):
    Dont update primary selection when select-enable-primary
    is non-nil (Bug#28631).

diff --git a/lisp/winner.el b/lisp/winner.el
index 61ea4d40e7..6bc27484a7 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -304,12 +304,15 @@ winner-set
           (push win xwins)))            ; delete this window
 
       ;; Restore marks
-      (save-current-buffer
-       (cl-loop for buf in buffers
-                 for entry = (cadr (assq buf winner-point-alist))
-                 do (progn (set-buffer buf)
-                           (set-mark (car entry))
-                           (setf (winner-active-region) (cdr entry)))))
+      ;; `winner-undo' shouldn't update the selection (Bug#28631) when
+      ;; select-enable-primary is non-nil.
+      (unless select-enable-primary
+        (save-current-buffer
+         (cl-loop for buf in buffers
+                   for entry = (cadr (assq buf winner-point-alist))
+                   do (progn (set-buffer buf)
+                             (set-mark (car entry))
+                             (setf (winner-active-region) (cdr entry))))))
       ;; Delete windows, whose buffers are dead or boring.
       ;; Return t if this is still a possible configuration.
       (or (null xwins)

--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-10-13
Repository revision: 7dc037e39e6bbfa8964d0040e8141dbcf70d726d





reply via email to

[Prev in Thread] Current Thread [Next in Thread]