[xyzzy:02332] save-window-configuration
- Subject: [xyzzy:02332] save-window-configuration
- From: Seiya Suda <seiya.suda@xxxxxxxxxxx>
- X-mailer: Denshin 8 Go V321.2b5
亀井さん、こんにちは。
今 window の configuration を save するやつを考えていて、
だいたい下のようでいいんじゃないかと思ってますが、方向性
がこれでいいかどうかお教えください。
それから、save-winconf したとき、lister の1画面でやっても
2画面でやっても、
(eq (car (nth 0 *current-winconf*)) ed::*lister-buffer*)
が t になってしまいます。
lister が2画面のときには左上の窓は *lister-1-buffer*
になっているはずなので、t ではいけないんですけど、t になります。
lister はたぶん使ってないでしょうけど、どうかよろしくおねがい
いたします。
--------------------------------------------------
(export '(*current-winconf* *winconf-type*
save-winconf restore-winconf))
(defvar *current-winconf* nil)
(defvar *winconf-type* 0)
(defun save-winconf ()
(interactive)
(setq *current-winconf* (window-data-list))
(setq *winconf-type* nil)
(let ((n (length *current-winconf*))
(h (- (screen-height) 5 )))
(cond ((eq (car (nth 0 *current-winconf*)) ed::*lister-buffer*)
(cond ((= n 2)
(setq *winconf-type* 1))
((= n 3)
(if (< (cadr (nth 1 *current-winconf*)) h)
(setq *winconf-type* 2)
(setq *winconf-type* 3)))
(t (message "Can't save"))))
((eq (car (nth 0 *current-winconf*)) ed::*lister-1-buffer*)
(cond ((= n 3)
(setq *winconf-type* 4))
((= n 4)
(cond ((< (cadr (nth 2 *current-winconf*)) h)
(setq *winconf-type* 5))
((= (cadr (nth 2 *current-winconf*)) h)
(setq *winconf-type* 6))
(t (messagae "Can't save."))))))
#| ((eq (car (nth 0 *current-winconf*)) den8-summary-buffer)
(setq *winconf-type* 7)) |#
(t
(cond ((= n 1)
(setq *winconf-type* 8))
((= n 2)
(cond ((< (cadr (nth 1 *current-winconf*)) h)
(setq *winconf-type* 9))
((= (cadr (nth 1 *current-winconf*)) h)
(setq *winconf-type* 10))))
(t
(message "Can't save")))))))
#|
(defun restore-winconf ()
(interactive)
(cond ((> (length *current-winconf*) 3)
(message "今のところリストアできません"))
((= (length *current-winconf*) 2)
(when (eq (nth 0 *current-winconf*) *lister-buffer*)
(progn
(lister)
(lister-adjust-winsize)))
(other-window)
(switch-to-buffer (nth 1 *current-winconf*)))))
|#
(defun window-data-list ()
"window の data list を返す"
(let (wins data wb wl wc)
(walk-windows #'(lambda (win)
(setq wb (window-buffer win))
(setq wl (window-lines win))
(setq wc (window-columns win))
(setq data (list wb wl wc))
(push data wins)))
wins))
;;; emacs の ?? より
(defun walk-windows (proc)
"窓を巡回しながら proc を呼ぶ"
(let* ((walk-windows-start (selected-window))
(walk-windows-current walk-windows-start))
(while (progn
(setq walk-windows-current
(next-window walk-windows-current))
(funcall proc walk-windows-current)
(not (eq walk-windows-current walk-windows-start))))))
--------
須田誠也(suda seiya)
seiya.suda@xxxxxxxxxxx
http://member.nifty.ne.jp/seiya-suda/