diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-11-29 12:26:31 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-11-29 12:26:31 -0500 |
commit | b1a69505843c593a3a757a614dea16e2a7185579 (patch) | |
tree | 043919f98b2980e39924c5a52858da57f8cbb7bf /lisp/gnus/gnus-start.el | |
parent | 7fff418edf56244a1fcf54718523aa9b5cb3a854 (diff) | |
download | emacs-b1a69505843c593a3a757a614dea16e2a7185579.tar.gz |
* lisp/gnus/gnus.el (gnus-info): Define with `cl-defstruct`
This makes the accessors into (inlined) functions (instead of macros),
which simplifies some uses, and it makes the gnus-info-set-<foo>
macros redundant since we can use `setf` instead. Remove them and
update all users.
(gnus-info-group, gnus-info-rank, gnus-info-read, gnus-info-marks)
(gnus-info-method, gnus-info-params): Auto-defined by defstruct.
(gnus-info-level, gnus-info-score): Define as a function. Add gv-setter.
(gnus-info-set-group, gnus-info-set-rank, gnus-info-set-read): Remove,
use `setf` instead.
(gnus-info-set-marks, gnus-info-set-method, gnus-info-set-params):
Define as a function.
(gnus-info-set-entry): Delete function.
(gnus-info--grow-entry): New function, extracted from it.
(gnus-info--set-level, gnus-info--set-score): New functions, extracted
from the `gnus-info-set-level` and `gnus-info-set-score` which they replace.
(gnus-get-info): Define as a function.
* lisp/gnus/gnus-group.el (gnus-group-edit-group-done):
Use the `extend` arg of `gnus-info-set-method`.
(gnus-group-sort-selected-flat): eta-reduce.
Diffstat (limited to 'lisp/gnus/gnus-start.el')
-rw-r--r-- | lisp/gnus/gnus-start.el | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index e142c438ee0..b90229e6f57 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1828,7 +1828,7 @@ The info element is shared with the same element of ;; Make the same select-methods identical Lisp objects. (when (setq method (gnus-info-method info)) (if (setq rest (member method methods)) - (gnus-info-set-method info (car rest)) + (setf (gnus-info-method info) (car rest)) (push method methods))) ;; Check for encoded group names and decode them. (when (string-match-p "[^[:ascii:]]" (setq gname (car info))) @@ -1890,8 +1890,8 @@ The info element is shared with the same element of (push article news))) (when news ;; Enter this list into the group info. - (gnus-info-set-read - info (gnus-remove-from-range (gnus-info-read info) (nreverse news))) + (setf (gnus-info-read info) + (gnus-remove-from-range (gnus-info-read info) (nreverse news))) ;; Set the number of unread articles in gnus-newsrc-hashtb. (gnus-get-unread-articles-in-group info (gnus-active group)) @@ -1958,7 +1958,7 @@ The info element is shared with the same element of (when (eq modified 'remove-null) (setq r (delq nil r))) ;; Enter this list into the group info. - (gnus-info-set-read info r) + (setf (gnus-info-read info) r) ;; Set the number of unread articles in gnus-newsrc-hashtb. (gnus-get-unread-articles-in-group info (gnus-active group)) @@ -2362,12 +2362,11 @@ If FORCE is non-nil, the .newsrc file is read." (setq dormant (cdr (assq 'dormant marks)) ticked (cdr (assq 'tick marks))) (when (or dormant ticked) - (gnus-info-set-read - info - (gnus-add-to-range - (gnus-info-read info) - (nconc (gnus-uncompress-range dormant) - (gnus-uncompress-range ticked))))))))) + (setf (gnus-info-read info) + (gnus-add-to-range + (gnus-info-read info) + (nconc (gnus-uncompress-range dormant) + (gnus-uncompress-range ticked))))))))) (defun gnus-load (file) "Load FILE, but in such a way that read errors can be reported." @@ -2438,9 +2437,9 @@ If FORCE is non-nil, the .newsrc file is read." (while (setq group (pop newsrc)) (if (setq info (gnus-get-info (car group))) (progn - (gnus-info-set-read info (cddr group)) - (gnus-info-set-level - info (if (nth 1 group) gnus-level-default-subscribed + (setf (gnus-info-read info) (cddr group)) + (setf (gnus-info-level info) + (if (nth 1 group) gnus-level-default-subscribed gnus-level-default-unsubscribed)) (push info gnus-newsrc-alist)) (push (setq info @@ -2453,9 +2452,9 @@ If FORCE is non-nil, the .newsrc file is read." (when (setq m (assoc (car group) marked)) (unless (nthcdr 3 info) (nconc info (list nil))) - (gnus-info-set-marks - info (list (cons 'tick (gnus-compress-sequence - (sort (cdr m) '<) t)))))) + (setf (gnus-info-marks info) + (list (cons 'tick (gnus-compress-sequence + (sort (cdr m) #'<) t)))))) (setq newsrc killed) (while newsrc (setcar newsrc (caar newsrc)) @@ -2609,7 +2608,7 @@ If FORCE is non-nil, the .newsrc file is read." ;; There is an entry for this file in ;; `gnus-newsrc-hashtb'. (progn - (gnus-info-set-read info (nreverse reads)) + (setf (gnus-info-read info) (nreverse reads)) ;; We update the level very gently. In fact, we ;; only change it if there's been a status change ;; from subscribed to unsubscribed, or vice versa. @@ -2621,7 +2620,7 @@ If FORCE is non-nil, the .newsrc file is read." (1+ gnus-level-default-unsubscribed)))) ((and (> level gnus-level-subscribed) subscribed) (setq level gnus-level-default-subscribed))) - (gnus-info-set-level info level)) + (setf (gnus-info-level info) level)) ;; This is a new group. (setq info (list group (if subscribed |