unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 53989@debbugs.gnu.org
Subject: bug#53989: 29.0.50; Gnus searches broken
Date: Tue, 15 Feb 2022 15:23:07 -0800	[thread overview]
Message-ID: <8735kjd89w.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87v8xg7oce.fsf@web.de> (Michael Heerdegen's message of "Tue, 15 Feb 2022 05:20:17 +0100")

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]


On 02/15/22 05:20 AM, Michael Heerdegen wrote:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Oh, that's not bad. If you mess up your mairix config again and then
>> eval this:
>>
>> (cl-defmethod gnus-search-indexed-extract :around
>>   ((_engine gnus-search-indexed))
>>   (let ((ret (cl-call-next-method)))
>>     (cl-callf expand-file-name (car ret) "/")
>>     ret))
>>
>> Does everything work properly?
>
> Yes, I think so, looks good.

Okay, it turns out that also lets us drop most of the regexp silliness
from the parsing stuff. Would you mind trying the attached patch and
confirm that it doesn't break anything? I'll try to make this the last
time I mess with search results parsing...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: moresearchparsingfun.diff --]
[-- Type: text/x-patch, Size: 1981 bytes --]

diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 605d8a34e9..871163c38b 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -1396,17 +1396,22 @@ gnus-search-indexed-parse-output
                    (file-readable-p f-name)
 		   (null (file-directory-p f-name)))
           (setq group
-                (replace-regexp-in-string
-	         "[/\\]" "."
-	         (replace-regexp-in-string
-	          "/?\\(cur\\|new\\|tmp\\)?/\\'" ""
+                (delete
+                 ""
+                 (file-name-split
 	          (replace-regexp-in-string
-	           "\\`\\." ""
-	           (string-remove-prefix
+	           "\\`\\." "" ; Why do we do this?
+                   (string-remove-prefix
                     prefix (file-name-directory f-name))
-                   nil t)
-	          nil t)
-	         nil t))
+                   nil t)))
+                ;; Turn file name segments into Gnus group name.
+                group (mapconcat
+                       #'identity
+                       (if (member (car (last group))
+                                   '("new" "tmp" "cur"))
+                           (nbutlast group)
+                         group)
+                       "."))
           (setq article (file-name-nondirectory f-name)
                 article
                 ;; TODO: Provide a cleaner way of producing final
@@ -1434,6 +1439,14 @@ gnus-search-indexed-parse-output
 		 (string-to-number score))))
             artlist)))
 
+(cl-defmethod gnus-search-indexed-extract :around
+  ((_engine gnus-search-indexed))
+  (let ((ret (cl-call-next-method)))
+    ;; We run `expand-file-name' here in order to collapse multiple
+    ;; consecutive directory separators.
+    (cl-callf expand-file-name (car ret))
+    ret))
+
 (cl-defmethod gnus-search-indexed-extract ((_engine gnus-search-indexed))
   "Base implementation treats the whole line as a filename, and
 fudges a relevancy score of 100."

  reply	other threads:[~2022-02-15 23:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14  3:37 bug#53989: 29.0.50; Gnus searches broken Michael Heerdegen
2022-02-14  4:23 ` Eric Abrahamsen
2022-02-14  4:59   ` Michael Heerdegen
2022-02-14  5:19     ` Michael Heerdegen
2022-02-14  6:06       ` Eric Abrahamsen
2022-02-14 22:11       ` Eric Abrahamsen
2022-02-14 22:41         ` Eric Abrahamsen
2022-02-14 23:06           ` Michael Heerdegen
2022-02-14 23:22             ` Eric Abrahamsen
2022-02-14 22:49         ` Michael Heerdegen
2022-02-14 23:08           ` Eric Abrahamsen
2022-02-14 23:21             ` Michael Heerdegen
2022-02-14 23:24               ` Eric Abrahamsen
2022-02-14 23:31                 ` Michael Heerdegen
2022-02-14 23:35                   ` Eric Abrahamsen
2022-02-14 23:40                   ` Michael Heerdegen
2022-02-14 23:45                     ` Eric Abrahamsen
2022-02-15  0:37                       ` Andreas Schwab
2022-02-15  1:29                         ` Eric Abrahamsen
2022-02-15  2:48                       ` Michael Heerdegen
2022-02-15  3:45                         ` Eric Abrahamsen
2022-02-15  4:20                           ` Michael Heerdegen
2022-02-15 23:23                             ` Eric Abrahamsen [this message]
2022-02-18  2:10                               ` Michael Heerdegen
2022-02-18 16:01                                 ` Eric Abrahamsen
2022-02-19  1:07                                   ` Michael Heerdegen
2022-02-19  1:20                                     ` Eric Abrahamsen
2022-02-19  1:29                                       ` Michael Heerdegen
2022-02-14  6:05     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735kjd89w.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=53989@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).