unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: carlmarcos@tutanota.com
Cc: 56258@debbugs.gnu.org
Subject: bug#56258: Changing major-mode with mouse event
Date: Tue, 28 Jun 2022 09:08:27 +1200	[thread overview]
Message-ID: <ec1161b5063acb76c92b8c9a2b731005@webmail.orcon.net.nz> (raw)
In-Reply-To: <N5_IS33--3-2@tutanota.com>

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.






  reply	other threads:[~2022-06-27 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec1161b5063acb76c92b8c9a2b731005@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=56258@debbugs.gnu.org \
    --cc=carlmarcos@tutanota.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).