GNU bug report logs - #56258
Changing major-mode with mouse event

Previous Next

Package: emacs;

Reported by: carlmarcos <at> tutanota.com

Date: Mon, 27 Jun 2022 13:59:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 56258 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56258; Package emacs. (Mon, 27 Jun 2022 13:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to carlmarcos <at> tutanota.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Jun 2022 13:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: carlmarcos <at> tutanota.com
To: Bug Gnu Emacs <bug-gnu-emacs <at> gnu.org>
Subject: Changing major-mode with mouse event
Date: Mon, 27 Jun 2022 15:58:47 +0200 (CEST)
[Message part 1 (text/plain, inline)]
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?

Or would something in the file menu-bar be more suitable, considering there are `New Window' and `New Frame'?
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56258; Package emacs. (Mon, 27 Jun 2022 21:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 56258 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: carlmarcos <at> tutanota.com
Cc: 56258 <at> debbugs.gnu.org
Subject: Re: bug#56258: Changing major-mode with mouse event
Date: Tue, 28 Jun 2022 09:08:27 +1200
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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56258; Package emacs. (Tue, 28 Jun 2022 12:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 56258 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: carlmarcos <at> tutanota.com, 56258 <at> debbugs.gnu.org
Subject: Re: bug#56258: Changing major-mode with mouse event
Date: Tue, 28 Jun 2022 14:50:16 +0200
Phil Sainty <psainty <at> orcon.net.nz> writes:

> 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.

Yes, it should be possible to provide a command to allow you to choose
between modes.  But I think having something like that callable from the
mode line would be of limited value, but perhaps not?  The reason is
that we just have So Many Modes -- over 500, at least, so discovering
modes via a menu would be cumbersome.

> 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.

Yes, that might be nice if you want to explore "what are the major
modes I can possibly use here?".

We almost kinda sorta have that.  All minor modes should be defined via
define-minor-mode now, and that updates the global-minor-modes and
local-minor-mode variables.  So all mode functions that aren't there are
major modes, so we could use heuristics to get us pretty far (along with
`derived-mode-parent').

However, we do have functions that end with -mode that aren't modes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56258; Package emacs. (Tue, 28 Jun 2022 23:18:01 GMT) Full text and rfc822 format available.

Message #14 received at 56258 <at> debbugs.gnu.org (full text, mbox):

From: carlmarcos <at> tutanota.com
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Phil Sainty <psainty <at> orcon.net.nz>, 56258 <at> debbugs.gnu.org
Subject: Re: bug#56258: Changing major-mode with mouse event
Date: Wed, 29 Jun 2022 01:17:41 +0200 (CEST)
[Message part 1 (text/plain, inline)]
Jun 28, 2022, 12:50 by larsi <at> gnus.org:

> Phil Sainty <psainty <at> orcon.net.nz> writes:
>
>> 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.
>>
>
> Yes, it should be possible to provide a command to allow you to choose
> between modes.  But I think having something like that callable from the
> mode line would be of limited value, but perhaps not?  The reason is
> that we just have So Many Modes -- over 500, at least, so discovering
> modes via a menu would be cumbersome.
>
You would know more about how best to approach this.  Perhaps some form
of completion could help.  Have you reflected on categorising the modes,
organised in ways that makes the process of going through them quicker?

>> 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.
>>
>
> Yes, that might be nice if you want to explore "what are the major
> modes I can possibly use here?".
>
> We almost kinda sorta have that.  All minor modes should be defined via
> define-minor-mode now, and that updates the global-minor-modes and
> local-minor-mode variables.  So all mode functions that aren't there are
> major modes, so we could use heuristics to get us pretty far (along with
> `derived-mode-parent').
>
> However, we do have functions that end with -mode that aren't modes.
>
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>  bloggy blog: http://lars.ingebrigtsen.no
>

[Message part 2 (text/html, inline)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 29 Jun 2022 14:56:02 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 362 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.