GNU bug report logs -
#39190
28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)
Previous Next
Full log
Message #116 received at 39190 <at> debbugs.gnu.org (full text, mbox):
>> That's the problem with the current approach: we end up making decisions
>> which can't be justified. Whether mode hooks should be run or not
>> depends on the hook and various other things. What we *do* know, OTOH
>> is that `vc-find-revision-no-save`s buffer is not associated with
>> a file, so setting `buffer-file-name` can result in bugs.
>
> delay-mode-hooks was intended as the safest workaround to install in emacs-27.
delay-mode-hooks is now in emacs-27.
> Using alternatives of buffer-file-name are not straightforward
> and need more testing in emacs-28.
I don't know how to handle this more properly because some hooks
should be run with buffer-file-name, e.g. generic-mode-find-file-hook
that uses buffer-file-name to add more font-lock highlighting.
But some hooks like in Eglot assume that buffer-file-name associates the
buffer with a file.
Also I tried to use indirect buffers:
(let ((buffer (make-indirect-buffer
(current-buffer)
(generate-new-buffer-name (buffer-name)))))
(funcall
(unwind-protect
(with-current-buffer buffer
(let ((buffer-file-name "/tmp/foo.el"))
(set-auto-mode)
major-mode))
(kill-buffer buffer))))
but not sure if it's enough to just set its deduced mode.
This bug report was last modified 5 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.