unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* FW: shell: cd after &
@ 2003-06-10 15:03 Marshall, Simon
  2003-06-11 13:24 ` Stephen J. Turnbull
  0 siblings, 1 reply; 5+ messages in thread
From: Marshall, Simon @ 2003-06-10 15:03 UTC (permalink / raw)


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:gin@mo.msk.ru] 
Sent: 06 June 2003 18:27
To: xemacs-patches@xemacs.org
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.

XEmacs/packages/xemacs-packages/xemacs-base/ChangeLog:

2003-06-06  Ilya N. Golubev  <gin@mo.msk.ru>

	* shell.el (shell-directory-tracker): Make regexp used for
	skipping to next command correspond to one used for command
	itself.
	(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
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)
@@ -704,7 +712,9 @@
 			      ;; what
`shell-dirtrack-process-other-func'
 			      ;; will want to do with it
 			      arg1)))
-	      (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"))))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FW: shell: cd after &
  2003-06-10 15:03 Marshall, Simon
@ 2003-06-11 13:24 ` Stephen J. Turnbull
  2003-06-11 15:52   ` Rajesh Vaidheeswarran
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen J. Turnbull @ 2003-06-11 13:24 UTC (permalink / raw)
  Cc: 'Emacs Developers'

>>>>> "Simon" == Simon Marshall <Marshall> writes:

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

FWIW Norbert Koch <viteno@xemacs.org> approved it for XEmacs.  So, if
you want rationale, you could ask him.



-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FW: shell: cd after &
  2003-06-11 13:24 ` Stephen J. Turnbull
@ 2003-06-11 15:52   ` Rajesh Vaidheeswarran
  2003-06-11 16:04     ` Rajesh Vaidheeswarran
  0 siblings, 1 reply; 5+ messages in thread
From: Rajesh Vaidheeswarran @ 2003-06-11 15:52 UTC (permalink / raw)
  Cc: 'Emacs Developers'

One of the issues that I have always found to be clunky with the existing
cwd tracking in shell is its inability to track the pwd after every command,
not just explicit directory commands.

For instance, I use a program called `workon' extensively to work with
different cvs modules. The program sets the pertinent environment variables
and exec a shell and puts the user in the root of the cvs module.

When I use this within emacs, I typically do something like

% workon emacs
% cd `pwd`

for emacs to understand the current directory.

Of course, I don't have any suggestions on how this can be solved.
Anyway, I guess the current change in question is a step in the right
direction. 

In a previous message, "Stephen J. Turnbull" writes:

> >>>>> "Simon" == Simon Marshall <Marshall> writes:
> 
>     Simon> I don't know if anyone cares enough about this.  It's so
>     Simon> long since I maintained shell.el I don't know if it's worth
>     Simon> it.
> 
> FWIW Norbert Koch <viteno@xemacs.org> approved it for XEmacs.  So, if
> you want rationale, you could ask him.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FW: shell: cd after &
  2003-06-11 15:52   ` Rajesh Vaidheeswarran
@ 2003-06-11 16:04     ` Rajesh Vaidheeswarran
  0 siblings, 0 replies; 5+ messages in thread
From: Rajesh Vaidheeswarran @ 2003-06-11 16:04 UTC (permalink / raw)
  Cc: 'Emacs Developers'

Actually, I meant to say

    When I use this within emacs, I typically do something like

    % workon emacs
    % pwd
    % cd <the dir reported by pwd>

    for emacs to understand the current directory.


In a previous message, Rajesh Vaidheeswarran writes:

> One of the issues that I have always found to be clunky with the existing
> cwd tracking in shell is its inability to track the pwd after every command,
> not just explicit directory commands.
> 
> For instance, I use a program called `workon' extensively to work with
> different cvs modules. The program sets the pertinent environment variables
> and exec a shell and puts the user in the root of the cvs module.
> 
> When I use this within emacs, I typically do something like
> 
> % workon emacs
> % cd `pwd`
> 
> for emacs to understand the current directory.
> 
> Of course, I don't have any suggestions on how this can be solved.
> Anyway, I guess the current change in question is a step in the right
> direction. 
> 
> In a previous message, "Stephen J. Turnbull" writes:
> 
> > >>>>> "Simon" == Simon Marshall <Marshall> writes:
> > 
> >     Simon> I don't know if anyone cares enough about this.  It's so
> >     Simon> long since I maintained shell.el I don't know if it's worth
> >     Simon> it.
> > 
> > FWIW Norbert Koch <viteno@xemacs.org> approved it for XEmacs.  So, if
> > you want rationale, you could ask him.
> 
> 
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://mail.gnu.org/mailman/listinfo/emacs-devel
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: FW: shell: cd after &
@ 2003-06-11 16:42 Marshall, Simon
  0 siblings, 0 replies; 5+ messages in thread
From: Marshall, Simon @ 2003-06-11 16:42 UTC (permalink / raw)
  Cc: 'Emacs Developers'

You can always do M-x dirs RET to resync emacs' idea of the directory
stack.  

It might be useful to add a selectable feature whereby emacs does a
(dirs) after each (comint-send-input).  You'd want to turn it off if you
did ftp or something from the *shell*.  I remember implementing
something like that many years ago, but decided it would be too annoying
to put in shell.el.  Nothing is going to be infallible.

As the shell.el comment says, "The solution is to relax, not stress out
about it, and settle for a hack that works pretty well in typical
circumstances."

-----Original Message-----
From: Rajesh Vaidheeswarran [mailto:rv@gnu.org]
Sent: 11 June 2003 16:52
To: Stephen J. Turnbull
Cc: Marshall, Simon; 'Emacs Developers'; Norbert Koch
Subject: Re: FW: shell: cd after &


One of the issues that I have always found to be clunky with the
existing
cwd tracking in shell is its inability to track the pwd after every
command,
not just explicit directory commands.

For instance, I use a program called `workon' extensively to work with
different cvs modules. The program sets the pertinent environment
variables
and exec a shell and puts the user in the root of the cvs module.

When I use this within emacs, I typically do something like

% workon emacs
% cd `pwd`

for emacs to understand the current directory.

Of course, I don't have any suggestions on how this can be solved.
Anyway, I guess the current change in question is a step in the right
direction. 

In a previous message, "Stephen J. Turnbull" writes:

> >>>>> "Simon" == Simon Marshall <Marshall> writes:
> 
>     Simon> I don't know if anyone cares enough about this.  It's so
>     Simon> long since I maintained shell.el I don't know if it's worth
>     Simon> it.
> 
> FWIW Norbert Koch <viteno@xemacs.org> approved it for XEmacs.  So, if
> you want rationale, you could ask him.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-06-11 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-11 16:42 FW: shell: cd after & Marshall, Simon
  -- strict thread matches above, loose matches on Subject: below --
2003-06-10 15:03 Marshall, Simon
2003-06-11 13:24 ` Stephen J. Turnbull
2003-06-11 15:52   ` Rajesh Vaidheeswarran
2003-06-11 16:04     ` Rajesh Vaidheeswarran

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).