* cd command parsing problem in `compilation-start`.
@ 2013-02-04 0:10 joonhwan.lee
0 siblings, 0 replies; only message in thread
From: joonhwan.lee @ 2013-02-04 0:10 UTC (permalink / raw)
To: bug-gnu-emacs
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-02-04 0:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 0:10 cd command parsing problem in `compilation-start` joonhwan.lee
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.