Function: hywiki-get-buttonize-characters

hywiki-get-buttonize-characters is a byte-compiled function defined in hywiki.el.

Signature

(hywiki-get-buttonize-characters)

Documentation

Return a string of Org self-insert keys that have punctuation/symbol syntax.

These trigger HyWiki reference highlighting. Cache the string and automatically invalidate it when global-map or outline-mode-syntax-table changes.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-get-buttonize-characters ()
  "Return a string of Org self-insert keys that have punctuation/symbol syntax.
These trigger HyWiki reference highlighting.  Cache the string and
automatically invalidate it when `global-map' or `outline-mode-syntax-table'
changes."
  (if (stringp hywiki--buttonize-characters-cache)
      hywiki--buttonize-characters-cache
    (let (key
	  cmd
	  key-cmds
	  result)
      ;; Org and other text mode self-insert-command bindings are just
      ;; remaps inherited from global-map.  Create key-cmds list of
      ;; parsable (key . cmd) combinations where key may be a
      ;; (start-key . end-key) range of keys.
      (map-keymap (lambda (key cmd) (setq key-cmds (cons (cons key cmd) key-cmds))) (current-global-map))
      (with-syntax-table hywiki--org-mode-syntax-table
        (setq hywiki--buttonize-characters-cache
              (dolist (key-cmd key-cmds (apply #'string (seq-difference (nreverse result)
                                                                        "-_*#:" #'=)))
                (setq key (car key-cmd)
                      cmd (cdr key-cmd))
                (when (eq cmd 'self-insert-command)
                  (cond ((and (characterp key)
                              (= (char-syntax key) ?.))
                         ;; char with punctuation syntax
                         (setq result (cons key result)))
                        ((and (consp key)
                              (characterp (car key))
                              (characterp (cdr key))
                              (<= (cdr key) 256))
                         ;; ASCII char range, some of which has punctuation/symbol syntax
                         (dolist (k (number-sequence (car key) (cdr key)))
                           (when (memq (char-syntax k) '(?. ?_))
                             (setq result (cons k result)))))))))))))