Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What is going on with this article?
@yakumo890

dired-toggle.elを開きっぱなしにする

More than 3 years have passed since last update.

dired-toggle.elをVisual Studioのソリューションエクスプローラーのように使いたかったので、
ファイルを開いたあとにウィンドウが閉じないように設定した。

設定

dired-toggle.elのdired-toggle-action-find-fileを以下のように編集

dired-toggle.el
(defun dired-toggle-action-find-file ()
  "Custom item action under `dired-toggle-mode'."
  (interactive)
  (let* ((buffer (current-buffer))
         (file (dired-get-file-for-visit))
         (dir-p (file-directory-p file)))
    (if dir-p                           ;open a directory
        (dired-toggle-list-dir buffer (file-name-as-directory file))
      ;; open a file, and delete the referred window firstly
      (if (and (window-live-p dired-toggle-refwin)
               (not (window-minibuffer-p dired-toggle-refwin))
               ;; Some times `dired-toggle-refwin' maybe dired-toggle
               ;; window itself, so just ignore it.
               (not (equal (selected-window) dired-toggle-refwin)))
---       (delete-window dired-toggle-refwin))
+++       (select-window dired-toggle-refwin))
--- (dired-find-alternate-file)
+++ (find-file file)
    )))

余談

プラグインを直接書き換えるのはよろしくない感じがするが、
関数の振る舞い変更をinit.elに書き加えるやり方がいまいちわからんかったのでこうした。
うまいやり方あったら教えてください。

3
Help us understand the problem. What is going on with this article?
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.
Sign Up
If you already have a Qiita account Login
3
Help us understand the problem. What is going on with this article?