Handle multiple directory separators in gnus-search results
Try to treat the file names more like file names, less like strings to massage. * lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): Use `expand-file-name' to collapse separators and generally canonicalize the name. Use `file-name-split' and joining instead of regexp munging.
This commit is contained in:
parent
b76cd8af05
commit
51e51ce2df
1 changed files with 19 additions and 10 deletions
|
@ -1393,18 +1393,27 @@ Returns a list of [group article score] vectors."
|
|||
(when (and f-name
|
||||
(file-readable-p f-name)
|
||||
(null (file-directory-p f-name)))
|
||||
(setq group
|
||||
(replace-regexp-in-string
|
||||
"[/\\]" "."
|
||||
(replace-regexp-in-string
|
||||
"/?\\(cur\\|new\\|tmp\\)?/\\'" ""
|
||||
;; `expand-file-name' canoncalizes the file name,
|
||||
;; specifically collapsing multiple consecutive directory
|
||||
;; separators.
|
||||
(setq f-name (expand-file-name f-name)
|
||||
group
|
||||
(delete
|
||||
"" ; forward slash at root leaves an empty string
|
||||
(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 a 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue