aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wohler2006-02-28 23:54:53 +0000
committerBill Wohler2006-02-28 23:54:53 +0000
commit898dda92519dfdc671e5f0851f7ee3c14f05280f (patch)
treeceae94b7988c1057fbe3f4fc82eb4abb14f21050
parent7dda19092fbe49defd431ef48f3f657a41504e1e (diff)
downloademacs-898dda92519dfdc671e5f0851f7ee3c14f05280f.tar.gz
emacs-898dda92519dfdc671e5f0851f7ee3c14f05280f.zip
(mh-folder-list): Fix problem with passing in a folder and getting
nothing back. Fix problem with passing in empty string and getting the entire filesystem (or infinite loop). Don't append slash to folder. These fixes fix problems observed with the pick search. Thanks to Thomas Baumann for the help (closes SF #1435381).
-rw-r--r--lisp/mh-e/ChangeLog5
-rw-r--r--lisp/mh-e/mh-utils.el39
2 files changed, 27 insertions, 17 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 84d9c0ada57..36a02532455 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -4,6 +4,11 @@
4 mh-image-directory. 4 mh-image-directory.
5 (mh-image-load-path): Access mh-image-directory instead of 5 (mh-image-load-path): Access mh-image-directory instead of
6 mh-image-load-path. 6 mh-image-load-path.
7 (mh-folder-list): Fix problem with passing in a folder and getting
8 nothing back. Fix problem with passing in empty string and getting
9 the entire filesystem (or infinite loop). Don't append slash to
10 folder. These fixes fix problems observed with the pick search.
11 Thanks to Thomas Baumann for the help (closes SF #1435381).
7 12
82006-02-27 Bill Wohler <wohler@newt.com> 132006-02-27 Bill Wohler <wohler@newt.com>
9 14
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index f09763ba9f5..ebd342b6786 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -526,14 +526,19 @@ number of sub-folders. XXX"
526;;;###mh-autoload 526;;;###mh-autoload
527(defun mh-folder-list (folder) 527(defun mh-folder-list (folder)
528 "Return FOLDER and its descendents. 528 "Return FOLDER and its descendents.
529Returns a list of strings. For example, 529FOLDER may have a + prefix. Returns a list of strings without the
530 530+ prefix. If FOLDER is nil, then all folders are considered. For
531 '(\"inbox\" \"lists\" \"lists/mh-e\"). 531example, if your Mail directory only contains the folders +inbox,
532 532+outbox, +lists, and +lists/mh-e, then
533If folder is nil, then all folders are considered. Respects the 533
534value of `mh-recursive-folders-flag'. If this flag is nil, and 534 (mh-folder-list nil)
535the sub-folders have not been explicitly viewed, then they will 535 => (\"inbox\" \"lists\" \"lists/mh-e\" \"outbox\")
536not be returned." 536 (mh-folder-list \"+lists\")
537 => (\"lists/mh-e\")
538
539Respects the value of `mh-recursive-folders-flag'. If this flag
540is nil, and the sub-folders have not been explicitly viewed, then
541they will not be returned."
537 (let ((folder-list)) 542 (let ((folder-list))
538 ;; Normalize folder. Strip leading +. Add trailing slash (done in 543 ;; Normalize folder. Strip leading +. Add trailing slash (done in
539 ;; two steps to avoid infinite loops when replacing "/*$" with "/" 544 ;; two steps to avoid infinite loops when replacing "/*$" with "/"
@@ -542,16 +547,16 @@ not be returned."
542 ;; returns all the files in / if given an empty string or +. 547 ;; returns all the files in / if given an empty string or +.
543 (when folder 548 (when folder
544 (setq folder (mh-replace-regexp-in-string "^\+" "" folder)) 549 (setq folder (mh-replace-regexp-in-string "^\+" "" folder))
545 (setq folder (mh-replace-regexp-in-string "/+$" "" folder)) 550 (setq folder (mh-replace-regexp-in-string "/+$" "" folder)))
546 (setq folder (concat folder "/")) 551 ;; Add provided folder to list, unless all folders are asked for.
547 (if (equal folder "") 552 (unless (null folder)
548 (setq folder nil))) 553 (setq folder-list (list folder)))
549 (loop for f in (mh-sub-folders folder) do 554 (loop for f in (mh-sub-folders folder) do
550 (setq folder-list (append folder-list (list (concat folder (car f))))) 555 (setq folder-list
551 (if (mh-children-p f) 556 (append folder-list
552 (setq folder-list 557 (if (mh-children-p f)
553 (append folder-list 558 (mh-folder-list (concat folder "/" (car f)))
554 (mh-folder-list (concat folder (car f))))))) 559 (list (concat folder "/" (car f)))))))
555 folder-list)) 560 folder-list))
556 561
557;;;###mh-autoload 562;;;###mh-autoload