unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 28631@debbugs.gnu.org, tino.calancha@gmail.com
Subject: bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection
Date: Thu, 12 Oct 2017 11:53:47 +0900	[thread overview]
Message-ID: <87o9pdaxfo.fsf@gmail.com> (raw)
In-Reply-To: <87o9pdazmp.fsf@users.sourceforge.net> (Noam Postavsky's message of "Wed, 11 Oct 2017 22:06:22 -0400")

Noam Postavsky <npostavs@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@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





  reply	other threads:[~2017-10-12  2:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28  8:02 bug#28631: 25.3.50; Deactivate mark with Ctrl-g mess up the primary-selection Tino Calancha
2017-10-12  0:52 ` Tino Calancha
2017-10-12  2:06 ` Noam Postavsky
2017-10-12  2:53   ` Tino Calancha [this message]
2017-10-13  0:46     ` Noam Postavsky
2017-10-13  1:54       ` Tino Calancha
2017-10-13  6:48       ` Eli Zaretskii
2017-10-13  8:06         ` Tino Calancha
2017-10-13 13:32           ` Noam Postavsky
2017-10-14  1:42             ` Tino Calancha
2017-10-14  2:09               ` Noam Postavsky
2017-10-14  6:56                 ` Eli Zaretskii
2017-10-17  7:25                   ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9pdaxfo.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=28631@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).