diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 23 |
2 files changed, 25 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e354027fd4b..8363cb40bda 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-10-24 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuffer.el (completion--embedded-envvar-table): Fix last change. | ||
| 4 | Ignore `pred' now that we receive one. | ||
| 5 | Handle test-completion specially. | ||
| 6 | |||
| 1 | 2009-10-23 Dan Nicolaescu <dann@ics.uci.edu> | 7 | 2009-10-23 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 8 | ||
| 3 | * vc.el (vc-responsible-backend): Throw an error if not backend is | 9 | * vc.el (vc-responsible-backend): Throw an error if not backend is |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cd606eb33b4..014faeac79c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1068,11 +1068,25 @@ variables.") | |||
| 1068 | "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'")) | 1068 | "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'")) |
| 1069 | 1069 | ||
| 1070 | (defun completion--embedded-envvar-table (string pred action) | 1070 | (defun completion--embedded-envvar-table (string pred action) |
| 1071 | "Completion table for envvars embedded in a string. | ||
| 1072 | The envvar syntax (and escaping) rules followed by this table are the | ||
| 1073 | same as `substitute-in-file-name'." | ||
| 1074 | ;; We ignore `pred', because the predicates passed to us via | ||
| 1075 | ;; read-file-name-internal are not 100% correct and fail here: | ||
| 1076 | ;; e.g. we get predicates like file-directory-p there, whereas the filename | ||
| 1077 | ;; completed needs to be passed through substitute-in-file-name before it | ||
| 1078 | ;; can be passed to file-directory-p. | ||
| 1071 | (when (string-match completion--embedded-envvar-re string) | 1079 | (when (string-match completion--embedded-envvar-re string) |
| 1072 | (let* ((beg (or (match-beginning 2) (match-beginning 1))) | 1080 | (let* ((beg (or (match-beginning 2) (match-beginning 1))) |
| 1073 | (table (completion--make-envvar-table)) | 1081 | (table (completion--make-envvar-table)) |
| 1074 | (prefix (substring string 0 beg))) | 1082 | (prefix (substring string 0 beg))) |
| 1075 | (if (eq (car-safe action) 'boundaries) | 1083 | (cond |
| 1084 | ((eq action 'lambda) | ||
| 1085 | ;; This table is expected to be used in conjunction with some | ||
| 1086 | ;; other table that provides the "main" completion. Let the | ||
| 1087 | ;; other table handle the test-completion case. | ||
| 1088 | nil) | ||
| 1089 | ((eq (car-safe action) 'boundaries) | ||
| 1076 | ;; Only return boundaries if there's something to complete, | 1090 | ;; Only return boundaries if there's something to complete, |
| 1077 | ;; since otherwise when we're used in | 1091 | ;; since otherwise when we're used in |
| 1078 | ;; completion-table-in-turn, we could return boundaries and | 1092 | ;; completion-table-in-turn, we could return boundaries and |
| @@ -1080,14 +1094,15 @@ variables.") | |||
| 1080 | ;; FIXME: Maybe it should rather be fixed in | 1094 | ;; FIXME: Maybe it should rather be fixed in |
| 1081 | ;; completion-table-in-turn instead, but it's difficult to | 1095 | ;; completion-table-in-turn instead, but it's difficult to |
| 1082 | ;; do it efficiently there. | 1096 | ;; do it efficiently there. |
| 1083 | (when (try-completion prefix table pred) | 1097 | (when (try-completion (substring string beg) table nil) |
| 1084 | ;; Compute the boundaries of the subfield to which this | 1098 | ;; Compute the boundaries of the subfield to which this |
| 1085 | ;; completion applies. | 1099 | ;; completion applies. |
| 1086 | (let ((suffix (cdr action))) | 1100 | (let ((suffix (cdr action))) |
| 1087 | (list* 'boundaries | 1101 | (list* 'boundaries |
| 1088 | (or (match-beginning 2) (match-beginning 1)) | 1102 | (or (match-beginning 2) (match-beginning 1)) |
| 1089 | (when (string-match "[^[:alnum:]_]" suffix) | 1103 | (when (string-match "[^[:alnum:]_]" suffix) |
| 1090 | (match-beginning 0))))) | 1104 | (match-beginning 0)))))) |
| 1105 | (t | ||
| 1091 | (if (eq (aref string (1- beg)) ?{) | 1106 | (if (eq (aref string (1- beg)) ?{) |
| 1092 | (setq table (apply-partially 'completion-table-with-terminator | 1107 | (setq table (apply-partially 'completion-table-with-terminator |
| 1093 | "}" table))) | 1108 | "}" table))) |
| @@ -1095,7 +1110,7 @@ variables.") | |||
| 1095 | ;; envvar completion to be case-sensitive. | 1110 | ;; envvar completion to be case-sensitive. |
| 1096 | (let ((completion-ignore-case nil)) | 1111 | (let ((completion-ignore-case nil)) |
| 1097 | (completion-table-with-context | 1112 | (completion-table-with-context |
| 1098 | prefix table (substring string beg) pred action)))))) | 1113 | prefix table (substring string beg) nil action))))))) |
| 1099 | 1114 | ||
| 1100 | (defun completion-file-name-table (string pred action) | 1115 | (defun completion-file-name-table (string pred action) |
| 1101 | "Completion table for file names." | 1116 | "Completion table for file names." |