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: Sat, 14 Oct 2017 10:42:15 +0900 (JST) Message-ID: References: <87ing3w8rk.fsf@gmail.com> <87o9pdazmp.fsf@users.sourceforge.net> <87o9pdaxfo.fsf@gmail.com> <87infjc1s1.fsf@users.sourceforge.net> <83a80vlf0w.fsf@gnu.org> <878tgf8o9u.fsf@gmail.com> <87y3of9nrn.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1507945410 12506 195.159.176.226 (14 Oct 2017 01:43:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 14 Oct 2017 01:43:30 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 28631@debbugs.gnu.org, Tino Calancha To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 14 03:43:24 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 1e3BTv-0001dE-Sa for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Oct 2017 03:43:16 +0200 Original-Received: from localhost ([::1]:52431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3BU3-000266-8Y for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Oct 2017 21:43:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3BTn-000213-08 for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 21:43:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3BTi-000197-DE for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 21:43:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e3BTi-000193-9p for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 21:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e3BTi-0005Sn-47 for bug-gnu-emacs@gnu.org; Fri, 13 Oct 2017 21:43: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: Sat, 14 Oct 2017 01:43: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.150794534720949 (code B ref 28631); Sat, 14 Oct 2017 01:43:02 +0000 Original-Received: (at 28631) by debbugs.gnu.org; 14 Oct 2017 01:42:27 +0000 Original-Received: from localhost ([127.0.0.1]:38603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3BT9-0005Ro-6H for submit@debbugs.gnu.org; Fri, 13 Oct 2017 21:42:27 -0400 Original-Received: from mail-pf0-f194.google.com ([209.85.192.194]:53462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3BT7-0005Ra-In for 28631@debbugs.gnu.org; Fri, 13 Oct 2017 21:42:25 -0400 Original-Received: by mail-pf0-f194.google.com with SMTP id t188so9163814pfd.10 for <28631@debbugs.gnu.org>; Fri, 13 Oct 2017 18:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=1CgHD+v5Rs7cFYlJtZ2mAIPrJiWUkfJpOoWOJJBIKK0=; b=kQdizRU6FI9C61cdNGk8EA99XSGiwu3clcTGKm3Gm6SwRoxHb//6xCpLGz/QN6dGTI o0PzcUHybj5IH+7vtTMEYVmpxtt9WXJ9pPiW3hlWcw8+Rfh/J6nz2j8Fi/O6ZGxRmZf6 Ap4iafrdQVDM00WacecLUQvp/9Kq1lJ3vubi+xxvXjJNEdlM9WxD9RwX9fXT5OjujTQ2 kHZ6K4fyvSdxUr9qN3YcfkrHDR5dQKAwAIJD11CgoN6muAZ+7r7waW6VnLucL3muIc21 ih35el7pkQfHpqgrk+/BfiRUTX+4EqLxrMQ6YJSRU44WaCsDEXltCThX6iuFdhKuMuRe DpOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=1CgHD+v5Rs7cFYlJtZ2mAIPrJiWUkfJpOoWOJJBIKK0=; b=G2fxave1ryUTEoODv2juyIRQ/ZZj2W2OB/JCP0spP0toM2O9u2yIHBnRx/eyRTWcEp 8ZXzlwAf4iRJCLktyJM/gRmkVQkG9G7KwlNkXTynC3K9NZB9Jn7cUfTKyOZe2b2ci8Rv AA05/zyDDx8s8rV5cxdA466A2f6/avZS7slAKGz0dPglA2w3350L8DMZ3PfjC5x05hNA u7CjFQlmghzzoe/J738xnsXHFY80cnd2gT8nK5dX/UemQfmakgKI+3U2N3quZTO6g2m3 KGhaXE48ME9M4oZpqxtVzYp34yR/g8zXvNf/kMms3NxpWWkhc5jXom2/Y4yJPZAgunbK xeyw== X-Gm-Message-State: AMCzsaX3rjpxOva/h5UCyy9zHrmYRAJJDhpg+F8XV+BOyBALOlZE5eUi cnhUGGG+D9bQGLnDklvOXb0= X-Google-Smtp-Source: AOwi7QDGmW+Y18ohTFtNvQnJt5pN41Yz6wA+IgBDE84cse9iPYxZlxWiTORRzJBmzBpXvANqsXLINA== X-Received: by 10.84.235.3 with SMTP id o3mr3005533plk.30.1507945339531; Fri, 13 Oct 2017 18:42:19 -0700 (PDT) Original-Received: from calancha-pc (203.191.218.133.dy.bbexcite.jp. [133.218.191.203]) by smtp.gmail.com with ESMTPSA id g24sm4905035pfk.0.2017.10.13.18.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 18:42:18 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <87y3of9nrn.fsf@users.sourceforge.net> 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:138368 Archived-At: On Fri, 13 Oct 2017, Noam Postavsky wrote: > > Eli Zaretskii 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.