branch: elpa/eglot-inactive-regions commit 7a274c128788cb3b1b5033d82aa1c1b196d7a277 Author: Filippo Argiolas <filippo.argio...@gmail.com> Commit: Filippo Argiolas <filippo.argio...@gmail.com>
honor no-enable argument when advising load-theme Do nothing if load-theme should not enable a theme. Move load-theme advice to dedicated function so I can keep refresh-all interactive. --- eglot-inactive-regions.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eglot-inactive-regions.el b/eglot-inactive-regions.el index 7c0b91a8c0..9b13021665 100644 --- a/eglot-inactive-regions.el +++ b/eglot-inactive-regions.el @@ -288,11 +288,17 @@ Useful to update colors after a face or theme change." (with-current-buffer buffer (eglot-inactive-regions-refresh))))) +(defun eglot-inactive-regions-refresh-after-theme (&rest args) + "Refresh all on theme changes." + (unless (cl-third args) + (eglot-inactive-regions-refresh-all))) + + (defun eglot-inactive-regions--enable () "Helper method to enable inactive regions minor mode." (add-function :after (default-value 'font-lock-fontify-region-function) #'eglot-inactive-regions--fontify) - (advice-add #'load-theme :after #'eglot-inactive-regions-refresh-all) + (advice-add #'load-theme :after #'eglot-inactive-regions-refresh-after-theme) (add-hook 'change-major-mode-hook #'eglot-inactive-regions-cleanup)) (defun eglot-inactive-regions--disable () @@ -304,7 +310,7 @@ Useful to update colors after a face or theme change." (eglot-inactive-regions-cleanup) (setq eglot-inactive-regions--ranges '()) (setq eglot-inactive-regions--active nil))) - (advice-remove #'load-theme :after #'eglot-inactive-regions-refresh-all) + (advice-remove #'load-theme :after #'eglot-inactive-regions-refresh-after-theme) (remove-hook 'change-major-mode-hook #'eglot-inactive-regions-cleanup)) (defun eglot-inactive-regions--uri-to-path (uri)