[xyzzy:03774] Re: 画面構成を記憶させたい (Re: 拡張子の一括変換 )
- Subject: [xyzzy:03774] Re: 画面構成を記憶させたい (Re: 拡張子の一括変換 )
- From: Seiya Suda <seiya.suda@xxxxxxxxxxx>
- X-mailer: Denshin 8 Go V321.2b5
- X-yzzy-version: 0.1.1.116
こんにちは。須田です。
Thu, 30 Dec 1999 01:17:19 +0900 の
[xyzzy:03772] Re: 画面構成を記憶させたい(Re: 拡張子の一括変換 )
に関するメールにお答えします。
レジスター保存はまだ一時的なので、ファイルに保存するのも
考えました。ただ、あまりにも亀井さんからの泥棒だし、必ず
しもスマートでないので、どこにも出していませんが、もしもっ
とよくなればと思って出します。改良のほど、お願いします > みなさん
酔っ払ってるからどこかミスがあるかも。
M-x your-popup-menu
ってやってください。*root* は適当に変えて。
しっかし、カッコ悪いな。
-------------------------------------------
(defavar *root* "H:/root/")
(defun save-window-configuration (s)
(let ((conf (current-window-configuration)))
(setf (cadr conf) (position (cadr conf) (caddr conf) :key #'car))
(setf (caddr conf)
(mapcar #'(lambda (x)
(mapcar #'(lambda (x)
(cond ((windowp x) nil)
((markerp x)
(marker-point x))
((bufferp x)
(cons (get-buffer-file-name x)
(buffer-name x)))
(t x)))
x))
(caddr conf)))
(write `(in-package ,(package-name *package*)) :stream s :escape t)
(write `(restore-window-configuration ',conf)
:stream s :escape t)
(terpri s)))
(defun restore-window-configuration (conf)
(when conf
(let ((n (cadr conf)))
(setf (cadr conf) nil)
(mapc #'(lambda (x)
(setf (cadr x)
(let ((f (cadr x)))
(or (and (car f) (get-file-buffer (car f)))
(find-buffer (cdr f))))))
(caddr conf))
(set-window-configuration conf)
(when n
(ignore-errors (other-window n))))))
(defun save-wconf-type1 ()
(interactive)
(with-open-file (s (concat *root* ".xyzzy-savewinconf-1")
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(save-window-configuration s)))
(defun restore-wconf-type1 ()
(interactive)
(load (concat *root* ".xyzzy-savewinconf-1")))
(defun save-wconf-type2 ()
(interactive)
(with-open-file (s (concat *root* ".xyzzy-savewinconf-2")
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(save-window-configuration s)))
(defun restore-wconf-type2 ()
(interactive)
(load (concat *root* ".xyzzy-savewinconf-2")))
(defun save-wconf-type3 ()
(interactive)
(with-open-file (s (concat *root* ".xyzzy-savewinconf-3")
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(save-window-configuration s)))
(defun restore-wconf-type3 ()
(interactive)
(load (concat *root* ".xyzzy-savewinconf-3")))
;;; ポップアップメニュ
(provide "your-popup-menu")
(defvar *your-popup-menu* nil)
(defun your-popup-menu ()
(interactive)
(setq *your-popup-menu*
(define-popup-menu
(:popup 'winconf "SaveWinconf(&S)"
(:item nil "タイプ1"
'save-wconf-type1)
(:item nil "タイプ2"
'save-wconf-type2)
(:item nil "タイプ3"
'save-wconf-type3))
(:popup 'winconf "RestoreWinconf(&R)"
(:item nil "タイプ1"
'restore-wconf-type1)
(:item nil "タイプ2"
'restore-wconf-type2)
(:item nil "タイプ3"
'restore-wconf-type3))))
(track-popup-menu *your-popup-menu*))