bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25951: 26.0.50; Error when ediffing files that are visited using quo


From: npostavs
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]