Variable: dynamic-completion-mode

dynamic-completion-mode is a customizable variable defined in completion.el.gz.

Value

nil

Documentation

Non-nil if Dynamic-Completion mode is enabled.

See the dynamic-completion-mode(var)/dynamic-completion-mode(fun) command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node (emacs)Easy Customization) or call the function dynamic-completion-mode(var)/dynamic-completion-mode(fun).

Probably introduced at or before Emacs version 20.4.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/completion.el.gz
;;;###autoload
(define-minor-mode dynamic-completion-mode
  "Toggle dynamic word-completion on or off."
  :global t
  ;; This is always good, not specific to dynamic-completion-mode.
  (define-key function-key-map [C-return] [?\C-\r])

  (dolist (x `((find-file-hook		. ,#'completion-find-file-hook)
               (pre-command-hook	. ,#'completion-before-command)
               ;; Save completions when killing Emacs.
               (kill-emacs-hook		. ,#'kill-emacs-save-completions)
               (post-self-insert-hook	. ,#'completion--post-self-insert)

               ;; Install the appropriate mode tables.
               (lisp-mode-hook		. ,#'completion-lisp-mode-hook)
               (c-mode-hook		. ,#'completion-c-mode-hook)
               (fortran-mode-hook	. ,#'completion-setup-fortran-mode)))
    (if dynamic-completion-mode
        (add-hook (car x) (cdr x))
      (remove-hook (car x) (cdr x))))

  ;; "Complete" Key Keybindings.  We don't want to use a minor-mode
  ;; map because these have too high a priority.  We could/should
  ;; probably change the interpretation of minor-mode-map-alist such
  ;; that a map has lower precedence if the symbol is not buffer-local.
  (while completion-saved-bindings
    (let ((binding (pop completion-saved-bindings)))
      (global-set-key (car binding) (cdr binding))))
  (when dynamic-completion-mode
    (dolist (binding
             '(("\M-\r"  . complete)
               ([?\C-\r] . complete)

               ;; Tests -
               ;; (add-completion "cumberland")
               ;; (add-completion "cumberbund")
               ;; cum
               ;; Cumber
               ;; cumbering
               ;; cumb

               ;; Patches to standard keymaps insert completions
               ([remap kill-region] . completion-kill-region)))
      (push (cons (car binding) (lookup-key global-map (car binding)))
            completion-saved-bindings)
      (global-set-key (car binding) (cdr binding)))

    ;; Tests --
    ;; foobarbiz
    ;; foobar
    ;; fooquux
    ;; fooper

    (completion-initialize)))