X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=08a86fd37afa757a39ca03ba29baa7b438b8783f;hp=17040ed86bd352343c6ce87296ff8ba2bb4c8752;hb=730b8f61e0cf4b2e8c0f123c0914d472d6df38fc;hpb=662e097984780165e57c7fa1f0ddf450dfeab83d diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 17040ed8..08a86fd3 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -355,6 +355,14 @@ user-friendly queries." "Return a query that matches the message with id ID." (concat "id:" (notmuch-escape-boolean-term id))) +(defun notmuch-hex-encode (str) + "Hex-encode STR (e.g., as used by batch tagging). + +This replaces spaces, percents, and double quotes in STR with +%NN where NN is the hexadecimal value of the character." + (replace-regexp-in-string + "[ %\"]" (lambda (match) (format "%%%02x" (aref match 0))) str)) + ;; (defun notmuch-common-do-stash (text)