diff options
| author | Eric Abrahamsen | 2020-11-19 16:32:41 -0800 |
|---|---|---|
| committer | Eric Abrahamsen | 2020-11-22 20:46:18 -0800 |
| commit | 8b7fa9e663d8898adebe7315bc9dcc4272858446 (patch) | |
| tree | 55d5760a0ad31bca0df5988a91cb81ad778b5535 | |
| parent | edd949a3eb8907eed84eab30e170cc138a5b2d41 (diff) | |
| download | emacs-8b7fa9e663d8898adebe7315bc9dcc4272858446.tar.gz emacs-8b7fa9e663d8898adebe7315bc9dcc4272858446.zip | |
Small fixes to gnus-search output parsing of indexed engines
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): When
filtering for desired groups, accept any of [.\/] as potential segment
delimiters. Later on, filesystem path separators will be interpreted
as dots (".") when constructing group names. Also, make sure we use
`expand-file-name' on the prefix, and just use `string-remove-prefix'
to get rid of it.
| -rw-r--r-- | lisp/gnus/gnus-search.el | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 498da200dab..492ee2052c4 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el | |||
| @@ -1365,10 +1365,13 @@ Returns a list of [group article score] vectors." | |||
| 1365 | server query &optional groups) | 1365 | server query &optional groups) |
| 1366 | (let ((prefix (slot-value engine 'remove-prefix)) | 1366 | (let ((prefix (slot-value engine 'remove-prefix)) |
| 1367 | (group-regexp (when groups | 1367 | (group-regexp (when groups |
| 1368 | (regexp-opt | 1368 | (mapconcat |
| 1369 | (mapcar | 1369 | (lambda (x) |
| 1370 | (lambda (x) (gnus-group-real-name x)) | 1370 | (replace-regexp-in-string |
| 1371 | groups)))) | 1371 | ;; Accept any of [.\/] as path separators. |
| 1372 | "[.\\/]" "[.\\\\/]" | ||
| 1373 | (gnus-group-real-name x))) | ||
| 1374 | groups "\\|"))) | ||
| 1372 | artlist vectors article group) | 1375 | artlist vectors article group) |
| 1373 | (goto-char (point-min)) | 1376 | (goto-char (point-min)) |
| 1374 | (while (not (eobp)) | 1377 | (while (not (eobp)) |
| @@ -1383,16 +1386,16 @@ Returns a list of [group article score] vectors." | |||
| 1383 | ;; Are we running an additional grep query? | 1386 | ;; Are we running an additional grep query? |
| 1384 | (when-let ((grep-reg (alist-get 'grep query))) | 1387 | (when-let ((grep-reg (alist-get 'grep query))) |
| 1385 | (setq artlist (gnus-search-grep-search engine artlist grep-reg))) | 1388 | (setq artlist (gnus-search-grep-search engine artlist grep-reg))) |
| 1389 | ;; Prep prefix. | ||
| 1390 | (when (and prefix (null (string-empty-p prefix))) | ||
| 1391 | (setq prefix (file-name-as-directory (expand-file-name prefix)))) | ||
| 1386 | ;; Turn (file-name score) into [group article score]. | 1392 | ;; Turn (file-name score) into [group article score]. |
| 1387 | (pcase-dolist (`(,f-name ,score) artlist) | 1393 | (pcase-dolist (`(,f-name ,score) artlist) |
| 1388 | (setq article (file-name-nondirectory f-name)) | 1394 | (setq article (file-name-nondirectory f-name) |
| 1395 | group (file-name-directory f-name)) | ||
| 1389 | ;; Remove prefix. | 1396 | ;; Remove prefix. |
| 1390 | (when (and prefix | 1397 | (when prefix |
| 1391 | (file-name-absolute-p prefix) | 1398 | (setq group (string-remove-prefix prefix group))) |
| 1392 | (string-match (concat "^" | ||
| 1393 | (file-name-as-directory prefix)) | ||
| 1394 | f-name)) | ||
| 1395 | (setq group (replace-match "" t t (file-name-directory f-name)))) | ||
| 1396 | ;; Break the directory name down until it's something that | 1399 | ;; Break the directory name down until it's something that |
| 1397 | ;; (probably) can be used as a group name. | 1400 | ;; (probably) can be used as a group name. |
| 1398 | (setq group | 1401 | (setq group |