X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=2fefdadc4e19e17b6f79f0b5b1c1e5350bbe226f;hb=ded713c39d8b0221a3b1b2b52a74966c20c3aba8;hp=fa35fa9fd89384cd16651bd07c767b32f0080ac1;hpb=957fc2e1a7d00636c7eaaf487edae65e7a63dc8f;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index fa35fa9f..2fefdadc 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -198,8 +198,13 @@ on the command line, and then retry your notmuch command"))) (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." @@ -215,7 +220,7 @@ on the command line, and then retry your notmuch command"))) (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.