[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Emacs keybindings according to file type
From: |
Christopher Dimech |
Subject: |
Emacs keybindings according to file type |
Date: |
Mon, 21 Sep 2020 08:46:02 +0200 |
I want to set different keybinding according to the type of file I load
into a buffer. I wonder how I can do that.
In my .emacs file I have
; Loads texinfo Customisations
(setq texi--customs "/home/hagbard/swadmin/emacs/el/naiad/texi--custom.el")
(load texi--customs)
; Loads Fortran Customisations.
(setq fortran--customs
"/home/hagbard/swadmin/emacs/el/naiad/fortran--custom.el")
(load fortran--customs)
; Adds Org Mode Custimisations
(setq org--customs "/home/hagbard/swadmin/emacs/el/naiad/org--custom.el")
(load org--customs)
Then in separate files I have commands for each language.
---------
I want to have keybinding for f1 and f2 to toggle between org-mode and
texinfo-mode
when the file is a .texi
; Helps traverse a texinfo document using org-mode commands
; Sets Keybinding for switching between texinfo-mode and org-mode
; The Major Mode toggle is used for Syntax Highlighting
(global-set-key [f1] (kbd "M-x org-mode"))
(global-set-key [f2] (kbd "M-x texinfo-mode"))
And if I have a .f file, I want the keybinding for f90-mode
(global-set-key [f1] (kbd "M-x org-mode"))
(global-set-key [f2] (kbd "M-x f90-mode"))
-------
However, if one looks at the .emacs file, the keybindings that take effect is
always of
the last file that is loaded, in this case being fortran--custom.el. This
means that if
I load a .texi file, the keybinding f2 will not change the buffer to
texinfo-mode.
Regards
S*
- Emacs keybindings according to file type,
Christopher Dimech <=
- Re: Emacs keybindings according to file type, Eli Zaretskii, 2020/09/21
- Re: Emacs keybindings according to file type, Christopher Dimech, 2020/09/21
- Re: Emacs keybindings according to file type, Christopher Dimech, 2020/09/23
- Re: Emacs keybindings according to file type, Yuri Khan, 2020/09/23
- Re: Emacs keybindings according to file type, Christopher Dimech, 2020/09/23
- Re: Emacs keybindings according to file type, Yuri Khan, 2020/09/23
- Re: Emacs keybindings according to file type, Christopher Dimech, 2020/09/23
- Re: Emacs keybindings according to file type, Marcin Borkowski, 2020/09/23
- Re: Emacs keybindings according to file type, Emanuel Berg, 2020/09/23