Help us understand the problem. What is going on with this article?

cdeとelscreen-separate-buffer-listの相性が悪い

More than 3 years have passed since last update.

elscreen-separate-buffer-list便利ですよね。余計なバッファがリストに現れないのは大変見通しが良くなるものです。

そしてcdeも大変便利です。シェルでEmacsのカレントバッファにcdすることってよくやる操作ですからね。

ですがelscreen-separate-buffer-listをインストールしてcdeを使おうとすると、cdeが謎のエラーメッセージを吐いてcdしてくれなくなります。

cdeの方がどちらかと言うと重要だったので elscreen-separate-buffer-list を外してしばらく使っていました。が、どうにも不便なので一念発起して調べてみました。

というかなおす箇所はcdeを定義している.zshrcの中の一箇所で、s/cadr/assoc 'window-configuration/すりゃいいです。

ついでにこれだけのまとまったコードをzsh側に置いておくのもなんか変な気がするのでinit.el側に移します。こんなふうになります。

init.el
(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)))
.zshrc
function cde () {
        EMACS_CWD=`emacsclient -e "(return-current-working-directory-to-shell)" | sed 's/^"\(.*\)"$/\1/'`
        echo "chdir to $EMACS_CWD"
        cd "$EMACS_CWD"
}

なんかうまい関数名が思いつかなかったので適当になってしまいました。誰かかっこいい関数名を…

__hage
BMC SL01 roadracer に乗るプログラマ。KUOTA KREDO は仮死状態です。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした