GNU bug report logs -
#56258
Changing major-mode with mouse event
Previous Next
Full log
Message #8 received at 56258 <at> debbugs.gnu.org (full text, mbox):
On 2022-06-28 01:58, carlmarcos wrote:
> I frequently make new buffers that selects `fundamental-mode`. Could
> there be a way to change the major-mode using the mouse. Perhaps by
> using the menu on the major-mode that shows up in the mode-line?
I suggest you create such buffers using C-x C-f (or the "Visit New
File" menu item) using a file name extension for the major mode you
wish to use. There's no need to actually save/write to the file if
you don't want to, and the buffer mode will be set appropriately.
Failing that, something like this may be suitable:
https://github.com/ieure/scratch-el
Major modes would need to be identifiable as such in order to
provide the menu you propose, and I don't believe there's a reliable
way to do that at present for all major modes.
We can identify major modes defined with `define-derived-mode'
however, as all such modes have a `derived-mode-parent' property;
and that does cover the majority.
-Phil
p.s. Tangentially, I think it would be good if all symbols for both
major and minor modes had (or rather, were expected to have) symbol
properties to explicitly identify which type of mode they are,
including differentiation between the various minor mode types
(buffer-local, global, and 'globalized' pairings), as I think there
would be other uses for being able to query the available modes.
This bug report was last modified 3 years and 87 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.