aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-04-03 05:15:02 +0000
committerChong Yidong2008-04-03 05:15:02 +0000
commitd5c8aafb7f172b7e4127c61e832f772424460718 (patch)
treed5b961fe1ef247672d3b9815f78dfb16fd650019
parent9b89075f7526c6381bdd802925905f26d7e8a4ed (diff)
downloademacs-d5c8aafb7f172b7e4127c61e832f772424460718.tar.gz
emacs-d5c8aafb7f172b7e4127c61e832f772424460718.zip
(shell-dynamic-complete-filename): New fun.
(shell-dynamic-complete-functions): Use it.
-rw-r--r--lisp/shell.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index 45ef23e98c3..0ee30ae7e5b 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -191,7 +191,7 @@ This is a fine thing to set in your `.emacs' file.")
191 shell-dynamic-complete-environment-variable 191 shell-dynamic-complete-environment-variable
192 shell-dynamic-complete-command 192 shell-dynamic-complete-command
193 shell-replace-by-expanded-directory 193 shell-replace-by-expanded-directory
194 comint-dynamic-complete-filename) 194 shell-dynamic-complete-filename)
195 "List of functions called to perform completion. 195 "List of functions called to perform completion.
196This variable is used to initialize `comint-dynamic-complete-functions' in the 196This variable is used to initialize `comint-dynamic-complete-functions' in the
197shell buffer. 197shell buffer.
@@ -1003,6 +1003,19 @@ See `shell-dynamic-complete-filename'. Returns t if successful."
1003 (insert " ")) 1003 (insert " "))
1004 success))) 1004 success)))
1005 1005
1006(defun shell-dynamic-complete-filename ()
1007 "Dynamically complete the filename at point.
1008This completes only if point is at a suitable position for a
1009filename argument."
1010 (interactive)
1011 (let ((opoint (point))
1012 (beg (comint-line-beginning-position)))
1013 (when (save-excursion
1014 (goto-char (if (re-search-backward "[;|&]" beg t)
1015 (match-end 0)
1016 beg))
1017 (re-search-forward "[^ \t][ \t]" opoint t))
1018 (comint-dynamic-complete-as-filename))))
1006 1019
1007(defun shell-match-partial-variable () 1020(defun shell-match-partial-variable ()
1008 "Return the shell variable at point, or nil if none is found." 1021 "Return the shell variable at point, or nil if none is found."