Skip to content

Instantly share code, notes, and snippets.

@yoshinari-nomura
Created September 27, 2011 06:30
Show Gist options
  • Save yoshinari-nomura/1244467 to your computer and use it in GitHub Desktop.
Save yoshinari-nomura/1244467 to your computer and use it in GitHub Desktop.
Small aliases to get along with Emacs buffer.
## Invoke the ``dired'' of current working directory in Emacs buffer.
function dired () {
emacsclient -e "(dired \"$PWD\")"
}
## Chdir to the ``default-directory'' of currently opened in Emacs buffer.
function cde () {
EMACS_CWD=`emacsclient -e "
(expand-file-name
(with-current-buffer
(nth 1
(assoc 'buffer-list
(nth 1 (nth 1 (current-frame-configuration)))))
default-directory))" | sed 's/^"\(.*\)"$/\1/'`
echo "chdir to $EMACS_CWD"
cd "$EMACS_CWD"
}
@masutaka
Copy link

ありがとうございます!
elscreen 使っていると、(current-frame-configuration) から buffer-list を取得できないので、
fork して修正してみました☆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment