From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs 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 Message-ID: <87o9pdaxfo.fsf@gmail.com> References: <87ing3w8rk.fsf@gmail.com> <87o9pdazmp.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507776918 24722 195.159.176.226 (12 Oct 2017 02:55:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Oct 2017 02:55:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 28631@debbugs.gnu.org, tino.calancha@gmail.com To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 12 04:55:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2TeM-0004go-8Y for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Oct 2017 04:55:06 +0200 Original-Received: from localhost ([::1]:43432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2TeS-00063O-11 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Oct 2017 22:55:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2TeM-000630-Ld for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2017 22:55:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2TeI-00045F-Nw for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2017 22:55:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2TeI-000453-JQ for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2017 22:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e2TeI-0005eZ-5x for bug-gnu-emacs@gnu.org; Wed, 11 Oct 2017 22:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Oct 2017 02:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28631 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28631-submit@debbugs.gnu.org id=B28631.150777684321647 (code B ref 28631); Thu, 12 Oct 2017 02:55:02 +0000 Original-Received: (at 28631) by debbugs.gnu.org; 12 Oct 2017 02:54:03 +0000 Original-Received: from localhost ([127.0.0.1]:34696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2TdK-0005d5-TA for submit@debbugs.gnu.org; Wed, 11 Oct 2017 22:54:03 -0400 Original-Received: from mail-pf0-f193.google.com ([209.85.192.193]:35800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2TdJ-0005cb-6l for 28631@debbugs.gnu.org; Wed, 11 Oct 2017 22:54:01 -0400 Original-Received: by mail-pf0-f193.google.com with SMTP id i23so4138893pfi.2 for <28631@debbugs.gnu.org>; Wed, 11 Oct 2017 19:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=7wk+97MYHgy7u9Y45Yb8UQ2PXc3hyKnCC3N1S0PcsLc=; b=QBT0zMi7JCCnzA2L2FnJmNhT42kAhXXH9hga0ZasVDL01AARx+vePq6YnV1iiKxPfY N1VJcI5IrbdxjV/UTNFtCdEA/2rz3DjfFkt8wlvIfTUvblw2kFPObjD+DD/K3j7maRVV Y26IS6EpvC7xorDtMQxqJhfFJVUinuMr/tU1t8FNQ+SKjKNduSqAUsktsNdNF3QW/LMi 90zSyG91J+NRn/csuG1o5kwK+sqtIiWe+wpFav+e4jdKsVMi4jG8XMOWLa+F9wkLDHsv CVEIf9ZuPAcXaDpt5jMTQRN8P/F/wFkehgLsIRwYoUIJsN/mrj4p5M+PyuHSOGzOy1oX iijg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=7wk+97MYHgy7u9Y45Yb8UQ2PXc3hyKnCC3N1S0PcsLc=; b=DCtkpGyiZZbhkBSHyOoUS3A1EWLECo2ABMvb6UYUe7fupS0BSqvPY/9OzWSXPouzCJ G2cLN+KE116nFFox5c+/gF0yQ9I+EsLRpUPrsroLDY77Z6QWHNBI/aIzGK0YC/7Br33n xWjJB4+RWO9PfhLkYNG1YihSmfgESn76nDHpgPjk5Al8Ua5DSa+pGuYwiQ22r75w7rnp 4dT7WFPNLXGr/IXwxFmJec7xAM5vfUBOomgL8reEZ/H5EapaZEnWbQZ7YpgHb6eB91Cc 76FaLYrf9c9P3yOVjvGE/denbtcZJCt7Z0iakrqwrjB28Hp3edSW/gQPwC5b2DIkeNsz M4mg== X-Gm-Message-State: AMCzsaU1JJ4qqTHucd6ufp7cZt5x0oeAQf6eQaYzRApyj2Jt9JdGzcCZ EHZZyMkxC+ffMnIeqAse3AM= X-Google-Smtp-Source: AOwi7QCUk0HoZbyulrLheKPC8MYKkRnC4lWlWFEKyRWppJkfBJp676usrsLdw2PqlR+Gek6ZZ/xvwQ== X-Received: by 10.101.65.2 with SMTP id w2mr913759pgp.131.1507776834891; Wed, 11 Oct 2017 19:53:54 -0700 (PDT) Original-Received: from calancha-pc (MAR90-45.kek.jp. [130.87.90.45]) by smtp.gmail.com with ESMTPSA id r81sm28981007pfj.106.2017.10.11.19.53.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Oct 2017 19:53:54 -0700 (PDT) In-Reply-To: <87o9pdazmp.fsf@users.sourceforge.net> (Noam Postavsky's message of "Wed, 11 Oct 2017 22:06:22 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138242 Archived-At: Noam Postavsky 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 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