X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=2fefdadc4e19e17b6f79f0b5b1c1e5350bbe226f;hb=81ede90597cb35ea66d473a50c355fe77ee585fe;hp=140d7603ce2d191613911ac4e7e96bbdd0685a0c;hpb=71d6a405815d8c7894e7241a944ff782eb886245;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 140d7603..2fefdadc 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -179,6 +179,13 @@ Otherwise the output will be returned" (setq notmuch--cli-sane-p (= status 0)))) notmuch--cli-sane-p) +(defun notmuch-assert-cli-sane () + (unless (notmuch-cli-sane-p) + (notmuch-logged-error + "notmuch cli seems misconfigured or unconfigured." +"Perhaps you haven't run \"notmuch setup\" yet? Try running this +on the command line, and then retry your notmuch command"))) + (defun notmuch-version () "Return a string with the notmuch version number." (let ((long-string @@ -191,8 +198,13 @@ Otherwise the output will be returned" (defun notmuch-config-get (item) "Return a value from the notmuch configuration." - ;; Trim off the trailing newline - (substring (notmuch-command-to-string "config" "get" item) 0 -1)) + (let* ((val (notmuch-command-to-string "config" "get" item)) + (len (length val))) + ;; Trim off the trailing newline (if the value is empty or not + ;; configured, there will be no newline) + (if (and (> len 0) (= (aref val (- len 1)) ?\n)) + (substring val 0 -1) + val))) (defun notmuch-database-path () "Return the database.path value from the notmuch configuration." @@ -208,7 +220,7 @@ Otherwise the output will be returned" (defun notmuch-user-other-email () "Return the user.other_email value (as a list) from the notmuch configuration." - (split-string (notmuch-config-get "user.other_email") "\n")) + (split-string (notmuch-config-get "user.other_email") "\n" t)) (defun notmuch-poll () "Run \"notmuch new\" or an external script to import mail. @@ -524,7 +536,8 @@ the given type." (if (>= emacs-major-version 24) (defadvice mm-shr (before load-gnus-arts activate) (require 'gnus-art nil t) - (ad-disable-advice 'mm-shr 'before 'load-gnus-arts))) + (ad-disable-advice 'mm-shr 'before 'load-gnus-arts) + (ad-activate 'mm-shr))) (defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto) "Use the mm-decode/mm-view functions to display a part in the