Function: hywiki-maybe-dehighlight-reference

hywiki-maybe-dehighlight-reference is an autoloaded, interactive and byte-compiled function defined in hywiki.el.

Signature

(hywiki-maybe-dehighlight-reference &optional ON-REFERENCE)

Documentation

Dehighlight any non-Org link HyWiki page#section at or one char before point.

A call to hywiki-active-in-current-buffer-p at point must return non-nil or this function does nothing.

With optional ON-REFERENCE non-nil, assume point is within the page or section name. Otherwise, if pre-command-hook has set hywiki--buttonize-start hywiki--buttonize-end global variables, use these as the region in which to dehighlight.

Use hywiki-word-face to dehighlight.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
;;;###autoload
(defun hywiki-maybe-dehighlight-reference (&optional on-reference)
  "Dehighlight any non-Org link HyWiki page#section at or one char before point.
A call to `hywiki-active-in-current-buffer-p' at point must return non-nil or
this function does nothing.

With optional ON-REFERENCE non-nil, assume point is within the page or
section name.  Otherwise, if `pre-command-hook' has set
`hywiki--buttonize-start' `hywiki--buttonize-end' global variables,
use these as the region in which to dehighlight.

Use `hywiki-word-face' to dehighlight."
  (interactive)
  (setq hywiki--start nil
	hywiki--end   nil)
  (when (and (hywiki-active-in-current-buffer-p)
	     (or on-reference
		 (and (characterp last-command-event)
		      (string-match (regexp-quote
				     (char-to-string (char-syntax last-command-event)))
				    " _()<>$.\"'")))
             (not executing-kbd-macro)
             (not noninteractive))
    (setq hywiki--highlighting-done-flag nil)
    (with-syntax-table hbut:syntax-table
      (save-excursion
	(save-restriction
	  (when (hywiki--buttonized-region-p)
	    (narrow-to-region hywiki--buttonize-start hywiki--buttonize-end)
	    (goto-char hywiki--buttonize-start))

	  (unless on-reference
	    ;; after page name
	    (skip-syntax-backward ">-"))

	  (hywiki-maybe-dehighlight-balanced-pairs)

	  (unless hywiki--highlighting-done-flag
	    (unless on-reference
	      ;; May be a non-delimiter but HyWikiWord ending punctuation to
	      ;; skip past
	      (skip-chars-backward (hywiki-get-buttonize-characters)))
	    ;; Skip past HyWikiWord or section
	    (skip-syntax-backward "^-$()<>._\"\'")
	    (skip-chars-backward "-_*#:[:alnum:]")

	    (setq hywiki--save-case-fold-search case-fold-search
		  case-fold-search nil
		  hywiki--save-org-link-type-required hywiki-org-link-type-required
		  hywiki-org-link-type-required t)
	    (unless (and (hywiki-maybe-at-wikiword-beginning)
			 (looking-at hywiki--word-and-buttonize-character-regexp)
			 (progn
			   (setq hywiki--word-only (match-string-no-properties 2)
				 hywiki--start (match-beginning 1)
				 hywiki--end   (match-end 1))
			   (hywiki-get-referent hywiki--word-only)))
	      ;; Remove any potential earlier highlighting since the
	      ;; previous word may have changed.
	      (skip-syntax-backward "^-$()<>._\"\'"))

	    (hproperty:but-clear-all-in-list
	     (hproperty:but-get-all-in-region (or hywiki--start (point))
					      (or hywiki--end (1+ (point)))
					      'face hywiki-word-face))))))))