Mercurial > emacs
changeset 80433:1eda7cc2e474
(shell-dynamic-complete-filename): New fun.
(shell-dynamic-complete-functions): Use it.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Thu, 03 Apr 2008 05:15:02 +0000 |
parents | afb0313509bb |
children | 08ed1836a895 |
files | lisp/shell.el |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/shell.el Thu Apr 03 05:14:37 2008 +0000 +++ b/lisp/shell.el Thu Apr 03 05:15:02 2008 +0000 @@ -191,7 +191,7 @@ shell-dynamic-complete-environment-variable shell-dynamic-complete-command shell-replace-by-expanded-directory - comint-dynamic-complete-filename) + shell-dynamic-complete-filename) "List of functions called to perform completion. This variable is used to initialize `comint-dynamic-complete-functions' in the shell buffer. @@ -1003,6 +1003,19 @@ (insert " ")) success))) +(defun shell-dynamic-complete-filename () + "Dynamically complete the filename at point. +This completes only if point is at a suitable position for a +filename argument." + (interactive) + (let ((opoint (point)) + (beg (comint-line-beginning-position))) + (when (save-excursion + (goto-char (if (re-search-backward "[;|&]" beg t) + (match-end 0) + beg)) + (re-search-forward "[^ \t][ \t]" opoint t)) + (comint-dynamic-complete-as-filename)))) (defun shell-match-partial-variable () "Return the shell variable at point, or nil if none is found."