Function: elisp--completion-local-symbols

elisp--completion-local-symbols is a byte-compiled function defined in elisp-mode.el.gz.

Signature

(elisp--completion-local-symbols)

Documentation

Compute collections of all Elisp symbols for completion purposes.

The return value is compatible with the COLLECTION form described in completion-at-point-functions (which see).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp--completion-local-symbols ()
  "Compute collections of all Elisp symbols for completion purposes.
The return value is compatible with the COLLECTION form described
in `completion-at-point-functions' (which see)."
  (cl-flet ((obarray-plus-shorthands ()
              (let (retval)
                (mapatoms
                 (lambda (s)
                   (push s retval)
                   (cl-loop
                    for (shorthand . longhand) in read-symbol-shorthands
                    for full-name = (symbol-name s)
                    when (string-prefix-p longhand full-name)
                    do (let ((sym (make-symbol
                                   (concat shorthand
                                           (substring full-name
                                                      (length longhand))))))
                         (put sym 'shorthand t)
                         (push sym retval)
                         retval))))
                retval)))
    (cond ((null read-symbol-shorthands) obarray)
          ((and obarray-cache
                (gethash (cons (current-buffer) read-symbol-shorthands)
                         obarray-cache)))
          (obarray-cache
            (puthash (cons (current-buffer) read-symbol-shorthands)
                     (obarray-plus-shorthands)
                     obarray-cache))
          (t
            (setq obarray-cache (make-hash-table :test #'equal))
            (puthash (cons (current-buffer) read-symbol-shorthands)
                     (obarray-plus-shorthands)
                     obarray-cache)))))