Skip to content

Commit

Permalink
inhibit-modification-hooks is set to nil during after-change
Browse files Browse the repository at this point in the history
This may potentially cause very strange issues.
  • Loading branch information
aaronjensen committed May 21, 2020
1 parent 3c1b0d1 commit e1810e0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions auto-rename-tag.el
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ DIRECT can be either only 'backward and 'forward."
(save-excursion
(let ((auto-rename-tag--after-action-active t)
(is-end-tag nil)
(current-word "") (pair-tag-word ""))
(current-word "") (pair-tag-word "")
(inhibit-modification-hooks nil))
;; Goto the first character inside the tag.
(auto-rename-tag--goto-the-start-of-tag-name)

Expand Down Expand Up @@ -423,19 +424,19 @@ DIRECT can be either only 'backward and 'forward."
"Do stuff before buffer is changed."
(auto-rename-tag--before-action))

(defun auto-rename-tag--post-command ()
(defun auto-rename-tag--after-change (&rest _args)
"Do stuff after buffer is changed."
(auto-rename-tag--after-action))

(defun auto-rename-tag--enable ()
"Enable `auto-rename-tag' in current buffer."
(add-hook 'before-change-functions #'auto-rename-tag--before-change nil t)
(add-hook 'post-command-hook #'auto-rename-tag--post-command nil t))
(add-hook 'after-change-functions #'auto-rename-tag--after-change nil t))

(defun auto-rename-tag--disable ()
"Disable `auto-rename-tag' in current buffer."
(remove-hook 'before-change-functions #'auto-rename-tag--before-change t)
(remove-hook 'post-command-hook #'auto-rename-tag--post-command t))
(remove-hook 'after-change-functions #'auto-rename-tag--after-change t))

;;;###autoload
(define-minor-mode auto-rename-tag-mode
Expand Down

0 comments on commit e1810e0

Please sign in to comment.