Article View: gnu.emacs.bug
Article #87881[19.25.94]: shell directory tracking can be slow
From: Simon Marshall
Date: Wed, 24 Aug 1994 09:41
Date: Wed, 24 Aug 1994 09:41
69 lines
3699 bytes
3699 bytes
In GNU Emacs 19.25.94.2 (sparc-sun-sunos4.1.3C, X toolkit) of Fri Aug 19 1994 on penelope
The shell directory tracker `shell-directory-tracker' calls
`comint-arguments' to extract the command and argument to see if it should
process them as directory commands. However, the regexp in
`comint-arguments' is slow. This patch halves the time it takes for the
directory tracker to process non-directory commands by delaying
calculation of the arg until we know we have a directory command.
Wed Aug 24 21:39:43 1994 Simon Marshall (Simon.Marshall@mail.esrin.esa.it)
* shell.el (shell-directory-tracker): Delay calculating command
argument until we know we have to.
Patch is:
*** shell.el.~1~ Wed Aug 24 11:22:20 1994
--- shell.el Wed Aug 24 11:33:52 1994
***************
*** 448,468 ****
(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 "^[;\\s ]*" str) ; skip whitespace
! (match-end 0)))
! end cmd arg1)
(while (string-match shell-command-regexp str start)
! (setq end (match-end 0)
! cmd (comint-arguments (substring str start end) 0 0)
! arg1 (comint-arguments (substring str start end) 1 1))
! (cond ((eq (string-match shell-popd-regexp cmd) 0)
! (shell-process-popd (substitute-in-file-name arg1)))
! ((eq (string-match shell-pushd-regexp cmd) 0)
! (shell-process-pushd (substitute-in-file-name arg1)))
! ((eq (string-match shell-cd-regexp cmd) 0)
! (shell-process-cd (substitute-in-file-name arg1))))
! (setq start (progn (string-match "[;\\s ]*" str end) ; skip again
! (match-end 0)))))
(error "Couldn't cd"))))
;;; popd [+n]
--- 448,474 ----
(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 "^[;\\s ]*" str) ; Skip whitespace
! (match-end 0))))
(while (string-match shell-command-regexp str start)
! (let* ((end (match-end 0))
! (cmd (comint-arguments (substring str start end) 0 0)))
! ;; Delay calculating arg until we know we have to.
! (cond ((eq (string-match shell-popd-regexp cmd) 0)
! (shell-process-popd
! (substitute-in-file-name
! (comint-arguments (substring str start end) 1 1))))
! ((eq (string-match shell-pushd-regexp cmd) 0)
! (shell-process-pushd
! (substitute-in-file-name
! (comint-arguments (substring str start end) 1 1))))
! ((eq (string-match shell-cd-regexp cmd) 0)
! (shell-process-cd
! (substitute-in-file-name
! (comint-arguments (substring str start end) 1 1)))))
! ;; Skip again
! (setq start (progn (string-match "[ ;\\s ]*" str end)
! (match-end 0))))))
(error "Couldn't cd"))))
;;; popd [+n]
Technical Details
Message-ID:
<9408240941.AA25833@plod.esrin.esa.it>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.cic.net!magnus.acs.ohio-state.edu!math.ohio-state.edu!cis.ohio-state.edu!mail.ESrin.ESa.IT!Simon.MarshallShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,a70a8cc8786243be,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-08-24 03:20:51 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.cic.net!magnus.acs.ohio-state.edu!math.ohio-state.edu!cis.ohio-state.edu!mail.ESrin.ESa.IT!Simon.Marshall From: Simon.Marshall@mail.ESrin.ESa.IT (Simon Marshall) Newsgroups: gnu.emacs.bug Subject: [19.25.94]: shell directory tracking can be slow Date: 24 Aug 1994 05:41:23 -0400 Organization: GNUs Not Usenet Lines: 69 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <9408240941.AA25833@plod.esrin.esa.it>