[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding major-mode selection to new buffer
From: |
Jean Louis |
Subject: |
Re: Adding major-mode selection to new buffer |
Date: |
Wed, 29 Jun 2022 13:57:43 +0300 |
User-agent: |
Mutt/+ () (2022-05-21) |
* Christopher Dimech <dimech@gmx.com> [2022-06-29 01:06]:
> How can the code be modified to have filename saved with the following format?
>
> %Y-%m-%d-T%H:%M:%S--<rcd-temp-buffer-name>-<name>.txt
My variable is this one: rcd-temp-buffer-name ⇒ "RCD TEMPORARY BUFFER"
And I rarely save it as such, but files are connected to temporary
buffers. It is very handy, as it is temporary note, and if I wish to
exit Emacs I will be notified there is maybe still something to be
saved.
You are right, your suggestion is much better for sorting and visual review.
(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 (completing-read
"Mode: "
(map-keys rcd-temp-buffer-modes) nil t nil
'rcd-temp-buffer-mode-history)))
(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/
- Re: Adding major-mode selection to new buffer, (continued)
- Re: Adding major-mode selection to new buffer, Emanuel Berg, 2022/06/27
- Re: Adding major-mode selection to new buffer, carlmarcos, 2022/06/27
- Re: Adding major-mode selection to new buffer, Emanuel Berg, 2022/06/27
- Re: Adding major-mode selection to new buffer, carlmarcos, 2022/06/27
- Re: Adding major-mode selection to new buffer, Emanuel Berg, 2022/06/27
- Re: Adding major-mode selection to new buffer, carlmarcos, 2022/06/27
- Re: Adding major-mode selection to new buffer, Emanuel Berg, 2022/06/27
Re: Adding major-mode selection to new buffer, Chris Van Dusen, 2022/06/27
Re: Adding major-mode selection to new buffer, Jean Louis, 2022/06/28
- Re: Adding major-mode selection to new buffer, Christopher Dimech, 2022/06/28
- Message not available
- Message not available
- Re: Adding major-mode selection to new buffer, carlmarcos, 2022/06/29
- Re: Adding major-mode selection to new buffer, Jean Louis, 2022/06/30
- RE: [External] : Re: Adding major-mode selection to new buffer, Drew Adams, 2022/06/30
- Re: [External] : Re: Adding major-mode selection to new buffer, Jean Louis, 2022/06/30
Re: Adding major-mode selection to new buffer, Christopher Dimech, 2022/06/28
Message not available