Function: hywiki-word-highlight-post-command
hywiki-word-highlight-post-command is a byte-compiled function defined
in hywiki.el.
Signature
(hywiki-word-highlight-post-command)
Documentation
Highlight any HyWikiWord before or after point as a Hyperbole button.
Triggered by post-command-hook for non-character-commands, including
deletion commands and those in hywiki-non-character-commands.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-word-highlight-post-command ()
"Highlight any HyWikiWord before or after point as a Hyperbole button.
Triggered by `post-command-hook' for non-character-commands, including
deletion commands and those in `hywiki-non-character-commands'."
;; (when ert--running-tests
;; (message "Running post-command-hook..."))
(unless (or (eq hywiki--buffer-modified-tick (buffer-modified-tick))
(hywiki-ignore-command-hooks-p))
(setq hywiki--range nil)
(cond ((and (symbolp this-command)
(string-match-p "\\(^\\|-?\\)\\(insert\\|undo\\)\\(-\\|$\\)\\|eval-last-sexp\\|eval-expression\\|read--expression-try-read"
(symbol-name this-command)))
(setq hywiki--end (point))
(when (and hywiki--start (not (eq hywiki--start hywiki--end)))
;; Something has been inserted
(cl-destructuring-bind (start end)
(hywiki--extend-region
(min hywiki--start hywiki--end)
(max hywiki--start hywiki--end))
(hywiki-maybe-dehighlight-references start end)
(hywiki-maybe-highlight-references start end))))
((when (or (memq this-command hywiki-non-character-commands)
(and (symbolp this-command)
(string-match-p "^\\(org-\\)?\\(delete-\\|kill-\\)\\|\\(-delete\\|-kill\\|eval-last-sexp\\|eval-expression\\)\\(-\\|$\\)\\|^\\(hkey-either\\|action-key\\|assist-key\\)" (symbol-name this-command))))
(save-excursion
;; Dehighlight any previously highlighted WikiWord at point
;; before we move to the start of any current WikiWord and
;; rehighlight that.
;; Dehighlight if point is on or between a HyWikiWord
(save-restriction
(narrow-to-region (line-beginning-position) (line-end-position 2))
(hywiki-maybe-dehighlight-between-references))
;; Record the WikiWord from any WikiWord ref that point is on
(unless hywiki--word-pre-command
(setq hywiki--word-pre-command (hywiki-get-singular-wikiword
(or (unless (hywiki-non-hook-context-p)
(hywiki-word-at))
(progn (goto-char (max (point-min)
(1- (point))))
(unless (hywiki-non-hook-context-p)
(hywiki-word-at)))))))
(cond ((marker-position hywiki--buttonize-start)
;; Point was before or after a WikiWord delimiter
(goto-char (1+ hywiki--buttonize-start))
(unless (hywiki-non-hook-context-p)
(set-marker hywiki--buttonize-start nil)
(set-marker hywiki--buttonize-end nil)))
((not (equal (setq hywiki--range
(hywiki-highlight-word-get-range))
'(nil nil nil)))
(cl-destructuring-bind (_ start end)
hywiki--range
(if (and start end)
(progn
;; On a non-delimited HyWikiWord
(set-marker hywiki--buttonize-start start)
(set-marker hywiki--buttonize-end end)
(goto-char start)
(skip-chars-backward "-" (line-beginning-position))
t)
(setq hywiki--range nil)))))
(unless (hywiki-non-hook-context-p)
;; This first rehighlighting is needed to ensure
;; any wikiword before an inserted whitespace character is
;; properly highlighted when separating two words or after a
;; closing delimiter.
(save-excursion
(goto-char (max (1- (point)) (point-min)))
(hywiki--maybe-rehighlight-at-point))
(hywiki--maybe-rehighlight-at-point))))))
(setq hywiki--command-executed-flag nil)))