From: Marcin Borkowski <mbork@mbork.pl>
To: Christopher Dimech <dimech@gmx.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Keybinding to change Major Mode according to file type
Date: Mon, 21 Sep 2020 10:35:15 +0200 [thread overview]
Message-ID: <87sgbba5oc.fsf@mbork.pl> (raw)
In-Reply-To: <trinity-a772d963-7d82-4bff-90bf-e4d5e8df66b6-1600674157478@3c-app-mailcom-bs09>
On 2020-09-21, at 09:42, Christopher Dimech <dimech@gmx.com> wrote:
> Can one use keybinding such as f2 loads the bluffer in Major Mode dependent on the file type.
>
> Example:
>
>
> If I have a .texi file in whicn I have changed the major mode with 'M-x org-mode'
>
> I want to press f2 to it will check the file, in my case .texi and change
> to major mode as though I keyed 'M-x texinfo-mode'
M-x normal-mode
And you can use global-set-key to bind this to f2 (although you'd have
to start with unsetting it, since it is a prefix key by default). You
can e.g. say
M-: (global-unset-key [f2]) RET
and then
M-x global-set-key RET f2 normal-mode RET.
Hth,
--
Marcin Borkowski
http://mbork.pl
prev parent reply other threads:[~2020-09-21 8:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 7:42 Keybinding to change Major Mode according to file type Christopher Dimech
2020-09-21 8:35 ` Marcin Borkowski [this message]
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=87sgbba5oc.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=dimech@gmx.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).