[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f1d9e41: * lisp/subr.el (generate-new-buffer): Move
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master f1d9e41: * lisp/subr.el (generate-new-buffer): Move (from files.el) before first use |
Date: |
Fri, 4 Oct 2019 08:56:23 -0400 (EDT) |
branch: master
commit f1d9e41ab022358c5086227d5b267f3f35d27666
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/subr.el (generate-new-buffer): Move (from files.el) before first use
(with-temp-file, with-output-to-string): Use it.
* lisp/files.el (generate-new-buffer): Move to subr.el.
---
lisp/files.el | 5 -----
lisp/subr.el | 13 ++++++++-----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 09180fd..20bc204 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1934,11 +1934,6 @@ this function prepends a \"|\" to the final result if
necessary."
(concat "|" lastname)
lastname))))
-(defun generate-new-buffer (name)
- "Create and return a buffer with a name based on NAME.
-Choose the buffer's name using `generate-new-buffer-name'."
- (get-buffer-create (generate-new-buffer-name name)))
-
(defcustom automount-dir-prefix (purecopy "^/tmp_mnt/")
"Regexp to match the automounter prefix in a directory name."
:group 'files
diff --git a/lisp/subr.el b/lisp/subr.el
index fcfc396..985bdc6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3415,6 +3415,11 @@ also `with-temp-buffer'."
(when (window-live-p (nth 1 state))
(select-window (nth 1 state) 'norecord)))
+(defun generate-new-buffer (name)
+ "Create and return a buffer with a name based on NAME.
+Choose the buffer's name using `generate-new-buffer-name'."
+ (get-buffer-create (generate-new-buffer-name name)))
+
(defmacro with-selected-window (window &rest body)
"Execute the forms in BODY with WINDOW as the selected window.
The value returned is the value of the last form in BODY.
@@ -3580,8 +3585,7 @@ See also `with-temp-buffer'."
(let ((temp-file (make-symbol "temp-file"))
(temp-buffer (make-symbol "temp-buffer")))
`(let ((,temp-file ,file)
- (,temp-buffer
- (get-buffer-create (generate-new-buffer-name " *temp file*"))))
+ (,temp-buffer (generate-new-buffer " *temp file*")))
(unwind-protect
(prog1
(with-current-buffer ,temp-buffer
@@ -3620,7 +3624,7 @@ See also `with-temp-file' and `with-output-to-string'."
(declare (indent 0) (debug t))
(let ((temp-buffer (make-symbol "temp-buffer")))
`(let ((,temp-buffer (generate-new-buffer " *temp*")))
- ;; FIXME: kill-buffer can change current-buffer in some odd cases.
+ ;; `kill-buffer' can change current-buffer in some odd cases.
(with-current-buffer ,temp-buffer
(unwind-protect
(progn ,@body)
@@ -3654,8 +3658,7 @@ of that nature."
(defmacro with-output-to-string (&rest body)
"Execute BODY, return the text it sent to `standard-output', as a string."
(declare (indent 0) (debug t))
- `(let ((standard-output
- (get-buffer-create (generate-new-buffer-name " *string-output*"))))
+ `(let ((standard-output (generate-new-buffer " *string-output*")))
(unwind-protect
(progn
(let ((standard-output standard-output))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f1d9e41: * lisp/subr.el (generate-new-buffer): Move (from files.el) before first use,
Stefan Monnier <=