all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Morgan Smith <Morgan.J.Smith@outlook.com>
To: emacs-orgmode@gnu.org
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>
Subject: [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer'
Date: Sun, 31 Mar 2024 17:00:25 -0400	[thread overview]
Message-ID: <CH3PR84MB3424CFF9BF4DEE8BCEA65AABC5382@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM> (raw)

* 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



             reply	other threads:[~2024-03-31 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-31 21:00 Morgan Smith [this message]
2024-04-01 11:46 ` [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer' Ihor Radchenko

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=CH3PR84MB3424CFF9BF4DEE8BCEA65AABC5382@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM \
    --to=morgan.j.smith@outlook.com \
    --cc=emacs-orgmode@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.