[Top][All Lists]

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

Re: Adding major-mode selection to new buffer

From: Chris Van Dusen
Subject: Re: Adding major-mode selection to new buffer
Date: Mon, 27 Jun 2022 19:28:06 -0500

Check the scratch package to see if it fits your needs.


> On Jun 27, 2022, at 17:51, carlmarcos--- via Users list for the GNU Emacs 
> text editor <> wrote:
> ´╗┐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))))

reply via email to

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