* [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer'
@ 2024-03-31 21:00 Morgan Smith
2024-04-01 11:46 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Morgan Smith @ 2024-03-31 21:00 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Morgan Smith
* lisp/org-capture.el (org-capture-get-indirect-buffer): Simplify by
using 'generate-new-buffer-name'.
---
lisp/org-capture.el | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 8ce11cb75..5d9ae4947 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1585,10 +1585,7 @@ If TEMPLATE-KEY is nil, the user is queried for the template."
"Make an indirect BUFFER for a capture process.
Use PREFIX as a prefix for the name of the indirect buffer."
(setq buffer (or buffer (current-buffer)))
- (let ((n 1) (base (buffer-name buffer)) bname)
- (setq bname (concat prefix "-" base))
- (while (buffer-live-p (get-buffer bname))
- (setq bname (concat prefix "-" (number-to-string (cl-incf n)) "-" base)))
+ (let ((bname (generate-new-buffer-name (concat prefix "-" (buffer-name buffer)))))
(condition-case nil
(make-indirect-buffer buffer bname 'clone)
(error
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer'
2024-03-31 21:00 [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer' Morgan Smith
@ 2024-04-01 11:46 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-04-01 11:46 UTC (permalink / raw)
To: Morgan Smith; +Cc: emacs-orgmode
Morgan Smith <Morgan.J.Smith@outlook.com> writes:
> * lisp/org-capture.el (org-capture-get-indirect-buffer): Simplify by
> using 'generate-new-buffer-name'.
> ...
> - (let ((n 1) (base (buffer-name buffer)) bname)
> - (setq bname (concat prefix "-" base))
> - (while (buffer-live-p (get-buffer bname))
> - (setq bname (concat prefix "-" (number-to-string (cl-incf n)) "-" base)))
> + (let ((bname (generate-new-buffer-name (concat prefix "-" (buffer-name buffer)))))
Thanks, but this is potentially backwards-incompatible.
`generate-new-buffer-name' following a different naming scheme compared
to the current implementation of `org-capture-get-indirect-buffer':
CAPTURE-<NUM>-foo.org vs. CAPTURE-foo.org<N>
Different naming scheme may potentially break user customization in
`display-buffer-alist'.
The change is not justified.
Canceled.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-01 11:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-31 21:00 [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer' Morgan Smith
2024-04-01 11:46 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).