diff options
| -rw-r--r-- | lisp/ChangeLog | 38 | ||||
| -rw-r--r-- | lisp/comint.el | 48 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 13 |
3 files changed, 61 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5d6b203aea2..d2403f0e53e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2011-03-24 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuffer.el (completion--flush-all-sorted-completions): | ||
| 4 | Remove itself from hook. | ||
| 5 | (completion-at-point): Let the functions perform the completion | ||
| 6 | immediately and return nil or t. | ||
| 7 | * comint.el (comint-dynamic-complete-functions): Now identical to | ||
| 8 | completion-at-point-functions. | ||
| 9 | (comint-dynamic-list-input-ring): Remove unused var `index'. | ||
| 10 | (comint--match-partial-filename, comint--unquote&expand-filename): | ||
| 11 | New funs, split from comint-match-partial-filename. | ||
| 12 | (comint-dynamic-complete): Use completion-at-point. | ||
| 13 | (comint-dynamic-complete-filename): Use comint--match-partial-filename. | ||
| 14 | |||
| 1 | 2011-03-24 Drew Adams <drew.adams@oracle.com> | 15 | 2011-03-24 Drew Adams <drew.adams@oracle.com> |
| 2 | 16 | ||
| 3 | * thingatpt.el: Support `defun'. | 17 | * thingatpt.el: Support `defun'. |
| @@ -52,8 +66,8 @@ | |||
| 52 | (provide-theme): Ignore custom--inhibit-theme-enable. | 66 | (provide-theme): Ignore custom--inhibit-theme-enable. |
| 53 | (load-theme): Enable the theme explicitly if NO-ENABLE is non-nil. | 67 | (load-theme): Enable the theme explicitly if NO-ENABLE is non-nil. |
| 54 | (custom-enabling-themes): Delete variable. | 68 | (custom-enabling-themes): Delete variable. |
| 55 | (enable-theme): Accept only loaded themes as arguments. Ignore | 69 | (enable-theme): Accept only loaded themes as arguments. |
| 56 | the special custom-enabled-themes variable. | 70 | Ignore the special custom-enabled-themes variable. |
| 57 | (custom-enabled-themes): Forbid themes from setting this. | 71 | (custom-enabled-themes): Forbid themes from setting this. |
| 58 | Eliminate use of custom-enabling-themes. | 72 | Eliminate use of custom-enabling-themes. |
| 59 | (custom-push-theme): Quote "changed" custom var entry. | 73 | (custom-push-theme): Quote "changed" custom var entry. |
| @@ -390,8 +404,8 @@ | |||
| 390 | 404 | ||
| 391 | 2011-03-09 Michael Albinus <michael.albinus@gmx.de> | 405 | 2011-03-09 Michael Albinus <michael.albinus@gmx.de> |
| 392 | 406 | ||
| 393 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Do | 407 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): |
| 394 | not use `tramp-file-name-port', because this returns also | 408 | Do not use `tramp-file-name-port', because this returns also |
| 395 | `tramp-default-port'. | 409 | `tramp-default-port'. |
| 396 | 410 | ||
| 397 | 2011-03-09 Deniz Dogan <deniz.a.m.dogan@gmail.com> | 411 | 2011-03-09 Deniz Dogan <deniz.a.m.dogan@gmail.com> |
| @@ -420,8 +434,8 @@ | |||
| 420 | * emacs-lisp/package.el (package-tar-file-info): Handle also | 434 | * emacs-lisp/package.el (package-tar-file-info): Handle also |
| 421 | remote files. | 435 | remote files. |
| 422 | 436 | ||
| 423 | * emacs-lisp/package-x.el (package-upload-buffer-internal): Use | 437 | * emacs-lisp/package-x.el (package-upload-buffer-internal): |
| 424 | `equal' for upload base check. | 438 | Use `equal' for upload base check. |
| 425 | 439 | ||
| 426 | 2011-03-08 Arni Magnusson <arnima@hafro.is> (tiny change) | 440 | 2011-03-08 Arni Magnusson <arnima@hafro.is> (tiny change) |
| 427 | 441 | ||
| @@ -750,9 +764,9 @@ | |||
| 750 | 2011-03-03 Christian Ohler <ohler@gnu.org> | 764 | 2011-03-03 Christian Ohler <ohler@gnu.org> |
| 751 | 765 | ||
| 752 | * emacs-lisp/ert.el (ert--explain-equal): New function. | 766 | * emacs-lisp/ert.el (ert--explain-equal): New function. |
| 753 | (ert--explain-equal-rec): Renamed from `ert--explain-not-equal'. | 767 | (ert--explain-equal-rec): Rename from `ert--explain-not-equal'. |
| 754 | All callers changed. | 768 | All callers changed. |
| 755 | (ert--explain-equal-including-properties): Renamed from | 769 | (ert--explain-equal-including-properties): Rename from |
| 756 | `ert--explain-not-equal-including-properties'. All callers | 770 | `ert--explain-not-equal-including-properties'. All callers |
| 757 | changed. | 771 | changed. |
| 758 | 772 | ||
| @@ -8275,8 +8289,8 @@ | |||
| 8275 | 8289 | ||
| 8276 | Sync with Tramp 2.1.19. | 8290 | Sync with Tramp 2.1.19. |
| 8277 | 8291 | ||
| 8278 | * net/tramp-gvfs.el (tramp-gvfs-handle-write-region): Protect | 8292 | * net/tramp-gvfs.el (tramp-gvfs-handle-write-region): |
| 8279 | deleting tmpfile. | 8293 | Protect deleting tmpfile. |
| 8280 | (tramp-gvfs-maybe-open-connection): Use `tramp-compat-funcall'. | 8294 | (tramp-gvfs-maybe-open-connection): Use `tramp-compat-funcall'. |
| 8281 | 8295 | ||
| 8282 | * net/tramp.el (tramp-handle-expand-file-name) | 8296 | * net/tramp.el (tramp-handle-expand-file-name) |
| @@ -10554,8 +10568,8 @@ | |||
| 10554 | * net/tramp-ftp.el (tramp-ftp-file-name-handler): | 10568 | * net/tramp-ftp.el (tramp-ftp-file-name-handler): |
| 10555 | Use `delete-file' instead of `tramp-compat-delete-file'. | 10569 | Use `delete-file' instead of `tramp-compat-delete-file'. |
| 10556 | 10570 | ||
| 10557 | * net/tramp-gvfs.el (tramp-gvfs-handle-write-region): Use | 10571 | * net/tramp-gvfs.el (tramp-gvfs-handle-write-region): |
| 10558 | `delete-file' instead of `tramp-compat-delete-file'. | 10572 | Use `delete-file' instead of `tramp-compat-delete-file'. |
| 10559 | 10573 | ||
| 10560 | * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): | 10574 | * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): |
| 10561 | Use `delete-file' instead of `tramp-compat-delete-file'. | 10575 | Use `delete-file' instead of `tramp-compat-delete-file'. |
diff --git a/lisp/comint.el b/lisp/comint.el index 711ebce20a3..c9d2108f132 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -368,7 +368,7 @@ text matching `comint-prompt-regexp', depending on the value of | |||
| 368 | (defvar comint-dynamic-complete-functions | 368 | (defvar comint-dynamic-complete-functions |
| 369 | '(comint-replace-by-expanded-history comint-dynamic-complete-filename) | 369 | '(comint-replace-by-expanded-history comint-dynamic-complete-filename) |
| 370 | "List of functions called to perform completion. | 370 | "List of functions called to perform completion. |
| 371 | Functions should return non-nil if completion was performed. | 371 | Works like `completion-at-point-functions'. |
| 372 | See also `comint-dynamic-complete'. | 372 | See also `comint-dynamic-complete'. |
| 373 | 373 | ||
| 374 | This is a good thing to set in mode hooks.") | 374 | This is a good thing to set in mode hooks.") |
| @@ -1008,7 +1008,6 @@ See also `comint-read-input-ring'." | |||
| 1008 | (message "No history") | 1008 | (message "No history") |
| 1009 | (let ((history nil) | 1009 | (let ((history nil) |
| 1010 | (history-buffer " *Input History*") | 1010 | (history-buffer " *Input History*") |
| 1011 | (index (1- (ring-length comint-input-ring))) | ||
| 1012 | (conf (current-window-configuration))) | 1011 | (conf (current-window-configuration))) |
| 1013 | ;; We have to build up a list ourselves from the ring vector. | 1012 | ;; We have to build up a list ourselves from the ring vector. |
| 1014 | (dotimes (index (ring-length comint-input-ring)) | 1013 | (dotimes (index (ring-length comint-input-ring)) |
| @@ -2946,13 +2945,22 @@ interpreter (e.g., the percent notation of cmd.exe on NT)." | |||
| 2946 | (setq name (replace-match env-var-val t t name)))))) | 2945 | (setq name (replace-match env-var-val t t name)))))) |
| 2947 | name)) | 2946 | name)) |
| 2948 | 2947 | ||
| 2948 | (defun comint--match-partial-filename () | ||
| 2949 | "Return the filename at point as-is, or nil if none is found. | ||
| 2950 | See `comint-word'." | ||
| 2951 | (comint-word comint-file-name-chars)) | ||
| 2952 | |||
| 2953 | (defun comint--unquote&expand-filename (filename) | ||
| 2954 | ;; FIXME: The code below does unquote-then-expand which means that "\\$HOME" | ||
| 2955 | ;; gets expanded to the same as "$HOME" | ||
| 2956 | (comint-substitute-in-file-name | ||
| 2957 | (comint-unquote-filename filename))) | ||
| 2958 | |||
| 2949 | (defun comint-match-partial-filename () | 2959 | (defun comint-match-partial-filename () |
| 2950 | "Return the filename at point, or nil if none is found. | 2960 | "Return the unquoted&expanded filename at point, or nil if none is found. |
| 2951 | Environment variables are substituted. See `comint-word'." | 2961 | Environment variables are substituted. See `comint-word'." |
| 2952 | (let ((filename (comint-word comint-file-name-chars))) | 2962 | (let ((filename (comint--match-partial-filename))) |
| 2953 | (and filename (comint-substitute-in-file-name | 2963 | (and filename (comint--unquote&expand-filename filename)))) |
| 2954 | (comint-unquote-filename filename))))) | ||
| 2955 | |||
| 2956 | 2964 | ||
| 2957 | (defun comint-quote-filename (filename) | 2965 | (defun comint-quote-filename (filename) |
| 2958 | "Return FILENAME with magic characters quoted. | 2966 | "Return FILENAME with magic characters quoted. |
| @@ -2987,13 +2995,13 @@ Calls the functions in `comint-dynamic-complete-functions' to perform | |||
| 2987 | completion until a function returns non-nil, at which point completion is | 2995 | completion until a function returns non-nil, at which point completion is |
| 2988 | assumed to have occurred." | 2996 | assumed to have occurred." |
| 2989 | (interactive) | 2997 | (interactive) |
| 2990 | (run-hook-with-args-until-success 'comint-dynamic-complete-functions)) | 2998 | (let ((completion-at-point-functions comint-dynamic-complete-functions)) |
| 2999 | (completion-at-point))) | ||
| 2991 | 3000 | ||
| 2992 | 3001 | ||
| 2993 | (defun comint-dynamic-complete-filename () | 3002 | (defun comint-dynamic-complete-filename () |
| 2994 | "Dynamically complete the filename at point. | 3003 | "Dynamically complete the filename at point. |
| 2995 | Completes if after a filename. See `comint-match-partial-filename' and | 3004 | Completes if after a filename. |
| 2996 | `comint-dynamic-complete-as-filename'. | ||
| 2997 | This function is similar to `comint-replace-by-expanded-filename', except that | 3005 | This function is similar to `comint-replace-by-expanded-filename', except that |
| 2998 | it won't change parts of the filename already entered in the buffer; it just | 3006 | it won't change parts of the filename already entered in the buffer; it just |
| 2999 | adds completion characters to the end of the filename. A completions listing | 3007 | adds completion characters to the end of the filename. A completions listing |
| @@ -3005,7 +3013,7 @@ completions listing is dependent on the value of `comint-completion-autolist'. | |||
| 3005 | 3013 | ||
| 3006 | Returns t if successful." | 3014 | Returns t if successful." |
| 3007 | (interactive) | 3015 | (interactive) |
| 3008 | (when (comint-match-partial-filename) | 3016 | (when (comint--match-partial-filename) |
| 3009 | (unless (window-minibuffer-p (selected-window)) | 3017 | (unless (window-minibuffer-p (selected-window)) |
| 3010 | (message "Completing file name...")) | 3018 | (message "Completing file name...")) |
| 3011 | (comint-dynamic-complete-as-filename))) | 3019 | (comint-dynamic-complete-as-filename))) |
| @@ -3021,18 +3029,12 @@ See `comint-dynamic-complete-filename'. Returns t if successful." | |||
| 3021 | ;;(file-name-handler-alist nil) | 3029 | ;;(file-name-handler-alist nil) |
| 3022 | (minibuffer-p (window-minibuffer-p (selected-window))) | 3030 | (minibuffer-p (window-minibuffer-p (selected-window))) |
| 3023 | (success t) | 3031 | (success t) |
| 3024 | (dirsuffix (cond ((not comint-completion-addsuffix) | 3032 | (dirsuffix (cond ((not comint-completion-addsuffix) "") |
| 3025 | "") | 3033 | ((not (consp comint-completion-addsuffix)) "/") |
| 3026 | ((not (consp comint-completion-addsuffix)) | 3034 | (t (car comint-completion-addsuffix)))) |
| 3027 | "/") | 3035 | (filesuffix (cond ((not comint-completion-addsuffix) "") |
| 3028 | (t | 3036 | ((not (consp comint-completion-addsuffix)) " ") |
| 3029 | (car comint-completion-addsuffix)))) | 3037 | (t (cdr comint-completion-addsuffix)))) |
| 3030 | (filesuffix (cond ((not comint-completion-addsuffix) | ||
| 3031 | "") | ||
| 3032 | ((not (consp comint-completion-addsuffix)) | ||
| 3033 | " ") | ||
| 3034 | (t | ||
| 3035 | (cdr comint-completion-addsuffix)))) | ||
| 3036 | (filename (comint-match-partial-filename)) | 3038 | (filename (comint-match-partial-filename)) |
| 3037 | (filename-beg (if filename (match-beginning 0) (point))) | 3039 | (filename-beg (if filename (match-beginning 0) (point))) |
| 3038 | (filename-end (if filename (match-end 0) (point))) | 3040 | (filename-end (if filename (match-end 0) (point))) |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e541be9fdd9..f1bc9f2d6d5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -688,6 +688,8 @@ scroll the window of possible completions." | |||
| 688 | (t t))))) | 688 | (t t))))) |
| 689 | 689 | ||
| 690 | (defun completion--flush-all-sorted-completions (&rest ignore) | 690 | (defun completion--flush-all-sorted-completions (&rest ignore) |
| 691 | (remove-hook 'after-change-functions | ||
| 692 | 'completion--flush-all-sorted-completions t) | ||
| 691 | (setq completion-cycling nil) | 693 | (setq completion-cycling nil) |
| 692 | (setq completion-all-sorted-completions nil)) | 694 | (setq completion-all-sorted-completions nil)) |
| 693 | 695 | ||
| @@ -1242,6 +1244,8 @@ Point needs to be somewhere between START and END." | |||
| 1242 | (assert (<= start (point)) (<= (point) end)) | 1244 | (assert (<= start (point)) (<= (point) end)) |
| 1243 | ;; FIXME: undisplay the *Completions* buffer once the completion is done. | 1245 | ;; FIXME: undisplay the *Completions* buffer once the completion is done. |
| 1244 | (with-wrapper-hook | 1246 | (with-wrapper-hook |
| 1247 | ;; FIXME: Maybe we should use this hook to provide a "display | ||
| 1248 | ;; completions" operation as well. | ||
| 1245 | completion-in-region-functions (start end collection predicate) | 1249 | completion-in-region-functions (start end collection predicate) |
| 1246 | (let ((minibuffer-completion-table collection) | 1250 | (let ((minibuffer-completion-table collection) |
| 1247 | (minibuffer-completion-predicate predicate) | 1251 | (minibuffer-completion-predicate predicate) |
| @@ -1253,7 +1257,9 @@ Point needs to be somewhere between START and END." | |||
| 1253 | 1257 | ||
| 1254 | (defvar completion-at-point-functions '(tags-completion-at-point-function) | 1258 | (defvar completion-at-point-functions '(tags-completion-at-point-function) |
| 1255 | "Special hook to find the completion table for the thing at point. | 1259 | "Special hook to find the completion table for the thing at point. |
| 1256 | It is called without any argument and should return either nil, | 1260 | Each function on this hook is called in turns without any argument and should |
| 1261 | return either nil to mean that it is not applicable at point, | ||
| 1262 | or t to mean that it already performed completion (discouraged), | ||
| 1257 | or a function of no argument to perform completion (discouraged), | 1263 | or a function of no argument to perform completion (discouraged), |
| 1258 | or a list of the form (START END COLLECTION &rest PROPS) where | 1264 | or a list of the form (START END COLLECTION &rest PROPS) where |
| 1259 | START and END delimit the entity to complete and should include point, | 1265 | START and END delimit the entity to complete and should include point, |
| @@ -1271,7 +1277,7 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 1271 | 'completion-at-point-functions))) | 1277 | 'completion-at-point-functions))) |
| 1272 | (cond | 1278 | (cond |
| 1273 | ((functionp res) (funcall res)) | 1279 | ((functionp res) (funcall res)) |
| 1274 | (res | 1280 | ((consp res) |
| 1275 | (let* ((plist (nthcdr 3 res)) | 1281 | (let* ((plist (nthcdr 3 res)) |
| 1276 | (start (nth 0 res)) | 1282 | (start (nth 0 res)) |
| 1277 | (end (nth 1 res)) | 1283 | (end (nth 1 res)) |
| @@ -1279,7 +1285,8 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 1279 | (or (plist-get plist :annotation-function) | 1285 | (or (plist-get plist :annotation-function) |
| 1280 | completion-annotate-function))) | 1286 | completion-annotate-function))) |
| 1281 | (completion-in-region start end (nth 2 res) | 1287 | (completion-in-region start end (nth 2 res) |
| 1282 | (plist-get plist :predicate))))))) | 1288 | (plist-get plist :predicate)))) |
| 1289 | (res)))) ;Maybe completion already happened and the function returned t. | ||
| 1283 | 1290 | ||
| 1284 | ;;; Key bindings. | 1291 | ;;; Key bindings. |
| 1285 | 1292 | ||