GNU bug report logs - #28631
25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection

Previous Next

Package: emacs;

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 28631 <at> debbugs.gnu.org
Subject: bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection
Date: Thu, 12 Oct 2017 20:46:54 -0400
Tino Calancha <tino.calancha <at> gmail.com> writes:

>> 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*.

Oops, you're right, I was confused.

> Following one works to me
>
> 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))

I think I would rather put it with the next condition:

--- 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.




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.