summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-util.el
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2019-05-05 01:28:57 +0100
committerBasil L. Contovounesios <contovob@tcd.ie>2019-05-30 02:56:28 +0100
commitceca1740ea2c9bc98da8c11765b78c696b27c79e (patch)
tree8f878809e34325af181edac66385307345c3ef03 /lisp/gnus/gnus-util.el
parent46a176169b9050a5e6d97b11f265bd58b4b5eb05 (diff)
downloademacs-ceca1740ea2c9bc98da8c11765b78c696b27c79e.tar.gz
Simplify Gnus buffer liveness checking and killing
* lisp/gnus/gnus-agent.el (gnus-agent-synchronize-group-flags): Fix indentation. * lisp/gnus/gnus-util.el (gnus-buffer-exists-p): Define as obsolete alias of gnus-buffer-live-p. (gnus-buffer-live-p): If the given argument is or names a live buffer, return the corresponding buffer object instead of a boolean. * lisp/gnus/gnus-win.el (gnus-delete-windows-in-gnusey-frames) (gnus-remove-some-windows): Simplify. * lisp/gnus/gnus.el (gnus-prune-buffers): Redefine as alias of gnus-buffers. (gnus-kill-buffer, gnus-buffers, gnus-group-find-parameter): * lisp/gnus/gnus-art.el (gnus-kill-sticky-article-buffers) (gnus-request-article-this-buffer): * lisp/gnus/gnus-bcklg.el (gnus-backlog-shutdown): * lisp/gnus/gnus-cus.el (gnus-group-customize) (gnus-agent-customize-category): * lisp/gnus/gnus-draft.el (gnus-draft-edit-message): * lisp/gnus/gnus-group.el (gnus-group-set-mode-line) (gnus--abort-on-unsaved-message-buffers, gnus-group-compact-group): * lisp/gnus/gnus-msg.el (gnus-inews-add-send-actions) (gnus-summary-supersede-article, gnus-copy-article-buffer): * lisp/gnus/gnus-score.el (gnus-score-edit-current-scores) (gnus-score-edit-file): * lisp/gnus/gnus-spec.el (gnus-update-format-specifications): * lisp/gnus/gnus-srvr.el (gnus-server-compact-server): * lisp/gnus/gnus-start.el (gnus-clear-system, gnus-dribble-enter) (gnus-dribble-save, gnus-dribble-clear, gnus-save-newsrc-file): * lisp/gnus/gnus-sum.el (gnus-summary-setup-buffer) (gnus-update-summary-mark-positions, gnus-summary-exit) (gnus-deaden-summary, gnus-kill-or-deaden-summary) (gnus-summary-next-group): * lisp/gnus/gnus-win.el (gnus-configure-frame): * lisp/gnus/mail-source.el (mail-source-movemail): * lisp/gnus/message.el (message-with-reply-buffer) (message-with-reply, message-send-and-exit) (message-send-mail-with-sendmail, message-pop-to-buffer) (message-do-send-housekeeping, message-forward-make-body-plain) (message-forward-make-body-mml): * lisp/gnus/mm-decode.el (mm-display-external, mm-remove-part): * lisp/gnus/nnbabyl.el (nnbabyl-server-opened) (nnbabyl-possibly-change-newsgroup, nnbabyl-read-mbox) (nnbabyl-check-mbox): * lisp/gnus/nndiary.el (nndiary-save-nov): * lisp/gnus/nndoc.el (nndoc-close-group) (nndoc-possibly-change-buffer): * lisp/gnus/nnfolder.el (nnfolder-close-group, nnfolder-save-nov): * lisp/gnus/nnimap.el (nnimap-make-process-buffer, nnimap-keepalive) (nnimap-find-connection): * lisp/gnus/nnmail.el (nnmail-cache-open, nnmail-cache-close): * lisp/gnus/nnmbox.el (nnmbox-close-server, nnmbox-server-opened) (nnmbox-possibly-change-newsgroup, nnmbox-read-mbox): * lisp/gnus/nnml.el (nnml-save-incremental-nov, nnml-open-nov) (nnml-save-nov): * lisp/gnus/nnoo.el (nnoo-server-opened): * lisp/gnus/nntp.el (nntp-kill-buffer, nntp-make-process-buffer) (nntp-open-connection, nntp-async-trigger): * lisp/net/mairix.el (mairix-gnus-fetch-field): Simplify buffer liveness checking and killing, replacing buffer-name with buffer-live-p and gnus-buffer-exists-p with gnus-buffer-live-p or equivalent where applicable.
Diffstat (limited to 'lisp/gnus/gnus-util.el')
-rw-r--r--lisp/gnus/gnus-util.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index e4bc9b900c2..31421cc7555 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -109,12 +109,6 @@ This is a compatibility function for different Emacsen."
(defsubst gnus-goto-char (point)
(and point (goto-char point)))
-(defmacro gnus-buffer-exists-p (buffer)
- `(let ((buffer ,buffer))
- (when buffer
- (funcall (if (stringp buffer) 'get-buffer 'buffer-name)
- buffer))))
-
(defun gnus-delete-first (elt list)
"Delete by side effect the first occurrence of ELT as a member of LIST."
(if (equal (car list) elt)
@@ -562,8 +556,12 @@ If N, return the Nth ancestor instead."
(match-string 1 references))))))
(defsubst gnus-buffer-live-p (buffer)
- "Say whether BUFFER is alive or not."
- (and buffer (buffer-live-p (get-buffer buffer))))
+ "If BUFFER names a live buffer, return its object; else nil."
+ (and buffer (buffer-live-p (setq buffer (get-buffer buffer)))
+ buffer))
+
+(define-obsolete-function-alias 'gnus-buffer-exists-p
+ 'gnus-buffer-live-p "27.1")
(defun gnus-horizontal-recenter ()
"Recenter the current buffer horizontally."