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.
When this minor mode is turned on, typing \\`M-RET' or \\`C-RET'
invokes the command `complete', which completes the word or
symbol at point using the record of words/symbols you used
previously and the previously-inserted completions. Typing
a word or moving point across it constitutes \"using\" the
word.
By default, the database of all the dynamic completions that
were inserted by \\[complete] is saved on the file specified
by `save-completions-file-name' when you exit Emacs, and will
be loaded from that file when this mode is enabled in a future
Emacs session.
The following important options control the various aspects of
this mode: `enable-completion', `save-completions-flag', and
`save-completions-retention-time'. Few other less important
options can be found in the `completion' group."
: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)))