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: Philipp Stephani
Subject: bug#25951: 26.0.50; Error when ediffing files that are visited using quoted file names
Date: Sun, 23 Apr 2017 16:54:12 +0000



<npostavs@users.sourceforge.net> schrieb am Sa., 22. Apr. 2017 um 22:31 Uhr:
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))

Yes, that should work, thanks. Will send a new patch in a second. 

reply via email to

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