Function: hywiki-completion-exit-function

hywiki-completion-exit-function is a byte-compiled function defined in hywiki.el.

Signature

(hywiki-completion-exit-function &rest _)

Documentation

Function called when HyWiki reference completion ends.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-completion-exit-function (&rest _)
  "Function called when HyWiki reference completion ends."
  ;; Find possibly needed closing delimiter and insert it if not already there
  (let ((end-delim (when (characterp hywiki--char-before)
                     (hash-get (char-to-string hywiki--char-before)
                               hywiki--open-close-hasht)))
        (point-at-end (and hywiki--end-pos (>= (point) hywiki--end-pos))))
    (when point-at-end
      (cond ((and end-delim (not (eq (char-after (point)) end-delim)))
             (insert end-delim)
             (goto-char (1- (point))))
            (end-delim)
            (hywiki--start-pos
             ;; No opening or closing delim yet.
             ;; If HyWiki ref has whitespace in it, need to add double
             ;; quotes at the beginning and the end
             (when (seq-contains-p (buffer-substring-no-properties hywiki--start-pos (point))
                                   ?\  #'=)
               (save-excursion
                 (insert ?\")
                 (goto-char hywiki--start-pos)
                 (insert ?\")))))))
  (hywiki-maybe-highlight-reference))