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

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

completing-read to set the mode for a buffer


From: carlmarcos
Subject: completing-read to set the mode for a buffer
Date: Sat, 9 Jul 2022 02:52:35 +0200 (CEST)

Am using completing-read to set the mode for a buffer.  What would be the 
advantage of defining modes in the following way, rather than with a normal 
list with "emacs-lisp-mode", "org-mode", and "sh-script" ?

I use (funcall (intern mode)) to set the mode for the buffer.

(defvar modes
  '( ("emacs-lisp-mode" . "el")
     ("org-mode" . "org")
     ("sh-script" . "sh")))

(completing-read " Mode: " (map-keys modes) nil t)




reply via email to

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