Function: hywiki--maybe-de/highlight-sexp

hywiki--maybe-de/highlight-sexp is a byte-compiled function defined in hywiki.el.

Signature

(hywiki--maybe-de/highlight-sexp FUNC DIRECTION-NUMBER &optional SEXP-START SEXP-END)

Documentation

De/highlight HyWikiWord with FUNC on a single paired delimiter char.

DIRECTION-NUMBER is 1 for forward scanning and -1 for backward scanning.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki--maybe-de/highlight-sexp (func direction-number &optional sexp-start sexp-end)
  "De/highlight HyWikiWord with FUNC on a single paired delimiter char.
DIRECTION-NUMBER is 1 for forward scanning and -1 for backward scanning."
  (setq sexp-start (or sexp-start (point))
	sexp-end (or sexp-end (scan-sexps sexp-start direction-number)))
  (when (and sexp-start sexp-end)
    (cl-destructuring-bind (start end)
	;; Point may be at end of sexp, so start and end may
	;; need to be reversed.
	(list (min sexp-start sexp-end) (max sexp-start sexp-end))
      ;; When `start' is at a delimiter, increment `sexp-start' so
      ;; regexp matching excludes the delimiter and starts with the
      ;; HyWikiWord.  But include any trailing delimiter or regexp
      ;; matching will not work.
      (save-restriction
	(when (memq (char-after start) '(?< ?> ?{ ?} ?\( ?\) ?\[ ?\] ?\"))
	  (setq start (1+ start)))
	(narrow-to-region start end)
	(prog1 (funcall func start end)
	  (setq hywiki--highlighting-done-flag nil))))))