X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=7c6cf61ac53ff498706cd3edf10514aa88cc07de;hb=04725cfbe5a8905651b3f6a4dcf1f3dce9a085e1;hp=790136e035594c30aedc77f3e8d4a430b2f9d47d;hpb=f0dfda5c7797f9db81ce35d270fe0ac406c7fca1;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 790136e0..7c6cf61a 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -360,6 +360,18 @@ OBJECT." below string)) +(defun notmuch-map-text-property (start end prop func &optional object) + "Transform text property PROP using FUNC. + +Applies FUNC to each distinct value of the text property PROP +between START and END of OBJECT, setting PROP to the value +returned by FUNC." + (while (< start end) + (let ((value (get-text-property start prop object)) + (next (next-single-property-change start prop object end))) + (put-text-property start next prop (funcall func value) object) + (setq start next)))) + (defun notmuch-logged-error (msg &optional extra) "Log MSG and EXTRA to *Notmuch errors* and signal MSG. @@ -438,7 +450,7 @@ You may need to restart Emacs or upgrade your notmuch package.")) (if err ;; We have an error message straight from the CLI. (notmuch-logged-error - (replace-regexp-in-string "\\s $" "" err) extra) + (replace-regexp-in-string "[ \n\r\t\f]*\\'" "" err) extra) ;; We only have combined output from the CLI; don't inundate ;; the user with it. Mimic `process-lines'. (notmuch-logged-error (format "%s exited with status %s"