Function: command-completion-using-modes-and-keymaps-p

command-completion-using-modes-and-keymaps-p is a byte-compiled function defined in simple.el.gz.

Signature

(command-completion-using-modes-and-keymaps-p SYMBOL BUFFER)

Documentation

Return non-nil if SYMBOL is marked for BUFFER's mode or bound in its keymaps.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun command-completion-using-modes-and-keymaps-p (symbol buffer)
  "Return non-nil if SYMBOL is marked for BUFFER's mode or bound in its keymaps."
  (with-current-buffer buffer
      (let ((keymaps
             ;; The major mode's keymap and any active minor modes.
             (nconc
              (and (current-local-map) (list (current-local-map)))
              (mapcar
               #'cdr
               (seq-filter
                (lambda (elem)
                  (symbol-value (car elem)))
                minor-mode-map-alist)))))
        (or (command-completion-using-modes-p symbol buffer)
            ;; Include commands that are bound in a keymap in the
            ;; current buffer.
            (and (where-is-internal symbol keymaps)
                 ;; But not if they have a command predicate that
                 ;; says that they shouldn't.  (This is the case
                 ;; for `ignore' and `undefined' and similar
                 ;; commands commonly found in keymaps.)
                 (or (null (get symbol 'completion-predicate))
                     (funcall (get symbol 'completion-predicate)
                              symbol buffer)))
            ;; Include customize-* commands (do we need a list of such
            ;; "always available" commands? customizable?)
            (string-match-p "customize-" (symbol-name symbol))))))