Function: jinx--add-suggestion

jinx--add-suggestion is a natively compiled function defined in jinx.el.

Signature

(jinx--add-suggestion LIST HT WORD GROUP &optional SUFFIX)

Documentation

Add suggestion WORD to LIST and HT.

The suggestion will get a prefix key. A GROUP and a SUFFIX property are optionally added.

Source Code

;; Defined in /nix/store/b5jnxgwmlp7hh60wfrx7amhrmrpfcqqi-emacs-packages-deps/share/emacs/site-lisp/elpa/jinx-20260926.912/jinx.el
(defun jinx--add-suggestion (list ht word group &optional suffix)
  "Add suggestion WORD to LIST and HT.
The suggestion will get a prefix key.  A GROUP and a SUFFIX property are
optionally added."
  (unless (gethash word ht)
    (add-text-properties
     0 (length word)
     `( jinx--group ,group
        jinx--prefix ,(let ((idx (1+ (hash-table-count ht))))
                        (cond
                         ((< idx 10)
                          (format #("%d " 0 3 (face jinx-key))
                                  idx))
                         ((< (- idx 10) (length jinx--select-keys))
                          (format #("0%c " 0 4 (face jinx-key))
                                  (aref jinx--select-keys (- idx 10))))))
        jinx--suffix ,suffix)
     word)
    (push word (car list))
    (puthash word t ht)))