Skip to content

Commit

Permalink
Unmark buffer modified at markdown-unfontify-region-wiki-links (#146)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nibble authored and jrblevin committed Jun 29, 2016
1 parent 0b907b9 commit c5f9265
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c5f9265

Please sign in to comment.