]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix gnus-search-run-search methods
authorEric Abrahamsen <eric@ericabrahamsen.net>
Fri, 18 Feb 2022 05:28:40 +0000 (21:28 -0800)
committerEric Abrahamsen <eric@ericabrahamsen.net>
Fri, 18 Feb 2022 05:29:36 +0000 (21:29 -0800)
* lisp/gnus/gnus-search.el (gnus-search-run-search): Both these
implementations were setting the current buffer and then not setting
it back.

lisp/gnus/gnus-search.el

index 1e927ca922152d6c86ed18fdcf79e0cf01c7fd82..ec4dc4cf5021a51527b01bb36580b863bac8dace 100644 (file)
@@ -1346,16 +1346,14 @@ This method is common to all indexed search engines.
 
 Returns a list of [group article score] vectors."
 
-  (save-excursion
-    (let* ((qstring (gnus-search-make-query-string engine query))
-          (program (slot-value engine 'program))
-          (buffer (slot-value engine 'proc-buffer))
-          (cp-list (gnus-search-indexed-search-command
-                    engine qstring query groups))
-           proc exitstatus)
-      (set-buffer buffer)
+  (let* ((qstring (gnus-search-make-query-string engine query))
+        (program (slot-value engine 'program))
+        (buffer (slot-value engine 'proc-buffer))
+        (cp-list (gnus-search-indexed-search-command
+                  engine qstring query groups))
+         proc exitstatus)
+    (with-current-buffer buffer
       (erase-buffer)
-
       (if groups
          (gnus-message 7 "Doing %s query on %s..." program groups)
        (gnus-message 7 "Doing %s query..." program))
@@ -1374,7 +1372,7 @@ Returns a list of [group article score] vectors."
        ;; wants it.
        (when (> gnus-verbose 6)
          (display-buffer buffer))
-       nil))))
+        nil))))
 
 (cl-defmethod gnus-search-indexed-parse-output ((engine gnus-search-indexed)
                                                server query &optional groups)
@@ -1628,17 +1626,17 @@ Namazu provides a little more information, for instance a score."
               (cp-list (gnus-search-indexed-search-command
                         engine qstring query groups))
               thread-ids proc)
-         (set-buffer proc-buffer)
-         (erase-buffer)
-         (setq proc (apply #'start-process (format "search-%s" server)
-                           proc-buffer program cp-list))
-         (while (process-live-p proc)
-           (accept-process-output proc))
-          (goto-char (point-min))
-         (while (re-search-forward
-                  "^thread:\\([^[:space:]\n]+\\)"
-                  (point-max) t)
-           (cl-pushnew (match-string 1) thread-ids :test #'equal))
+         (with-current-buffer proc-buffer
+           (erase-buffer)
+           (setq proc (apply #'start-process (format "search-%s" server)
+                             proc-buffer program cp-list))
+           (while (process-live-p proc)
+             (accept-process-output proc))
+            (goto-char (point-min))
+           (while (re-search-forward
+                    "^thread:\\([^[:space:]\n]+\\)"
+                    (point-max) t)
+             (cl-pushnew (match-string 1) thread-ids :test #'equal)))
          (cl-call-next-method
           engine server
           ;; If we found threads, completely replace the query with