From 7a7e5714f2e4966203b0bc25f8bd33827c96b24b Mon Sep 17 00:00:00 2001 From: defanor Date: Tue, 24 Apr 2018 03:07:38 +0300 Subject: Refine initialisation Rely on minor mode activation/deactivation to hide/show links, remove unnecessary key bindings. --- html-wysiwyg.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'html-wysiwyg.el') diff --git a/html-wysiwyg.el b/html-wysiwyg.el index 1a069fe..f5cab97 100644 --- a/html-wysiwyg.el +++ b/html-wysiwyg.el @@ -36,17 +36,15 @@ (define-minor-mode html-wysiwyg-mode "A minor mode for partial WYSIWYG editing of HTML, akin to org." - :after-hook (html-wysiwyg-initialise) - :keymap `((,(kbd "C-c , e") . html-wysiwyg-edit-link-at-point) - (,(kbd "C-c , h") . html-wysiwyg-hide-links) - (,(kbd "C-c , s") . html-wysiwyg-show-links))) - -(defun html-wysiwyg-initialise () - "Initialises html-wysiwyg-mode." - (interactive) - (add-to-list 'font-lock-extra-managed-props 'invisible) - (add-to-list 'font-lock-extra-managed-props 'help-echo) - (html-wysiwyg-hide-links)) + :keymap `((,(kbd "C-c , e") . html-wysiwyg-edit-link-at-point)) + (if html-wysiwyg-mode + ;; Enabled + (progn + (add-to-list 'font-lock-extra-managed-props 'invisible) + (add-to-list 'font-lock-extra-managed-props 'help-echo) + (html-wysiwyg-hide-links)) + ;; Disabled + (html-wysiwyg-show-links))) (defvar html-wysiwyg-link-match (rx (group ""))) "href=" (syntax string-quote)) -- cgit v1.2.3