From 7f8e616f3b1fbe1c4f893c8ba94b13e908dcd8b7 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 20 Oct 2022 12:50:41 +0800 Subject: [PATCH] org-num-mode: Clear remaining num overlays before activation * lisp/org-num.el (org-num-mode): Call `org-num--clear' when enabling the mode. This avoids duplicate overlays when the mode was active prior (org-num-mode +1) call. Reported-by: Ruijie Yu Link: https://orgmode.org/list/sdvbkq8a7lp.fsf@fw.net.yu --- lisp/org-num.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org-num.el b/lisp/org-num.el index 4179d1205..4a57e6a9e 100644 --- a/lisp/org-num.el +++ b/lisp/org-num.el @@ -461,6 +461,7 @@ NUMBERING is a list of numbers." (org-num-mode (unless (derived-mode-p 'org-mode) (user-error "Cannot activate headline numbering outside Org mode")) + (org-num--clear) (setq org-num--numbering nil) (setq org-num--overlays (nreverse (org-num--number-region nil nil))) (add-hook 'after-change-functions #'org-num--verify nil t)