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

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

bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-


From: Stefan Monnier
Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)
Date: Tue, 28 Jan 2020 15:12:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> So this is because those modes

They're not "modes", really, they're features that create a temp buffer
related to file FOO and need to set this buffer to the same mode as file FOO
(e.g. this happens in vc-revision-other-window, or also in diff-mode
where we grab a hunk's text and want to put it in its corresponding
major mode to give it mode-specific highlighting).

> set buffer-file-name instead of activating the major mode directly?

Right: they don't know which major mode should be used, so they set
buffer-file-name and then call set-auto-mode (which looks up
auto-mode-alist and directory local vars appropriately).

> And by setting buffer-file-name they by side effect tell unrelated
> features that this buffer is associated with a file?

Indeed.

> If so, then I'm not sure I understand the solution.  The offending
> modes will have to be modified to use this new variable instead of
> buffer-file-name, no?

That's what the patch does, yes (modulo the fact that they're not
really "modes").

> And if we have to modify them, then why not do TRT while at that,
> i.e. call the major mode directly instead of setting some variable?

We set the variable in order to find out what mode to use.


        Stefan






reply via email to

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