Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make cdp alias more fault tolerant.

  • Loading branch information...
commit 6555f9a48dd1e7bba9ce1222381e966e9eeb83bd 1 parent 5cc022a
Thomas Frössman thomasf authored
Showing with 8 additions and 6 deletions.
  1. +8 −6 contrib/eproject.sh
14 contrib/eproject.sh
View
@@ -25,9 +25,9 @@
### Code:
-cdp(){
- # Go to currently active project root in Emacs
- EMACS_CWP=$(emacsclient -e "
+# Go to currently active project root in Emacs
+cdp() {
+ local EMACS_CWP=$(emacsclient -a false -e "
(let ((current-buffer
(nth 1 (assoc 'buffer-list
(nth 1 (nth 1 (current-frame-configuration)))))))
@@ -38,7 +38,9 @@ cdp(){
(file-name-directory filename)
default-directory)))))
" | sed 's/^"\(.*\)"$/\1/')
-
- echo "chdir to $EMACS_CWP"
- cd "$EMACS_CWP"
+ if [ -d "$EMACS_CWP" ]; then
+ cd "$EMACS_CWP"
+ else
+ return 1
+ fi
}
Please sign in to comment.
Something went wrong with that request. Please try again.