]> git.eshelyaron.com Git - emacs.git/commitdiff
; Simplify (with-current-buffer (get-buffer ...) ...)
authorTim Landscheidt <tim@tim-landscheidt.de>
Tue, 12 Mar 2024 00:21:06 +0000 (00:21 +0000)
committerEshel Yaron <me@eshelyaron.com>
Fri, 15 Mar 2024 09:04:21 +0000 (10:04 +0100)
There's no need to call 'get-buffer', since 'with-current-buffer'
does that internally.
* 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 ...).

(cherry picked from commit 6d1c1fca0aa7c5a1ff0254af3f89a34d5309ea0d)

31 files changed:
lisp/calendar/todo-mode.el
lisp/comint.el
lisp/emacs-lisp/checkdoc.el
lisp/emacs-lisp/debug.el
lisp/emacs-lisp/eieio-opt.el
lisp/emacs-lisp/re-builder.el
lisp/erc/erc-dcc.el
lisp/eshell/em-unix.el
lisp/gnus/gnus-group.el
lisp/net/eww.el
lisp/net/sieve.el
lisp/net/tramp-cmds.el
lisp/obsolete/quickurl.el
lisp/org/ob-calc.el
lisp/org/org-agenda.el
lisp/pcomplete.el
lisp/progmodes/bug-reference.el
lisp/progmodes/idlw-help.el
lisp/progmodes/verilog-mode.el
lisp/replace.el
lisp/term.el
lisp/time.el
lisp/url/url-cache.el
lisp/vc/vc-cvs.el
lisp/vc/vc-rcs.el
lisp/vc/vc-svn.el
test/lisp/calendar/icalendar-tests.el
test/lisp/erc/erc-dcc-tests.el
test/lisp/erc/erc-networks-tests.el
test/lisp/erc/erc-scenarios-services-misc.el
test/lisp/erc/erc-tests.el

index f2ee94ec8f758224721b67afb93b1c46a75749d7..12287299a7fbbc8e3114002647c0b8e82d94fe93 100644 (file)
@@ -1612,7 +1612,7 @@ archive file and the source category is deleted."
         (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 @@ archive file and the source category is deleted."
             (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 @@ archive file and the source category is deleted."
        (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 @@ archive file and the source category is deleted."
                        (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))
index 655ff30469c23563bae87cf9348fd65762316584..a8fe095e99c4376ea7875e9ccd35ff884010da1c 100644 (file)
@@ -3510,7 +3510,7 @@ the 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)
index 02c11cae57378b2408d8e2398fcdf51b4d9e03cc..c22dfb2eb26d1dbbb52ef5ff09ca959928191554 100644 (file)
@@ -2794,7 +2794,7 @@ function called to create the messages."
                     ": " 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)
index 506b73f6fa2c77187dd4ad1c67574b7a6de95f22..60d14d11970ff5777696a6bc7d576a366e29742f 100644 (file)
@@ -200,7 +200,7 @@ the debugger will not be entered."
       (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 @@ Complete list of commands:
     (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)))))
index 893f8cd7e7fa91a7f1ea7ad2fc47650ada64955c..bf6be1690e425390ebaae3708c8f2bda3fcadb09 100644 (file)
@@ -50,7 +50,7 @@ variable `eieio-default-superclass'."
   (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 "" "")
index 0a47cca02317c4fdb2ba430a268d20d9ea0f83f6..c5307f70d08cc981e53eebef4fec76aac6b3e4d2 100644 (file)
@@ -825,7 +825,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."
 
 (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)
index 522973a0156e53411573cf16d63f6515bbf44844..b8e16df755bda9a095f91e8015e8bd726bcd2e9c 100644 (file)
@@ -619,7 +619,7 @@ It lists the current state of `erc-dcc-list' in an easy to read manner."
                            (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%%)"
index 23028576f4591269381083922d2674471ad18e45..751f13cc715f562a21b7943ca92e92d80a369ea9 100644 (file)
@@ -789,7 +789,7 @@ available..."
                    (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))
index d562d052d8269195ef135d048458f0bae480a068..71bfaa639fac2515cf549922e88ad69fa0fb51a5 100644 (file)
@@ -4638,7 +4638,7 @@ and the second element is the address."
   "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)))))
index 2936bc8f0997eac6ef01beee82f7b064c3c4e817..54847bdf3961c15714edba7d9f2e11821e18d26c 100644 (file)
@@ -2267,7 +2267,7 @@ If ERROR-OUT, signal user-error if there are no bookmarks."
       (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 @@ If ERROR-OUT, signal user-error if there are no bookmarks."
       (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))
index fddc6e21bcc4bd142d39b4bba815679f2bdad4a8..a6ba556e7aeeb1195667dfa0d2ee6158534652f0 100644 (file)
@@ -354,7 +354,7 @@ Used to bracket operations which move point in the sieve-buffer."
     (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))
