From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2016 10:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 23824@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14665903505935 (code B ref -1); Wed, 22 Jun 2016 10:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Jun 2016 10:12:30 +0000 Received: from localhost ([127.0.0.1]:50357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFf94-0001Xf-Kh for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFf93-0001XT-JM for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFf8x-0002xF-GT for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8x-0002wr-Cm for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8v-0005fA-77 for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFf8r-0002uz-2B for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:21 -0400 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]:35200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8q-0002us-RF for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:16 -0400 Received: by mail-pa0-x22d.google.com with SMTP id hl6so15692486pac.2 for ; Wed, 22 Jun 2016 03:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:subject:message-id:user-agent:mime-version; bh=FnW/RFv3b0Qj/vlLYXRw4aI62z5N5HG1INmVhYFuKyo=; b=w2YcBER7yAEG/VNcHNOFR/1p3GGwOUV1NCZa4f+FjPAbRrp5TnpkJvLTFAHq5bu/lj l6timxX1s4DLPSxw1rbwlnNFEH8A6sBCOM81NsWbna34K3BtPoiCN62+7stjGVKsnbdH VniWQI0yfOaiYGexU6Y5vflcScss9hVFcYehexWaKIVST/AkZuljlSu4teSOAJCh6zaT fhEFfn5fsLLRMjfST4Co8iHAw/Go8WOYo+9c2EQ4PN3rmRGDBRhG8xJ3qW64Wmi8TLKN j+kY/cl8De1fgZifFvgW0l4JXlv8bbOJRO7HRQkKEtcThtDbYScpqNtJEm7FKOwuDDfO g7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=FnW/RFv3b0Qj/vlLYXRw4aI62z5N5HG1INmVhYFuKyo=; b=V6SLNNPwmJdPQA2c8wJLMv2Ve1mGVUD8oloBcQbysG0kDoKmXlADKJ70fMNxhRxS66 SrMo3C0caMO4ssN3UuaUSBLscmbe/88wfEbjgFwvYr2d64yh7lgJODSJNcaHUGgCk5wA z+T2jTV5WqePMcHM+P16U4LB9GDXG38K4mwZNdQoASnNiBLZzlSUarPmSUEXrg+kxrlq pje1U8wIIf2eWymahV9CE9P6ZXfeXxnHNnf6Abmw7iqUp18B+eyIGRUZlXSHAgBZBmQz 5qZgXxHb0TYVt7g6eVhQte6KabkiOydKzZFUJ+4M+zZ8EX5BStcMLTnhL0r+gatNnD8t nKrg== X-Gm-Message-State: ALyK8tKx+6Mctxx3gDeJHxNKaYPPk+unCjaFvE8P5kmIQMm2aAxlvgJ1sij7BC6MzxgSHA== X-Received: by 10.66.132.72 with SMTP id os8mr33745219pab.63.1466590335701; Wed, 22 Jun 2016 03:12:15 -0700 (PDT) Received: from calancha-pc (softbank126103144234.bbtec.net. [126.103.144.234]) by smtp.gmail.com with ESMTPSA id v62sm72575276pfv.50.2016.06.22.03.12.14 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2016 03:12:15 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Wed, 22 Jun 2016 19:12:13 +0900 (JST) X-X-Sender: calancha@calancha-pc Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) When the current buffer, buf-a, is visiting FILE-B, buf-b should be a temporary buffer on sync with FILE-B. ./emacs -r -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foo")) (find-file "/tmp/foo") (insert "bar"))' M-: (highlight-compare-with-file "/tmp/foo") RET n n ; Answer no to saving suggestions. ;; Current buffer content different than /tmp/foo but no face highlight-changes shown. In GNU Emacs 25.0.95.2 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) Repository revision: 829733104db073f8abd67765eae162e7360281fa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 47921b1f4898f9fad3acdaa15c2c70fa4b3f9061 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 22 Jun 2016 18:30:14 +0900 Subject: [PATCH] Prevent compare one buffer with itself * lisp/hilit-chg.el (highlight-compare-with-file): Use a new temporary buffer on sync with file-b; mark this buffer as unmodified to prevent being prompt to save it (Bug#23824). --- lisp/hilit-chg.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index 8f042b6..89ca154 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el @@ -900,10 +900,18 @@ highlight-compare-with-file (let* ((buf-a (current-buffer)) (file-a (buffer-file-name)) (existing-buf (get-file-buffer file-b)) - (buf-b (or existing-buf - (find-file-noselect file-b)))) + (buf-b (cond ((eq buf-a existing-buf) + (let ((buf-new (generate-new-buffer (generate-new-buffer-name + (buffer-name buf-a))))) + (with-current-buffer buf-new + (insert-file-contents-literally file-b) + (set-buffer-modified-p nil)) buf-new)) + (t + (or existing-buf + (find-file-noselect file-b)))))) (highlight-markup-buffers buf-a file-a buf-b file-b (not existing-buf)) - (unless existing-buf + (when (or (not existing-buf) + (eq buf-a existing-buf)) (kill-buffer buf-b)) )) -- 2.8.1 From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2016 15:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha Cc: 23824@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146660882320626 (code B ref 23824); Wed, 22 Jun 2016 15:21:02 +0000 Received: (at 23824) by debbugs.gnu.org; 22 Jun 2016 15:20:23 +0000 Received: from localhost ([127.0.0.1]:51309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjx1-0005Mc-IR for submit@debbugs.gnu.org; Wed, 22 Jun 2016 11:20:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjx0-0005MR-Is for 23824@debbugs.gnu.org; Wed, 22 Jun 2016 11:20:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFjwq-0002iz-KV for 23824@debbugs.gnu.org; Wed, 22 Jun 2016 11:20:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFjwq-0002iB-Hc; Wed, 22 Jun 2016 11:20:12 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1873 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bFjwj-0006K6-Mk; Wed, 22 Jun 2016 11:20:08 -0400 Date: Wed, 22 Jun 2016 18:19:15 +0300 Message-Id: <83wplh45fw.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Tino Calancha on Wed, 22 Jun 2016 19:12:13 +0900 (JST)) References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.5 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.5 (------) > From: Tino Calancha > Date: Wed, 22 Jun 2016 19:12:13 +0900 (JST) > > When the current buffer, buf-a, is visiting FILE-B, buf-b should > be a temporary buffer on sync with FILE-B. > > ./emacs -r -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foo")) > (find-file "/tmp/foo") (insert "bar"))' > M-: (highlight-compare-with-file "/tmp/foo") RET > n n ; Answer no to saving suggestions. > ;; Current buffer content different than /tmp/foo but no face > highlight-changes shown. I think we need first to establish what exactly is the semantic of this situation. You are comparing a buffer with the file that the buffer visits. The doc string of this function tries to say something about this situation: If the current buffer is visiting the file being compared against, it also will have its differences highlighted. Otherwise, the file is read in temporarily but the buffer is deleted. but I must confess that this is incomprehensible for me. So I think we should first establish what that means, or what the code is trying to do. > + (with-current-buffer buf-new > + (insert-file-contents-literally file-b) ??? Why insert-file-contents-literally? That definitely sounds wrong. Thanks. From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jun 2016 00:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 23824@debbugs.gnu.org Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146664349315737 (code B ref 23824); Thu, 23 Jun 2016 00:59:02 +0000 Received: (at 23824) by debbugs.gnu.org; 23 Jun 2016 00:58:13 +0000 Received: from localhost ([127.0.0.1]:51633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFsyC-00045l-T4 for submit@debbugs.gnu.org; Wed, 22 Jun 2016 20:58:13 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFsyB-00045Z-8X for 23824@debbugs.gnu.org; Wed, 22 Jun 2016 20:58:11 -0400 Received: by mail-pa0-f41.google.com with SMTP id wo6so21696247pac.3 for <23824@debbugs.gnu.org>; Wed, 22 Jun 2016 17:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=W+J5xGDTW+lE6w9Lg/JHVK15TuUmWEm7glslhBF6kw8=; b=qD6kps8Ab3Le+Qrh/cJcwATpg5Sq7cTXMDJaMuQv/jhcL+nxUobjMZcEgbfsRr6Jma ng3SRkxWlUjALj3culIw+87yJFoYiD/hGWnSVoZKQQVTYpW01KwieS7SZLJcmWIyhfuU Q00GiGuq/l6Mstco4LXRZzd3Xg0/+K+wTnIL0WMQ58E33QGYBtMPLthQ0X4s8ROuLiPU ohnHVwqe/ZtJumU9MalOeVTsdN9oVLvJ7tmrLfLlW6cc3s5eU5EI7P7u1lbCj4bdx8er D8lthRhRx7ClIFETyQMHFyRPAJyEW5hn5OUYHiX36SnDchVtYgyHXcAHN+fJsCcvNlzV XcKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=W+J5xGDTW+lE6w9Lg/JHVK15TuUmWEm7glslhBF6kw8=; b=D3zQfQQImEeW74OQOJdh0aujhgQEInUqGOFbpcS9B6m6KssBB2yhO3agtfUib94Im/ dnu/L/tgdlMZSz/Qa7971D77M7AyeYOIGHKjFRiCZWZVhyyZNhv1kImHP/naROdCX7PT Ft4i7gnOtKi09rB/v2sBqfr85URQk7d50VOBar4cgX2YTpw5G9P/+Jl67gNxGTjiugLE QJTnpHIvEol5H7CqB0alt1tC/B5s2qvvAQF2CfUBGB0yMk2ZcDfcoSl6ZH7ky2E6/SGu G9c33AlMGVeiRqpbD9Bso8CVkJeFAk27IR+YVm1I5wfOX6mB12qDey59kcLaU7Qcfnuj Y2yw== X-Gm-Message-State: ALyK8tIn2b891yQPovBkMBc4+eWkKaLCpg+jTMau/yxE47vL9lhtX9nc3yYahhYJPeXAaQ== X-Received: by 10.66.85.197 with SMTP id j5mr38505633paz.87.1466643485323; Wed, 22 Jun 2016 17:58:05 -0700 (PDT) Received: from [192.168.1.51] (softbank126103144234.bbtec.net. [126.103.144.234]) by smtp.gmail.com with ESMTPSA id d2sm2406786pfk.36.2016.06.22.17.58.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2016 17:58:04 -0700 (PDT) References: <83wplh45fw.fsf@gnu.org> From: Tino Calancha Message-ID: Date: Thu, 23 Jun 2016 09:58:02 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <83wplh45fw.fsf@gnu.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 06/23/2016 12:19 AM, Eli Zaretskii wrote: >> From: Tino Calancha >> Date: Wed, 22 Jun 2016 19:12:13 +0900 (JST) >> >> When the current buffer, buf-a, is visiting FILE-B, buf-b should >> be a temporary buffer on sync with FILE-B. >> >> ./emacs -r -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foo")) >> (find-file "/tmp/foo") (insert "bar"))' >> M-: (highlight-compare-with-file "/tmp/foo") RET >> n n ; Answer no to saving suggestions. >> ;; Current buffer content different than /tmp/foo but no face >> highlight-changes shown. > I think we need first to establish what exactly is the semantic of > this situation. You are comparing a buffer with the file that the > buffer visits. The doc string of this function tries to say something > about this situation: > > If the current buffer is visiting the file being compared against, it > also will have its differences highlighted. Otherwise, the file is > read in temporarily but the buffer is deleted. > > but I must confess that this is incomprehensible for me. So I think > we should first establish what that means, or what the code is trying > to do. I understand what the doc means: if the current buffer (buf-a) is visiting file-b, then this func will perform a diff between buf-a and file-b. * So, if buf-a is modified, the command highlight you the differences with file-b, so let you decide if you want to save buf-a (overwritting file-b) or not. It sounds useful. * Current implementation doesn't match the doc string: even if buf-a is visiting file-b and modified, the func compare buf-a with buf-a, so that you never get nothing highlight in this case. >> + (with-current-buffer buf-new >> + (insert-file-contents-literally file-b) > ??? Why insert-file-contents-literally? That definitely sounds wrong. > > Thanks. We can use: (insert-file-contents file-b) it doesn't matter. At the end, what this func does is comparing buffers with ediff-diff-program so only the literal content would matter. From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jun 2016 15:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha Cc: 23824@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146669569619035 (code B ref 23824); Thu, 23 Jun 2016 15:29:02 +0000 Received: (at 23824) by debbugs.gnu.org; 23 Jun 2016 15:28:16 +0000 Received: from localhost ([127.0.0.1]:52825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG6YC-0004ww-E1 for submit@debbugs.gnu.org; Thu, 23 Jun 2016 11:28:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG6YB-0004wl-7j for 23824@debbugs.gnu.org; Thu, 23 Jun 2016 11:28:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG6Y0-0007un-L9 for 23824@debbugs.gnu.org; Thu, 23 Jun 2016 11:28:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG6Y0-0007tu-Iw; Thu, 23 Jun 2016 11:28:04 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3142 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bG6Xw-0002bn-N4; Thu, 23 Jun 2016 11:28:03 -0400 Date: Thu, 23 Jun 2016 18:27:04 +0300 Message-Id: <83lh1w2aev.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Tino Calancha on Thu, 23 Jun 2016 09:58:02 +0900) References: <83wplh45fw.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > Cc: 23824@debbugs.gnu.org > From: Tino Calancha > Date: Thu, 23 Jun 2016 09:58:02 +0900 > > > I think we need first to establish what exactly is the semantic of > > this situation. You are comparing a buffer with the file that the > > buffer visits. The doc string of this function tries to say something > > about this situation: > > > > If the current buffer is visiting the file being compared against, it > > also will have its differences highlighted. Otherwise, the file is > > read in temporarily but the buffer is deleted. > > > > but I must confess that this is incomprehensible for me. So I think > > we should first establish what that means, or what the code is trying > > to do. > I understand what the doc means: if the current buffer (buf-a) is > visiting file-b, > then this func will perform a diff between buf-a and file-b. But then what is that "also" word doing in the doc string? > * So, if buf-a is modified, the command highlight you the differences > with file-b, so > let you decide if you want to save buf-a (overwritting file-b) or > not. It sounds useful. > * Current implementation doesn't match the doc string: even if buf-a is > visiting file-b and > modified, the func compare buf-a with buf-a, so that you never get > nothing highlight > in this case. I think there's more here than meets the eye. Did you ask yourself why the user is asked twice whether to save the same buffer to the same file in your scenario? Why does it do that? What does it have in mind? > >> + (with-current-buffer buf-new > >> + (insert-file-contents-literally file-b) > > ??? Why insert-file-contents-literally? That definitely sounds wrong. > > > > Thanks. > > We can use: (insert-file-contents file-b) > it doesn't matter. Oh, it matters a lot. insert-file-contents-literally will bypass any decoding and leave the CR-LF EOLs untranslated, something that you don't want to affect the comparison. From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2016 05:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Tino Calancha , 23824@debbugs.gnu.org Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146674486018713 (code B ref 23824); Fri, 24 Jun 2016 05:08:02 +0000 Received: (at 23824) by debbugs.gnu.org; 24 Jun 2016 05:07:40 +0000 Received: from localhost ([127.0.0.1]:53203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGJL9-0004rl-Ob for submit@debbugs.gnu.org; Fri, 24 Jun 2016 01:07:39 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGJL7-0004rW-V4 for 23824@debbugs.gnu.org; Fri, 24 Jun 2016 01:07:38 -0400 Received: by mail-pa0-f43.google.com with SMTP id b13so34026153pat.0 for <23824@debbugs.gnu.org>; Thu, 23 Jun 2016 22:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Apf1H9XtNjfv20UcoQRWL5Qsx4e1VwFuzmZtrh2+S6o=; b=QeELvo9aByj62fz/hvG7HApnT3MjdcIEeHt+XTnnfQLpjsm7+b+vGLVeoteLtdsU8u D51/RwyTaPX3wbqJaF3FR7jNwtVuttur/3oPRmDgW/Oob5hixbFHumgiKQ7a8jEJAJ6q U0l5juhHy5ocZ0qbWZ11S3tX2Bixj1DnfbsVvx30dTdsm0yferGjFXp7bD8JRDCXS3u6 2FF81w76W9B/d90iCGd0gsk4uyikhZkWTI45Sj8JNcUu5M52EHIvfay5wPDGS+GIWD2L eGTbTxkMrUsSNGcsKuGOawLJTuUwPeX3nvIZ10IwmGijdkZCXf4wMpDCUm8wUYx2ivQs AoYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Apf1H9XtNjfv20UcoQRWL5Qsx4e1VwFuzmZtrh2+S6o=; b=Id1CsjNmq0pGjOfIU7BqeIF2igMipiW3ypejQG7utgZmGUDdL3+3LyNPAin6IITbjG fZAIA1s2OQ1ejA6Ih9y8yqVVSb5/35ZtnzgpJ1ghHdfzdM66UK0ENsp+YOxsC/wU3pnN j9aD/Vm/SQEG/6RNAj1g+XwiJ+0gmIjweYga9PHrdzRzz4dHjvTWrzm03AizXttzM+ru GuSan8+0WwRZo/4gWSsJfwf1LbSDbLkQPj75zG15ROlXK/dYV6W69x9cCmk+mA4JnbYl TgnY1EgMsOLmMBiIFdMv1uxkJN+aOnvOpj6sZEJkNix9/ctw9Y7yRksY73CZso6k+UDy dM8g== X-Gm-Message-State: ALyK8tIwU6znzAZgK3mtE/7UiTJJorP7b3Vqy0DHGdER/VSDzNAVgJfPJ+KpUPHe6Ua3vA== X-Received: by 10.66.139.133 with SMTP id qy5mr4210897pab.4.1466744852247; Thu, 23 Jun 2016 22:07:32 -0700 (PDT) Received: from calancha-pc (softbank126103139048.bbtec.net. [126.103.139.48]) by smtp.gmail.com with ESMTPSA id h77sm3808402pfj.86.2016.06.23.22.07.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 22:07:31 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 24 Jun 2016 14:07:29 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <83lh1w2aev.fsf@gnu.org> Message-ID: References: <83wplh45fw.fsf@gnu.org> <83lh1w2aev.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, 23 Jun 2016, Eli Zaretskii wrote: >But then what is that "also" word doing in the doc string? Nothing special: It states that the person whom wrote this func took in account both cases: *) When buf-a is not visiting file-b (let's call it 'default' case). *) When buf-a is visiting file-b ('special' case). Something like: "Dear doc readers, i let you know that i have _also_ considered the case when buf-a is visiting file-b". >I think there's more here than meets the eye. Did you ask yourself >why the user is asked twice whether to save the same buffer to the >same file in your scenario? Why does it do that? What does it have >in mind? I guess is just a bug in the logic. The author of this code overlooked that (get-file-buffer file-b) may return the very same buffer that buf-a (when buf-a is visiting file-b). Then, calling (highlight-markup-buffers BUF-A FILE-B BUF-A FILE-B) will prompt you twice to save BUF-A when BUF-A is modified. It prompts you to save buf-a again even if you saved buf-a after the first prompt: this is because `highlight-markup-buffers' save the bit on the modification status of BUF-A and BUF-B at the top of the function. In my patch, for this case (buf-a visiting file-b), i explicitely create a temporary buffer whose content equals file-b content. Then, I call (set-buffer-modified-p nil) to prevent being prompted to save this temporary buffer. >Oh, it matters a lot. insert-file-contents-literally will bypass any >decoding and leave the CR-LF EOLs untranslated, something that you >don't want to affect the comparison. I see. Another example that reviewing a patch before applying it is a good thing. Then, my patch need to be modified: insert-file-contents-literally -> insert-file-contents From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Do not prompt twice to save a buffer Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2016 13:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: f92capac@gmail.com, 23824@debbugs.gnu.org Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.14667741769625 (code B ref 23824); Fri, 24 Jun 2016 13:17:02 +0000 Received: (at 23824) by debbugs.gnu.org; 24 Jun 2016 13:16:16 +0000 Received: from localhost ([127.0.0.1]:53516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGQy0-0002VB-57 for submit@debbugs.gnu.org; Fri, 24 Jun 2016 09:16:16 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGQxz-0002Ux-5S for 23824@debbugs.gnu.org; Fri, 24 Jun 2016 09:16:15 -0400 Received: by mail-pa0-f47.google.com with SMTP id bz2so37653680pad.1 for <23824@debbugs.gnu.org>; Fri, 24 Jun 2016 06:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=0bQFTAhsagbvpObqAmcpUyoh6Avb2/h96YO6yJ6xYdY=; b=aFADecXlRePvyi08dNoSvcjBN4mkiTar/gEN9kZ7tw2baXbsRmh4DHvSKtTYNE/ZcG ATrn452mj8rJGUbf6nltY7lXaGQ7AlJV5hOTYwfKxYacusyeJ8N1GDE4r7i25q5UrjNp SVAj+CgCQgaQGtSFRjW7/p5hsriujF9ffRGpSCTfZXHwMlAmT2P/5akA4ARC4nF1Vrwd eTyNuapjj6sYSXJ9H8qW4uFW+zklJFyCCU/vk0JizDlnxqL4RobdhweQGM/+yDKCSExU k00d8eBhnGEmBW32+Ihwhk+EuJuwQ98fV3FoPm9rWO3THAtLa+MUFPVWyFa8JA5Eh3br uizw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=0bQFTAhsagbvpObqAmcpUyoh6Avb2/h96YO6yJ6xYdY=; b=UF2/YAc/bPiPLiZUQp7wed6mhtPFcZQcsogcKEGxYV8y6MCsHGIzwDqrSE5BOF7pMG 6sMvdl3JhPVEgx+Tqx3xJjnH/al2TiFk4ViBhbDhqEPKOVq/0KdZ2vae7wfpVe0r74d9 R2whYRrGQNHmKZH1pNVmuZLhM8dGiRRrM5s+/5/yennqlMa8FJ828TuhUWFz+yBxG3dY lR6NnEZpwGk27EpAyTX7FhCHAOYYfWVhY2fTpYkXBFhXB/XBnEOvK409lPO7T1b6itmF ddPJxS0a6v3cqQOcwiT+tVUgFe5XbG1YyWJ61QJeR9XMl+8rxczxw/xorkWWLn2YXz+N lV2Q== X-Gm-Message-State: ALyK8tIbejslanhM1ymgrAt2GOvEVZJPF3DTtl9X1lwlqe39GN1WPq9CoSFTy1OldBCpAw== X-Received: by 10.66.232.136 with SMTP id to8mr7681172pac.130.1466774169606; Fri, 24 Jun 2016 06:16:09 -0700 (PDT) Received: from calancha-pc (softbank126103139048.bbtec.net. [126.103.139.48]) by smtp.gmail.com with ESMTPSA id o22sm178103pfa.15.2016.06.24.06.16.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 06:16:08 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 24 Jun 2016 22:16:06 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: Message-ID: References: <83wplh45fw.fsf@gnu.org> <83lh1w2aev.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Fri, 24 Jun 2016, Tino Calancha wrote: >(highlight-markup-buffers BUF-A FILE-B BUF-A FILE-B) >will prompt you twice to save BUF-A when BUF-A is modified. >It prompts you to save buf-a again even if you saved buf-a after >the first prompt: this is because `highlight-markup-buffers' >save the bit on the modification status of BUF-A and BUF-B at the >top of the function. User should be prompted just one in this case. I propose following patch: >From 67eb8473757392f893c3f83227cbdfd184499e25 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 24 Jun 2016 21:53:56 +0900 Subject: [PATCH] Do not prompt twice to save a buffer * lisp/hilit-chg.el (highlight-markup-buffers): (Bug#23824). --- lisp/hilit-chg.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index 8f042b6..d4276ce 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el @@ -782,7 +782,7 @@ highlight-markup-buffers a-start a-end len-a b-start b-end len-b (bufa-modified (buffer-modified-p buf-a)) - (bufb-modified (buffer-modified-p buf-b)) + (bufb-modified (and (not (eq buf-a buf-b)) (buffer-modified-p buf-b))) (buf-a-read-only (with-current-buffer buf-a buffer-read-only)) (buf-b-read-only (with-current-buffer buf-b buffer-read-only)) temp-a temp-b) -- 2.8.1 From unknown Tue Aug 19 14:22:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23824: 25.0.95; Do not prompt twice to save a buffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Jun 2016 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha Cc: f92capac@gmail.com, 23824@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146685047722273 (code B ref 23824); Sat, 25 Jun 2016 10:28:02 +0000 Received: (at 23824) by debbugs.gnu.org; 25 Jun 2016 10:27:57 +0000 Received: from localhost ([127.0.0.1]:54908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGkoe-0005nB-TQ for submit@debbugs.gnu.org; Sat, 25 Jun 2016 06:27:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGkoc-0005mx-UF for 23824@debbugs.gnu.org; Sat, 25 Jun 2016 06:27:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGkoT-000618-SU for 23824@debbugs.gnu.org; Sat, 25 Jun 2016 06:27:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGkoT-000614-Pm; Sat, 25 Jun 2016 06:27:45 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4887 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bGkoQ-0002nb-V1; Sat, 25 Jun 2016 06:27:44 -0400 Date: Sat, 25 Jun 2016 13:26:37 +0300 Message-Id: <83wpldzhr6.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Tino Calancha on Fri, 24 Jun 2016 22:16:06 +0900 (JST)) References: <83wplh45fw.fsf@gnu.org> <83lh1w2aev.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > From: Tino Calancha > Date: Fri, 24 Jun 2016 22:16:06 +0900 (JST) > cc: f92capac@gmail.com, 23824@debbugs.gnu.org > > >(highlight-markup-buffers BUF-A FILE-B BUF-A FILE-B) > >will prompt you twice to save BUF-A when BUF-A is modified. > >It prompts you to save buf-a again even if you saved buf-a after > >the first prompt: this is because `highlight-markup-buffers' > >save the bit on the modification status of BUF-A and BUF-B at the > >top of the function. > > User should be prompted just one in this case. > I propose following patch: > > >From 67eb8473757392f893c3f83227cbdfd184499e25 Mon Sep 17 00:00:00 2001 > From: Tino Calancha > Date: Fri, 24 Jun 2016 21:53:56 +0900 > Subject: [PATCH] Do not prompt twice to save a buffer > > * lisp/hilit-chg.el (highlight-markup-buffers): (Bug#23824). > --- > lisp/hilit-chg.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el > index 8f042b6..d4276ce 100644 > --- a/lisp/hilit-chg.el > +++ b/lisp/hilit-chg.el > @@ -782,7 +782,7 @@ highlight-markup-buffers > a-start a-end len-a > b-start b-end len-b > (bufa-modified (buffer-modified-p buf-a)) > - (bufb-modified (buffer-modified-p buf-b)) > + (bufb-modified (and (not (eq buf-a buf-b)) (buffer-modified-p buf-b))) > (buf-a-read-only (with-current-buffer buf-a buffer-read-only)) > (buf-b-read-only (with-current-buffer buf-b buffer-read-only)) > temp-a temp-b) > -- > 2.8.1 LGTM, thanks. From unknown Tue Aug 19 14:22:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#23824: closed () Message-ID: References: X-Gnu-PR-Message: they-closed 23824 X-Gnu-PR-Package: emacs Reply-To: 23824@debbugs.gnu.org Date: Sun, 26 Jun 2016 02:00:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1466906403-13542-1" This is a multi-part message in MIME format... ------------=_1466906403-13542-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #23824: 25.0.95; Prevent compare one buffer with itself which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 23824@debbugs.gnu.org. --=20 23824: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D23824 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1466906403-13542-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 23824-done) by debbugs.gnu.org; 26 Jun 2016 01:59:15 +0000 Received: from localhost ([127.0.0.1]:55873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGzLu-0003V4-QM for submit@debbugs.gnu.org; Sat, 25 Jun 2016 21:59:14 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:34786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGzLs-0003Ur-Vi for 23824-done@debbugs.gnu.org; Sat, 25 Jun 2016 21:59:13 -0400 Received: by mail-pa0-f45.google.com with SMTP id bz2so48264660pad.1 for <23824-done@debbugs.gnu.org>; Sat, 25 Jun 2016 18:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:message-id:user-agent:mime-version; bh=vieodb1MRE9+au5gQdyqmLZHrq+ovWsvHAGwj7ex0ko=; b=pNZn/ye/ciPh1CMt9nTMeFTYq2bChmN+1XldHNappzIisaIOvATtdPYcALLG700fZP ZyfEfTZPTTlqLjmAWrxg8SIdF1w5qglGketiNmBTY7KGQ05h1faWxcS/WEXCOKbWLQop Ll+MnpKq4zkluPtap1lKI3fl3JmCPie5GW7xc8bBQ3nYRirIGiNmDkmeXb95sN0IWpO9 duAI72KxPU5EgKfgRJetGAxjON368DwF+vYZhWh0RQYT0+tJFTeEWarsXpfiZoitsDal LV32ZoM88xOs1ALM3G5a2S+twcb3AHD9/ibjCBZcIyKbLYLjGKs6UKVTvPSd1alLki17 lyYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:message-id:user-agent:mime-version; bh=vieodb1MRE9+au5gQdyqmLZHrq+ovWsvHAGwj7ex0ko=; b=JcEOjBoxSh1x7x6jVLrm0a8bFlksujQoNDF5Lvjhbdae74VnsyHSKk7Vc+lVUAPWDu JmhqOm6ELBmZCwnQ25VVfFFKQNUNS5rgt5BzFU2jXle+k30Jpl8OqZfnGTbCo0OsY+OG rX+VEJzCEfMJoeLbNqJWiT+OxpOOjkTNYgx8MZK+Uh+tpcSVbsdg7YJzxEKsyLNyjTa6 ZfafPw3L53zno0qz3pOta7Kxs7WK4BEhq6rNk4poVeWPbIOtGI9I8SzYuuwlNgf7PH/5 HyqCOI2FtBXh7kwdGjUJdr8EJxWel985YYru347pLQ3zjfHOZv6lNu1Rnn14pzZhuZDc /l5Q== X-Gm-Message-State: ALyK8tIAwxGzvAiFamR+gP5MGBWQUKNMRZfbFdg1b7WaMZXGh3DtwY2SeVMkyIF1y/zX/A== X-Received: by 10.66.149.66 with SMTP id ty2mr21409725pab.153.1466906347058; Sat, 25 Jun 2016 18:59:07 -0700 (PDT) Received: from calancha-pc (softbank126103139048.bbtec.net. [126.103.139.48]) by smtp.gmail.com with ESMTPSA id cq17sm2466260pac.5.2016.06.25.18.59.05 for <23824-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jun 2016 18:59:06 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Sun, 26 Jun 2016 10:59:04 +0900 (JST) X-X-Sender: calancha@calancha-pc To: 23824-done@debbugs.gnu.org Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Applied patch on master branch [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.45 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.45 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: 23824-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Applied patch on master branch [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.45 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.45 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject Applied patch on master branch ------------=_1466906403-13542-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Jun 2016 10:12:30 +0000 Received: from localhost ([127.0.0.1]:50357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFf94-0001Xf-Kh for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFf93-0001XT-JM for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFf8x-0002xF-GT for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8x-0002wr-Cm for submit@debbugs.gnu.org; Wed, 22 Jun 2016 06:12:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8v-0005fA-77 for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFf8r-0002uz-2B for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:21 -0400 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]:35200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf8q-0002us-RF for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 06:12:16 -0400 Received: by mail-pa0-x22d.google.com with SMTP id hl6so15692486pac.2 for ; Wed, 22 Jun 2016 03:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:subject:message-id:user-agent:mime-version; bh=FnW/RFv3b0Qj/vlLYXRw4aI62z5N5HG1INmVhYFuKyo=; b=w2YcBER7yAEG/VNcHNOFR/1p3GGwOUV1NCZa4f+FjPAbRrp5TnpkJvLTFAHq5bu/lj l6timxX1s4DLPSxw1rbwlnNFEH8A6sBCOM81NsWbna34K3BtPoiCN62+7stjGVKsnbdH VniWQI0yfOaiYGexU6Y5vflcScss9hVFcYehexWaKIVST/AkZuljlSu4teSOAJCh6zaT fhEFfn5fsLLRMjfST4Co8iHAw/Go8WOYo+9c2EQ4PN3rmRGDBRhG8xJ3qW64Wmi8TLKN j+kY/cl8De1fgZifFvgW0l4JXlv8bbOJRO7HRQkKEtcThtDbYScpqNtJEm7FKOwuDDfO g7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=FnW/RFv3b0Qj/vlLYXRw4aI62z5N5HG1INmVhYFuKyo=; b=V6SLNNPwmJdPQA2c8wJLMv2Ve1mGVUD8oloBcQbysG0kDoKmXlADKJ70fMNxhRxS66 SrMo3C0caMO4ssN3UuaUSBLscmbe/88wfEbjgFwvYr2d64yh7lgJODSJNcaHUGgCk5wA z+T2jTV5WqePMcHM+P16U4LB9GDXG38K4mwZNdQoASnNiBLZzlSUarPmSUEXrg+kxrlq pje1U8wIIf2eWymahV9CE9P6ZXfeXxnHNnf6Abmw7iqUp18B+eyIGRUZlXSHAgBZBmQz 5qZgXxHb0TYVt7g6eVhQte6KabkiOydKzZFUJ+4M+zZ8EX5BStcMLTnhL0r+gatNnD8t nKrg== X-Gm-Message-State: ALyK8tKx+6Mctxx3gDeJHxNKaYPPk+unCjaFvE8P5kmIQMm2aAxlvgJ1sij7BC6MzxgSHA== X-Received: by 10.66.132.72 with SMTP id os8mr33745219pab.63.1466590335701; Wed, 22 Jun 2016 03:12:15 -0700 (PDT) Received: from calancha-pc (softbank126103144234.bbtec.net. [126.103.144.234]) by smtp.gmail.com with ESMTPSA id v62sm72575276pfv.50.2016.06.22.03.12.14 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2016 03:12:15 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Wed, 22 Jun 2016 19:12:13 +0900 (JST) X-X-Sender: calancha@calancha-pc To: bug-gnu-emacs@gnu.org Subject: 25.0.95; Prevent compare one buffer with itself Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) When the current buffer, buf-a, is visiting FILE-B, buf-b should be a temporary buffer on sync with FILE-B. ./emacs -r -Q -eval '(progn (with-temp-file "/tmp/foo" (insert "foo")) (find-file "/tmp/foo") (insert "bar"))' M-: (highlight-compare-with-file "/tmp/foo") RET n n ; Answer no to saving suggestions. ;; Current buffer content different than /tmp/foo but no face highlight-changes shown. In GNU Emacs 25.0.95.2 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) Repository revision: 829733104db073f8abd67765eae162e7360281fa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 47921b1f4898f9fad3acdaa15c2c70fa4b3f9061 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 22 Jun 2016 18:30:14 +0900 Subject: [PATCH] Prevent compare one buffer with itself * lisp/hilit-chg.el (highlight-compare-with-file): Use a new temporary buffer on sync with file-b; mark this buffer as unmodified to prevent being prompt to save it (Bug#23824). --- lisp/hilit-chg.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index 8f042b6..89ca154 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el @@ -900,10 +900,18 @@ highlight-compare-with-file (let* ((buf-a (current-buffer)) (file-a (buffer-file-name)) (existing-buf (get-file-buffer file-b)) - (buf-b (or existing-buf - (find-file-noselect file-b)))) + (buf-b (cond ((eq buf-a existing-buf) + (let ((buf-new (generate-new-buffer (generate-new-buffer-name + (buffer-name buf-a))))) + (with-current-buffer buf-new + (insert-file-contents-literally file-b) + (set-buffer-modified-p nil)) buf-new)) + (t + (or existing-buf + (find-file-noselect file-b)))))) (highlight-markup-buffers buf-a file-a buf-b file-b (not existing-buf)) - (unless existing-buf + (when (or (not existing-buf) + (eq buf-a existing-buf)) (kill-buffer buf-b)) )) -- 2.8.1 ------------=_1466906403-13542-1--