unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] ;  Simplify (with-current-buffer (get-buffer …) …)
@ 2024-03-12  0:21 Tim Landscheidt
  2024-03-14 10:42 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2024-03-12  0:21 UTC (permalink / raw)
  To: emacs-devel

* lisp/calendar/todo-mode.el (todo-merge-category):
* lisp/comint.el (comint-dynamic-list-completions):
* lisp/emacs-lisp/checkdoc.el (checkdoc-error):
* lisp/emacs-lisp/debug.el (debug, debugger-record-expression):
* lisp/emacs-lisp/eieio-opt.el (eieio-browse):
* lisp/emacs-lisp/re-builder.el (reb-restart-font-lock):
* lisp/erc/erc-dcc.el (erc-dcc-do-LIST-command):
* lisp/eshell/em-unix.el (eshell-poor-mans-grep):
* lisp/gnus/gnus-group.el (gnus-add-mark):
* lisp/net/eww.el (eww-next-bookmark, eww-previous-bookmark):
* lisp/net/sieve.el (sieve-upload):
* lisp/net/tramp-cmds.el (tramp-cleanup-some-buffers):
* lisp/obsolete/quickurl.el (quickurl-list-populate-buffer):
* lisp/org/ob-calc.el: (org-babel-execute:calc):
* lisp/org/org-agenda.el (org-agenda-use-sticky-p):
* lisp/pcomplete.el (pcomplete-show-completions):
* lisp/progmodes/bug-reference.el
(bug-reference--try-setup-gnus-article):
* lisp/progmodes/idlw-help.el
(idlwave-highlight-linked-completions):
* lisp/progmodes/verilog-mode.el (verilog-preprocess):
* lisp/replace.el (occur-1):
* lisp/term.el (term-dynamic-list-completions):
* lisp/time.el (world-clock-update):
* lisp/url/url-cache.el (url-store-in-cache):
* lisp/vc/vc-cvs.el (vc-cvs-merge, vc-cvs-merge-news):
* lisp/vc/vc-rcs.el (vc-rcs-system-release):
* lisp/vc/vc-svn.el (vc-svn-merge, vc-svn-merge-news):
* test/lisp/calendar/icalendar-tests.el
(icalendar-tests--get-error-string-for-export):
* test/lisp/erc/erc-dcc-tests.el
(pcomplete/erc-mode/DCC--get-1flag)
(pcomplete/erc-mode/DCC--get-2flags)
(pcomplete/erc-mode/DCC--get-2flags-reverse):
* test/lisp/erc/erc-networks-tests.el
(erc-networks--rename-server-buffer--existing--noreuse):
* test/lisp/erc/erc-scenarios-services-misc.el
(erc-scenarios-services-misc--reconnect-retry-nick):
* test/lisp/erc/erc-tests.el (erc--refresh-prompt):
Replace (with-current-buffer (get-buffer …) …) with
(with-current-buffer … …).
---
 lisp/calendar/todo-mode.el                   | 8 ++++----
 lisp/comint.el                               | 2 +-
 lisp/emacs-lisp/checkdoc.el                  | 2 +-
 lisp/emacs-lisp/debug.el                     | 4 ++--
 lisp/emacs-lisp/eieio-opt.el                 | 2 +-
 lisp/emacs-lisp/re-builder.el                | 2 +-
 lisp/erc/erc-dcc.el                          | 2 +-
 lisp/eshell/em-unix.el                       | 2 +-
 lisp/gnus/gnus-group.el                      | 2 +-
 lisp/net/eww.el                              | 4 ++--
 lisp/net/sieve.el                            | 2 +-
 lisp/net/tramp-cmds.el                       | 2 +-
 lisp/obsolete/quickurl.el                    | 2 +-
 lisp/org/ob-calc.el                          | 2 +-
 lisp/org/org-agenda.el                       | 2 +-
 lisp/pcomplete.el                            | 2 +-
 lisp/progmodes/bug-reference.el              | 2 +-
 lisp/progmodes/idlw-help.el                  | 2 +-
 lisp/progmodes/verilog-mode.el               | 2 +-
 lisp/replace.el                              | 2 +-
 lisp/term.el                                 | 2 +-
 lisp/time.el                                 | 2 +-
 lisp/url/url-cache.el                        | 2 +-
 lisp/vc/vc-cvs.el                            | 4 ++--
 lisp/vc/vc-rcs.el                            | 2 +-
 lisp/vc/vc-svn.el                            | 4 ++--
 test/lisp/calendar/icalendar-tests.el        | 2 +-
 test/lisp/erc/erc-dcc-tests.el               | 6 +++---
 test/lisp/erc/erc-networks-tests.el          | 2 +-
 test/lisp/erc/erc-scenarios-services-misc.el | 2 +-
 test/lisp/erc/erc-tests.el                   | 2 +-
 31 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index f2ee94ec8f7..12287299a7f 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1612,7 +1612,7 @@ todo-merge-category
 	 (garchive (concat (file-name-sans-extension gfile) ".toda"))
 	 (archived-count (todo-get-count 'archived))
 	 here)
-    (with-current-buffer (get-buffer (find-file-noselect tfile))
+    (with-current-buffer (find-file-noselect tfile)
       (widen)
       (let* ((inhibit-read-only t)
 	     (cbeg (progn
@@ -1638,7 +1638,7 @@ todo-merge-category
 	     (todo-count (todo-get-count 'todo cat))
 	     (done-count (todo-get-count 'done cat)))
 	;; Merge into goal todo category.
-	(with-current-buffer (get-buffer (find-file-noselect gfile))
+	(with-current-buffer (find-file-noselect gfile)
 	  (unless (derived-mode-p 'todo-mode) (todo-mode))
 	  (widen)
 	  (goto-char (point-min))
@@ -1677,7 +1677,7 @@ todo-merge-category
 	(mapc (lambda (m) (set-marker m nil))
 	      (list cbeg tbeg dbeg tend cend))))
     (when (> archived-count 0)
-      (with-current-buffer (get-buffer (find-file-noselect tarchive))
+      (with-current-buffer (find-file-noselect tarchive)
 	(widen)
 	(goto-char (point-min))
 	(let* ((inhibit-read-only t)
@@ -1697,7 +1697,7 @@ todo-merge-category
 			(forward-line)
 			(buffer-substring-no-properties (point) cend))))
 	  ;; Merge into goal archive category, if it exists, else create it.
-	  (with-current-buffer (get-buffer (find-file-noselect garchive))
+	  (with-current-buffer (find-file-noselect garchive)
 	    (let ((gbeg (when (re-search-forward
 			       (concat "^" (regexp-quote
 					    (concat todo-category-beg goal))
diff --git a/lisp/comint.el b/lisp/comint.el
index 655ff30469c..a8fe095e99c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3510,7 +3510,7 @@ comint-dynamic-list-completions
 
     ;; Read the next key, to process SPC.
     (let (key first)
-      (if (with-current-buffer (get-buffer "*Completions*")
+      (if (with-current-buffer "*Completions*"
 	    (setq-local comint-displayed-dynamic-completions
                         completions)
 	    (setq key (read-key-sequence nil)
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 02c11cae573..c22dfb2eb26 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -2794,7 +2794,7 @@ checkdoc-error
                     ": " msg)))
     (if (string= checkdoc-diagnostic-buffer "*warn*")
         (warn (apply #'concat text))
-      (with-current-buffer (get-buffer checkdoc-diagnostic-buffer)
+      (with-current-buffer checkdoc-diagnostic-buffer
           (let ((inhibit-read-only t)
                 (pt (point-max)))
             (goto-char pt)
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 506b73f6fa2..60d14d11970 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -200,7 +200,7 @@ debug
       (let (debugger-value
 	    (debugger-previous-state
              (if (get-buffer "*Backtrace*")
-                 (with-current-buffer (get-buffer "*Backtrace*")
+                 (with-current-buffer "*Backtrace*"
                    (debugger--save-buffer-state))))
             (debugger-args args)
 	    (debugger-buffer (get-buffer-create "*Backtrace*"))
@@ -651,7 +651,7 @@ debugger-record-expression
     (princ (debugger-eval-expression exp))
     (terpri))
 
-  (with-current-buffer (get-buffer debugger-record-buffer)
+  (with-current-buffer debugger-record-buffer
     (message "%s"
 	     (buffer-substring (line-beginning-position 0)
 			       (line-end-position 0)))))
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index 893f8cd7e7f..bf6be1690e4 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -50,7 +50,7 @@ eieio-browse
   (if (not root-class) (setq root-class 'eieio-default-superclass))
   (cl-check-type root-class class)
   (display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t)
-  (with-current-buffer (get-buffer "*EIEIO OBJECT BROWSE*")
+  (with-current-buffer "*EIEIO OBJECT BROWSE*"
     (erase-buffer)
     (goto-char 0)
     (eieio-browse-tree root-class "" "")
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 0a47cca0231..c5307f70d08 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -825,7 +825,7 @@ reb-rx-font-lock-keywords
 
 (defun reb-restart-font-lock ()
   "Restart `font-lock-mode' to fit current regexp format."
-  (with-current-buffer (get-buffer reb-buffer)
+  (with-current-buffer reb-buffer
     (let ((font-lock-is-on font-lock-mode))
       (font-lock-mode -1)
       (kill-local-variable 'font-lock-set-defaults)
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 522973a0156..b8e16df755b 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -619,7 +619,7 @@ erc-dcc-do-LIST-command
                            (buffer-live-p (get-buffer (plist-get elt :file)))
                            (plist-member elt :size))
                       (let ((byte-count (with-current-buffer
-                                            (get-buffer (plist-get elt :file))
+                                            (plist-get elt :file)
                                           (+ (buffer-size) 0.0
                                              erc-dcc-byte-count))))
                         (format " (%d%%)"
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 23028576f45..751f13cc715 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -789,7 +789,7 @@ eshell-poor-mans-grep
 		    (ignore-errors
 		      (occur (car args))))
 		  (if (get-buffer "*Occur*")
-		      (with-current-buffer (get-buffer "*Occur*")
+		      (with-current-buffer "*Occur*"
 			(setq string (buffer-string))
 			(kill-buffer (current-buffer)))))
 		(if string (insert string))
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index d562d052d82..71bfaa639fa 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4638,7 +4638,7 @@ gnus-add-mark
   "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
   (let ((buffer (gnus-summary-buffer-name group)))
     (if (gnus-buffer-live-p buffer)
-	(with-current-buffer (get-buffer buffer)
+	(with-current-buffer buffer
 	  (gnus-summary-add-mark article mark))
       (gnus-add-marked-articles group (cdr (assq mark gnus-article-mark-lists))
 				(list article)))))
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 2936bc8f099..54847bdf396 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2267,7 +2267,7 @@ eww-next-bookmark
       (setq first t)
       (eww-read-bookmarks t)
       (eww-bookmark-prepare))
-    (with-current-buffer (get-buffer "*eww bookmarks*")
+    (with-current-buffer "*eww bookmarks*"
       (when (and (not first)
 		 (not (eobp)))
 	(forward-line 1))
@@ -2286,7 +2286,7 @@ eww-previous-bookmark
       (setq first t)
       (eww-read-bookmarks t)
       (eww-bookmark-prepare))
-    (with-current-buffer (get-buffer "*eww bookmarks*")
+    (with-current-buffer "*eww bookmarks*"
       (if first
 	  (goto-char (point-max))
 	(beginning-of-line))
diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el
index fddc6e21bcc..a6ba556e7ae 100644
--- a/lisp/net/sieve.el
+++ b/lisp/net/sieve.el
@@ -354,7 +354,7 @@ sieve-upload
     (let ((script (buffer-string))
           (script-name (file-name-sans-extension (buffer-name)))
           err)
-      (with-current-buffer (get-buffer sieve-buffer)
+      (with-current-buffer sieve-buffer
 	(setq err (sieve-manage-putscript
                    (or name sieve-buffer-script-name script-name)
                    script sieve-manage-buffer))
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index a545a8e7273..d3af7a009ec 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -281,7 +281,7 @@ tramp-cleanup-some-buffers
   ;; Remove all buffers with a remote default-directory which fit the hook.
   (dolist (name (tramp-list-remote-buffers))
     (and (buffer-live-p (get-buffer name))
-	 (with-current-buffer (get-buffer name)
+	 (with-current-buffer name
 	   (run-hook-with-args-until-success 'tramp-cleanup-some-buffers-hook))
 	 (kill-buffer name))))
 
diff --git a/lisp/obsolete/quickurl.el b/lisp/obsolete/quickurl.el
index 7393bebdce1..7da51a8a4a8 100644
--- a/lisp/obsolete/quickurl.el
+++ b/lisp/obsolete/quickurl.el
@@ -447,7 +447,7 @@ quickurl-list
 
 (defun quickurl-list-populate-buffer ()
   "Populate the `quickurl-list' buffer."
-  (with-current-buffer (get-buffer quickurl-list-buffer-name)
+  (with-current-buffer quickurl-list-buffer-name
     (let* ((sizes (or (cl-loop for url in quickurl-urls
                                collect (length (quickurl-url-description url)))
                       (list 20)))
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index d335aab7499..f834f05cb6d 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -93,7 +93,7 @@ org-babel-execute:calc
      (mapcar #'org-trim
 	     (split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
   (save-excursion
-    (with-current-buffer (get-buffer "*Calculator*")
+    (with-current-buffer "*Calculator*"
       (prog1
           (calc-eval (calc-top 1))
         (calc-pop 1)))))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index f8195a053bc..06249ed48fa 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -3883,7 +3883,7 @@ org-agenda-use-sticky-p
    ;; buffer found
    (get-buffer org-agenda-buffer-name)
    ;; C-u parameter is same as last call
-   (with-current-buffer (get-buffer org-agenda-buffer-name)
+   (with-current-buffer org-agenda-buffer-name
      (and
       (equal current-prefix-arg
 	     org-agenda-last-prefix-arg)
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 196c5f159cd..0b34712a50c 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -1140,7 +1140,7 @@ pcomplete-show-completions
   (let (event)
     (prog1
         (catch 'done
-          (while (with-current-buffer (get-buffer "*Completions*")
+          (while (with-current-buffer "*Completions*"
                    (setq event (read-event)))
             (cond
              ((eq event ?\s)
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 29ff521253b..977a3d72cb7 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -493,7 +493,7 @@ bug-reference--try-setup-gnus-article
         ;; the values of the From, To, and Cc headers.
         (let (header-values)
           (with-current-buffer
-              (get-buffer gnus-original-article-buffer)
+              gnus-original-article-buffer
             (save-excursion
               (goto-char (point-min))
               ;; The Newsgroup is omitted because we already matched
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index 217b2ab6691..7bed69a738b 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -631,7 +631,7 @@ idlwave-highlight-linked-completions
 Those words in `idlwave-completion-help-links' have links.  The
 `idlwave-help-link' face is used for this."
   (if idlwave-highlight-help-links-in-completion
-      (with-current-buffer (get-buffer "*Completions*")
+      (with-current-buffer "*Completions*"
 	(save-excursion
 	  (let* ((case-fold-search t)
 		 (props (list 'face 'idlwave-help-link))
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 7af78f2229a..a83bad0e8ed 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -5803,7 +5803,7 @@ verilog-preprocess
 	 (dir (file-name-directory (or filename buffer-file-name)))
 	 (cmd (concat "cd " dir "; " command)))
     (with-output-to-temp-buffer "*Verilog-Preprocessed*"
-      (with-current-buffer (get-buffer "*Verilog-Preprocessed*")
+      (with-current-buffer "*Verilog-Preprocessed*"
 	(insert (concat "// " cmd "\n"))
 	(call-process shell-file-name nil t nil shell-command-switch cmd)
 	(verilog-mode)
diff --git a/lisp/replace.el b/lisp/replace.el
index 49e7c85c487..01a892bbba7 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1931,7 +1931,7 @@ occur-1
                    (lambda (boo)
                      (buffer-name (if (overlayp boo) (overlay-buffer boo) boo)))
                    active-bufs))
-      (with-current-buffer (get-buffer buf-name)
+      (with-current-buffer buf-name
 	(rename-uniquely)))
 
     ;; Now find or create the output buffer.
diff --git a/lisp/term.el b/lisp/term.el
index 2ce0c2b5e79..3a0ecc041ca 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -4342,7 +4342,7 @@ term-dynamic-list-completions
       (display-completion-list (sort completions 'string-lessp)))
     (message "Hit space to flush")
     (let (key first)
-      (if (with-current-buffer (get-buffer "*Completions*")
+      (if (with-current-buffer "*Completions*"
 	    (setq key (read-key-sequence nil)
 		  first (aref key 0))
 	    (and (consp first)
diff --git a/lisp/time.el b/lisp/time.el
index 9b932e945ba..a8d3ab9c813 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -611,7 +611,7 @@ world-clock-cancel-timer
 (defun world-clock-update (&optional _arg _noconfirm)
   "Update the `world-clock' buffer."
   (if (get-buffer world-clock-buffer-name)
-      (with-current-buffer (get-buffer world-clock-buffer-name)
+      (with-current-buffer world-clock-buffer-name
         (let ((op (point)))
           (world-clock-display (time--display-world-list))
           (goto-char op)))
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 0d27321cc47..ce6de2b3ee4 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -70,7 +70,7 @@ url-cache-prepare
 ;;;###autoload
 (defun url-store-in-cache (&optional buff)
   "Store buffer BUFF in the cache."
-    (with-current-buffer (get-buffer (or buff (current-buffer)))
+    (with-current-buffer (or buff (current-buffer))
       (let ((fname (url-cache-create-filename (url-view-url t))))
         (if (url-cache-prepare fname)
             (let ((coding-system-for-write 'binary))
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 52039f8da74..63b566b0afe 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -476,7 +476,7 @@ vc-cvs-merge
                  (concat "-j" first-revision)
                  (concat "-j" second-revision))
   (vc-file-setprop file 'vc-state 'edited)
-  (with-current-buffer (get-buffer "*vc*")
+  (with-current-buffer "*vc*"
     (goto-char (point-min))
     (if (re-search-forward "conflicts during merge" nil t)
 	(progn
@@ -495,7 +495,7 @@ vc-cvs-merge-news
   (vc-cvs-command nil nil file "update")
   ;; Analyze the merge result reported by CVS, and set
   ;; file properties accordingly.
-  (with-current-buffer (get-buffer "*vc*")
+  (with-current-buffer "*vc*"
     (goto-char (point-min))
     ;; get new working revision
     (if (re-search-forward
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 1a43b440d18..33377ce1cc8 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -1177,7 +1177,7 @@ vc-rcs-system-release
   (or vc-rcs-release
       (setq vc-rcs-release
 	    (or (and (zerop (vc-do-command "*vc*" nil "rcs" nil "-V"))
-		     (with-current-buffer (get-buffer "*vc*")
+		     (with-current-buffer "*vc*"
 		       (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1)))
 		'unknown))))
 
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 96baa642b44..ae281e54519 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -436,7 +436,7 @@ vc-svn-merge
 			(concat first-version ":" second-version)
 		      first-version))
   (vc-file-setprop file 'vc-state 'edited)
-  (with-current-buffer (get-buffer "*vc*")
+  (with-current-buffer "*vc*"
     (goto-char (point-min))
     (if (looking-at "C  ")
         1				; signal conflict
@@ -450,7 +450,7 @@ vc-svn-merge-news
   (vc-svn-command nil 0 file "update")
   ;; Analyze the merge result reported by SVN, and set
   ;; file properties accordingly.
-  (with-current-buffer (get-buffer "*vc*")
+  (with-current-buffer "*vc*"
     (goto-char (point-min))
     ;; get new working revision
     (if (re-search-forward
diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el
index 7d3af25ea49..39ad735a789 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -68,7 +68,7 @@ icalendar-tests--get-error-string-for-export
     (with-temp-buffer
       (insert diary-string)
       (icalendar-export-region (point-min) (point-max) file))
-    (with-current-buffer (get-buffer "*icalendar-errors*")
+    (with-current-buffer "*icalendar-errors*"
       (buffer-string))))
 
 ;; ======================================================================
diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el
index a2fb0392727..d4b5919a1cc 100644
--- a/test/lisp/erc/erc-dcc-tests.el
+++ b/test/lisp/erc/erc-dcc-tests.el
@@ -243,7 +243,7 @@ pcomplete/erc-mode/DCC--get-1flag
      (delete-region (point) (point-max))
      (insert "/dcc get -")
      (call-interactively #'completion-at-point)
-     (with-current-buffer (get-buffer "*Completions*")
+     (with-current-buffer "*Completions*"
        (goto-char (point-min))
        (search-forward "-s")
        (search-forward "-t"))
@@ -264,7 +264,7 @@ pcomplete/erc-mode/DCC--get-2flags
      (delete-region (point) (point-max))
      (insert "/dcc get -")
      (call-interactively #'completion-at-point)
-     (with-current-buffer (get-buffer "*Completions*")
+     (with-current-buffer "*Completions*"
        (goto-char (point-min))
        (search-forward "-s")
        (search-forward "-t"))
@@ -289,7 +289,7 @@ pcomplete/erc-mode/DCC--get-2flags-reverse
      (delete-region (point) (point-max))
      (insert "/dcc get -")
      (call-interactively #'completion-at-point)
-     (with-current-buffer (get-buffer "*Completions*")
+     (with-current-buffer "*Completions*"
        (goto-char (point-min))
        (search-forward "-s")
        (search-forward "-t"))
diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el
index 90b8aa99741..0d8861f2167 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -1349,7 +1349,7 @@ erc-networks--rename-server-buffer--existing--noreuse
         (should-not
          (erc-server-process-alive
           (should (get-buffer "#chan/irc.foonet.org"))))
-        (with-current-buffer (get-buffer "#chan/irc.foonet.org")
+        (with-current-buffer "#chan/irc.foonet.org"
           (should-not erc-server-connected)
           (should (eq erc-server-process old-proc))
           (erc-with-server-buffer
diff --git a/test/lisp/erc/erc-scenarios-services-misc.el b/test/lisp/erc/erc-scenarios-services-misc.el
index ab4a97c5724..47d0bcff41a 100644
--- a/test/lisp/erc/erc-scenarios-services-misc.el
+++ b/test/lisp/erc/erc-scenarios-services-misc.el
@@ -186,7 +186,7 @@ erc-scenarios-services-misc--reconnect-retry-nick
         (funcall expect 10 "Last login from")
         (funcall expect 10 "Your new nickname is tester")))
 
-    (with-current-buffer (get-buffer "#test")
+    (with-current-buffer "#test"
       (funcall expect 10 "tester ")
       (funcall expect 10 "was created on"))))
 
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 6809d9db41d..3e8ddef3731 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -382,7 +382,7 @@ erc--refresh-prompt
           (should-not (search-forward (rx (or "9" "10") ">") nil t)))))
 
     (ert-info ("Query buffer")
-      (with-current-buffer (get-buffer "bob")
+      (with-current-buffer "bob"
         (goto-char erc-insert-marker)
         (should (looking-at-p "bob@ServNet 14>"))
         (goto-char erc-input-marker)
-- 
2.44.0




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ;  Simplify (with-current-buffer (get-buffer …) …)
  2024-03-12  0:21 [PATCH] ; Simplify (with-current-buffer (get-buffer …) …) Tim Landscheidt
@ 2024-03-14 10:42 ` Eli Zaretskii
  2024-03-15  9:16   ` UTF-8 characters in commit messages (was: [PATCH] ; Simplify (with-current-buffer (get-buffer …) …)) Tim Landscheidt
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-03-14 10:42 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: emacs-devel

> From: Tim Landscheidt <tim@tim-landscheidt.de>
> Date: Tue, 12 Mar 2024 00:21:06 +0000
> 
> * lisp/calendar/todo-mode.el (todo-merge-category):
> * lisp/comint.el (comint-dynamic-list-completions):
> * lisp/emacs-lisp/checkdoc.el (checkdoc-error):
> * lisp/emacs-lisp/debug.el (debug, debugger-record-expression):
> * lisp/emacs-lisp/eieio-opt.el (eieio-browse):
> * lisp/emacs-lisp/re-builder.el (reb-restart-font-lock):
> * lisp/erc/erc-dcc.el (erc-dcc-do-LIST-command):
> * lisp/eshell/em-unix.el (eshell-poor-mans-grep):
> * lisp/gnus/gnus-group.el (gnus-add-mark):
> * lisp/net/eww.el (eww-next-bookmark, eww-previous-bookmark):
> * lisp/net/sieve.el (sieve-upload):
> * lisp/net/tramp-cmds.el (tramp-cleanup-some-buffers):
> * lisp/obsolete/quickurl.el (quickurl-list-populate-buffer):
> * lisp/org/ob-calc.el: (org-babel-execute:calc):
> * lisp/org/org-agenda.el (org-agenda-use-sticky-p):
> * lisp/pcomplete.el (pcomplete-show-completions):
> * lisp/progmodes/bug-reference.el
> (bug-reference--try-setup-gnus-article):
> * lisp/progmodes/idlw-help.el
> (idlwave-highlight-linked-completions):
> * lisp/progmodes/verilog-mode.el (verilog-preprocess):
> * lisp/replace.el (occur-1):
> * lisp/term.el (term-dynamic-list-completions):
> * lisp/time.el (world-clock-update):
> * lisp/url/url-cache.el (url-store-in-cache):
> * lisp/vc/vc-cvs.el (vc-cvs-merge, vc-cvs-merge-news):
> * lisp/vc/vc-rcs.el (vc-rcs-system-release):
> * lisp/vc/vc-svn.el (vc-svn-merge, vc-svn-merge-news):
> * test/lisp/calendar/icalendar-tests.el
> (icalendar-tests--get-error-string-for-export):
> * test/lisp/erc/erc-dcc-tests.el
> (pcomplete/erc-mode/DCC--get-1flag)
> (pcomplete/erc-mode/DCC--get-2flags)
> (pcomplete/erc-mode/DCC--get-2flags-reverse):
> * test/lisp/erc/erc-networks-tests.el
> (erc-networks--rename-server-buffer--existing--noreuse):
> * test/lisp/erc/erc-scenarios-services-misc.el
> (erc-scenarios-services-misc--reconnect-retry-nick):
> * test/lisp/erc/erc-tests.el (erc--refresh-prompt):
> Replace (with-current-buffer (get-buffer …) …) with
> (with-current-buffer … …).

Thanks, I installed this on master.

For the future, please avoid using non-ASCII characters in commit log
messages.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* UTF-8 characters in commit messages (was: [PATCH] ;  Simplify (with-current-buffer (get-buffer …) …))
  2024-03-14 10:42 ` Eli Zaretskii
@ 2024-03-15  9:16   ` Tim Landscheidt
  2024-03-15 11:32     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2024-03-15  9:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> wrote:

> […]

> For the future, please avoid using non-ASCII characters in commit log
> messages.

I had only looked at CONTRIBUTE's:

| - Commit messages should contain only printable UTF-8 characters.

Further down, the test commit-msg performs is described as:

| - commit log message should include only valid printable ASCII and
|   UTF-8 characters;

The GNU Coding Standards are a bit more explicit about this:

| Sticking to the ASCII character set (plain text, 7-bit
| characters) is preferred in GNU source code comments, text
| documents, and other contexts, unless there is good reason
| to do something else because of the application domain.  For
| example, if source code deals with the French Revolutionary
| calendar, it is OK if its literal strings contain accented
| characters in month names like “Floréal”.  Also, it is OK
| (but not required) to use non-ASCII characters to represent
| proper names of contributors in change logs (see Change
| Logs).

Perhaps the first line quoted above could be rephrased à la:

| - Commit messages should contain only valid printable ASCII
|   characters.  If necessary, they may contain printable
|   UTF-8 characters.

Tim



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UTF-8 characters in commit messages (was: [PATCH] ;  Simplify (with-current-buffer (get-buffer …) …))
  2024-03-15  9:16   ` UTF-8 characters in commit messages (was: [PATCH] ; Simplify (with-current-buffer (get-buffer …) …)) Tim Landscheidt
@ 2024-03-15 11:32     ` Eli Zaretskii
  2024-03-15 12:43       ` UTF-8 characters in commit messages Tim Landscheidt
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-03-15 11:32 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: emacs-devel

> From: Tim Landscheidt <tim@tim-landscheidt.de>
> Cc: emacs-devel@gnu.org
> Date: Fri, 15 Mar 2024 09:16:34 +0000
> 
> Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > […]
> 
> > For the future, please avoid using non-ASCII characters in commit log
> > messages.
> 
> I had only looked at CONTRIBUTE's:
> 
> | - Commit messages should contain only printable UTF-8 characters.
> 
> Further down, the test commit-msg performs is described as:
> 
> | - commit log message should include only valid printable ASCII and
> |   UTF-8 characters;

That's not a contradiction: ASCII characters are by definition valid
UTF-8 characters.

> The GNU Coding Standards are a bit more explicit about this:
> 
> | Sticking to the ASCII character set (plain text, 7-bit
> | characters) is preferred in GNU source code comments, text
> | documents, and other contexts, unless there is good reason
> | to do something else because of the application domain.  For
> | example, if source code deals with the French Revolutionary
> | calendar, it is OK if its literal strings contain accented
> | characters in month names like “Floréal”.  Also, it is OK
> | (but not required) to use non-ASCII characters to represent
> | proper names of contributors in change logs (see Change
> | Logs).
> 
> Perhaps the first line quoted above could be rephrased à la:
> 
> | - Commit messages should contain only valid printable ASCII
> |   characters.  If necessary, they may contain printable
> |   UTF-8 characters.

IMNSHO, this is simple and obvious rule: don't use non-ASCII unless
you must.  But since people insist on having every possible rule
explicitly codified, I've now modified CONTRIBUTE to say:

  - Commit messages should contain only printable UTF-8 characters.
    However, we ask that non-ASCII characters be used only if strictly
    necessary, not just for aesthetic purposes.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UTF-8 characters in commit messages
  2024-03-15 11:32     ` Eli Zaretskii
@ 2024-03-15 12:43       ` Tim Landscheidt
  2024-03-19  2:02         ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2024-03-15 12:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> wrote:

> […]

>> The GNU Coding Standards are a bit more explicit about this:

>> | Sticking to the ASCII character set (plain text, 7-bit
>> | characters) is preferred in GNU source code comments, text
>> | documents, and other contexts, unless there is good reason
>> | to do something else because of the application domain.  For
>> | example, if source code deals with the French Revolutionary
>> | calendar, it is OK if its literal strings contain accented
>> | characters in month names like “Floréal”.  Also, it is OK
>> | (but not required) to use non-ASCII characters to represent
>> | proper names of contributors in change logs (see Change
>> | Logs).

>> Perhaps the first line quoted above could be rephrased à la:

>> | - Commit messages should contain only valid printable ASCII
>> |   characters.  If necessary, they may contain printable
>> |   UTF-8 characters.

> IMNSHO, this is simple and obvious rule: don't use non-ASCII unless
> you must.

Sure, but CONTRIBUTE on the other hand implies that the GNU
Coding Standards recommend to use ‘’ for quoting:

| - Emacs follows the GNU coding standards for ChangeLog entries: see
|   https://www.gnu.org/prep/standards/html_node/Change-Logs.html or run
|   'info "(standards)Change Logs"'.  One exception is that commits
|   still sometimes quote `like-this' (as the standards used to
|   recommend) rather than 'like-this' or ‘like this’ (as they do now),
|   as `...' is so widely used elsewhere in Emacs.

This does not seem to be backed up by the latter itself,
though
(https://www.gnu.org/prep/standards/standards.html#Quote-Characters,
CMII missed another section in regard to this topic):

| In the C locale, the output of GNU programs should stick to
| plain ASCII for quotation characters in messages to users:
| preferably 0x22 (‘"’) or 0x27 (‘'’) for both opening and
| closing quotes.  Although GNU programs traditionally used
| 0x60 (‘`’) for opening and 0x27 (‘'’) for closing quotes,
| nowadays quotes ‘`like this'’ are typically rendered
| asymmetrically, so quoting ‘"like this"’ or ‘'like this'’
| typically looks better.

However, typographic quotation marks are widely used
throughout Emacs's source code and change logs.

>            But since people insist on having every possible rule
> explicitly codified, I've now modified CONTRIBUTE to say:

>   - Commit messages should contain only printable UTF-8 characters.
>     However, we ask that non-ASCII characters be used only if strictly
>     necessary, not just for aesthetic purposes.

Thanks!

Tim



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UTF-8 characters in commit messages
  2024-03-15 12:43       ` UTF-8 characters in commit messages Tim Landscheidt
@ 2024-03-19  2:02         ` Richard Stallman
  2024-03-19  2:26           ` Collin Funk
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2024-03-19  2:02 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: eliz, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > However, typographic quotation marks are widely used

Could you explain which characters you mean by "typographic quotation
marks"?
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: UTF-8 characters in commit messages
  2024-03-19  2:02         ` Richard Stallman
@ 2024-03-19  2:26           ` Collin Funk
  0 siblings, 0 replies; 7+ messages in thread
From: Collin Funk @ 2024-03-19  2:26 UTC (permalink / raw)
  To: emacs-devel

On 3/18/24 7:02 PM, Richard Stallman wrote:
> Could you explain which characters you mean by "typographic quotation
> marks"?

I think he is referencing Unicode quotes which are angled to
differentiate between closing and opening brackets.

As an interesting expirement in Emacs:
# U+2018 LEFT SINGLE QUOTATION MARK
$ find . -name 'ChangeLog*' | xargs grep ‘ | wc -l
705
# U+2019 RIGHT SINGLE QUOTATION MARK
$ find . -name 'ChangeLog*' | xargs grep ’ | wc -l
1599
# U+201C LEFT DOUBLE QUOTATION MARK
find . -name 'ChangeLog*' | xargs grep “ | wc -l
119
# U+201D RIGHT DOUBLE QUOTATION MARK
$ find . -name 'ChangeLog*' | xargs grep ” | wc -l
119

Collin



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-19  2:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  0:21 [PATCH] ; Simplify (with-current-buffer (get-buffer …) …) Tim Landscheidt
2024-03-14 10:42 ` Eli Zaretskii
2024-03-15  9:16   ` UTF-8 characters in commit messages (was: [PATCH] ; Simplify (with-current-buffer (get-buffer …) …)) Tim Landscheidt
2024-03-15 11:32     ` Eli Zaretskii
2024-03-15 12:43       ` UTF-8 characters in commit messages Tim Landscheidt
2024-03-19  2:02         ` Richard Stallman
2024-03-19  2:26           ` Collin Funk

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).