diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-06-07 15:28:12 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-06-07 15:28:12 -0400 |
commit | da1974fabddda6fac029db6960110001c6472ddc (patch) | |
tree | be1c9d5cd25355eb298d505537266d56d7c98cf1 /lisp/gnus/gnus-sum.el | |
parent | 77f96e2cc1da30730f79d5935eaf5d23e53f37ad (diff) | |
download | emacs-da1974fabddda6fac029db6960110001c6472ddc.tar.gz |
* lisp/gnus: Further reduce assumptions about gnus-data format
* lisp/gnus/gnus-registry.el (gnus-registry-fetch-message-id-fast)
(gnus-registry-fetch-simplified-message-subject-fast)
(gnus-registry-fetch-sender-fast, gnus-registry-fetch-recipients-fast)
(gnus-registry--set/remove-mark): Don't hardcode assoc for gnus-data-find-in.
* lisp/gnus/gnus-sum.el (gnus-data-update-list): Don't hardcode `nth 2`
for gnus-data-pos.
(gnus-summary-insert-old-articles, gnus-summary-insert-new-articles)
(gnus-summary-first-article-p): Don't hardcode `car` for `gnus-data-number`.
(gnus-summary-move-article, gnus-summary-expire-articles)
(gnus-summary-delete-article): Don't hardcode assoc for gnus-data-find-in.
* lisp/gnus/spam.el (spam-fetch-article-header): Don't hardcode `nth 3`
for gnus-data-header.
Diffstat (limited to 'lisp/gnus/gnus-sum.el')
-rw-r--r-- | lisp/gnus/gnus-sum.el | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 4c4445275a6..8fdb766584b 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -3246,7 +3246,7 @@ The following commands are available: "Add OFFSET to the POS of all data entries in DATA." (setq gnus-newsgroup-data-reverse nil) (while data - (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data)))) + (cl-incf (gnus-data-pos (car data)) offset) (setq data (cdr data)))) (defun gnus-summary-article-pseudo-p (article) @@ -3574,7 +3574,7 @@ buffer that was in action when the last article was fetched." "Return whether ARTICLE is the first article in the buffer." (if (not (setq article (or article (gnus-summary-article-number)))) nil - (eq article (caar gnus-newsgroup-data)))) + (eq article (gnus-data-number (car gnus-newsgroup-data))))) (defun gnus-summary-last-article-p (&optional article) "Return whether ARTICLE is the last article in the buffer." @@ -4725,10 +4725,10 @@ If LINE, insert the rebuilt thread starting on line LINE." (push thr roots)) (setq thread (cdr thread))) ;; We now have all (unique) roots. - (if (= (length roots) 1) - ;; All the loose roots are now one solid root. - (setq thread (car roots)) - (setq thread (cons subject (gnus-sort-threads roots)))))) + (setq thread (if (= (length roots) 1) + ;; All the loose roots are now one solid root. + (car roots) + (cons subject (gnus-sort-threads roots)))))) (let (threads) ;; We then insert this thread into the summary buffer. (when line @@ -4738,6 +4738,7 @@ If LINE, insert the rebuilt thread starting on line LINE." (if gnus-show-threads (gnus-summary-prepare-threads (gnus-cut-threads (list thread))) (gnus-summary-prepare-unthreaded thread)) + ;; FIXME: Why is this `nreverse' safe? Don't we need `reverse' instead? (setq data (nreverse gnus-newsgroup-data)) (setq threads gnus-newsgroup-threads)) ;; We splice the new data into the data structure. @@ -10170,7 +10171,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'." (run-hook-with-args 'gnus-summary-article-delete-hook action (gnus-data-header - (assoc article (gnus-data-list nil))) + (gnus-data-find-in article (gnus-data-list nil))) gnus-newsgroup-name nil select-method))) (t @@ -10280,8 +10281,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'." ;; run the move/copy/crosspost/respool hook (run-hook-with-args 'gnus-summary-article-move-hook action - (gnus-data-header - (assoc article (gnus-data-list nil))) + (gnus-data-header (gnus-data-find article)) gnus-newsgroup-name to-newsgroup select-method)) @@ -10524,7 +10524,7 @@ This will be the case if the article has both been mailed and posted." (run-hook-with-args 'gnus-summary-article-expire-hook 'delete - (gnus-data-header (assoc article (gnus-data-list nil))) + (gnus-data-header (gnus-data-find article)) gnus-newsgroup-name (cond ((stringp nnmail-expiry-target) nnmail-expiry-target) @@ -10588,8 +10588,7 @@ confirmation before the articles are deleted." (unless (memq (car articles) not-deleted) (gnus-summary-mark-article (car articles) gnus-canceled-mark) (let* ((article (car articles)) - (ghead (gnus-data-header - (assoc article (gnus-data-list nil))))) + (ghead (gnus-data-header (gnus-data-find article)))) (run-hook-with-args 'gnus-summary-article-delete-hook 'delete ghead gnus-newsgroup-name nil nil))) @@ -13038,7 +13037,7 @@ If ALL is non-nil, already read articles become readable. If ALL is a number, fetch this number of articles." (interactive "P") (prog1 - (let ((old (sort (mapcar #'car gnus-newsgroup-data) #'<)) + (let ((old (sort (mapcar #'gnus-data-number gnus-newsgroup-data) #'<)) older len) (setq older ;; Some nntp servers lie about their active range. When @@ -13108,7 +13107,7 @@ If ALL is a number, fetch this number of articles." (defun gnus-summary-insert-new-articles () "Insert all new articles in this group." (interactive) - (let ((old (sort (mapcar #'car gnus-newsgroup-data) #'<)) + (let ((old (sort (mapcar #'gnus-data-number gnus-newsgroup-data) #'<)) (old-high gnus-newsgroup-highest) (nnmail-fetched-sources (list t)) (new-active (gnus-activate-group gnus-newsgroup-name 'scan)) |