Function: mh-remove-from-sub-folders-cache
mh-remove-from-sub-folders-cache is an autoloaded and byte-compiled
function defined in mh-utils.el.gz.
Signature
(mh-remove-from-sub-folders-cache FOLDER)
Documentation
Remove FOLDER and its parent from mh-sub-folders-cache.
FOLDER should be unconditionally removed from the cache. Also the last ancestor of FOLDER present in the cache must be removed as well.
To see why this is needed assume we have a folder +foo which has
a single sub-folder qux. Now we create the folder +foo/bar/baz.
Here we will need to invalidate the cached sub-folders of +foo,
otherwise completion on +foo won't tell us about the option
+foo/bar!
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-utils.el.gz
;;;###mh-autoload
(defun mh-remove-from-sub-folders-cache (folder)
"Remove FOLDER and its parent from `mh-sub-folders-cache'.
FOLDER should be unconditionally removed from the cache. Also the
last ancestor of FOLDER present in the cache must be removed as
well.
To see why this is needed assume we have a folder +foo which has
a single sub-folder qux. Now we create the folder +foo/bar/baz.
Here we will need to invalidate the cached sub-folders of +foo,
otherwise completion on +foo won't tell us about the option
+foo/bar!"
(remhash folder mh-sub-folders-cache)
(cl-block ancestor-found
(let ((parent folder)
(one-ancestor-found nil)
last-slash)
(while (setq last-slash (mh-search-from-end ?/ parent))
(setq parent (substring parent 0 last-slash))
(unless (eq (gethash parent mh-sub-folders-cache 'none) 'none)
(remhash parent mh-sub-folders-cache)
(if one-ancestor-found
(cl-return-from ancestor-found)
(setq one-ancestor-found t))))
(remhash nil mh-sub-folders-cache))))