* mua updates

This commit is contained in:
Dirk-Jan C. Binnema
2011-08-11 08:23:23 +03:00
parent 550a265a1b
commit 4a995b509c
2 changed files with 12 additions and 11 deletions

View File

@ -99,7 +99,7 @@ parameter is added automatically if `mua/mu-home' is non-nil."
(with-current-buffer standard-output ;; but we also get stderr... (with-current-buffer standard-output ;; but we also get stderr...
(setq rv (apply 'call-process mua/mu-binary nil t nil (setq rv (apply 'call-process mua/mu-binary nil t nil
args)))))) args))))))
(mua/log cmdstr) (mua/log "%s => %S" cmdstr rv)
`(,(if (numberp rv) rv 1) . ,str))) `(,(if (numberp rv) rv 1) . ,str)))
(defun mua/mu-binary-version () (defun mua/mu-binary-version ()
@ -130,7 +130,7 @@ Function returns the target filename if the move succeeds, or
(let ((flagstr (let ((flagstr
(and flags (mua/maildir-flags-to-string flags)))) (and flags (mua/maildir-flags-to-string flags))))
(if (not (file-readable-p src)) (if (not (file-readable-p src))
(mua/warn "Source is not a readable file") (mua/warn "Cannot move unreadable file %s" src)
(let* ((rv (if flagstr (let* ((rv (if flagstr
(mua/mu-run "mv" "--printtarget" (mua/mu-run "mv" "--printtarget"
(concat "--flags=" flagstr) src target) (concat "--flags=" flagstr) src target)
@ -138,7 +138,7 @@ Function returns the target filename if the move succeeds, or
(code (car rv)) (output (cdr rv))) (code (car rv)) (output (cdr rv)))
(if (/= 0 code) (if (/= 0 code)
(mua/warn "Moving message file failed: %s" (if output output "error")) (mua/warn "Moving message file failed: %s" (if output output "error"))
output))))) ;; the full target path (substring output 0 -1)))))) ;; the full target path, minus the \n
(defun mua/maildir-flags-from-path (path) (defun mua/maildir-flags-from-path (path)
"Get the flags for the message at PATH, which does not have to exist. "Get the flags for the message at PATH, which does not have to exist.
@ -156,7 +156,7 @@ and `mua/maildir-flags-to-string'.
"Add message file at PATH to the mu database (using the 'mu "Add message file at PATH to the mu database (using the 'mu
add') command. Return t if it succeed or nil in case of error." add') command. Return t if it succeed or nil in case of error."
(if (not (file-readable-p path)) (if (not (file-readable-p path))
(mua/warn "Path is not a readable file: %s" path) (mua/warn "Cannot add unreadable file: %s" path)
(let* ((rv (mua/mu-run "add" path)) (let* ((rv (mua/mu-run "add" path))
(code (car rv)) (output (cdr rv))) (code (car rv)) (output (cdr rv)))
(if (/= code 0) (if (/= code 0)
@ -179,7 +179,7 @@ succeed or nil in case of error."
at PATH; the format is described in `mua/msg-from-string', and at PATH; the format is described in `mua/msg-from-string', and
that function converts the string into a Lisp object (plist)" that function converts the string into a Lisp object (plist)"
(if (not (file-readable-p path)) (if (not (file-readable-p path))
(mua/warn "Path is note a readable file") (mua/warn "Cannot view unreadable file %s" path)
(let* ((rv (mua/mu-run "view" "--format=sexp" path)) (let* ((rv (mua/mu-run "view" "--format=sexp" path))
(code (car rv)) (str (cdr rv))) (code (car rv)) (str (cdr rv)))
(if (= code 0) (if (= code 0)

View File

@ -121,11 +121,12 @@ Function returns the target filename if the move succeeds, or
\[1\] http://cr.yp.to/proto/maildir.html." \[1\] http://cr.yp.to/proto/maildir.html."
(let ((fulltarget (mua/mu-mv src targetdir flags))) (let ((fulltarget (mua/mu-mv src targetdir flags)))
(if fulltarget (if fulltarget
(progn
(mua/mu-remove src) (mua/mu-remove src)
(unless (string= targetdir "/dev/null") (unless (string= targetdir "/dev/null")
(mua/mu-add fulltarget)) (mua/mu-add fulltarget))
fulltarget) fulltarget)
(mua/warn "Moving message failed"))) (mua/warn "Moving message %s=>%s %S failed" src targetdir flags))))
;; functions for composing new messages (forward, reply and new) ;; functions for composing new messages (forward, reply and new)