summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>2012-03-10 18:33:05 +0900
committerSatoru Takeuchi <satoru.takeuchi@gmail.com>2012-03-10 18:33:05 +0900
commit9d4e0df85f1a72b2738b0c6de2e8c9b00299fadd (patch)
tree8bf2615f66d4dd55c34017eba6d7ad3b143d505d
parent60ee133a2a003d78d9658a97dd2acfee0c61d008 (diff)
downloadquilt-9d4e0df85f1a72b2738b0c6de2e8c9b00299fadd.tar.gz
quilt-el: return to the original cwd even if `shell-command' failed.
-rw-r--r--lib/quilt.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/quilt.el b/lib/quilt.el
index 9b1dabc..a907206 100644
--- a/lib/quilt.el
+++ b/lib/quilt.el
@@ -81,8 +81,9 @@
(if (not qd)
(shell-command (concat "quilt " cmd) buf)
(cd qd)
- (shell-command (concat "quilt " cmd) buf)
- (cd d))))
+ (unwind-protect ; make sure to cd back even if an erro occurs.
+ (shell-command (concat "quilt " cmd) buf)
+ (cd d)))))
(defun quilt-cmd-to-string (cmd)
"execute a quilt command at the top of the quilt tree for the given buffer"
@@ -91,8 +92,9 @@
(if (not qd)
nil
(cd qd)
- (let ((r (shell-command-to-string (concat "quilt " cmd))))
- (cd d) r))))
+ (unwind-protect ; make sure to cd back even if an error occurs.
+ (shell-command-to-string (concat "quilt " cmd))
+ (cd d)))))
(defun quilt-applied-list ()
(let ((s (quilt-cmd-to-string "applied")))