From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#56258: Changing major-mode with mouse event Date: Tue, 28 Jun 2022 09:08:27 +1200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40230"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: 56258@debbugs.gnu.org To: carlmarcos@tutanota.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 27 23:09:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5vyq-000AKL-Mc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 23:09:12 +0200 Original-Received: from localhost ([::1]:54814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5vyp-0002oa-7J for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 17:09:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5vyg-0002oF-1l for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 17:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5vyf-0002tv-QJ for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 17:09:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5vyf-0006Yw-LZ for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 17:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jun 2022 21:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56258 X-GNU-PR-Package: emacs Original-Received: via spool by 56258-submit@debbugs.gnu.org id=B56258.165636411425193 (code B ref 56258); Mon, 27 Jun 2022 21:09:01 +0000 Original-Received: (at 56258) by debbugs.gnu.org; 27 Jun 2022 21:08:34 +0000 Original-Received: from localhost ([127.0.0.1]:53431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5vyE-0006YH-He for submit@debbugs.gnu.org; Mon, 27 Jun 2022 17:08:34 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:35915) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5vyA-0006Y6-Gj for 56258@debbugs.gnu.org; Mon, 27 Jun 2022 17:08:33 -0400 Original-Received: from [10.253.37.70] (port=35810 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1o5vy8-00044V-2x; Tue, 28 Jun 2022 09:08:28 +1200 Original-Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 28 Jun 2022 09:08:27 +1200 In-Reply-To: X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235499 Archived-At: 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.