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

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

Re: Keybinding that loops through Major Modes


From: Emanuel Berg
Subject: Re: Keybinding that loops through Major Modes
Date: Tue, 03 Nov 2020 00:27:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech wrote:

> 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.

(defun iterate-major-mode ()
  (interactive)
  (let*((modes     (list #'emacs-lisp-mode #'perl-mode #'text-mode))
        (new-mode  (or (cadr (member major-mode modes)) (car modes))) )
    (apply `(,new-mode)) ))
;; (iterate-major-mode)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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