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

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

Changing buffer mode


From: carlmarcos
Subject: Changing buffer mode
Date: Wed, 20 Jul 2022 05:55:17 +0200 (CEST)

With the following function I can change the mode of a buffer.  I would like to 
change it to use `completing-read` using a list composed of a selection of mode 
names.  How can I go about doing that? 

(defun mode-sweep ()
  "Cycle the buffer through three major modes (text, org, normal)."
  (interactive)

  (let* ( (modes (list #'org-mode #'text-mode #'normal-mode))
          (new-mode
              (or (cadr (member major-mode modes)) (car modes))) )
    (apply (list new-mode)) ))




reply via email to

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