[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cd command parsing problem in `compilation-start`.
From: |
joonhwan.lee |
Subject: |
cd command parsing problem in `compilation-start`. |
Date: |
Sun, 3 Feb 2013 16:10:52 -0800 (PST) |
User-agent: |
G2/1.0 |
The following part of `compilation-start` seems to have a problem that cd
command of path with space characters.
;; Then evaluate a cd command if any, but don't perform it yet, else
;; start-command would do it again through the shell: (cd "..") AND
;; sh -c "cd ..; make"
(cd (if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
command)
(if (match-end 1)
(substitute-env-vars (match-string 1 command))
"~")
default-directory))
In my Win7/Emacs24.2, I've tested following 4 cases
(1) quoted path with space
(2) quoted path without space
(3) non-quoted path with space
(4) non-quoted path without space,
only (2), (4) cases(path without space cases) are detected as cd command in
above code.
see my test result in *scratch* buffer.(I think I have not that deep
understanding of regexp, sigh...).
;; case (1)
(let ((my-string "cd \"c:/my project path with space/first project\" && make"))
(if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
my-string)
(match-string 1 my-string)))
nil
;; case (2)
(let ((my-string "cd \"c:/my_project_path_without_space/first_project\" &&
make"))
(if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
my-string)
(match-string 1 my-string)))
"\"c:/my_project_path_without_space/first_project\""
;; case (3)
(let ((my-string "cd c:/my project path with space/first project && make"))
(if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
my-string)
(match-string 1 my-string)))
nil
;; case(4)
(let ((my-string "cd c:/my_project_path_without_space/first_project && make"))
(if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
my-string)
(match-string 1 my-string)))
"c:/my_project_path_without_space/first_project"
and make things worse, only case (4) was I in that compilation-start starts its
work successfully in my win32 box(windows 7 korean/emacs 24.2). it spits out
following messages
No such directory found via CDPATH environment variable
Is this bug or my miunderstanding?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- cd command parsing problem in `compilation-start`.,
joonhwan.lee <=