Function: minibuffer-electric-default-mode

minibuffer-electric-default-mode is an autoloaded, interactive and byte-compiled function defined in minibuf-eldef.el.gz.

Signature

(minibuffer-electric-default-mode &optional ARG)

Documentation

Toggle Minibuffer Electric Default mode.

Minibuffer Electric Default mode is a global minor mode. When enabled, minibuffer prompts that show a default value only show the default when it's applicable -- that is, when hitting RET would yield the default value. If the user modifies the input such that hitting RET would enter a non-default value, the prompt is modified to remove the default indication.

This is a global minor mode. If called interactively, toggle the Minibuffer-Electric-Default 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 \=minibuffer-electric-default-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/minibuf-eldef.el.gz
;;;###autoload
(define-minor-mode minibuffer-electric-default-mode
  "Toggle Minibuffer Electric Default mode.

Minibuffer Electric Default mode is a global minor mode.  When
enabled, minibuffer prompts that show a default value only show
the default when it's applicable -- that is, when hitting RET
would yield the default value.  If the user modifies the input
such that hitting RET would enter a non-default value, the prompt
is modified to remove the default indication."
  :global t
  :group 'minibuffer
  (if minibuffer-electric-default-mode
      ;; Enable the mode
      (add-hook 'minibuffer-setup-hook 'minibuf-eldef-setup-minibuffer)
    ;; Disable the mode
    (remove-hook 'minibuffer-setup-hook 'minibuf-eldef-setup-minibuffer)
    ;; Remove our entry from any post-command-hook variable's it's still in
    (dolist (minibuf minibuf-eldef-frobbed-minibufs)
      (with-current-buffer minibuf
	(remove-hook 'post-command-hook #'minibuf-eldef-update-minibuffer t)))
    (setq minibuf-eldef-frobbed-minibufs nil)))