Function: dynamic-completion-mode
dynamic-completion-mode is an autoloaded, interactive and
byte-compiled function defined in completion.el.gz.
Signature
(dynamic-completion-mode &optional ARG)
Documentation
Toggle dynamic word-completion on or off.
This is a minor mode. If called interactively, toggle the
Dynamic-Completion mode mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the
mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=dynamic-completion-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
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)))