Skip to content

Instantly share code, notes, and snippets.

@hage
Last active January 15, 2016 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hage/5d1ef65115255052ec5b to your computer and use it in GitHub Desktop.
Save hage/5d1ef65115255052ec5b to your computer and use it in GitHub Desktop.
cdeとelscreen-separate-buffer-listの相性が悪い ref: http://qiita.com/__hage/items/2dd732b4dd68e124e8bd
function cde () {
EMACS_CWD=`emacsclient -e "(return-current-working-directory-to-shell)" | sed 's/^"\(.*\)"$/\1/'`
echo "chdir to $EMACS_CWD"
cd "$EMACS_CWD"
}
function cde () {
EMACS_CWD=`emacsclient -e "(return-current-working-directory-to-shell)" | sed 's/^"\(.*\)"$/\1/'`
echo "chdir to $EMACS_CWD"
cd "$EMACS_CWD"
}
(defun return-current-working-directory-to-shell ()
(expand-file-name
(with-current-buffer
(if (featurep 'elscreen)
(let* ((frame-confs (elscreen-get-frame-confs (selected-frame)))
(num (nth 1 (assoc 'screen-history frame-confs)))
(cur-window-conf
(assoc 'window-configuration
(assoc num (assoc 'screen-property frame-confs))))
(marker (nth 2 cur-window-conf)))
(marker-buffer marker))
(nth 1
(assoc 'buffer-list
(nth 1 (nth 1 (current-frame-configuration))))))
default-directory)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment