unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56258: Changing major-mode with mouse event
@ 2022-06-27 13:58 carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-27 21:08 ` Phil Sainty
  0 siblings, 1 reply; 4+ messages in thread
From: carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-27 13:58 UTC (permalink / raw)
  To: 56258

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]


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'?

[-- Attachment #2: Type: text/html, Size: 529 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#56258: Changing major-mode with mouse event
  2022-06-27 13:58 bug#56258: Changing major-mode with mouse event carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-27 21:08 ` Phil Sainty
  2022-06-28 12:50   ` Lars Ingebrigtsen
       [not found]   ` <87czetq7ef.fsf@gnus.org-N5eMbXh----2>
  0 siblings, 2 replies; 4+ messages in thread
From: Phil Sainty @ 2022-06-27 21:08 UTC (permalink / raw)
  To: carlmarcos; +Cc: 56258

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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#56258: Changing major-mode with mouse event
  2022-06-27 21:08 ` Phil Sainty
@ 2022-06-28 12:50   ` Lars Ingebrigtsen
       [not found]   ` <87czetq7ef.fsf@gnus.org-N5eMbXh----2>
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-28 12:50 UTC (permalink / raw)
  To: Phil Sainty; +Cc: carlmarcos, 56258

Phil Sainty <psainty@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#56258: Changing major-mode with mouse event
       [not found]   ` <87czetq7ef.fsf@gnus.org-N5eMbXh----2>
@ 2022-06-28 23:17     ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-28 23:17 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Phil Sainty, 56258

[-- Attachment #1: Type: text/plain, Size: 2084 bytes --]


Jun 28, 2022, 12:50 by larsi@gnus.org:

> Phil Sainty <psainty@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
>


[-- Attachment #2: Type: text/html, Size: 3011 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-28 23:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 13:58 bug#56258: Changing major-mode with mouse event carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-27 21:08 ` Phil Sainty
2022-06-28 12:50   ` Lars Ingebrigtsen
     [not found]   ` <87czetq7ef.fsf@gnus.org-N5eMbXh----2>
2022-06-28 23:17     ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).