This works like 'report-emacs-bug', but is more geared towards sending
patches to the Emacs issue tracker.
----
-*** 'icomplete-show-matches-on-no-input' behavior change.
-Previously, choosing a different completion with commands like 'C-.'
-and then hitting 'RET' would choose the default completion. Doing
-this will now choose the completion under point.
-
+++
*** The user can now customize how "default" values are prompted for.
The new utility function 'format-prompt' has been added which uses the
*** Change in meaning of 'icomplete-show-matches-on-no-input'.
Previously, choosing a different completion with commands like 'C-.'
and then hitting 'RET' would choose the default completion. Doing this
-will now choose the completion under point instead.
+will now choose the completion under point instead. Also when this option
+is nil, completions are not shown when the minibuffer reads a file name
+with initial input as the default directory.
---
*** The width of the buffer-name column in 'list-buffers' is now dynamic.
selection process starts again from the user's $HOME.")
(defcustom icomplete-show-matches-on-no-input nil
- "When non-nil, show completions when the minibuffer is empty.
+ "When non-nil, show completions when first prompting for input.
+This means to show completions even when the current minibuffer contents
+is the same as was the initial input after minibuffer activation.
This also means that if you traverse the list of completions with
commands like `C-.' and just hit RET without typing any
characters, the match under point will be chosen instead of the
(defvar icomplete-overlay (make-overlay (point-min) (point-min) nil t t)
"Overlay used to display the list of completions.")
+(defvar icomplete--initial-input nil
+ "Initial input in the minibuffer when icomplete-mode was activated.
+Used to implement the option `icomplete-show-matches-on-no-input'.")
+
(defun icomplete-pre-command-hook ()
(let ((non-essential t))
(icomplete-tidy)))
(interactive)
(if (and icomplete-show-matches-on-no-input
(car completion-all-sorted-completions)
- (eql (icomplete--field-end) (icomplete--field-beg)))
+ (equal (icomplete--field-string) icomplete--initial-input))
(icomplete-force-complete-and-exit)
(minibuffer-complete-and-exit)))
(if (or
;; there's some input, meaning the default in off the table by
;; definition; OR
- (> (icomplete--field-end) (icomplete--field-beg))
+ (not (equal (icomplete--field-string) icomplete--initial-input))
;; there's no input, but there's also no minibuffer default
;; (and the user really wants to see completions on no input,
;; meaning he expects a "force" to be at least attempted); OR
"Run in minibuffer on activation to establish incremental completion.
Usually run by inclusion in `minibuffer-setup-hook'."
(when (and icomplete-mode (icomplete-simple-completing-p))
+ (setq-local icomplete--initial-input (icomplete--field-string))
(setq-local completion-show-inline-help nil)
(use-local-map (make-composed-keymap icomplete-minibuffer-map
(current-local-map)))
;; `completing-read' invocations, described below:
for fn in (cond ((and minibuffer-default
(stringp minibuffer-default) ; bug#38992
- (= (icomplete--field-end) (icomplete--field-beg)))
+ (equal (icomplete--field-string) icomplete--initial-input))
;; Here, we have a non-nil string default and
;; no input whatsoever. We want to make sure
;; that the default is bubbled to the top so
(goto-char (point-max))
; Insert the match-status information:
(when (and (or icomplete-show-matches-on-no-input
- (> (icomplete--field-end) (icomplete--field-beg)))
+ (not (equal (icomplete--field-string)
+ icomplete--initial-input)))
(or
;; Don't bother with delay after certain number of chars:
(> (- (point) (icomplete--field-beg))
(or (>= (- (point) (overlay-end rfn-eshadow-overlay)) 2)
(eq ?/ (char-before (- (point) 2)))))
(delete-region (overlay-start rfn-eshadow-overlay)
- (overlay-end rfn-eshadow-overlay)) )
+ (overlay-end rfn-eshadow-overlay)))
(let* ((field-string (icomplete--field-string))
;; Not sure why, but such requests seem to come
;; every once in a while. It's not fully