From 9df147b8cd60e95cf9a99c1e5313f1f4d2010a49 Mon Sep 17 00:00:00 2001 From: Javier Donaire Date: Tue, 28 Jun 2016 20:41:59 +0200 Subject: [PATCH] Unmark buffer modified at markdown-unfontify-region-wiki-links In Emacs 24.3 some `remove-text-properties` calls, like the ones in `markdown-unfontify-region-wiki-links`, mark the buffer modified. This function is invoked by default from `markdown-mode`, and so it makes that a Markdown buffer is marked modified just by visiting a file or changing to this major mode. This change unsets the buffer modified mark if it wasn't previously set. --- markdown-mode.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index 7584cad4..53f92edd 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -6274,8 +6274,12 @@ See `markdown-wiki-link-p' and `markdown-follow-wiki-link'." (defun markdown-unfontify-region-wiki-links (from to) "Remove wiki link faces from the region specified by FROM and TO." (interactive "*r") - (remove-text-properties from to '(font-lock-face markdown-link-face)) - (remove-text-properties from to '(font-lock-face markdown-missing-link-face))) + (let ((modified (buffer-modified-p))) + (remove-text-properties from to '(font-lock-face markdown-link-face)) + (remove-text-properties from to '(font-lock-face markdown-missing-link-face)) + ;; remove-text-properties marks the buffer modified in emacs 24.3, + ;; undo that if it wasn't originally marked modified + (set-buffer-modified-p modified))) (defun markdown-fontify-region-wiki-links (from to) "Search region given by FROM and TO for wiki links and fontify them.