From a7964c86d12558396cda0f297ebf8dcc602bab61 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 11 Oct 2013 09:53:39 -0400 Subject: emacs: Sanitize authors and subjects in search and show Authors and subjects can contain embedded, encoded control characters like "\n" and "\t" that mess up display. Transform control characters into spaces everywhere we display them in search and show. --- emacs/notmuch-lib.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'emacs/notmuch-lib.el') diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 58f3313d..65412821 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -243,6 +243,12 @@ depending on the value of `notmuch-poll-script'." "[No Subject]" subject))) +(defun notmuch-sanitize (str) + "Sanitize control character in STR. + +This includes newlines, tabs, and other funny characters." + (replace-regexp-in-string "[[:cntrl:]\x7f\u2028\u2029]+" " " str)) + (defun notmuch-escape-boolean-term (term) "Escape a boolean term for use in a query. -- cgit v1.2.3