From: Jean Louis <bugs@gnu.support>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Make new buffer from menu
Date: Sun, 4 Dec 2022 15:03:05 +0300 [thread overview]
Message-ID: <Y4yMeZ9Udf7WbeuO@protected.localdomain> (raw)
In-Reply-To: <3BpVZiHtJ2qfvYFaoGSD6wsXiZ9I4gzw1gPBRi3VA8jvDWEJx119h77NiqZkLEqmAZmX1AyjWJN6zBgZwHwRU1wqpTqthx9-BO0Sx34z-80=@protonmail.com>
* Heime <heimeborgia@protonmail.com> [2022-12-03 06:59]:
>
> It would help me a lot if can can make a new buffer that I can set with
> some major mode, from the menu.
>
> One cannot make a new buffer without saving it.
I make new buffer with {C-x b name-of-my-new-buffer} and I use this
below to create buffers by using {C-u F5}, I bind it to F5, so by
using prefix, I choose the mode.
For required functions see the package:
GNU Emacs package: rcd-utilities.el :
https://gnu.support/gnu-emacs/packages/rcd-utilities-el.html
;;; RCD TEMPORARY BUFFERS
(defcustom rcd-temp-file-directory "~/tmp/"
"Temporary directory for other temporary files."
:group 'rcd
:type 'string)
(defvar rcd-temp-buffer-name "RCD TEMPORARY BUFFER")
(defvar rcd-temp-buffer-modes '(("adoc-mode" . "adoc")
("emacs-lisp-mode" . "el")
("lisp-mode" . ".lisp")
("markdown-mode" . ".md")
("org-mode" . "org")
("sql-mode" . "sql")
("fundamental-mode" . "txt")
("html-mode" . "html")))
(defun rcd-temp-buffer (&optional prefix name mode)
"Generate new temporary buffer."
(interactive "p")
(let* ((file-name (concat rcd-temp-file-directory
(format-time-string "%Y-%m-%d-%H:%M:%S-")
rcd-temp-buffer-name
".txt"))
(buffer (or name (concat "*" rcd-temp-buffer-name "*"))))
(switch-to-buffer (generate-new-buffer buffer))
(setq buffer-file-name file-name)
(if current-prefix-arg
(let ((mode (rcd-choose (map-keys rcd-temp-buffer-modes) "Major mode: ")))
(funcall (intern mode)))
(funcall (intern (or mode "fundamental-mode"))))
buffer-file-name))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
prev parent reply other threads:[~2022-12-04 12:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-03 3:58 Make new buffer from menu Heime
2022-12-03 17:20 ` [External] : " Drew Adams
2022-12-03 18:43 ` Heime
2022-12-03 19:15 ` tomas
2022-12-03 20:27 ` Heime
2022-12-04 6:20 ` tomas
2022-12-04 6:48 ` Eli Zaretskii
2022-12-04 7:20 ` Heime
2022-12-04 14:20 ` Jean Louis
2022-12-04 17:12 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-04 12:13 ` Jean Louis
2022-12-04 11:55 ` Dr Rainer Woitok
2022-12-04 12:32 ` Heime
2022-12-04 12:39 ` Jean Louis
2022-12-04 12:36 ` Jean Louis
2022-12-04 12:03 ` Jean Louis [this message]
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=Y4yMeZ9Udf7WbeuO@protected.localdomain \
--to=bugs@gnu.support \
--cc=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.