unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 25951@debbugs.gnu.org
Subject: bug#25951: 26.0.50; Error when ediffing files that are visited using quoted file names
Date: Sat, 22 Apr 2017 16:32:40 -0400	[thread overview]
Message-ID: <87inlwp4if.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAArVCkSzfOh8qZYDAtSG3QB7h_XicpuvDU+PnbBkMujb15LeXQ@mail.gmail.com> (Philipp Stephani's message of "Sat, 22 Apr 2017 19:43:09 +0000")

Philipp Stephani <p.stephani2@gmail.com> writes:

> <npostavs@users.sourceforge.net> schrieb am Sa., 22. Apr. 2017 um 00:48 Uhr:
>
>> Philipp Stephani <p.stephani2@gmail.com> writes:
>>
>> > +       (let ((buffer (current-buffer)))
>> > +         ;; `unquote-then-quote' is only used for the
>> > +         ;; `verify-visited-file-modtime' action, which takes a buffer
>> > +         ;; as only optional argument.
>> > +         (with-current-buffer (or (car arguments) buffer)
>> > +           (let ((buffer-file-name (substring buffer-file-name 2)))
>> > +             ;; Make sure to hide the temporary buffer change from the
>> > +             ;; underlying operation.
>> > +             (with-current-buffer buffer
>> > +               (apply operation arguments))))))
>>
>> I think this could be simplified by using the buffer-file-name function:
>>
>>     (let ((buffer-file-name
>>            (substring (buffer-file-name (car arguments)) 2)))
>>       (apply operation arguments))
>>
>
> That's not the same, it will set the file name of the wrong buffer.

Oh, I think I get it now.  It could be written like this, right?

    (cl-letf* ((buf (or (car arguments) (current-buffer)))
               ((buffer-local-value buffer-file-name buf)
                (substring (buffer-file-name buf) 2)))
      (apply operation arguments))





  reply	other threads:[~2017-04-22 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 13:56 bug#25951: 26.0.50; Error when ediffing files that are visited using quoted file names Philipp Stephani
2017-04-21 22:14 ` Philipp Stephani
2017-04-21 22:50   ` npostavs
2017-04-22 19:43     ` Philipp Stephani
2017-04-22 20:32       ` npostavs [this message]
2017-04-23 16:54         ` Philipp Stephani
2017-04-29 11:49           ` bug#25951: [PATCH] Fix quoted files for 'verify-visited-file-modtime' Philipp Stephani

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=87inlwp4if.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=25951@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /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).