From ef80fc093a3b13ee9c1575c54b7831bc9cf2ef8b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 3 May 2011 22:19:32 -0300 Subject: [PATCH] * lisp/minibuffer.el (completion--message): New function. (completion--do-completion, minibuffer-complete) (minibuffer-force-complete, minibuffer-complete-word): Use it. (completion--do-completion): Don't ignore completion-auto-help when in icomplete-mode. --- lisp/ChangeLog | 6 ++++++ lisp/minibuffer.el | 37 +++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 664d59ab41d..65a2ba029dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2011-05-04 Stefan Monnier + * minibuffer.el (completion--message): New function. + (completion--do-completion, minibuffer-complete) + (minibuffer-force-complete, minibuffer-complete-word): Use it. + (completion--do-completion): Don't ignore completion-auto-help when in + icomplete-mode. + * whitespace.el (whitespace-trailing-regexp): Don't rely on the internal encoding (e.g. tibetan zero is not whitespace). (global-whitespace-mode): Prefer save-current-buffer. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7bd256afc79..41399f3f141 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -558,6 +558,10 @@ candidates than this number." (defvar completion-fail-discreetly nil "If non-nil, stay quiet when there is no match.") +(defun completion--message (msg) + (if completion-show-inline-help + (minibuffer-message msg))) + (defun completion--do-completion (&optional try-completion-function) "Do the completion and return a summary of what happened. M = completion was performed, the text was Modified. @@ -585,9 +589,9 @@ E = after completion we now have an Exact match. (cond ((null comp) (minibuffer-hide-completions) - (when (and (not completion-fail-discreetly) completion-show-inline-help) + (unless completion-fail-discreetly (ding) - (minibuffer-message "No match")) + (completion--message "No match")) (minibuffer--bitset nil nil nil)) ((eq t comp) (minibuffer-hide-completions) @@ -657,15 +661,13 @@ E = after completion we now have an Exact match. (minibuffer-hide-completions)) ;; Show the completion table, if requested. ((not exact) - (if (cond (icomplete-mode t) - ((null completion-show-inline-help) t) - ((eq completion-auto-help 'lazy) - (eq this-command last-command)) - (t completion-auto-help)) + (if (case completion-auto-help + (lazy (eq this-command last-command)) + (t completion-auto-help)) (minibuffer-completion-help) - (minibuffer-message "Next char not unique"))) + (completion--message "Next char not unique"))) ;; If the last exact completion and this one were the same, it - ;; means we've already given a "Next char not unique" message + ;; means we've already given a "Complete, but not unique" message ;; and the user's hit TAB again, so now we give him help. ((eq this-command last-command) (if completion-auto-help (minibuffer-completion-help)))) @@ -703,11 +705,9 @@ scroll the window of possible completions." t) (t (case (completion--do-completion) (#b000 nil) - (#b001 (if completion-show-inline-help - (minibuffer-message "Sole completion")) + (#b001 (completion--message "Sole completion") t) - (#b011 (if completion-show-inline-help - (minibuffer-message "Complete, but not unique")) + (#b011 (completion--message "Complete, but not unique") t) (t t))))) @@ -765,9 +765,8 @@ Repeated uses step through the possible completions." (end (field-end)) (all (completion-all-sorted-completions))) (if (not (consp all)) - (if completion-show-inline-help - (minibuffer-message - (if all "No more completions" "No completions"))) + (completion--message + (if all "No more completions" "No completions")) (setq completion-cycling t) (goto-char end) (insert (car all)) @@ -955,11 +954,9 @@ Return nil if there is no valid completion, else t." (interactive) (case (completion--do-completion 'completion--try-word-completion) (#b000 nil) - (#b001 (if completion-show-inline-help - (minibuffer-message "Sole completion")) + (#b001 (completion--message "Sole completion") t) - (#b011 (if completion-show-inline-help - (minibuffer-message "Complete, but not unique")) + (#b011 (completion--message "Complete, but not unique") t) (t t))) -- 2.39.2