emacs: escape % in header line format
authorDavid Bremner <david@tethera.net>
Thu, 22 Jan 2015 08:37:32 +0000 (09:37 +0100)
committerDavid Bremner <david@tethera.net>
Sat, 24 Jan 2015 08:38:46 +0000 (09:38 +0100)
We set header-line-format to the message subject, but if the subject
contains percents, the next character is interpreted as a formatting
control, which is not desired.

emacs/notmuch-show.el

index 9f6fe077df0caa5843454c91cd93a27d87db50f6..87b48813987ae859491c2f2bf14f8ec225463806 100644 (file)
@@ -1198,7 +1198,11 @@ function is used."
       (notmuch-show-mapc (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags))))
 
       ;; Set the header line to the subject of the first message.
-      (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject))))
+      (setq header-line-format
+           (replace-regexp-in-string "%" "%%"
+                           (notmuch-sanitize
+                            (notmuch-show-strip-re
+                             (notmuch-show-get-subject)))))
 
       (run-hooks 'notmuch-show-hook))))