index a545a8e72730120a4b267d901536d9027b310b19..d3af7a009eccff4b94a31468488f7694cb8ae2d5 100644 (file)
@@ -281,7 +281,7 @@ non-nil."
   ;; 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))))
 
index 7393bebdce12d1af532733643744f436e12387b1..7da51a8a4a88d29bb288dc346195b19795802ba2 100644 (file)
@@ -447,7 +447,7 @@ The key bindings for `quickurl-list-mode' are:
 
 (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)))
index d335aab7499c22ddc6b5be58c416bb84d51b1f61..f834f05cb6d467769344eb9cda842166caa3bdd8 100644 (file)
@@ -93,7 +93,7 @@
      (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)))))
index f8195a053bcb4ecb25f5fe933a3f2b288f8a2ed4..06249ed48fa9be984beab027741b6fc2a7db0b50 100644 (file)
@@ -3883,7 +3883,7 @@ generating a new one."
    ;; 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)
index 8b435f64ba485948d3e16cbe91741ed72e172732..a22d3d85806c6d653307d618576b71027ca9ce65 100644 (file)
@@ -1139,7 +1139,7 @@ Typing SPC flushes the help buffer."
   (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)
index 29ff521253b24895e893e71b9a7649b92408c2c3..977a3d72cb79a7c9f668aa6d077036cc707aa199 100644 (file)
@@ -493,7 +493,7 @@ and set it if applicable."
         ;; 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
index 217b2ab669140bf1965ebdbd0d04ca42adc3418f..7bed69a738b8fae4085cbe600a1bf6b07f70f900 100644 (file)
@@ -631,7 +631,7 @@ Needs additional info stored in global `idlwave-completion-help-info'."
 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))
index 7af78f2229a230b53e682dd4d5fa170dbe803f24..a83bad0e8ed3f423254ceea03aaf94f1aedcee26 100644 (file)
@@ -5803,7 +5803,7 @@ FILENAME to find directory to run in, or defaults to `buffer-file-name'."
         (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)
index 0b4b7cb915f9de4324cae34fb6881b8a863184db..ce18f6269edc08121b2777955220f0b52fcf8060 100644 (file)
@@ -1933,7 +1933,7 @@ See also `multi-occur'."
                    (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.
index 2ce0c2b5e7993104848cc35a5b28c65d528af11c..3a0ecc041cac76378a73319c04e36b4b1bd6c991 100644 (file)
@@ -4342,7 +4342,7 @@ Typing SPC flushes the help buffer."
       (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)
index 9b932e945baa29dd6bd70b25e4ed74876a869edc..a8d3ab9c813e4f26381b7ee8d9dee935faf12d04 100644 (file)
@@ -611,7 +611,7 @@ To turn off the world time display, go to the window and type \\[quit-window]."
 (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)))
index 0d27321cc47957d38a9ab949e1e3b90e69854398..ce6de2b3ee4554b7a88f757590978346b2d19ca9 100644 (file)
@@ -70,7 +70,7 @@ FILE can be created or overwritten."
 ;;;###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))
index 52039f8da74985795dfe5f4b5b0bea88887359e6..63b566b0afecb544c803714d760cac8a096bb017 100644 (file)
@@ -476,7 +476,7 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
                  (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 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
   (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
index 1a43b440d185557208abe5f9b8c11e267d464132..33377ce1cc851e1c72ec28e1caa3a6d11f2c129e 100644 (file)
@@ -1177,7 +1177,7 @@ variable `vc-rcs-release' is set to the returned value."
   (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))))
 
index 96baa642b44088ed698ecd2e50e85453d456dec6..ae281e54519d548d01401aed97b4cbc9f58d4edb 100644 (file)
@@ -436,7 +436,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
                        (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 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
   (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
index 7d3af25ea4928a88d50c265b5819727087c753af..39ad735a7897f8c2953183415ee50614906e14a6 100644 (file)
@@ -68,7 +68,7 @@
     (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))))
 
 ;; ======================================================================
index a2fb039272785733accf15ebe9f0936eb5c2bb34..d4b5919a1ccf0e666560bb757c730c42fc94d8ae 100644 (file)
      (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"))
      (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"))
      (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"))
index 90b8aa99741fb5c72381683c601657bc45d68350..0d8861f216789c855f11abee02454499a6d25544 100644 (file)
         (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
index ab4a97c5724d4de7a9e4fcf230eaef45cfd4e9db..47d0bcff41a7bd826e68f0ed66a583d7b5f9bde3 100644 (file)
         (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"))))
 
index 6809d9db41deeff7a772638808d72dcd6f95b8ed..3e8ddef3731748465855259fd05fe517de4bf681 100644 (file)
           (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)