こんな感じかぁ。もしかすると、洩れがあるかも。
でございます。継ぎ足し、継ぎ足しで作ったから結構冗長化。
(defvar w3m-pop-elscreen t) (defadvice w3m-popup-buffer (around w3m-elscreen-poup-buffer activate) (if (or (not w3m-pop-elscreen) (memq this-command '(w3m-copy-buffer ;; w3m-goto-url-new-session w3m-view-this-url-new-session)) (not (featurep 'elscreen)) (save-window-excursion (catch 'detwin (let ((owin (selected-window)) (oframe (selected-frame))) (mapcar (lambda (frame) (unless (eq frame oframe) (select-frame frame) (mapcar (lambda (win) (set-buffer (window-buffer win)) (when (eq major-mode 'w3m-mode) (throw 'detwin t))) (window-list)))) (frame-list)) nil)))) (let ((w3m-pop-up-frames nil) (w3m-pop-up-windows nil)) ad-do-it) (if (stringp buffer) (setq buffer (get-buffer buffer))) (let ((screen (elscreen-find-screen-by-buffer buffer)) (create t)) (when (and (not screen) (memq this-command '(w3m-goto-url-new-session))) (if (not (eq major-mode 'w3m-mode)) (setq create nil) (setq screen (elscreen-find-screen (lambda (num) (elscreen-goto-internal num) (save-selected-window (catch 'find (mapcar (lambda (window) (select-window window) (when (and (eq major-mode 'w3m-mode) (not (eq (current-buffer) buffer))) (throw 'find num))) (window-list)) nil))))))) (if screen (progn (when (/= (elscreen-get-current-screen) screen) (elscreen-goto screen)) (if (not (or (one-window-p) (eq major-mode 'w3m-mode))) (let* ((cwin (selected-window)) (win (previous-window cwin)) buf) (catch 'detect (while (not (eq cwin win)) (setq buf (window-buffer win)) (set-buffer buf) (when (eq major-mode 'w3m-mode) (select-window win) (throw 'detect 'ok)) (setq win (previous-window win))) (elscreen-create) (set-window-buffer (selected-window) buffer))) (unless (eq (current-buffer) buffer) (set-window-buffer (selected-window) buffer)))) (when create (elscreen-create))
(defun w3m-no-elscreen (&optional url) (interactive (let ((url (w3m-examine-command-line-args)) new) (list (or url (let ((default (if (w3m-alive-p) 'popup w3m-home-page))) (setq new (if current-prefix-arg default (w3m-input-url nil nil default (not (get-buffer "*w3m*")))))))))) (let (w3m-pop-elscreen) (cond ((eq url 'popup) (w3m)) (t (w3m url)))))
(add-hook 'mew-suspend-hook 'elscreen-kill-buffer-force) (add-hook 'mew-quit-hook 'elscreen-kill-buffer-force) (add-hook 'navi2ch-exit-hook 'elscreen-kill-buffer-force) (defadvice w3m-close-window (after elscreen-kill-buffer activate) "Kill elscreen." (elscreen-kill-buffer-force)) (defadvice w3m-quit (after elscreen-kill-buffer activate) "Kill elscreen." (elscreen-kill-buffer-force)) (defadvice kill-buffer (after elscreen-kill-buffer activate) "Kill elscreen." (elscreen-kill-buffer)) (defun elscreen-kill-buffer-force () (elscreen-kill-buffer 'force)) (defun elscreen-kill-buffer (&optional force) (when (and (not (elscreen-one-screen-p)) (or force (memq this-command '(kill-buffer)))) (let* ((cur (elscreen-get-current-screen)) (buffer (current-buffer)) (new (elscreen-find-screen (lambda (screen) (if (= cur screen) nil (elscreen-goto-internal screen) (member buffer (mapcar (lambda (window) (window-buffer window)) (window-list)))))))) (cond (force (elscreen-kill) (when new (elscreen-goto new))) (t (when new (elscreen-kill) (elscreen-goto new)))))))
(define-key elscreen-map "d" 'elscreen-dired)
(defvar elscreen-dnd-buffers nil) (defadvice x-dnd-handle-drag-n-drop-event (around elscreen-dnd-buffers activate) (setq elscreen-dnd-buffers nil) (save-window-excursion ad-do-it) (when elscreen-dnd-buffers (elscreen-goto (car (mapcar (lambda (buffer) (elscreen-find-screen-by-buffer buffer 'create)) elscreen-dnd-buffers))) (setq elscreen-dnd-buffers nil) (elscreen-notify-screen-modification 'force-immediately))) (defadvice w32-drag-n-drop (around elscreen-dnd-buffers activate) (setq elscreen-dnd-buffers nil) (save-window-excursion ad-do-it) (when elscreen-dnd-buffers (elscreen-goto (car (mapcar (lambda (buffer) (elscreen-find-screen-by-buffer buffer 'create)) elscreen-dnd-buffers))) (setq elscreen-dnd-buffers nil) (elscreen-notify-screen-modification 'force-immediately))) (defadvice dnd-handle-one-url (after elscreen-get-dnd-buffers activate) (setq elscreen-dnd-buffers (cons (current-buffer) elscreen-dnd-buffers)))
screenで開いてdiredは、C-z C-fでディレクトリを指定すればよかったりしません?ぼくはいつもそうしてるです。
あう、コメントに書いてた、ごめんなさいー。
普段から dired は C-xC-f と C-xd と気分で両方使っているので作ってみましたーという感じです。<br>強いていえば、C-u で switch を指定できるから(って数年に一度ぐらいしか使わないけど)。
なるほど。C-z dあいてるし、次のには入れますね。