help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keybinding to change Major Mode according to file type


From: Marcin Borkowski
Subject: Re: Keybinding to change Major Mode according to file type
Date: Mon, 21 Sep 2020 10:35:15 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]