aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew G Cohen2023-04-17 08:09:12 +0800
committerAndrew G Cohen2023-04-17 08:52:38 +0800
commit6c81ef4cf985dad908fc473f31c0daf662fd2dad (patch)
tree00e0a35061f5d1e305144813631e9fc5650d9fdb
parent2d24eb69ed56b00f400066f4dfcf549d69036ce6 (diff)
downloademacs-6c81ef4cf985dad908fc473f31c0daf662fd2dad.tar.gz
emacs-6c81ef4cf985dad908fc473f31c0daf662fd2dad.zip
Include previous summary buffer articles in gnus thread referrals
* lisp/gnus/gnus-search.el (gnus-search-thread): Include all the current articles along with the thread when searching outside the current group.
-rw-r--r--lisp/gnus/gnus-search.el61
1 files changed, 44 insertions, 17 deletions
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 12d9dacf132..98a7e23428b 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -2183,7 +2183,8 @@ checked for articles; if t all groups on the server containing
2183the article's group will be searched; if a list then all servers 2183the article's group will be searched; if a list then all servers
2184in this list will be searched. If possible the newly found 2184in this list will be searched. If possible the newly found
2185articles are added to the summary buffer; otherwise the full 2185articles are added to the summary buffer; otherwise the full
2186thread is displayed in a new ephemeral nnselect buffer." 2186thread along with the original articles are displayed in a new
2187ephemeral nnselect buffer."
2187 (let* ((group (or group gnus-newsgroup-name)) 2188 (let* ((group (or group gnus-newsgroup-name))
2188 (server (or server (gnus-group-server group))) 2189 (server (or server (gnus-group-server group)))
2189 (query 2190 (query
@@ -2207,22 +2208,48 @@ thread is displayed in a new ephemeral nnselect buffer."
2207 (cons 'search-group-spec 2208 (cons 'search-group-spec
2208 (list (list server group)))))) 2209 (list (list server group))))))
2209 #'<) nil t) 2210 #'<) nil t)
2210 ;; Otherwise create an ephemeral search group. If we return to 2211 ;; Otherwise create an ephemeral search group: record the
2211 ;; the current summary buffer after exiting the thread we would 2212 ;; current summary contents; exit the current group (so that
2212 ;; end up overwriting any changes we made, so we exit the 2213 ;; changes are saved); then create a new ephemeral group with
2213 ;; current summary buffer first. 2214 ;; the original articles plus those of the thread.
2214 (gnus-summary-exit) 2215 (let ((selection (seq-map (lambda (x) (vector group x 100))
2215 (gnus-group-read-ephemeral-search-group 2216 gnus-newsgroup-articles))
2216 nil 2217 (thread (gnus-search-run-query
2217 (list (cons 'search-query-spec query) 2218 (list (cons 'search-query-spec query)
2218 (cons 'search-group-spec 2219 (cons 'search-group-spec
2219 (if (listp gnus-refer-thread-use-search) 2220 (if (listp gnus-refer-thread-use-search)
2220 gnus-refer-thread-use-search 2221 gnus-refer-thread-use-search
2221 (list (list server)))))) 2222 (list (list server))))))))
2222 (if (gnus-id-to-article (mail-header-id header)) 2223 (if (< (nnselect-artlist-length thread) 2)
2223 (gnus-summary-goto-subject 2224 (message "No other articles in thread")
2224 (gnus-id-to-article (mail-header-id header))) 2225 (setq selection
2225 (message "Thread search failed"))))) 2226 (seq-into
2227 (seq-union selection thread
2228 (lambda (x y)
2229 (and (equal (nnselect-artitem-group x)
2230 (nnselect-artitem-group y))
2231 (eql (nnselect-artitem-number x)
2232 (nnselect-artitem-number y)))))
2233 'vector))
2234 (gnus-summary-exit)
2235 (gnus-group-read-ephemeral-group
2236 (concat "nnselect-" (message-unique-id))
2237 (list 'nnselect "nnselect")
2238 nil
2239 (cons (current-buffer) gnus-current-window-configuration)
2240 nil nil
2241 (list
2242 (cons 'nnselect-specs
2243 (list
2244 (cons 'nnselect-function 'identity)
2245 (cons 'nnselect-args
2246 selection)))
2247 (cons 'nnselect-artlist nil))
2248 (nnselect-artlist-length selection))
2249 (if (gnus-id-to-article (mail-header-id header))
2250 (gnus-summary-goto-subject
2251 (gnus-id-to-article (mail-header-id header)))
2252 (message "Thread search failed")))))))
2226 2253
2227(defun gnus-search-get-active (srv) 2254(defun gnus-search-get-active (srv)
2228 (let ((method (gnus-server-to-method srv)) 2255 (let ((method (gnus-server-to-method srv))