all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: completing-read to set the mode for a buffer
Date: Sat, 9 Jul 2022 02:52:35 +0200 (CEST)	[thread overview]
Message-ID: <N6VRPiS--3-2@tutanota.com> (raw)

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	other threads:[~2022-07-09  0:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  0:52 carlmarcos--- via Users list for the GNU Emacs text editor [this message]
2022-07-09  1:51 ` completing-read to set the mode for a buffer Emanuel Berg
2022-07-09  3:42   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-10  4:20     ` Emanuel Berg

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=N6VRPiS--3-2@tutanota.com \
    --to=help-gnu-emacs@gnu.org \
    --cc=carlmarcos@tutanota.com \
    /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.