summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-04-24 03:07:38 +0300
committerdefanor <defanor@uberspace.net>2018-04-24 03:07:38 +0300
commit7a7e5714f2e4966203b0bc25f8bd33827c96b24b (patch)
tree561989aa11ba4def7c4daba5371be598f985a2d9
parentc3c944ec936b1980abc0f8adc2615d4e458da8f3 (diff)
downloadhtml-wysiwyg-master.zip
html-wysiwyg-master.tar.gz
html-wysiwyg-master.tar.bz2
Refine initialisationHEADmaster
Rely on minor mode activation/deactivation to hide/show links, remove unnecessary key bindings.
-rw-r--r--html-wysiwyg.el20
1 files changed, 9 insertions, 11 deletions
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 "<a" (+? (not (any "<" ">"))) "href=" (syntax string-quote))