From: Christopher Dimech <dimech@gmx.com>
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Emacs keybindings according to file type
Date: Mon, 21 Sep 2020 08:46:02 +0200 [thread overview]
Message-ID: <trinity-44074d76-a145-4d0c-ad6f-3c242b141a57-1600670762817@3c-app-mailcom-bs09> (raw)
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*
next reply other threads:[~2020-09-21 6:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 6:46 Christopher Dimech [this message]
2020-09-21 14:16 ` Emacs keybindings according to file type Eli Zaretskii
2020-09-21 14:20 ` Christopher Dimech
2020-09-21 15:57 ` Eric S Fraga
2020-09-23 6:33 ` Christopher Dimech
2020-09-23 7:33 ` Yuri Khan
2020-09-23 7:44 ` Christopher Dimech
2020-09-23 7:52 ` Yuri Khan
2020-09-23 8:03 ` Christopher Dimech
2020-09-23 8:06 ` Marcin Borkowski
2020-09-23 23:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-44074d76-a145-4d0c-ad6f-3c242b141a57-1600670762817@3c-app-mailcom-bs09 \
--to=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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.