From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Date: Thu, 23 Jun 2016 09:58:02 +0900 Message-ID: References: <83wplh45fw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1466643572 22231 80.91.229.3 (23 Jun 2016 00:59:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jun 2016 00:59:32 +0000 (UTC) Cc: 23824@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 23 02:59:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFszE-0008NP-8F for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Jun 2016 02:59:16 +0200 Original-Received: from localhost ([::1]:33562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFszD-0006N9-3k for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jun 2016 20:59:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsz6-0006N4-Io for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 20:59:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFsz0-0001qJ-HC for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 20:59:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsz0-0001qF-EU for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 20:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFsz0-00046u-47 for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 20:59: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, 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: Original-Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146664349315737 (code B ref 23824); Thu, 23 Jun 2016 00:59:02 +0000 Original-Received: (at 23824) by debbugs.gnu.org; 23 Jun 2016 00:58:13 +0000 Original-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 Original-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 Original-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) Original-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) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 In-Reply-To: <83wplh45fw.fsf@gnu.org> 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:119958 Archived-At: 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.