Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c79825bd
Commit
c79825bd
authored
Oct 23, 2012
by
Stefan Monnier
Browse files
* lisp/progmodes/compile.el (compilation-start): Try to handle common
quoting of `cd' argument. Fixes: debbugs:12640
parent
9c3e39f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
lisp/ChangeLog
lisp/ChangeLog
+3
-0
lisp/progmodes/compile.el
lisp/progmodes/compile.el
+14
-6
No files found.
lisp/ChangeLog
View file @
c79825bd
2012-10-23 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/compile.el (compilation-start): Try to handle common
quoting of `cd' argument (bug#12640).
* vc/diff-mode.el (diff-hunk): `save-excursion' while refining
(bug#12671).
...
...
lisp/progmodes/compile.el
View file @
c79825bd
...
...
@@ -1568,12 +1568,20 @@ Returns the compilation buffer created."
;; 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
))
(
cd
(
cond
((
not
(
string-match
"\\`\\s *cd\\(?:\\s +\\(\\S +?\\|'[^']*'\\|\"\\(?:[^\"`$\\]\\|\\\\.\\)*\"\\)\\)?\\s *[;&\n]"
command
))
default-directory
)
((
not
(
match-end
1
))
"~"
)
((
eq
(
aref
command
(
match-beginning
1
))
?\'
)
(
substring
command
(
1+
(
match-beginning
1
))
(
1-
(
match-end
1
))))
((
eq
(
aref
command
(
match-beginning
1
))
?\"
)
(
replace-regexp-in-string
"\\\\\\(.\\)"
"\\1"
(
substring
command
(
1+
(
match-beginning
1
))
(
1-
(
match-end
1
)))))
(
t
(
substitute-env-vars
(
match-string
1
command
)))))
(
erase-buffer
)
;; Select the desired mode.
(
if
(
not
(
eq
mode
t
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment