mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
MH-E: support Mailutils "folders +/"
* lisp/mh-e/mh-utils.el (mh-sub-folders-parse): Support Mailutils style of "folders +/" output. * test/lisp/mh-e/mh-utils.el: Test "folders +/" with GNU Mailutils 3.13.91 and later.
This commit is contained in:
parent
96f58718a0
commit
d24ad504fc
2 changed files with 14 additions and 4 deletions
|
|
@ -592,10 +592,14 @@ This function is a testable helper of `mh-sub-folders-actual'."
|
|||
(cl-incf start-pos))
|
||||
(let* ((name (buffer-substring start-pos has-pos))
|
||||
(first-char (aref name 0))
|
||||
(second-char (and (length> name 1) (aref name 1)))
|
||||
(last-char (aref name (1- (length name)))))
|
||||
(unless (member first-char '(?. ?# ?,))
|
||||
(when (and (equal last-char ?+) (equal name current-folder))
|
||||
(setq name (substring name 0 (1- (length name)))))
|
||||
;; nmh outputs double slash in root folder, e.g., "//tmp"
|
||||
(when (and (equal first-char ?/) (equal second-char ?/))
|
||||
(setq name (substring name 1)))
|
||||
(push
|
||||
(cons name
|
||||
(search-forward "(others)" (line-end-position) t))
|
||||
|
|
@ -605,6 +609,9 @@ This function is a testable helper of `mh-sub-folders-actual'."
|
|||
(when (stringp folder)
|
||||
(setq results (cdr results))
|
||||
(let ((folder-name-len (length (format "%s/" (substring folder 1)))))
|
||||
(when (equal "+/" folder)
|
||||
;; folder "+/" includes a trailing slash
|
||||
(cl-decf folder-name-len))
|
||||
(setq results (mapcar (lambda (f)
|
||||
(cons (substring (car f) folder-name-len)
|
||||
(cdr f)))
|
||||
|
|
|
|||
|
|
@ -121,10 +121,12 @@
|
|||
"Test `mh-sub-folders-parse' with root folder."
|
||||
(with-temp-buffer
|
||||
(insert "/+ has no messages.\n")
|
||||
(insert "/ has no messages.\n")
|
||||
(insert "//nmh-style has no messages.\n")
|
||||
(insert "/mu-style has no messages.\n")
|
||||
(should (equal
|
||||
(mh-sub-folders-parse "+/" "inbox+")
|
||||
'(("nmh-style"))))))
|
||||
'(("") ("nmh-style") ("mu-style"))))))
|
||||
|
||||
|
||||
;; Folder names that are used by the following tests.
|
||||
|
|
@ -259,8 +261,8 @@ The tests use this method if no configured MH variant is found."
|
|||
"/abso-folder/food has no messages."))
|
||||
(("folders" "-noheader" "-norecurse" "-nototal" "+/") .
|
||||
("/+ has no messages ; (others)."
|
||||
"//abso-folder has no messages ; (others)."
|
||||
"//tmp has no messages ; (others)."))
|
||||
"/abso-folder has no messages ; (others)."
|
||||
"/tmp has no messages ; (others)."))
|
||||
))
|
||||
(arglist (cons (file-name-base program) args)))
|
||||
(let ((response-list-cons (assoc arglist argument-responses)))
|
||||
|
|
@ -358,7 +360,8 @@ if `mh-test-utils-debug-mocks' is non-nil."
|
|||
Mailutils 3.5, 3.7, and 3.13 are known not to."
|
||||
(cond ((not (stringp variant))) ;our mock handles it
|
||||
((string-search "GNU Mailutils" variant)
|
||||
nil)
|
||||
(let ((mu-version (string-remove-prefix "GNU Mailutils " variant)))
|
||||
(version<= "3.13.91" mu-version)))
|
||||
(t))) ;no other known failures
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue