emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110640: * lisp/progmodes/compile.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110640: * lisp/progmodes/compile.el (compilation-start): Try to handle common
Date: Tue, 23 Oct 2012 15:07:44 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110640
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12640
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-10-23 15:07:44 -0400
message:
  * lisp/progmodes/compile.el (compilation-start): Try to handle common
  quoting of `cd' argument.
modified:
  lisp/ChangeLog
  lisp/progmodes/compile.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-10-23 18:40:23 +0000
+++ b/lisp/ChangeLog    2012-10-23 19:07:44 +0000
@@ -1,5 +1,8 @@
 2012-10-23  Stefan Monnier  <address@hidden>
 
+       * 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).
 

=== modified file 'lisp/progmodes/compile.el'
--- a/lisp/progmodes/compile.el 2012-10-14 07:40:05 +0000
+++ b/lisp/progmodes/compile.el 2012-10-23 19:07:44 +0000
@@ -1568,12 +1568,20 @@
        ;; 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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]