* mu4e: check if maildir is readable first (`mu4e~get-maildirs-1')
This commit is contained in:
@ -145,24 +145,25 @@ paths."
|
|||||||
;; first, we get a list of all directory paths under PATH that have a
|
;; first, we get a list of all directory paths under PATH that have a
|
||||||
;; directory 'cur' as leaf; then we we remove from that list all of those that
|
;; directory 'cur' as leaf; then we we remove from that list all of those that
|
||||||
;; don't have tmp, new sister dirs. And there we're done!
|
;; don't have tmp, new sister dirs. And there we're done!
|
||||||
;; 1. get all proper subdirs of the current dir
|
;; 1. get all proper subdirs of the current dir, if it is readable
|
||||||
(let* ((subdirs
|
(when (file-accessible-directory-p path)
|
||||||
(remove-if
|
(let* ((subdirs
|
||||||
(lambda (de)
|
(remove-if
|
||||||
(or (not (file-directory-p (concat path mdir "/" de)))
|
(lambda (de)
|
||||||
(string-match "\\.\\{1,2\\}$" de)))
|
(or (not (file-directory-p (concat path mdir "/" de)))
|
||||||
(directory-files (concat path mdir))))
|
(string-match "\\.\\{1,2\\}$" de)))
|
||||||
;; 2. get the list of dirs with a /cur leaf dir
|
(directory-files (concat path mdir))))
|
||||||
(maildirs '()))
|
;; 2. get the list of dirs with a /cur leaf dir
|
||||||
(dolist (dir subdirs)
|
(maildirs '()))
|
||||||
(when (string= dir "cur")
|
(dolist (dir subdirs)
|
||||||
;; be pedantic, and insist on there being a new/tmp as well
|
(when (string= dir "cur")
|
||||||
(when (and (file-directory-p (concat path mdir "/new" ))
|
;; be pedantic, and insist on there being a new/tmp as well
|
||||||
(file-directory-p (concat path mdir "/tmp")))
|
(when (and (file-directory-p (concat path mdir "/new" ))
|
||||||
(add-to-list 'maildirs (if mdir mdir "/") t)))
|
(file-directory-p (concat path mdir "/tmp")))
|
||||||
(setq maildirs (append maildirs
|
(add-to-list 'maildirs (if mdir mdir "/") t)))
|
||||||
(mu4e~get-maildirs-1 path (concat mdir "/" dir)))))
|
(setq maildirs (append maildirs
|
||||||
maildirs))
|
(mu4e~get-maildirs-1 path (concat mdir "/" dir)))))
|
||||||
|
maildirs)))
|
||||||
|
|
||||||
(defvar mu4e~maildir-list nil "Cached list of maildirs.")
|
(defvar mu4e~maildir-list nil "Cached list of maildirs.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user