Function: hywiki-word-set-auto-highlighting

hywiki-word-set-auto-highlighting is a byte-compiled function defined in hywiki.el.

Signature

(hywiki-word-set-auto-highlighting HYWIKI-FROM-MODE HYWIKI-TO-MODE)

Documentation

Set HyWikiWord auto-highlighting based on HYWIKI-FROM-MODE HYWIKI-TO-MODE.

Highlight only those buffers attached to windows.

Auto-highlighting uses pre- and post-command hooks. If an error occurs with one of these hooks, the problematic hook is removed.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-word-set-auto-highlighting (hywiki-from-mode hywiki-to-mode)
  "Set HyWikiWord auto-highlighting based on HYWIKI-FROM-MODE HYWIKI-TO-MODE.
Highlight only those buffers attached to windows.

Auto-highlighting uses pre- and post-command hooks.  If an error
occurs with one of these hooks, the problematic hook is removed."
  (cond ((null hywiki-to-mode)
         (hywiki-mode-disable)
	 ;; Ensure hooks are removed from all hywiki buffers any time
	 ;; mode is disabled
	 (let ((hywiki-mode hywiki-to-mode))
	   (hywiki-word-dehighlight-buffers (hywiki-get-buffers :all))))
	((or (null hywiki-from-mode)
	     (and (eq hywiki-from-mode :pages) (eq hywiki-to-mode :pages))
	     (and (eq hywiki-from-mode :all)   (eq hywiki-to-mode :all)))
	 ;; Don't use `hywiki-get-buffers-in-windows' when
	 ;; highlighting since if edebug this function, it will not
	 ;; highlight. -- rsw, 2026-02-08
	 (hywiki-word-highlight-buffers (hywiki-get-buffers
					 hywiki-to-mode)))
	((and (eq hywiki-from-mode :all) (eq hywiki-to-mode :pages))
	 (hywiki-word-dehighlight-buffers
	  (set:difference (hywiki-get-buffers :all)
			  (hywiki-get-buffers :pages))))
	((and (eq hywiki-from-mode :pages) (eq hywiki-to-mode :all))
	 (hywiki-word-highlight-buffers
          ;; Here the larger set must always be given first to compute any
          ;; difference
	  (set:difference (hywiki-get-buffers :all)
                          (hywiki-get-buffers :pages))))
	(t
	 (error "(hywiki-word-set-auto-highlighting): Inputs must be nil, :pages or :all, not '%s' and '%s'"
		hywiki-from-mode hywiki-to-mode))))