Created
September 27, 2011 06:30
-
-
Save yoshinari-nomura/1244467 to your computer and use it in GitHub Desktop.
Small aliases to get along with Emacs buffer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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" | |
} |
Dubhead さん:
dired() の方は
emacsclient -e "(dired "${1:a}")"
にしてはどうでしょう。
なるほど.ありがとうございます.でも,これって,引数なしの場合になぜうまく動いてるんだろ.
ありがとうございます!
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
dired() の方は
emacsclient -e "(dired "${1:a}")"
にしてはどうでしょう。
「dired」に加えて「dired ..」や「dired /tmp」も出来るようになります。