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: Sat, 14 Oct 2017 10:42:15 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Fri, 13 Oct 2017, Noam Postavsky wrote:


Eli Zaretskii <eliz@gnu.org> writes:

            ((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)))))

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.

That patch only has affect during winner-undo, no?
I think so.

+      ;; `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))))))

Maybe only the (setf (winner-active-region) (cdr entry)) part should be
skipped?
We need to ban
(set-mark (car entry))
as well, because it updates the primary selection.

emacs  -Q -eval '(winner-mode 1)' \
-eval "(customize-set-variable 'select-enable-clipboard nil)" \
-eval "(customize-set-variable 'select-enable-primary t)"

M-<
M-: (set-mark 15) RET
M-: C-y ; It inserts in minibuffer ";; This buffer"

I prefer this patch because:
1) Make the fix inside winner.el
2) The fix takes effect just if user has enabled select-enable-primary

I don't fully understand the purpose of that part of the code, but
I assume if someone have set select-enable-primary, then she
probably doesn't want winner-undo to change her selection.





reply via email to

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