changeset 51554:8cf86bc95fe5

(shell-command-separator-regexp): New variable. (shell-directory-tracker): Make regexp used for skipping to next command correspond to one used for command itself.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 12 Jun 2003 22:20:49 +0000
parents 13b4b238c835
children a55a32d4725a
files lisp/shell.el
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/shell.el	Thu Jun 12 22:14:31 2003 +0000
+++ b/lisp/shell.el	Thu Jun 12 22:20:49 2003 +0000
@@ -202,6 +202,12 @@
   :type 'regexp
   :group 'shell)
 
+(defcustom shell-command-separator-regexp "[;&|\n \t]*"
+  "*Regexp to match a single command within a pipeline.
+This is used for directory tracking and does not do a perfect job."
+  :type 'regexp
+  :group 'shell)
+
 (defcustom shell-completion-execonly t
   "*If non-nil, use executable files only for completion candidates.
 This mirrors the optional behavior of tcsh.
@@ -608,7 +614,9 @@
   (if shell-dirtrackp
       ;; We fail gracefully if we think the command will fail in the shell.
       (condition-case chdir-failure
-	  (let ((start (progn (string-match "^[; \t]*" str) ; skip whitespace
+	  (let ((start (progn (string-match
+			       (concat "^" shell-command-separator-regexp)
+			       str) ; skip whitespace
 			      (match-end 0)))
 		end cmd arg1)
 	    (while (string-match shell-command-regexp str start)
@@ -634,7 +642,9 @@
 						"\\)\\($\\|[ \t]\\)")
 					cmd))
 		     (shell-process-cd (comint-substitute-in-file-name cmd))))
-	      (setq start (progn (string-match "[; \t]*" str end) ; skip again
+	      (setq start (progn (string-match shell-command-separator-regexp
+					       str end)
+				 ;; skip again
 				 (match-end 0)))))
 	(error "Couldn't cd"))))