aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRoland McGrath1993-09-08 06:59:23 +0000
committerRoland McGrath1993-09-08 06:59:23 +0000
commitfdfe2a28762cc7442e26371aa3b77bac5530366d (patch)
treebf989bbf67af1834b75dfd72a6d763b6566e303d /lisp
parentf8f418d80e0d87b3adb69119b99b5ece3697746f (diff)
downloademacs-fdfe2a28762cc7442e26371aa3b77bac5530366d.tar.gz
emacs-fdfe2a28762cc7442e26371aa3b77bac5530366d.zip
(comint-filename-prefix): New variable.
(comint-replace-by-expanded-filename, comint-dynamic-complete, comint-dynamic-list-completions): Prepend it to absolute file names before completing.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/comint.el47
1 files changed, 36 insertions, 11 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 7670ae65265..216d622c1ae 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1148,6 +1148,10 @@ See `comint-prompt-regexp'."
1148 (substitute-in-file-name 1148 (substitute-in-file-name
1149 (buffer-substring (match-beginning 0) (match-end 0))))) 1149 (buffer-substring (match-beginning 0) (match-end 0)))))
1150 1150
1151(defvar comint-filename-prefix nil
1152 "Prefix prepended to all absolute file names taken from process input.
1153This is used by the completion functions, and by directory tracking in shell
1154mode.")
1151 1155
1152(defun comint-replace-by-expanded-filename () 1156(defun comint-replace-by-expanded-filename ()
1153 "Expand the filename at point. 1157 "Expand the filename at point.
@@ -1162,8 +1166,18 @@ See functions `expand-file-name' and `substitute-in-file-name'. See also
1162 (let* ((pathname (comint-match-partial-pathname)) 1166 (let* ((pathname (comint-match-partial-pathname))
1163 (pathdir (file-name-directory pathname)) 1167 (pathdir (file-name-directory pathname))
1164 (pathnondir (file-name-nondirectory pathname)) 1168 (pathnondir (file-name-nondirectory pathname))
1165 (completion (file-name-completion pathnondir 1169 (completion (file-name-completion
1166 (or pathdir default-directory)))) 1170 pathnondir
1171 (if pathdir
1172 ;; It is important to expand PATHDIR because
1173 ;; default-directory might be a handled name, and
1174 ;; the unexpanded PATHDIR won't necessarily match
1175 ;; the handler regexp.
1176 (expand-file-name (concat
1177 (if (file-name-absolute-p pathdir)
1178 comint-filename-prefix)
1179 pathdir))
1180 default-directory))))
1167 (cond ((null completion) 1181 (cond ((null completion)
1168 (message "No completions of %s" pathname) 1182 (message "No completions of %s" pathname)
1169 (ding)) 1183 (ding))
@@ -1189,12 +1203,15 @@ it just adds completion characters to the end of the filename."
1189 (pathnondir (file-name-nondirectory pathname)) 1203 (pathnondir (file-name-nondirectory pathname))
1190 (completion (file-name-completion 1204 (completion (file-name-completion
1191 pathnondir 1205 pathnondir
1192 ;; It is important to expand PATHDIR because
1193 ;; default-directory might be a handled name, and the
1194 ;; unexpanded PATHDIR won't necessarily match the
1195 ;; handler regexp.
1196 (if pathdir 1206 (if pathdir
1197 (expand-file-name pathdir) 1207 ;; It is important to expand PATHDIR because
1208 ;; default-directory might be a handled name, and
1209 ;; the unexpanded PATHDIR won't necessarily match
1210 ;; the handler regexp.
1211 (expand-file-name
1212 (concat (if (file-name-absolute-p pathdir)
1213 comint-filename-prefix)
1214 pathdir))
1198 default-directory)))) 1215 default-directory))))
1199 (cond ((null completion) 1216 (cond ((null completion)
1200 (message "No completions of %s" pathname) 1217 (message "No completions of %s" pathname)
@@ -1212,10 +1229,18 @@ it just adds completion characters to the end of the filename."
1212 (pathdir (file-name-directory pathname)) 1229 (pathdir (file-name-directory pathname))
1213 (pathnondir (file-name-nondirectory pathname)) 1230 (pathnondir (file-name-nondirectory pathname))
1214 (completions 1231 (completions
1215 (file-name-all-completions pathnondir 1232 (file-name-all-completions
1216 (if pathdir 1233 pathnondir
1217 (expand-file-name pathdir) 1234 (if pathdir
1218 default-directory)))) 1235 ;; It is important to expand PATHDIR because
1236 ;; default-directory might be a handled name, and
1237 ;; the unexpanded PATHDIR won't necessarily match
1238 ;; the handler regexp.
1239 (expand-file-name
1240 (concat (if (file-name-absolute-p pathdir)
1241 comint-filename-prefix)
1242 pathdir))
1243 default-directory))))
1219 (cond ((null completions) 1244 (cond ((null completions)
1220 (message "No completions of %s" pathname) 1245 (message "No completions of %s" pathname)
1221 (ding)) 1246 (ding))