From: Tino Calancha <f92capac@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23824@debbugs.gnu.org
Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself
Date: Thu, 23 Jun 2016 09:58:02 +0900 [thread overview]
Message-ID: <a9a44a4c-3c94-31b5-8230-5314fab1f327@gmail.com> (raw)
In-Reply-To: <83wplh45fw.fsf@gnu.org>
On 06/23/2016 12:19 AM, Eli Zaretskii wrote:
>> From: Tino Calancha <f92capac@gmail.com>
>> 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.
next prev parent reply other threads:[~2016-06-23 0:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 10:12 bug#23824: 25.0.95; Prevent compare one buffer with itself Tino Calancha
2016-06-22 15:19 ` Eli Zaretskii
2016-06-23 0:58 ` Tino Calancha [this message]
2016-06-23 15:27 ` Eli Zaretskii
2016-06-24 5:07 ` Tino Calancha
2016-06-24 13:16 ` bug#23824: 25.0.95; Do not prompt twice to save a buffer Tino Calancha
2016-06-25 10:26 ` Eli Zaretskii
2016-06-26 1:59 ` bug#23824: (no subject) Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9a44a4c-3c94-31b5-8230-5314fab1f327@gmail.com \
--to=f92capac@gmail.com \
--cc=23824@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).