From: Tomi Ollila Date: Wed, 2 Sep 2015 14:34:39 +0000 (+0300) Subject: emacs: notmuch-show-view-raw-message clears buffer, makes it read-only X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bfb709851406255d87e1427b7c94f3204d9ea743;p=notmuch.git emacs: notmuch-show-view-raw-message clears buffer, makes it read-only notmuch-show-view-raw-message() re-uses buffer created with same name (same Message-Id:) but it did not erase it before filling. If this ever happened, there were duplicated (potentially overlapping) content in the buffer. Now this is fixed. Apparently since emacs 24.5 the (view-buffer) makes the buffer read-only; so this problem would not have happened there, just that notmuch-show-view-raw-message() failed. This is fixed by setting inhibit-read-only t before erasing and filling the buffer. The emacs 24.5 feature having raw message buffer read-only is also now explicitly set to the buffer so the same experience is available with emaces < 24.5. --- diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 793f1a5c..3345878f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1878,12 +1878,15 @@ to show, nil otherwise." "View the original source of the current message." (interactive) (let* ((id (notmuch-show-get-message-id)) - (buf (get-buffer-create (concat "*notmuch-raw-" id "*")))) - (let ((coding-system-for-read 'no-conversion)) - (call-process notmuch-command nil buf nil "show" "--format=raw" id)) + (buf (get-buffer-create (concat "*notmuch-raw-" id "*"))) + (inhibit-read-only t)) (switch-to-buffer buf) + (erase-buffer) + (let ((coding-system-for-read 'no-conversion)) + (call-process notmuch-command nil t nil "show" "--format=raw" id)) (goto-char (point-min)) (set-buffer-modified-p nil) + (setq buffer-read-only t) (view-buffer buf 'kill-buffer-if-not-modified))) (put 'notmuch-show-pipe-message 'notmuch-doc