]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid leaving temp buffers in bib-mode and refbib
authorStefan Kangas <stefan@marxist.se>
Sat, 30 Jul 2022 09:52:05 +0000 (11:52 +0200)
committerStefan Kangas <stefan@marxist.se>
Sat, 30 Jul 2022 10:07:49 +0000 (12:07 +0200)
* lisp/textmodes/bib-mode.el (bib-capitalize-title):
* lisp/textmodes/refbib.el (r2b-capitalize-title): Use
with-temp-buffer.

lisp/textmodes/bib-mode.el
lisp/textmodes/refbib.el

index 21a4dc751a0eaf07eafaf9dd8cf3b0b53501260c..83759090aff8c731f5e5ba66caf7f3d46096ac5c 100644 (file)
@@ -225,12 +225,12 @@ named by variable `bib-unread-file'."
         (set-syntax-table orig-syntax-table))))
 
 (defun bib-capitalize-title (s)
-   "Like `capitalize', but don't capitalize stop words, except the first."
-   (with-current-buffer (get-buffer-create "$$$Scratch$$$")
-     (erase-buffer)
-     (insert s)
-     (bib-capitalize-title-region (point-min) (point-max))
-     (buffer-string)))
+  "Like `capitalize', but don't capitalize stop words, except the first."
+  (with-temp-buffer
+    (erase-buffer)
+    (insert s)
+    (bib-capitalize-title-region (point-min) (point-max))
+    (buffer-string)))
 
 (define-obsolete-function-alias 'addbib #'bib-add "29.1")
 (define-obsolete-function-alias 'return-key-bib #'bib-return-key "29.1")
index ba1deca47dc35fc99285eed809e3a3872cefe128..f697fcaf403ebc37851d028b64a26bac302cbc6a 100644 (file)
@@ -163,12 +163,12 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
 
 
 (defun r2b-capitalize-title (s)
-   "Like `capitalize', but don't capitalize stop words, except the first."
-   (with-current-buffer (get-buffer-create "$$$Scratch$$$")
-     (erase-buffer)
-     (insert s)
-     (r2b-capitalize-title-region (point-min) (point-max))
-     (buffer-string)))
+  "Like `capitalize', but don't capitalize stop words, except the first."
+  (with-temp-buffer
+    (erase-buffer)
+    (insert s)
+    (r2b-capitalize-title-region (point-min) (point-max))
+    (buffer-string)))
 
 ;*********************************************************
 (defun r2b-reset ()