mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
; Simplify (with-current-buffer (get-buffer ...) ...)
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 ...).
This commit is contained in:
parent
3807f380b3
commit
6d1c1fca0a
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)))))
|
||||
|
@ -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 "" "")
|
||||
|
@ -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)
|
||||
|
@ -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%%)"
|
||||
|
@ -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))
|
||||
|
@ -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)))))
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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))))
|
||||
|
||||
|
@ -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)))
|
||||
|
@ -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)))))
|
||||
|
@ -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)
|
||||
|
@ -1140,7 +1140,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)
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -1931,7 +1931,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.
|
||||
|
@ -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)
|
||||
|
@ -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)))
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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))))
|
||||
|
||||
|
@ -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
|
||||
|
@ -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))))
|
||||
|
||||
;; ======================================================================
|
||||
|
@ -243,7 +243,7 @@
|
||||
(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 @@
|
||||
(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 @@
|
||||
(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"))
|
||||
|
@ -1349,7 +1349,7 @@
|
||||
(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
|
||||
|
@ -186,7 +186,7 @@
|
||||
(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"))))
|
||||
|
||||
|
@ -382,7 +382,7 @@
|
||||
(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)
|
||||
|
Loading…
Reference in New Issue
Block a user