emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d89d5e0: Fix handling of folder "+/" in MH-E


From: Stephen Gildea
Subject: master d89d5e0: Fix handling of folder "+/" in MH-E
Date: Tue, 16 Nov 2021 01:05:39 -0500 (EST)

branch: master
commit d89d5e0f9466b9823fe31d02a374d654163594e4
Author: Mike Kupfer <mkupfer@alum.berkeley.edu>
Commit: Stephen Gildea <stepheng+emacs@gildea.com>

    Fix handling of folder "+/" in MH-E
    
    * lisp/mh-e/mh-utils.el (mh-sub-folders): Fix handling of "+/".
    * test/lisp/mh-e/mh-utils-tests.el
    (mh-folder-completion-function-08-plus-slash)
    (mh-folder-completion-function-09-plus-slash-tmp):
    Fix errors made importing tests from mh-unit.el; remove declaration
    that these tests are expected to fail.
---
 lisp/mh-e/mh-utils.el            | 7 ++++++-
 test/lisp/mh-e/mh-utils-tests.el | 6 ++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index feebf64..1c322b8 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -531,7 +531,12 @@ results of the actual folders call.
 If optional argument ADD-TRAILING-SLASH-FLAG is non-nil then a
 slash is added to each of the sub-folder names that may have
 nested folders within them."
-  (let* ((folder (mh-normalize-folder-name folder nil nil t))
+  ;; In most cases we want to remove a trailing slash.  We keep the
+  ;; slash for "+/", because it refers to folders in the system root
+  ;; directory, whereas "+" refers to the user's top-level folders.
+  (let* ((folder (mh-normalize-folder-name folder nil
+                                           (string= folder "+/")
+                                           t))
          (match (gethash folder mh-sub-folders-cache 'no-result))
          (sub-folders (cond ((eq match 'no-result)
                              (setf (gethash folder mh-sub-folders-cache)
diff --git a/test/lisp/mh-e/mh-utils-tests.el b/test/lisp/mh-e/mh-utils-tests.el
index d9a26e5..0df4d44 100644
--- a/test/lisp/mh-e/mh-utils-tests.el
+++ b/test/lisp/mh-e/mh-utils-tests.el
@@ -437,8 +437,7 @@ and the `should' macro requires idempotent evaluation 
anyway."
 
 (ert-deftest mh-folder-completion-function-08-plus-slash ()
   "Test `mh-folder-completion-function' with `+/'."
-  :expected-result :failed              ;to be fixed in a patch by mkupfer
-  (mh-test-folder-completion-1 "+/" "+/" "tmp/" nil)
+  (mh-test-folder-completion-1 "+/" "+/" "tmp/" t)
     ;; case "bb"
     (with-mh-test-env
       (should (equal nil
@@ -447,8 +446,7 @@ and the `should' macro requires idempotent evaluation 
anyway."
 
 (ert-deftest mh-folder-completion-function-09-plus-slash-tmp ()
   "Test `mh-folder-completion-function' with `+/tmp'."
-  :expected-result :failed              ;to be fixed in a patch by mkupfer
-  (mh-test-folder-completion-1 "+/tmp" "+/tmp" "tmp/" t))
+  (mh-test-folder-completion-1 "+/tmp" "+/tmp/" "tmp/" t))
 
 (ert-deftest mh-folder-completion-function-10-plus-slash-abs-folder ()
   "Test `mh-folder-completion-function' with `+/abso-folder'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]