[mew-dist 23094] split vertical もどき
Hideyuki SHIRAI ( 白井秀行 )
shirai at example.com
2003年 2月 20日 (木) 21:37:00 JST
# 現実逃避のイッカンで .mew.el の中身を吐き出してみる。
Window 制御の話で思い出したのですが、こういうのやっています。
一時的に message buffer のコピーを作るものです。
"}" => 今見ている message のコピーを作る。
"{" => コピーを消す。
"]", "[" => コピーが無ければコピーを作り、コピーがあれば上下にスクロール
(define-key mew-summary-mode-map "}" 'mew-summary-message-copy)
(define-key mew-summary-mode-map "{" 'mew-summary-message-copy-kill)
(define-key mew-summary-mode-map "]" 'mew-summary-message-copy-up)
(define-key mew-summary-mode-map "[" 'mew-summary-message-copy-down)
(define-key mew-message-mode-map "}" 'mew-message-copy)
(define-key mew-message-mode-map "{" 'mew-message-copy-kill)
(define-key mew-message-mode-map "]" 'mew-message-copy-up)
(define-key mew-message-mode-map "[" 'mew-message-copy-down)
(defvar mew-message-copy-buffer "*Mew Message* REVIEW")
(defun mew-summary-message-copy-kill ()
(interactive)
(mew-summary-message-copy 'kill))
(defun mew-summary-message-copy (&optional kill)
(interactive "P")
(let ((owin (selected-window))
(mbuf (mew-buffer-message)))
(if kill
(mew-message-copy 'kill)
(when (and (get-buffer mbuf) (get-buffer-window mbuf))
(select-window (get-buffer-window mbuf))
(mew-message-copy)
(select-window owin)))))
(defun mew-summary-message-copy-down ()
(interactive)
(mew-summary-message-copy-up 'reverse))
(defun mew-summary-message-copy-up (&optional reverse)
(interactive "P")
(let ((owin (selected-window))
(nbuf (get-buffer mew-message-copy-buffer))
(mbuf (mew-buffer-message))
cwin)
(when (setq cwin (or (and nbuf (get-buffer-window nbuf))
(and mbuf (get-buffer-window mbuf))))
(select-window cwin)
(mew-message-copy-up reverse)
(select-window owin))))
(defun mew-message-copy-kill ()
(interactive)
(mew-message-copy 'kill))
(defun mew-message-copy (&optional kill)
(interactive "P")
(if kill
(let ((nbuf (get-buffer mew-message-copy-buffer)))
(when nbuf
(delete-windows-on nbuf)
(kill-buffer nbuf)))
(let ((nbuf (get-buffer-create mew-message-copy-buffer))
(msg (buffer-substring (point-min) (point-max)))
(fld (mew-minfo-get-summary))
(owin (selected-window))
(start (window-start))
(end (window-end))
new)
(if (get-buffer-window nbuf)
(select-window (get-buffer-window nbuf))
(setq new t)
(split-window-vertically)
(next-window)
(pop-to-buffer nbuf))
(setq rwin (selected-window))
(setq buffer-read-only t)
(mew-elet
(mew-erase-buffer)
(insert msg)
(mew-minfo-set-summary fld)
(let ((mew-message-mode-map (copy-keymap mew-message-mode-map)))
(define-key mew-message-mode-map "q" 'mew-message-copy-kill)
(mew-message-mode))
(set-buffer-modified-p nil)
(when (> (window-height) (/ (frame-height) 3))
(shrink-window (- (window-height) (/ (frame-height) 3))))
(set-window-start (selected-window)
(progn
(goto-char end)
(forward-line (- (+ (window-height) (if new 1 -2))))
(point))))
(select-window owin))))
(defun mew-message-copy-down ()
(interactive)
(mew-message-copy-up 'reverse))
(defun mew-message-copy-up (&optional reverse)
(interactive "P")
(let ((owin (selected-window))
(mbuf (mew-buffer-message))
(nbuf (get-buffer mew-message-copy-buffer)))
(cond
((and nbuf (get-buffer-window nbuf))
(select-window (get-buffer-window nbuf))
(if reverse
(if (eq (window-start) (point-min))
(message "Beginning of buffer")
(scroll-up (- 3 (window-height))))
(if (>= (window-end) (point-max)) ;; '>' for XEmacs
(message "End of buffer")
(scroll-up (- (window-height) 3))))
(select-window owin))
((and (get-buffer mbuf) (get-buffer-window mbuf))
(mew-message-copy)))))
--
白井秀行 (mailto:shirai at example.com)
Mew-dist メーリングリストの案内