Skip to content

Commit d1bd8ff

Browse files
committed
inhibit-modification-hooks is set to nil during after-change
This may potentially cause very strange issues.
1 parent 3c1b0d1 commit d1bd8ff

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

auto-rename-tag.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ DIRECT can be either only 'backward and 'forward."
375375
(save-excursion
376376
(let ((auto-rename-tag--after-action-active t)
377377
(is-end-tag nil)
378-
(current-word "") (pair-tag-word ""))
378+
(current-word "") (pair-tag-word "")
379+
(inhibit-modification-hooks nil))
379380
;; Goto the first character inside the tag.
380381
(auto-rename-tag--goto-the-start-of-tag-name)
381382

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

426-
(defun auto-rename-tag--post-command ()
427+
(defun auto-rename-tag--post-command (&rest _args)
427428
"Do stuff after buffer is changed."
428429
(auto-rename-tag--after-action))
429430

430431
(defun auto-rename-tag--enable ()
431432
"Enable `auto-rename-tag' in current buffer."
432433
(add-hook 'before-change-functions #'auto-rename-tag--before-change nil t)
433-
(add-hook 'post-command-hook #'auto-rename-tag--post-command nil t))
434+
(add-hook 'after-change-functions #'auto-rename-tag--post-command nil t))
434435

435436
(defun auto-rename-tag--disable ()
436437
"Disable `auto-rename-tag' in current buffer."
437438
(remove-hook 'before-change-functions #'auto-rename-tag--before-change t)
438-
(remove-hook 'post-command-hook #'auto-rename-tag--post-command t))
439+
(remove-hook 'after-change-functions #'auto-rename-tag--post-command t))
439440

440441
;;;###autoload
441442
(define-minor-mode auto-rename-tag-mode

0 commit comments

Comments
 (0)