[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Keybinding that loops through Major Modes
From: |
Christopher Dimech |
Subject: |
Re: Keybinding that loops through Major Modes |
Date: |
Mon, 2 Nov 2020 23:54:31 +0100 |
I think something similar to
(let ((modes (list
would work. But by forcing a mode change in the current buffer. not based on
file extension.
> Sent: Monday, November 02, 2020 at 9:59 PM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor"
> <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Keybinding that loops through Major Modes
>
> Christopher Dimech wrote:
>
> > Is it difficult to make an keybinding that if I continue to press
> > it, it will loop through a list of major modes in a predefined
> > order (e.g. text-mode, org-mode, normal-mode, text-mode, ...)
>
> Not difficult but perhaps not a good idea since it is probably better
> to let Emacs set the major mode automatically.
>
> If it doesn't do it to your liking there are many ways to set it up,
> depending on the situation.
>
> Based on file extension:
>
> (let ((modes (list
> '("\\.bal\\'" . balance-mode)
> '("\\.lu\\'" . lua-mode)
> '("\\.nqp\\'" . perl-mode)
> '("\\.php\\'" . html-mode)
> '("\\.pic\\'" . nroff-mode)
> '("\\.pl\\'" . prolog-mode)
> '("\\.tex\\'" . latex-mode)
> '("\\.xr\\'" . conf-xdefaults-mode)
> '("*" . text-mode) )))
> (setf auto-mode-alist (nconc modes auto-mode-alist)) )
>
> For scripts, use the hash-bang line, topmost. You probably want it
> anyway. For example, for zsh:
>
> #! /bin/zsh
>
> You can also force a mode like this, also topmost:
>
> ;;; -*- emacs-lisp -*-
>
> For the rare cases none of these methods will do, I think M-x
> perl-mode RET will do...
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
- Re: Keybinding that loops through Major Modes, (continued)
- Re: Keybinding that loops through Major Modes, Christopher Dimech, 2020/11/03
- Re: Keybinding that loops through Major Modes, Michael Heerdegen, 2020/11/03
- Re: Keybinding that loops through Major Modes, Emanuel Berg, 2020/11/03
- Re: Keybinding that loops through Major Modes, Michael Heerdegen, 2020/11/03
- Re: Keybinding that loops through Major Modes, Christopher Dimech, 2020/11/03
- Re: Keybinding that loops through Major Modes, Joost Kremers, 2020/11/03
- Re: Keybinding that loops through Major Modes, Michael Heerdegen, 2020/11/03
- Re: Keybinding that loops through Major Modes, Stefan Monnier, 2020/11/03
- Re: Keybinding that loops through Major Modes, Joost Kremers, 2020/11/03
- RE: Keybinding that loops through Major Modes, Drew Adams, 2020/11/03
- Re: Keybinding that loops through Major Modes,
Christopher Dimech <=
- Re: Keybinding that loops through Major Modes, Stefan Monnier, 2020/11/02