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