diff options
| author | Stefan Monnier | 2011-05-03 22:19:32 -0300 |
|---|---|---|
| committer | Stefan Monnier | 2011-05-03 22:19:32 -0300 |
| commit | ef80fc093a3b13ee9c1575c54b7831bc9cf2ef8b (patch) | |
| tree | 77f4041776fd0cd73d8c23f86ae292157e5ee361 | |
| parent | dd5a5ee08cb51d0b0be8f92b8d57aa326d7a7295 (diff) | |
| download | emacs-ef80fc093a3b13ee9c1575c54b7831bc9cf2ef8b.tar.gz emacs-ef80fc093a3b13ee9c1575c54b7831bc9cf2ef8b.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2011-05-04 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2011-05-04 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * minibuffer.el (completion--message): New function. | ||
| 4 | (completion--do-completion, minibuffer-complete) | ||
| 5 | (minibuffer-force-complete, minibuffer-complete-word): Use it. | ||
| 6 | (completion--do-completion): Don't ignore completion-auto-help when in | ||
| 7 | icomplete-mode. | ||
| 8 | |||
| 3 | * whitespace.el (whitespace-trailing-regexp): Don't rely on the | 9 | * whitespace.el (whitespace-trailing-regexp): Don't rely on the |
| 4 | internal encoding (e.g. tibetan zero is not whitespace). | 10 | internal encoding (e.g. tibetan zero is not whitespace). |
| 5 | (global-whitespace-mode): Prefer save-current-buffer. | 11 | (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." | |||
| 558 | (defvar completion-fail-discreetly nil | 558 | (defvar completion-fail-discreetly nil |
| 559 | "If non-nil, stay quiet when there is no match.") | 559 | "If non-nil, stay quiet when there is no match.") |
| 560 | 560 | ||
| 561 | (defun completion--message (msg) | ||
| 562 | (if completion-show-inline-help | ||
| 563 | (minibuffer-message msg))) | ||
| 564 | |||
| 561 | (defun completion--do-completion (&optional try-completion-function) | 565 | (defun completion--do-completion (&optional try-completion-function) |
| 562 | "Do the completion and return a summary of what happened. | 566 | "Do the completion and return a summary of what happened. |
| 563 | M = completion was performed, the text was Modified. | 567 | M = completion was performed, the text was Modified. |
| @@ -585,9 +589,9 @@ E = after completion we now have an Exact match. | |||
| 585 | (cond | 589 | (cond |
| 586 | ((null comp) | 590 | ((null comp) |
| 587 | (minibuffer-hide-completions) | 591 | (minibuffer-hide-completions) |
| 588 | (when (and (not completion-fail-discreetly) completion-show-inline-help) | 592 | (unless completion-fail-discreetly |
| 589 | (ding) | 593 | (ding) |
| 590 | (minibuffer-message "No match")) | 594 | (completion--message "No match")) |
| 591 | (minibuffer--bitset nil nil nil)) | 595 | (minibuffer--bitset nil nil nil)) |
| 592 | ((eq t comp) | 596 | ((eq t comp) |
| 593 | (minibuffer-hide-completions) | 597 | (minibuffer-hide-completions) |
| @@ -657,15 +661,13 @@ E = after completion we now have an Exact match. | |||
| 657 | (minibuffer-hide-completions)) | 661 | (minibuffer-hide-completions)) |
| 658 | ;; Show the completion table, if requested. | 662 | ;; Show the completion table, if requested. |
| 659 | ((not exact) | 663 | ((not exact) |
| 660 | (if (cond (icomplete-mode t) | 664 | (if (case completion-auto-help |
| 661 | ((null completion-show-inline-help) t) | 665 | (lazy (eq this-command last-command)) |
| 662 | ((eq completion-auto-help 'lazy) | 666 | (t completion-auto-help)) |
| 663 | (eq this-command last-command)) | ||
| 664 | (t completion-auto-help)) | ||
| 665 | (minibuffer-completion-help) | 667 | (minibuffer-completion-help) |
| 666 | (minibuffer-message "Next char not unique"))) | 668 | (completion--message "Next char not unique"))) |
| 667 | ;; If the last exact completion and this one were the same, it | 669 | ;; If the last exact completion and this one were the same, it |
| 668 | ;; means we've already given a "Next char not unique" message | 670 | ;; means we've already given a "Complete, but not unique" message |
| 669 | ;; and the user's hit TAB again, so now we give him help. | 671 | ;; and the user's hit TAB again, so now we give him help. |
| 670 | ((eq this-command last-command) | 672 | ((eq this-command last-command) |
| 671 | (if completion-auto-help (minibuffer-completion-help)))) | 673 | (if completion-auto-help (minibuffer-completion-help)))) |
| @@ -703,11 +705,9 @@ scroll the window of possible completions." | |||
| 703 | t) | 705 | t) |
| 704 | (t (case (completion--do-completion) | 706 | (t (case (completion--do-completion) |
| 705 | (#b000 nil) | 707 | (#b000 nil) |
| 706 | (#b001 (if completion-show-inline-help | 708 | (#b001 (completion--message "Sole completion") |
| 707 | (minibuffer-message "Sole completion")) | ||
| 708 | t) | 709 | t) |
| 709 | (#b011 (if completion-show-inline-help | 710 | (#b011 (completion--message "Complete, but not unique") |
| 710 | (minibuffer-message "Complete, but not unique")) | ||
| 711 | t) | 711 | t) |
| 712 | (t t))))) | 712 | (t t))))) |
| 713 | 713 | ||
| @@ -765,9 +765,8 @@ Repeated uses step through the possible completions." | |||
| 765 | (end (field-end)) | 765 | (end (field-end)) |
| 766 | (all (completion-all-sorted-completions))) | 766 | (all (completion-all-sorted-completions))) |
| 767 | (if (not (consp all)) | 767 | (if (not (consp all)) |
| 768 | (if completion-show-inline-help | 768 | (completion--message |
| 769 | (minibuffer-message | 769 | (if all "No more completions" "No completions")) |
| 770 | (if all "No more completions" "No completions"))) | ||
| 771 | (setq completion-cycling t) | 770 | (setq completion-cycling t) |
| 772 | (goto-char end) | 771 | (goto-char end) |
| 773 | (insert (car all)) | 772 | (insert (car all)) |
| @@ -955,11 +954,9 @@ Return nil if there is no valid completion, else t." | |||
| 955 | (interactive) | 954 | (interactive) |
| 956 | (case (completion--do-completion 'completion--try-word-completion) | 955 | (case (completion--do-completion 'completion--try-word-completion) |
| 957 | (#b000 nil) | 956 | (#b000 nil) |
| 958 | (#b001 (if completion-show-inline-help | 957 | (#b001 (completion--message "Sole completion") |
| 959 | (minibuffer-message "Sole completion")) | ||
| 960 | t) | 958 | t) |
| 961 | (#b011 (if completion-show-inline-help | 959 | (#b011 (completion--message "Complete, but not unique") |
| 962 | (minibuffer-message "Complete, but not unique")) | ||
| 963 | t) | 960 | t) |
| 964 | (t t))) | 961 | (t t))) |
| 965 | 962 | ||