Function: mh-folder-list

mh-folder-list is an autoloaded and byte-compiled function defined in mh-utils.el.gz.

Signature

(mh-folder-list FOLDER)

Documentation

Return FOLDER and its descendants.

FOLDER may have a + prefix. Returns a list of strings without the
+ prefix. If FOLDER is nil, then all folders are considered. For
example, if your Mail directory only contains the folders +inbox,
+outbox, +lists, and +lists/mh-e, then

  (mh-folder-list nil)
       => ("inbox" "lists" "lists/mh-e" "outbox")
  (mh-folder-list "+lists")
       => ("lists" "lists/mh-e")

Respects the value of mh-recursive-folders-flag. If this flag is nil, and the sub-folders have not been explicitly viewed, then they will not be returned.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-utils.el.gz
;;;###mh-autoload
(defun mh-folder-list (folder)
  "Return FOLDER and its descendants.
FOLDER may have a + prefix. Returns a list of strings without the
+ prefix. If FOLDER is nil, then all folders are considered. For
example, if your Mail directory only contains the folders +inbox,
+outbox, +lists, and +lists/mh-e, then

  (mh-folder-list nil)
       => (\"inbox\" \"lists\" \"lists/mh-e\" \"outbox\")
  (mh-folder-list \"+lists\")
       => (\"lists\" \"lists/mh-e\")

Respects the value of `mh-recursive-folders-flag'. If this flag
is nil, and the sub-folders have not been explicitly viewed, then
they will not be returned."
  (let ((folder-list))
    ;; Normalize folder. Strip leading + and trailing slash(es). If no
    ;; folder is specified, ensure it is nil to avoid adding the
    ;; folder to the folder-list and adding a slash to it.
    (when folder
      (setq folder (replace-regexp-in-string "^\\+" "" folder))
      (setq folder (replace-regexp-in-string "/+$" "" folder))
      (if (equal folder "")
          (setq folder nil)))
    ;; Add provided folder to list, unless all folders are asked for.
    ;; Then append slash to separate sub-folders.
    (unless (null folder)
      (setq folder-list (list folder))
      (setq folder (concat folder "/")))
    (cl-loop for f in (mh-sub-folders folder) do
             (setq folder-list
                   (append folder-list
                           (if (mh-children-p f)
                               (mh-folder-list (concat folder (car f)))
                             (list (concat folder (car f)))))))
    folder-list))