[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: shell: cd after &

From: Marshall, Simon
Subject: FW: shell: cd after &
Date: Tue, 10 Jun 2003 16:03:29 +0100

I don't know if anyone cares enough about this.  It's so long since I
maintained shell.el I don't know if it's worth it.

-----Original Message-----
From: Ilya N. Golubev [mailto:address@hidden 
Sent: 06 June 2003 18:27
To: address@hidden
Cc: Olin Shivers; Simon Marshall
Subject: shell: cd after &

Current version of `shell-directory-tracker' fails even on simple
command sequences: linear ones, where some commands are separated with
`&' rather than ';': `pushd dir;cmd&popd'.  The patch fixes this.


2003-06-06  Ilya N. Golubev  <address@hidden>

        * shell.el (shell-directory-tracker): Make regexp used for
        skipping to next command correspond to one used for command
        (shell-command-separator-regexp): New variable.

--- shell.el    26 Nov 2002 19:38:35 -0000      1.9
+++ shell.el    6 Jun 2003 17:04:01 -0000
@@ -193,6 +193,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.
@@ -666,7 +672,9 @@
   (if shell-dirtrackp
       ;; We fail gracefully if we think the command will fail in the
       (condition-case chdir-failure
-         (let ((start (progn (string-match "^[; \t]*" str) ; skip
+         (let ((start (progn (string-match
+                              (concat "^"
+                              str) ; skip whitespace
                              (match-end 0)))
                end cmd arg1)
            (while (string-match shell-command-regexp str start)
@@ -704,7 +712,9 @@
                              ;; what
                              ;; will want to do with it
-             (setq start (progn (string-match "[; \t]*" str end) ; skip
+             (setq start (progn (string-match
+                                 shell-command-separator-regexp str
+                                ;; skip again
                                 (match-end 0)))))
        (error "Couldn't cd"))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]