mirror of https://github.com/djcb/mu.git
mu4e: use mu4e-join-paths
This commit is contained in:
parent
491f9e91ff
commit
29e6c21ed8
|
@ -205,7 +205,7 @@ See `mu4e-trash-folder'." (mu4e--get-folder 'mu4e-trash-folder msg))
|
|||
(mu4e-root-maildir)
|
||||
""
|
||||
(expand-file-name
|
||||
(concat path "/../.."))))))
|
||||
(mu4e-join-paths path ".." ".."))))))
|
||||
|
||||
(defun mu4e-create-maildir-maybe (dir)
|
||||
"Offer to create maildir DIR if it does not exist yet.
|
||||
|
@ -214,12 +214,12 @@ create it -- we cannot be sure creation succeeded here, since this
|
|||
is done asynchronously. Otherwise, return nil. NOte, DIR has to be
|
||||
an absolute path."
|
||||
(if (and (file-exists-p dir) (not (file-directory-p dir)))
|
||||
(mu4e-error "File %s exists, but is not a directory" dir))
|
||||
(cond
|
||||
((file-directory-p dir) t)
|
||||
((yes-or-no-p (mu4e-format "%s does not exist yet. Create now?" dir))
|
||||
(mu4e--server-mkdir dir) t)
|
||||
(t nil)))
|
||||
(mu4e-error "File %s exists, but is not a directory" dir)
|
||||
(cond
|
||||
((file-directory-p dir) t)
|
||||
((yes-or-no-p (mu4e-format "%s does not exist yet. Create now?" dir))
|
||||
(mu4e--server-mkdir dir) t)
|
||||
(t nil))))
|
||||
|
||||
(defun mu4e~get-maildirs-1 (path mdir)
|
||||
"Get maildirs for MDIR under PATH.
|
||||
|
@ -228,19 +228,19 @@ Do so recursively and produce a list of relative paths."
|
|||
(dentries
|
||||
(ignore-errors
|
||||
(directory-files-and-attributes
|
||||
(concat path mdir) nil
|
||||
(mu4e-join-paths path mdir) nil
|
||||
"^[^.]\\|\\.[^.][^.]" t))))
|
||||
(dolist (dentry dentries)
|
||||
(when (and (booleanp (cadr dentry)) (cadr dentry))
|
||||
(if (file-accessible-directory-p
|
||||
(concat (mu4e-root-maildir) "/" mdir "/" (car dentry) "/cur"))
|
||||
(setq dirs (cons (concat mdir (car dentry)) dirs)))
|
||||
(mu4e-join-paths (mu4e-root-maildir) mdir (car dentry) "cur"))
|
||||
(setq dirs
|
||||
(cons (mu4e-join-paths mdir (car dentry)) dirs)))
|
||||
(unless (member (car dentry) '("cur" "new" "tmp"))
|
||||
(setq dirs
|
||||
(append dirs
|
||||
(mu4e~get-maildirs-1 path
|
||||
(concat mdir
|
||||
(car dentry) "/")))))))
|
||||
(mu4e~get-maildirs-1
|
||||
path (mu4e-join-paths mdir (car dentry))))))))
|
||||
dirs))
|
||||
|
||||
(defvar mu4e-cache-maildir-list nil
|
||||
|
@ -265,9 +265,12 @@ the list of maildirs will not change until you restart mu4e."
|
|||
(sort
|
||||
(append
|
||||
(when (file-accessible-directory-p
|
||||
(concat (mu4e-root-maildir) "/cur")) '("/"))
|
||||
(mu4e-join-paths
|
||||
(mu4e-root-maildir) "cur"))
|
||||
'("/"))
|
||||
(mu4e~get-maildirs-1 (mu4e-root-maildir) "/"))
|
||||
(lambda (s1 s2) (string< (downcase s1) (downcase s2))))))
|
||||
(lambda (s1 s2)
|
||||
(string< (downcase s1) (downcase s2))))))
|
||||
mu4e-maildir-list)
|
||||
|
||||
(defun mu4e-ask-maildir (prompt)
|
||||
|
@ -308,7 +311,7 @@ from all maildirs under `mu4e-maildir'."
|
|||
"Like `mu4e-ask-maildir', PROMPT for existence of the maildir.
|
||||
Offer to create it if it does not exist yet."
|
||||
(let* ((mdir (mu4e-ask-maildir prompt))
|
||||
(fullpath (concat (mu4e-root-maildir) mdir)))
|
||||
(fullpath (mu4e-join-paths (mu4e-root-maildir) mdir)))
|
||||
(unless (file-directory-p fullpath)
|
||||
(and (yes-or-no-p
|
||||
(mu4e-format "%s does not exist. Create now?" fullpath))
|
||||
|
|
|
@ -81,12 +81,12 @@ the personal addresses."
|
|||
(defun mu4e-about ()
|
||||
"Show the mu4e \"About\" page."
|
||||
(interactive)
|
||||
(mu4e-info (concat mu4e-doc-dir "/mu4e-about.org")))
|
||||
(mu4e-info (mu4e-join-paths mu4e-doc-dir "mu4e-about.org")))
|
||||
|
||||
(defun mu4e-news ()
|
||||
"Show page with news for the current version of mu4e."
|
||||
(interactive)
|
||||
(mu4e-info (concat mu4e-doc-dir "/NEWS.org")))
|
||||
(mu4e-info (mu4e-join-paths mu4e-doc-dir "NEWS.org")))
|
||||
|
||||
(defun mu4e-baseline-time ()
|
||||
"Show the baseline time."
|
||||
|
|
|
@ -286,7 +286,7 @@ The following marks are available, and the corresponding props:
|
|||
(target (if (string= (substring target 0 1) "/")
|
||||
target
|
||||
(concat "/" target)))
|
||||
(fulltarget (concat (mu4e-root-maildir) target)))
|
||||
(fulltarget (mu4e-join-paths (mu4e-root-maildir) target)))
|
||||
(when (or (file-directory-p fulltarget)
|
||||
(and (yes-or-no-p
|
||||
(format "%s does not exist. Create now?" fulltarget))
|
||||
|
@ -366,7 +366,7 @@ user which one)."
|
|||
|
||||
(defun mu4e--mark-check-target (target)
|
||||
"Check if TARGET exists; if not, offer to create it."
|
||||
(let ((fulltarget (concat (mu4e-root-maildir) target)))
|
||||
(let ((fulltarget (mu4e-join-paths (mu4e-root-maildir) target)))
|
||||
(if (not (mu4e-create-maildir-maybe fulltarget))
|
||||
(mu4e-error "Target dir %s does not exist " fulltarget)
|
||||
target)))
|
||||
|
|
|
@ -595,7 +595,8 @@ Returns either (:update ... ) or (:error ) sexp, which are handled my
|
|||
(unless (or maildir flags)
|
||||
(mu4e-error "At least one of maildir and flags must be specified"))
|
||||
(unless (or (not maildir)
|
||||
(file-exists-p (concat (mu4e-root-maildir) "/" maildir "/")))
|
||||
(file-exists-p
|
||||
(mu4e-join-paths (mu4e-root-maildir) maildir)))
|
||||
(mu4e-error "Target dir does not exist"))
|
||||
(mu4e--server-call-mu
|
||||
`(move
|
||||
|
|
|
@ -118,7 +118,7 @@ is non-nil."
|
|||
(mu4e-error "Please set %S" var))
|
||||
(unless (functionp (symbol-value var)) ;; functions are okay, too
|
||||
(let* ((dir (symbol-value var))
|
||||
(path (concat (mu4e-root-maildir) dir)))
|
||||
(path (mu4e-join-paths (mu4e-root-maildir) dir)))
|
||||
(unless (string= (substring dir 0 1) "/")
|
||||
(mu4e-error "%S must start with a '/'" dir))
|
||||
(unless (mu4e-create-maildir-maybe path)
|
||||
|
|
Loading…
Reference in New Issue