Function: completion-shorthand-try-completion

completion-shorthand-try-completion is a byte-compiled function defined in minibuffer.el.gz.

Signature

(completion-shorthand-try-completion STRING TABLE PRED POINT)

Documentation

Try completion with read-symbol-shorthands of original buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
;; Shorthand completion
;;
;; Iff there is a (("x-" . "string-library-")) shorthand setup and
;; string-library-foo is in candidates, complete x-foo to it.

(defun completion-shorthand-try-completion (string table pred point)
  "Try completion with `read-symbol-shorthands' of original buffer."
  (cl-loop with expanded
           for (short . long) in
           (with-current-buffer minibuffer--original-buffer
             read-symbol-shorthands)
           for probe =
           (and (> point (length short))
                (string-prefix-p short string)
                (try-completion (setq expanded
                                      (concat long
                                              (substring
                                               string
                                               (length short))))
                                table pred))
           when probe
           do (message "Shorthand expansion")
           and return (cons expanded (max (length long)
                                          (+ (- point (length short))
                                             (length long))))))