unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adding major-mode selection to new buffer
@ 2022-06-27 22:46 carlmarcos--- via Users list for the GNU Emacs text editor
  2022-06-27 23:06 ` Emanuel Berg
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-06-27 22:46 UTC (permalink / raw)
  To: Help Gnu Emacs

With the following function I can make a new buffer with a name.  Would also 
like to set the major-mode from the minibuffer.

Perhaps using `completing-read` 

(cseq '("sh-mode" "emacs-lisp-mode" "org-mode" "f90-mode" "c-mode" ))
(csel  (completing-read "Major Mode: " cseq nil t "org-mode"))

How can I introduce the above functionality in the `workbench' function?

(defun workbench (&optional name)
  "Make new buffer with unique name based on NAME."
  (interactive "s Buffer Name: ")
  (switch-to-buffer
   (generate-new-buffer
    (if (string-blank-p name) "wb" name))))


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-06-30 15:07 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27 22:46 Adding major-mode selection to new buffer carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-27 23:06 ` Emanuel Berg
2022-06-27 23:09   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-27 23:13     ` Emanuel Berg
2022-06-27 23:24       ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-27 23:29         ` Emanuel Berg
2022-06-28  0:03           ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-28  0:19             ` Emanuel Berg
2022-06-28  0:28 ` Chris Van Dusen
2022-06-28 10:21 ` Jean Louis
2022-06-28 22:05   ` Christopher Dimech
2022-06-29 10:57     ` Jean Louis
     [not found]     ` <YrwwJ0/FaRxg2Ryn@protected.localdomain-N5j6REm----2>
2022-06-29 16:05       ` carlmarcos--- via Users list for the GNU Emacs text editor
     [not found]       ` <N5jJkLB--3-2@tutanota.com-N5kDENb----2>
2022-06-29 16:42         ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-30 13:06           ` Jean Louis
2022-06-30 14:37             ` [External] : " Drew Adams
2022-06-30 15:07               ` Jean Louis
2022-06-28 22:20   ` Christopher Dimech
2022-06-29 10:47     ` Christopher Dimech
     [not found] ` <YrrWHhpK7uiKKVb1@protected.localdomain-N5dqNXf--J-2>
2022-06-28 12:40   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-28 18:22     ` Jean Louis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).