diff options
| author | Stefan Monnier | 2008-04-09 19:33:56 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-09 19:33:56 +0000 |
| commit | ba5ff07b2a19846cc8624bfe7f802bc9d38a4867 (patch) | |
| tree | 004000e50574173045cde8e079b1cc2937f38984 | |
| parent | b2ca37cdf37072d90032d5a9b705c71c188312a4 (diff) | |
| download | emacs-ba5ff07b2a19846cc8624bfe7f802bc9d38a4867.tar.gz emacs-ba5ff07b2a19846cc8624bfe7f802bc9d38a4867.zip | |
* minibuffer.el (minibuffer): Move group from cus-edit.el.
(completion-auto-help): Move from C code.
(minibuffer--maybe-completion-help): Remove.
(minibuffer--bitset): New function.
(minibuffer--do-completion): Rename from minibuffer-do-completion.
Renumber a bit. Really complete on string *before* point.
Add argument used for word-completion.
Join trailing / in completion with following text, as done in
minibuffer-complete-word.
Handle new value `lazy' for completion-auto-help.
(minibuffer-try-word-completion): New function extracted from
minibuffer-complete-word.
(minibuffer-complete-word): Use minibuffer--do-completion.
(minibuffer--insert-strings): Rename from
minibuffer-complete-insert-strings.
(exit-minibuffer): Fix typo.
* cus-edit.el (minibuffer): Move group to minibuffer.el.
* cus-start.el: Remove completion-auto-help.
* minibuf.c (Vcompletion_auto_help): Move to minibuffer.el.
(syms_of_minibuf): Remove its initialization.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/ChangeLog | 31 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 5 | ||||
| -rw-r--r-- | lisp/cus-start.el | 1 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 234 | ||||
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/minibuf.c | 10 |
7 files changed, 159 insertions, 129 deletions
| @@ -65,6 +65,10 @@ default toolkit, but you can use --with-x-toolkit=gtk if necessary. | |||
| 65 | 65 | ||
| 66 | * Changes in Emacs 23.1 | 66 | * Changes in Emacs 23.1 |
| 67 | 67 | ||
| 68 | ** `completion-auto-help' can be set to `lazy' to list the completions only | ||
| 69 | if you repeat the completion. This was already supported in | ||
| 70 | `partial-completion-mode'. | ||
| 71 | |||
| 68 | ** Emacs now supports using both X displays and ttys in one session. | 72 | ** Emacs now supports using both X displays and ttys in one session. |
| 69 | Start the server (M-x server-start). Then `emacsclient -t' creates a | 73 | Start the server (M-x server-start). Then `emacsclient -t' creates a |
| 70 | tty frame connected to the running emacs server. You can also use any | 74 | tty frame connected to the running emacs server. You can also use any |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb50cb7ad2b..ad1ce6d8bb4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,9 +1,30 @@ | |||
| 1 | 2008-04-09 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuffer.el (minibuffer): Move group from cus-edit.el. | ||
| 4 | (completion-auto-help): Move from C code. | ||
| 5 | (minibuffer--maybe-completion-help): Remove. | ||
| 6 | (minibuffer--bitset): New function. | ||
| 7 | (minibuffer--do-completion): Rename from minibuffer-do-completion. | ||
| 8 | Renumber a bit. Really complete on string *before* point. | ||
| 9 | Add argument used for word-completion. | ||
| 10 | Join trailing / in completion with following text, as done in | ||
| 11 | minibuffer-complete-word. | ||
| 12 | Handle new value `lazy' for completion-auto-help. | ||
| 13 | (minibuffer-try-word-completion): New function extracted from | ||
| 14 | minibuffer-complete-word. | ||
| 15 | (minibuffer-complete-word): Use minibuffer--do-completion. | ||
| 16 | (minibuffer--insert-strings): Rename from | ||
| 17 | minibuffer-complete-insert-strings. | ||
| 18 | (exit-minibuffer): Fix typo. | ||
| 19 | * cus-edit.el (minibuffer): Move group to minibuffer.el. | ||
| 20 | * cus-start.el: Remove completion-auto-help. | ||
| 21 | |||
| 1 | 2008-04-09 Alexandre Julliard <julliard@winehq.org> | 22 | 2008-04-09 Alexandre Julliard <julliard@winehq.org> |
| 2 | 23 | ||
| 3 | * vc.el (vc-status-add-entries): New function. | 24 | * vc.el (vc-status-add-entries): New function. |
| 4 | (vc-status-add-entry): Removed. | 25 | (vc-status-add-entry): Remove. |
| 5 | (vc-update-vc-status-buffer, vc-status-mark-buffer-changed): Use | 26 | (vc-update-vc-status-buffer, vc-status-mark-buffer-changed): |
| 6 | vc-status-add-entries. | 27 | Use vc-status-add-entries. |
| 7 | 28 | ||
| 8 | * emacs-lisp/ewoc.el (ewoc-collect): Return results in the correct | 29 | * emacs-lisp/ewoc.el (ewoc-collect): Return results in the correct |
| 9 | order. | 30 | order. |
| @@ -18,8 +39,8 @@ | |||
| 18 | 39 | ||
| 19 | 2008-04-09 Chong Yidong <cyd@stupidchicken.com> | 40 | 2008-04-09 Chong Yidong <cyd@stupidchicken.com> |
| 20 | 41 | ||
| 21 | * emacs-lisp/regexp-opt.el (regexp-opt): Reduce | 42 | * emacs-lisp/regexp-opt.el (regexp-opt): |
| 22 | max-lisp-eval-depth and max-specpdl-size to 10000. | 43 | Reduce max-lisp-eval-depth and max-specpdl-size to 10000. |
| 23 | 44 | ||
| 24 | 2008-04-09 Lennart Borgman <lennart.borgman@gmail.com> | 45 | 2008-04-09 Lennart Borgman <lennart.borgman@gmail.com> |
| 25 | 46 | ||
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index b1a9cf93e9e..ea0253304af 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -416,11 +416,6 @@ | |||
| 416 | "Debugging Emacs itself." | 416 | "Debugging Emacs itself." |
| 417 | :group 'development) | 417 | :group 'development) |
| 418 | 418 | ||
| 419 | (defgroup minibuffer nil | ||
| 420 | "Controlling the behavior of the minibuffer." | ||
| 421 | :link '(custom-manual "(emacs)Minibuffer") | ||
| 422 | :group 'environment) | ||
| 423 | |||
| 424 | (defgroup keyboard nil | 419 | (defgroup keyboard nil |
| 425 | "Input from the keyboard." | 420 | "Input from the keyboard." |
| 426 | :group 'environment) | 421 | :group 'environment) |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index f6d4a03563c..2227735582e 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -248,7 +248,6 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 248 | ;;; (const :tag " current dir" nil) | 248 | ;;; (const :tag " current dir" nil) |
| 249 | ;;; (directory :format "%v")))) | 249 | ;;; (directory :format "%v")))) |
| 250 | ;; minibuf.c | 250 | ;; minibuf.c |
| 251 | (completion-auto-help minibuffer boolean) | ||
| 252 | (enable-recursive-minibuffers minibuffer boolean) | 251 | (enable-recursive-minibuffers minibuffer boolean) |
| 253 | (history-length minibuffer | 252 | (history-length minibuffer |
| 254 | (choice (const :tag "Infinite" t) integer) | 253 | (choice (const :tag "Infinite" t) integer) |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d3ce8231cce..8815a72222a 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -21,6 +21,9 @@ | |||
| 21 | 21 | ||
| 22 | ;;; Commentary: | 22 | ;;; Commentary: |
| 23 | 23 | ||
| 24 | ;; Names starting with "minibuffer--" are for functions and variables that | ||
| 25 | ;; are meant to be for internal use only. | ||
| 26 | |||
| 24 | ;; TODO: | 27 | ;; TODO: |
| 25 | ;; - merge do-completion and complete-word | 28 | ;; - merge do-completion and complete-word |
| 26 | ;; - move all I/O out of do-completion | 29 | ;; - move all I/O out of do-completion |
| @@ -29,6 +32,11 @@ | |||
| 29 | 32 | ||
| 30 | (eval-when-compile (require 'cl)) | 33 | (eval-when-compile (require 'cl)) |
| 31 | 34 | ||
| 35 | (defgroup minibuffer nil | ||
| 36 | "Controlling the behavior of the minibuffer." | ||
| 37 | :link '(custom-manual "(emacs)Minibuffer") | ||
| 38 | :group 'environment) | ||
| 39 | |||
| 32 | (defun minibuffer-message (message &rest args) | 40 | (defun minibuffer-message (message &rest args) |
| 33 | "Temporarily display MESSAGE at the end of the minibuffer. | 41 | "Temporarily display MESSAGE at the end of the minibuffer. |
| 34 | The text is displayed for `minibuffer-message-timeout' seconds, | 42 | The text is displayed for `minibuffer-message-timeout' seconds, |
| @@ -37,7 +45,7 @@ Enclose MESSAGE in [...] if this is not yet the case. | |||
| 37 | If ARGS are provided, then pass MESSAGE through `format'." | 45 | If ARGS are provided, then pass MESSAGE through `format'." |
| 38 | ;; Clear out any old echo-area message to make way for our new thing. | 46 | ;; Clear out any old echo-area message to make way for our new thing. |
| 39 | (message nil) | 47 | (message nil) |
| 40 | (unless (string-match "\\[.+\\]" message) | 48 | (unless (and (null args) (string-match "\\[.+\\]" message)) |
| 41 | (setq message (concat " [" message "]"))) | 49 | (setq message (concat " [" message "]"))) |
| 42 | (when args (setq message (apply 'format message args))) | 50 | (when args (setq message (apply 'format message args))) |
| 43 | (let ((ol (make-overlay (point-max) (point-max) nil t t))) | 51 | (let ((ol (make-overlay (point-max) (point-max) nil t t))) |
| @@ -57,33 +65,45 @@ That is what completion commands operate on." | |||
| 57 | If the current buffer is not a minibuffer, erase its entire contents." | 65 | If the current buffer is not a minibuffer, erase its entire contents." |
| 58 | (delete-field)) | 66 | (delete-field)) |
| 59 | 67 | ||
| 60 | (defun minibuffer--maybe-completion-help () | 68 | (defcustom completion-auto-help t |
| 61 | (if completion-auto-help | 69 | "Non-nil means automatically provide help for invalid completion input. |
| 62 | (minibuffer-completion-help) | 70 | If the value is t the *Completion* buffer is displayed whenever completion |
| 63 | (minibuffer-message "Next char not unique"))) | 71 | is requested but cannot be done. |
| 64 | 72 | If the value is `lazy', the *Completions* buffer is only displayed after | |
| 65 | (defun minibuffer-do-completion () | 73 | the second failed attempt to complete." |
| 74 | :type (choice (const nil) (const t) (const lazy)) | ||
| 75 | :group 'minibuffer) | ||
| 76 | |||
| 77 | (defun minibuffer--bitset (modified completions exact) | ||
| 78 | (logior (if modified 4 0) | ||
| 79 | (if completions 2 0) | ||
| 80 | (if exact 1 0))) | ||
| 81 | |||
| 82 | (defun minibuffer--do-completion (&optional try-completion-function) | ||
| 66 | "Do the completion and return a summary of what happened. | 83 | "Do the completion and return a summary of what happened. |
| 67 | C = There were available completions. | 84 | M = completion was performed, the text was Modified. |
| 68 | E = After completion we now have an exact match. | 85 | C = there were available Completions. |
| 69 | M = Completion was performed, the text was Modified. | 86 | E = after completion we now have an Exact match. |
| 70 | 87 | ||
| 71 | CEM | 88 | MCE |
| 72 | 000 0 no possible completion | 89 | 000 0 no possible completion |
| 73 | 010 1 was already an exact and unique completion | 90 | 001 1 was already an exact and unique completion |
| 74 | 110 3 was already an exact completion | 91 | 010 2 no completion happened |
| 75 | 111 4 completed to an exact completion | 92 | 011 3 was already an exact completion |
| 76 | 101 5 some completion happened | 93 | 100 4 ??? impossible |
| 77 | 100 6 no completion happened" | 94 | 101 5 ??? impossible |
| 78 | (let* ((string (minibuffer-completion-contents)) | 95 | 110 6 some completion happened |
| 79 | (completion (try-completion (field-string) | 96 | 111 7 completed to an exact completion" |
| 80 | minibuffer-completion-table | 97 | (let* ((beg (field-beginning)) |
| 81 | minibuffer-completion-predicate))) | 98 | (string (buffer-substring beg (point))) |
| 82 | (setq last-exact-completion nil) | 99 | (completion (funcall (or try-completion-function 'try-completion) |
| 100 | string | ||
| 101 | minibuffer-completion-table | ||
| 102 | minibuffer-completion-predicate))) | ||
| 83 | (cond | 103 | (cond |
| 84 | ((null completion) | 104 | ((null completion) |
| 85 | (ding) (minibuffer-message "No match") 0) | 105 | (ding) (minibuffer-message "No match") (minibuffer--bitset nil nil nil)) |
| 86 | ((eq t completion) 1) ;Exact and unique match. | 106 | ((eq t completion) (minibuffer--bitset nil nil t)) ;Exact and unique match. |
| 87 | (t | 107 | (t |
| 88 | ;; `completed' should be t if some completion was done, which doesn't | 108 | ;; `completed' should be t if some completion was done, which doesn't |
| 89 | ;; include simply changing the case of the entered string. However, | 109 | ;; include simply changing the case of the entered string. However, |
| @@ -93,34 +113,46 @@ M = Completion was performed, the text was Modified. | |||
| 93 | (unchanged (eq t (compare-strings completion nil nil | 113 | (unchanged (eq t (compare-strings completion nil nil |
| 94 | string nil nil nil)))) | 114 | string nil nil nil)))) |
| 95 | (unless unchanged | 115 | (unless unchanged |
| 96 | (let ((beg (field-beginning)) | 116 | ;; Merge a trailing / in completion with a / after point. |
| 97 | (end (point))) | 117 | ;; We used to only do it for word completion, but it seems to make |
| 118 | ;; sense for all completions. | ||
| 119 | (if (and (eq ?/ (aref completion (1- (length completion)))) | ||
| 120 | (< (point) (field-end)) | ||
| 121 | (eq ?/ (char-after))) | ||
| 122 | (setq completion (substring completion 0 -1))) | ||
| 123 | |||
| 124 | ;; Insert in minibuffer the chars we got. | ||
| 125 | (let ((end (point))) | ||
| 98 | (insert completion) | 126 | (insert completion) |
| 99 | (delete-region beg end))) | 127 | (delete-region beg end))) |
| 128 | |||
| 100 | (if (not (or unchanged completed)) | 129 | (if (not (or unchanged completed)) |
| 101 | ;; The case of the string changed, but that's all. We're not sure | 130 | ;; The case of the string changed, but that's all. We're not sure |
| 102 | ;; whether this is a unique completion or not, so try again using | 131 | ;; whether this is a unique completion or not, so try again using |
| 103 | ;; the real case (this shouldn't recurse again, because the next | 132 | ;; the real case (this shouldn't recurse again, because the next |
| 104 | ;; time try-completion will return either t or the exact string). | 133 | ;; time try-completion will return either t or the exact string). |
| 105 | (minibuffer-do-completion) | 134 | (minibuffer--do-completion) |
| 106 | 135 | ||
| 107 | ;; It did find a match. Do we match some possibility exactly now? | 136 | ;; It did find a match. Do we match some possibility exactly now? |
| 108 | (let ((exact (test-completion (field-string) | 137 | (let ((exact (test-completion (field-string) |
| 109 | minibuffer-completion-table | 138 | minibuffer-completion-table |
| 110 | minibuffer-completion-predicate))) | 139 | minibuffer-completion-predicate))) |
| 111 | (cond | 140 | (unless completed |
| 112 | ((not exact) | 141 | ;; Show the completion table, if requested. |
| 113 | (if completed 5 | 142 | (cond |
| 114 | (minibuffer--maybe-completion-help) | 143 | ((not exact) |
| 115 | 6)) | 144 | (if (case completion-auto-help |
| 116 | (completed 4) | 145 | (lazy (eq this-command last-command)) |
| 117 | (t | 146 | (t completion-auto-help)) |
| 118 | ;; If the last exact completion and this one were the same, | 147 | (minibuffer-completion-help) |
| 119 | ;; it means we've already given a "Complete but not unique" | 148 | (minibuffer-message "Next char not unique"))) |
| 120 | ;; message and the user's hit TAB again, so now we give him help. | 149 | ;; If the last exact completion and this one were the same, |
| 121 | (if (eq this-command last-command) | 150 | ;; it means we've already given a "Complete but not unique" |
| 122 | (minibuffer-completion-help)) | 151 | ;; message and the user's hit TAB again, so now we give him help. |
| 123 | 3))))))))) | 152 | ((eq this-command last-command) |
| 153 | (if completion-auto-help (minibuffer-completion-help))))) | ||
| 154 | |||
| 155 | (minibuffer--bitset completed t exact)))))))) | ||
| 124 | 156 | ||
| 125 | (defun minibuffer-complete () | 157 | (defun minibuffer-complete () |
| 126 | "Complete the minibuffer contents as far as possible. | 158 | "Complete the minibuffer contents as far as possible. |
| @@ -146,16 +178,15 @@ scroll the window of possible completions." | |||
| 146 | (scroll-other-window)) | 178 | (scroll-other-window)) |
| 147 | nil) | 179 | nil) |
| 148 | 180 | ||
| 149 | (let ((i (minibuffer-do-completion))) | 181 | (case (minibuffer--do-completion) |
| 150 | (case i | 182 | (0 nil) |
| 151 | (0 nil) | 183 | (1 (goto-char (field-end)) |
| 152 | (1 (goto-char (field-end)) | 184 | (minibuffer-message "Sole completion") |
| 153 | (minibuffer-message "Sole completion") | 185 | t) |
| 154 | t) | 186 | (3 (goto-char (field-end)) |
| 155 | (3 (goto-char (field-end)) | 187 | (minibuffer-message "Complete, but not unique") |
| 156 | (minibuffer-message "Complete, but not unique") | 188 | t) |
| 157 | t) | 189 | (t t))))) |
| 158 | (t t)))))) | ||
| 159 | 190 | ||
| 160 | (defun minibuffer-complete-and-exit () | 191 | (defun minibuffer-complete-and-exit () |
| 161 | "If the minibuffer contents is a valid completion then exit. | 192 | "If the minibuffer contents is a valid completion then exit. |
| @@ -195,33 +226,21 @@ a repetition of this command will exit." | |||
| 195 | 226 | ||
| 196 | (t | 227 | (t |
| 197 | ;; Call do-completion, but ignore errors. | 228 | ;; Call do-completion, but ignore errors. |
| 198 | (let ((i (condition-case nil | 229 | (case (condition-case nil |
| 199 | (minibuffer-do-completion) | 230 | (minibuffer--do-completion) |
| 200 | (error 1)))) | 231 | (error 1)) |
| 201 | (case i | 232 | ((1 3) (exit-minibuffer)) |
| 202 | ((1 3) (exit-minibuffer)) | 233 | (7 (if (not minibuffer-completion-confirm) |
| 203 | (4 (if (not minibuffer-completion-confirm) | 234 | (exit-minibuffer) |
| 204 | (exit-minibuffer) | 235 | (minibuffer-message "Confirm") |
| 205 | (minibuffer-message "Confirm") | 236 | nil)) |
| 206 | nil)) | 237 | (t nil))))) |
| 207 | (t nil)))))) | 238 | |
| 239 | (defun minibuffer-try-word-completion (string table predicate) | ||
| 240 | (let ((completion (try-completion string table predicate))) | ||
| 241 | (if (not (stringp completion)) | ||
| 242 | completion | ||
| 208 | 243 | ||
| 209 | (defun minibuffer-complete-word () | ||
| 210 | "Complete the minibuffer contents at most a single word. | ||
| 211 | After one word is completed as much as possible, a space or hyphen | ||
| 212 | is added, provided that matches some possible completion. | ||
| 213 | Return nil if there is no valid completion, else t." | ||
| 214 | (interactive) | ||
| 215 | (let* ((beg (field-beginning)) | ||
| 216 | (string (buffer-substring beg (point))) | ||
| 217 | (completion (try-completion string | ||
| 218 | minibuffer-completion-table | ||
| 219 | minibuffer-completion-predicate))) | ||
| 220 | (cond | ||
| 221 | ((null completion) | ||
| 222 | (ding) (minibuffer-message "No match") nil) | ||
| 223 | ((eq t completion) nil) ;Exact and unique match. | ||
| 224 | (t | ||
| 225 | ;; Completing a single word is actually more difficult than completing | 244 | ;; Completing a single word is actually more difficult than completing |
| 226 | ;; as much as possible, because we first have to find the "current | 245 | ;; as much as possible, because we first have to find the "current |
| 227 | ;; position" in `completion' in order to find the end of the word | 246 | ;; position" in `completion' in order to find the end of the word |
| @@ -239,10 +258,7 @@ Return nil if there is no valid completion, else t." | |||
| 239 | (substitute-in-file-name string) | 258 | (substitute-in-file-name string) |
| 240 | (error string)))) | 259 | (error string)))) |
| 241 | (unless (eq string substituted) | 260 | (unless (eq string substituted) |
| 242 | (setq string substituted) | 261 | (setq string substituted)))) |
| 243 | (let ((end (point))) | ||
| 244 | (insert substituted) | ||
| 245 | (delete-region beg end))))) | ||
| 246 | 262 | ||
| 247 | ;; Make buffer (before point) contain the longest match | 263 | ;; Make buffer (before point) contain the longest match |
| 248 | ;; of `string's tail and `completion's head. | 264 | ;; of `string's tail and `completion's head. |
| @@ -255,8 +271,7 @@ Return nil if there is no valid completion, else t." | |||
| 255 | (setq startpos (1+ startpos)) | 271 | (setq startpos (1+ startpos)) |
| 256 | (setq length (1- length))) | 272 | (setq length (1- length))) |
| 257 | 273 | ||
| 258 | (setq string (substring string startpos)) | 274 | (setq string (substring string startpos))) |
| 259 | (delete-region beg (+ beg startpos))) | ||
| 260 | 275 | ||
| 261 | ;; Now `string' is a prefix of `completion'. | 276 | ;; Now `string' is a prefix of `completion'. |
| 262 | 277 | ||
| @@ -267,31 +282,34 @@ Return nil if there is no valid completion, else t." | |||
| 267 | tem) | 282 | tem) |
| 268 | (while (and exts (not (stringp tem))) | 283 | (while (and exts (not (stringp tem))) |
| 269 | (setq tem (try-completion (concat string (pop exts)) | 284 | (setq tem (try-completion (concat string (pop exts)) |
| 270 | minibuffer-completion-table | 285 | table predicate))) |
| 271 | minibuffer-completion-predicate))) | ||
| 272 | (if (stringp tem) (setq completion tem)))) | 286 | (if (stringp tem) (setq completion tem)))) |
| 273 | 287 | ||
| 274 | (if (= (length string) (length completion)) | 288 | ;; Otherwise cut after the first word. |
| 275 | ;; If got no characters, print help for user. | 289 | (if (string-match "\\W" completion (length string)) |
| 276 | (progn | 290 | ;; First find first word-break in the stuff found by completion. |
| 277 | (if completion-auto-help (minibuffer-completion-help)) | 291 | ;; i gets index in string of where to stop completing. |
| 278 | nil) | 292 | (substring completion 0 (match-end 0)) |
| 279 | ;; Otherwise insert in minibuffer the chars we got. | 293 | completion)))) |
| 280 | (if (string-match "\\W" completion (length string)) | 294 | |
| 281 | ;; First find first word-break in the stuff found by completion. | 295 | |
| 282 | ;; i gets index in string of where to stop completing. | 296 | (defun minibuffer-complete-word () |
| 283 | (setq completion (substring completion 0 (match-end 0)))) | 297 | "Complete the minibuffer contents at most a single word. |
| 284 | 298 | After one word is completed as much as possible, a space or hyphen | |
| 285 | (if (and (eq ?/ (aref completion (1- (length completion)))) | 299 | is added, provided that matches some possible completion. |
| 286 | (eq ?/ (char-after))) | 300 | Return nil if there is no valid completion, else t." |
| 287 | (setq completion (substring completion 0 (1- (length completion))))) | 301 | (interactive) |
| 288 | 302 | (case (minibuffer--do-completion 'minibuffer-try-word-completion) | |
| 289 | (let ((pos (point))) | 303 | (0 nil) |
| 290 | (insert completion) | 304 | (1 (goto-char (field-end)) |
| 291 | (delete-region beg pos) | 305 | (minibuffer-message "Sole completion") |
| 292 | t)))))) | 306 | t) |
| 293 | 307 | (3 (goto-char (field-end)) | |
| 294 | (defun minibuffer-complete-insert-strings (strings) | 308 | (minibuffer-message "Complete, but not unique") |
| 309 | t) | ||
| 310 | (t t))) | ||
| 311 | |||
| 312 | (defun minibuffer--insert-strings (strings) | ||
| 295 | "Insert a list of STRINGS into the current buffer. | 313 | "Insert a list of STRINGS into the current buffer. |
| 296 | Uses columns to keep the listing readable but compact. | 314 | Uses columns to keep the listing readable but compact. |
| 297 | It also eliminates runs of equal strings." | 315 | It also eliminates runs of equal strings." |
| @@ -378,7 +396,7 @@ during running `completion-setup-hook'." | |||
| 378 | (insert "There are no possible completions of what you have typed.") | 396 | (insert "There are no possible completions of what you have typed.") |
| 379 | 397 | ||
| 380 | (insert "Possible completions are:\n") | 398 | (insert "Possible completions are:\n") |
| 381 | (minibuffer-complete-insert-strings completions)))) | 399 | (minibuffer--insert-strings completions)))) |
| 382 | (let ((completion-common-substring common-substring)) | 400 | (let ((completion-common-substring common-substring)) |
| 383 | (run-hooks 'completion-setup-hook)) | 401 | (run-hooks 'completion-setup-hook)) |
| 384 | nil) | 402 | nil) |
| @@ -421,7 +439,7 @@ during running `completion-setup-hook'." | |||
| 421 | ;; A better solution would be to make deactivate-mark buffer-local | 439 | ;; A better solution would be to make deactivate-mark buffer-local |
| 422 | ;; (or to turn it into a list of buffers, ...), but in the mean time, | 440 | ;; (or to turn it into a list of buffers, ...), but in the mean time, |
| 423 | ;; this should do the trick in most cases. | 441 | ;; this should do the trick in most cases. |
| 424 | (setq deactivate_mark nil) | 442 | (setq deactivate-mark nil) |
| 425 | (throw 'exit nil)) | 443 | (throw 'exit nil)) |
| 426 | 444 | ||
| 427 | (defun self-insert-and-exit () | 445 | (defun self-insert-and-exit () |
diff --git a/src/ChangeLog b/src/ChangeLog index 893af47ccc7..88a86246728 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2008-04-09 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-04-09 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * minibuf.c (Vcompletion_auto_help): Move to minibuffer.el. | ||
| 4 | (syms_of_minibuf): Remove its initialization. | ||
| 5 | |||
| 3 | * minibuf.c (temp_echo_area_glyphs): Remove unused function. | 6 | * minibuf.c (temp_echo_area_glyphs): Remove unused function. |
| 4 | 7 | ||
| 5 | 2008-04-09 Juanma Barranquero <lekktu@gmail.com> | 8 | 2008-04-09 Juanma Barranquero <lekktu@gmail.com> |
diff --git a/src/minibuf.c b/src/minibuf.c index 8cdea645d34..dae6918e073 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -55,10 +55,6 @@ Lisp_Object minibuf_save_list; | |||
| 55 | 55 | ||
| 56 | int minibuf_level; | 56 | int minibuf_level; |
| 57 | 57 | ||
| 58 | /* Nonzero means display completion help for invalid input. */ | ||
| 59 | |||
| 60 | Lisp_Object Vcompletion_auto_help; | ||
| 61 | |||
| 62 | /* The maximum length of a minibuffer history. */ | 58 | /* The maximum length of a minibuffer history. */ |
| 63 | 59 | ||
| 64 | Lisp_Object Qhistory_length, Vhistory_length; | 60 | Lisp_Object Qhistory_length, Vhistory_length; |
| @@ -2126,12 +2122,6 @@ history list, so it is possible to do this afterwards by calling | |||
| 2126 | `add-to-history' explicitly. */); | 2122 | `add-to-history' explicitly. */); |
| 2127 | Vhistory_add_new_input = Qt; | 2123 | Vhistory_add_new_input = Qt; |
| 2128 | 2124 | ||
| 2129 | DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help, | ||
| 2130 | doc: /* *Non-nil means automatically provide help for invalid completion input. | ||
| 2131 | Under Partial Completion mode, a non-nil, non-t value has a special meaning; | ||
| 2132 | see the doc string of `partial-completion-mode' for more details. */); | ||
| 2133 | Vcompletion_auto_help = Qt; | ||
| 2134 | |||
| 2135 | DEFVAR_BOOL ("completion-ignore-case", &completion_ignore_case, | 2125 | DEFVAR_BOOL ("completion-ignore-case", &completion_ignore_case, |
| 2136 | doc: /* Non-nil means don't consider case significant in completion. | 2126 | doc: /* Non-nil means don't consider case significant in completion. |
| 2137 | 2127 | ||