Skip to content

Commit

Permalink
Adds hook markdown-remove-gfm-checkbox-overlays
Browse files Browse the repository at this point in the history
Hook added to change-major-mode-hook when markdown-make-gfm-checkboxes is
non-nil.

Closes #238
  • Loading branch information
rnkn authored and jrblevin committed Sep 18, 2017
1 parent 2d790a7 commit 7050c4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -8594,6 +8594,13 @@ BEG and END are the limits of scanned region."
(progn (goto-char beg) (beginning-of-line) (point))
(progn (goto-char end) (forward-line 1) (point))))))

(defun markdown-remove-gfm-checkbox-overlays ()
"Remove all GFM checkbox overlays in buffer."
(save-excursion
(save-restriction
(widen)
(remove-overlays nil nil 'face 'markdown-gfm-checkbox-face))))


;;; Display inline image =================================================

Expand Down Expand Up @@ -8972,7 +8979,8 @@ position."
;; Make checkboxes buttons
(when markdown-make-gfm-checkboxes-buttons
(markdown-make-gfm-checkboxes-buttons (point-min) (point-max))
(add-hook 'after-change-functions #'markdown-gfm-checkbox-after-change-function t t))
(add-hook 'after-change-functions #'markdown-gfm-checkbox-after-change-function t t)
(add-hook 'change-major-mode-hook #'markdown-remove-gfm-checkbox-overlays t t))

;; edit-indirect
(add-hook 'edit-indirect-after-commit-functions
Expand Down

0 comments on commit 7050c4d

Please sign in to comment.