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: Fri, 13 Oct 2017 17:06:53 +0900 Message-ID: <878tgf8o9u.fsf@gmail.com> References: <87ing3w8rk.fsf@gmail.com> <87o9pdazmp.fsf@users.sourceforge.net> <87o9pdaxfo.fsf@gmail.com> <87infjc1s1.fsf@users.sourceforge.net> <83a80vlf0w.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507882092 4949 195.159.176.226 (13 Oct 2017 08:08:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 13 Oct 2017 08:08:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 28631@debbugs.gnu.org, Noam Postavsky To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 13 10:08:08 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 1e2v0p-0000Rd-2s for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Oct 2017 10:08:07 +0200 Original-Received: from localhost ([::1]:48872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2v0u-0001vz-Un for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Oct 2017 04:08:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2v0o-0001vr-SJ for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 04:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2v0k-0007t1-RK for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 04:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2v0k-0007su-Mi for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 04:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e2v0k-0005rX-EC for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 04:08: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: Fri, 13 Oct 2017 08:08: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.150788202922472 (code B ref 28631); Fri, 13 Oct 2017 08:08:02 +0000 Original-Received: (at 28631) by debbugs.gnu.org; 13 Oct 2017 08:07:09 +0000 Original-Received: from localhost ([127.0.0.1]:36778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2uzt-0005qO-8H for submit@debbugs.gnu.org; Fri, 13 Oct 2017 04:07:09 -0400 Original-Received: from mail-pf0-f173.google.com ([209.85.192.173]:55539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2uzq-0005py-Vq for 28631@debbugs.gnu.org; Fri, 13 Oct 2017 04:07:07 -0400 Original-Received: by mail-pf0-f173.google.com with SMTP id 17so8975258pfn.12 for <28631@debbugs.gnu.org>; Fri, 13 Oct 2017 01:07:06 -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=xOvNTYD+S+OBu8f7f79/mTbBZ0rF9Od0jefzs0w2514=; b=MW0VoaM7ARlGnG36eQIRZuGMZwK3VM563hsRjpnEELRZZbpb7SW+AdFfQ+AovBs/nx RC7babFlYilIzi0PpwP5W7QoE1lJm62FSbUDog+DpzrgioYM9WBk/pDPJV2QGnJEHXYY p7VTovRcraPwt0RFl2CvkH0YgNzDrsOByt2WWk/mG2Y7+kSqYB6XVZFqrS7lv4a4FZZ0 EXCBdEmO+slSveoKrIqu0y3jzGZwC4/dKCjljW4Razj2Uvm2gY7y3tJF9A6TV+ZfI8Bu G4TxWFPWLfxrmPhD7IQCTfldOL1uHr6xm6+bNBPwwWCjNZoO2povOmcgi4rzR/qfX4LT AqYg== 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=xOvNTYD+S+OBu8f7f79/mTbBZ0rF9Od0jefzs0w2514=; b=Z2KUFFzniU4a2iOC9Q0GROrSQ5Op1F1GSEU9I0W09II2BIqHv9QiBk0O6K6TRzQt86 WcotFfJD7IuTWO1PEHKtcU43pUGj1T2bn9luhIw30R+OLEI4q61l7GMYRdgV/kJI2Vec zyJNJKofHmmMlfi3tPb1WQhBk/p+lmvuGGPk7Yo7zr3M8o8MzM0Fy2exmdxS0io8ZqUy JSwhpNR080YigFTeMEpKgaGUCJAvn0MlhbivuWzL65/wZusSntm6r5tAm4gE0Lkr8fNg kbZWD+ZcXS6bKLcfhCyPShSqmGU0Q3kfiHmkDncQ+uKD4U6fa3DZjCY12L9x7LpYFIef c1Gw== X-Gm-Message-State: AMCzsaUSvL67d95k/g4InruulGOmetFzZaNVRxNXIs1MEyn4hQj0Zckt xMg8OvIjrQjnjLlE69jfNfmhiw== X-Google-Smtp-Source: AOwi7QBSSn2RpaP9tmVefUKHbqKiVgInn/2EN0rZOVIRF3I6g9X4X4V/5eELIKD/WYQCCCr0hLNPuQ== X-Received: by 10.84.131.103 with SMTP id 94mr677069pld.302.1507882020988; Fri, 13 Oct 2017 01:07:00 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.183]) by smtp.gmail.com with ESMTPSA id q70sm1468095pfj.39.2017.10.13.01.06.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2017 01:06:59 -0700 (PDT) In-Reply-To: <83a80vlf0w.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Oct 2017 09:48:15 +0300") 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:138326 Archived-At: Eli Zaretskii writes: >> From: Noam Postavsky >> 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 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