aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-04-08 15:43:26 -0400
committerStefan Monnier2019-04-08 15:43:26 -0400
commit31e9087cdcd0b78b2247c3d8532290881abfbb08 (patch)
tree0e8b4653d471daac74579fc2c00b6ad9c8de536e
parentbaaacd92fff4e6a49bbb1fea3caed25004490559 (diff)
downloademacs-31e9087cdcd0b78b2247c3d8532290881abfbb08.tar.gz
emacs-31e9087cdcd0b78b2247c3d8532290881abfbb08.zip
* lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles): Use match-string
(gnus-agent-expire-group-1): Dial down on the 'setq'.
-rw-r--r--lisp/gnus/gnus-agent.el91
1 files changed, 45 insertions, 46 deletions
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 879e1fe2052..9f7d2c9df7d 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -276,7 +276,7 @@ Actually a hash table holding subjects mapped to t.")
276(defmacro gnus-agent-with-refreshed-group (group &rest body) 276(defmacro gnus-agent-with-refreshed-group (group &rest body)
277 "Performs the body then updates the group's line in the group 277 "Performs the body then updates the group's line in the group
278buffer. Automatically blocks multiple updates due to recursion." 278buffer. Automatically blocks multiple updates due to recursion."
279`(prog1 (let ((gnus-agent-inhibit-update-total-fetched-for t)) ,@body) 279 `(prog1 (let ((gnus-agent-inhibit-update-total-fetched-for t)) ,@body)
280 (when (and gnus-agent-need-update-total-fetched-for 280 (when (and gnus-agent-need-update-total-fetched-for
281 (not gnus-agent-inhibit-update-total-fetched-for)) 281 (not gnus-agent-inhibit-update-total-fetched-for))
282 (with-current-buffer gnus-group-buffer 282 (with-current-buffer gnus-group-buffer
@@ -311,9 +311,10 @@ buffer. Automatically blocks multiple updates due to recursion."
311(defun gnus-agent-cat-set-property (category property value) 311(defun gnus-agent-cat-set-property (category property value)
312 (if value 312 (if value
313 (setcdr (or (assq property category) 313 (setcdr (or (assq property category)
314 (let ((cell (cons property nil))) 314 (let ((cell (cons property nil)))
315 (setcdr category (cons cell (cdr category))) 315 (setcdr category (cons cell (cdr category)))
316 cell)) value) 316 cell))
317 value)
317 (let ((category category)) 318 (let ((category category))
318 (while (cond ((eq property (caadr category)) 319 (while (cond ((eq property (caadr category))
319 (setcdr category (cddr category)) 320 (setcdr category (cddr category))
@@ -378,7 +379,8 @@ manipulated as follows:
378 (setcdr (or (assq 'agent-groups category) 379 (setcdr (or (assq 'agent-groups category)
379 (let ((cell (cons 'agent-groups nil))) 380 (let ((cell (cons 'agent-groups nil)))
380 (setcdr category (cons cell (cdr category))) 381 (setcdr category (cons cell (cdr category)))
381 cell)) new-g)) 382 cell))
383 new-g))
382 (t 384 (t
383 (let ((groups groups)) 385 (let ((groups groups))
384 (while groups 386 (while groups
@@ -395,7 +397,8 @@ manipulated as follows:
395 (setcdr (or (assq 'agent-groups category) 397 (setcdr (or (assq 'agent-groups category)
396 (let ((cell (cons 'agent-groups nil))) 398 (let ((cell (cons 'agent-groups nil)))
397 (setcdr category (cons cell (cdr category))) 399 (setcdr category (cons cell (cdr category)))
398 cell)) groups)))))) 400 cell))
401 groups))))))
399 402
400(defsubst gnus-agent-cat-make (name &optional default-agent-predicate) 403(defsubst gnus-agent-cat-make (name &optional default-agent-predicate)
401 (list name `(agent-predicate . ,(or default-agent-predicate 'false)))) 404 (list name `(agent-predicate . ,(or default-agent-predicate 'false))))
@@ -1557,11 +1560,8 @@ downloaded into the agent."
1557 (skip-chars-forward " ") 1560 (skip-chars-forward " ")
1558 (setq crosses nil) 1561 (setq crosses nil)
1559 (while (looking-at "\\([^: \n]+\\):\\([0-9]+\\) *") 1562 (while (looking-at "\\([^: \n]+\\):\\([0-9]+\\) *")
1560 (push (cons (buffer-substring (match-beginning 1) 1563 (push (cons (match-string 1)
1561 (match-end 1)) 1564 (string-to-number (match-string 2)))
1562 (string-to-number
1563 (buffer-substring (match-beginning 2)
1564 (match-end 2))))
1565 crosses) 1565 crosses)
1566 (goto-char (match-end 0))) 1566 (goto-char (match-end 0)))
1567 (gnus-agent-crosspost crosses (caar pos) date))) 1567 (gnus-agent-crosspost crosses (caar pos) date)))
@@ -2939,7 +2939,7 @@ The following commands are available:
2939 'or) 2939 'or)
2940 ((memq (car predicate) gnus-category-not) 2940 ((memq (car predicate) gnus-category-not)
2941 'not)) 2941 'not))
2942 ,@(mapcar 'gnus-category-make-function-1 (cdr predicate)))) 2942 ,@(mapcar #'gnus-category-make-function-1 (cdr predicate))))
2943 (t 2943 (t
2944 (error "Unknown predicate type: %s" predicate)))) 2944 (error "Unknown predicate type: %s" predicate))))
2945 2945
@@ -2965,7 +2965,7 @@ return read articles, nil when it is known to always return read
2965articles, and t_nil when the function may return both read and unread 2965articles, and t_nil when the function may return both read and unread
2966articles." 2966articles."
2967 (let ((func (car function)) 2967 (let ((func (car function))
2968 (args (mapcar 'gnus-function-implies-unread-1 (cdr function)))) 2968 (args (mapcar #'gnus-function-implies-unread-1 (cdr function))))
2969 (cond ((eq func 'and) 2969 (cond ((eq func 'and)
2970 (cond ((memq t args) ; if any argument returns only unread articles 2970 (cond ((memq t args) ; if any argument returns only unread articles
2971 ;; then that argument constrains the result to only unread articles. 2971 ;; then that argument constrains the result to only unread articles.
@@ -3151,38 +3151,37 @@ FORCE is equivalent to setting the expiration predicates to true."
3151 (nov-file (concat dir ".overview")) 3151 (nov-file (concat dir ".overview"))
3152 (cnt 0) 3152 (cnt 0)
3153 (completed -1) 3153 (completed -1)
3154 dlist 3154 type
3155 type) 3155
3156 3156 ;; The normal article alist contains elements that look like
3157 ;; The normal article alist contains elements that look like 3157 ;; (article# . fetch_date) I need to combine other
3158 ;; (article# . fetch_date) I need to combine other 3158 ;; information with this list. For example, a flag indicating
3159 ;; information with this list. For example, a flag indicating 3159 ;; that a particular article MUST BE KEPT. To do this, I'm
3160 ;; that a particular article MUST BE KEPT. To do this, I'm 3160 ;; going to transform the elements to look like (article#
3161 ;; going to transform the elements to look like (article# 3161 ;; fetch_date keep_flag NOV_entry_position) Later, I'll reverse
3162 ;; fetch_date keep_flag NOV_entry_position) Later, I'll reverse 3162 ;; the process to generate the expired article alist.
3163 ;; the process to generate the expired article alist. 3163 (dlist
3164 3164 (nconc
3165 ;; Convert the alist elements to (article# fetch_date nil 3165 ;; Convert the alist elements to (article# fetch_date nil nil).
3166 ;; nil). 3166 (mapcar (lambda (e)
3167 (setq dlist (mapcar (lambda (e) 3167 (list (car e) (cdr e) nil nil))
3168 (list (car e) (cdr e) nil nil)) alist)) 3168 alist)
3169 3169
3170 ;; Convert the keep lists to elements that look like (article# 3170 ;; Convert the keep lists to elements that look like (article#
3171 ;; nil keep_flag nil) then append it to the expanded dlist 3171 ;; nil keep_flag nil) then append it to the expanded dlist
3172 ;; These statements are sorted by ascending precedence of the 3172 ;; These statements are sorted by ascending precedence of the
3173 ;; keep_flag. 3173 ;; keep_flag.
3174 (setq dlist (nconc dlist 3174 (mapcar (lambda (e)
3175 (mapcar (lambda (e) 3175 (list e nil 'unread nil))
3176 (list e nil 'unread nil)) 3176 unreads)
3177 unreads))) 3177
3178 (setq dlist (nconc dlist 3178 (mapcar (lambda (e)
3179 (mapcar (lambda (e) 3179 (list e nil 'marked nil))
3180 (list e nil 'marked nil)) 3180 marked)
3181 marked))) 3181
3182 (setq dlist (nconc dlist 3182 (mapcar (lambda (e)
3183 (mapcar (lambda (e) 3183 (list e nil 'special nil))
3184 (list e nil 'special nil)) 3184 specials))))
3185 specials)))
3186 3185
3187 (set-buffer overview) 3186 (set-buffer overview)
3188 (erase-buffer) 3187 (erase-buffer)
@@ -3391,7 +3390,7 @@ article alist" type) actions))
3391 (when actions 3390 (when actions
3392 (gnus-agent-message 8 "gnus-agent-expire: %s:%d: %s" 3391 (gnus-agent-message 8 "gnus-agent-expire: %s:%d: %s"
3393 decoded article-number 3392 decoded article-number
3394 (mapconcat 'identity actions ", "))))) 3393 (mapconcat #'identity actions ", ")))))
3395 (t 3394 (t
3396 (gnus-agent-message 3395 (gnus-agent-message
3397 10 "gnus-agent-expire: %s:%d: Article kept as \ 3396 10 "gnus-agent-expire: %s:%d: Article kept as \
@@ -3624,7 +3623,7 @@ If CACHED-HEADER is nil, articles are only excluded if the article itself
3624has been fetched." 3623has been fetched."
3625 3624
3626 ;; Logically equivalent to: (gnus-sorted-difference articles (mapcar 3625 ;; Logically equivalent to: (gnus-sorted-difference articles (mapcar
3627 ;; 'car gnus-agent-article-alist)) 3626 ;; #'car gnus-agent-article-alist))
3628 3627
3629 ;; Functionally, I don't need to construct a temp list using mapcar. 3628 ;; Functionally, I don't need to construct a temp list using mapcar.
3630 3629