[Mew-dist 15209] mew-goto-last-message

KOIE Hidetaka ( 鯉江英隆 ) hide at example.com
2000年 11月 29日 (水) 16:02:42 JST


読みたいメッセージにreviewマークをつけておいて
dで不要なメッセージを消しながらNで移動する場合
直前のメッセージを読み返したくなったとき一発で戻りたいと思いました。
そこで最後に表示したメッセージにジャンプするコマンドをつくってみました。

━━━━━━━━━━━━━━ここから━━━━━━━━━━━━━━
--- ../mew-1.95b82/mew-summary.el	Mon Nov 27 22:41:50 2000
+++ mew-summary.el	Wed Nov 29 15:36:27 2000
@@ -665,6 +665,30 @@ (defmacro mew-summary-cursor-postscript 
 ;;; Display
 ;;;
 
+(defvar mew-last-message '((nil nil) (nil nil)))
+(defun mew-set-last-message (vfld msg)
+  (let ((here (list vfld msg)))
+    (if (not (or (equal here (car mew-last-message))
+                 (equal here (cadr mew-last-message))))
+        (setq mew-last-message (list here
+                                     (car mew-last-message))))))
+(defun mew-goto-last-message ()
+  (interactive)
+  (let* ((ofld (mew-summary-folder-name 'ext))
+         (omsg (mew-summary-message-number))
+         (1st (car mew-last-message))
+         (2nd (cadr mew-last-message))
+         (fldmsg (if (not (equal (list ofld omsg) 1st))
+                     1st
+                   (setq mew-last-message (list 2nd 1st))
+                   2nd))
+         (fld (car fldmsg))
+         (msg (cadr fldmsg)))
+    (if (and fld msg)
+        (progn
+          (mew-summary-goto-folder nil fld)
+          (mew-summary-jump-message msg)))))
+
 (defun mew-summary-display (&optional redisplay)
   " (1) If called interactively, this command lets you read through
 messages.  That is, display a message, scroll it, and
@@ -692,6 +716,7 @@ (defun mew-summary-display (&optional re
       ()
     (mew-summary-msg-or-part
      (let* ((fld (mew-summary-folder-name))
+	    (vfld (mew-summary-folder-name 'ext))
 	    (msg (mew-summary-message-number))
 	    (part (mew-syntax-nums))
 	    (ofld (mew-current-get 'fld))
@@ -707,6 +732,7 @@ (defun mew-summary-display (&optional re
 	     (mew-summary-toggle-disp-msg 'on)
 	     (mew-window-configure 'message)
 	     ;; messge buffer
+             (mew-set-last-message vfld msg)
 	     (mew-current-set 'fld fld) 
 	     (mew-current-set 'msg (or msg omsg))
 	     (mew-current-set 'part part)
@@ -763,6 +789,7 @@ (defun mew-summary-display (&optional re
 		     (setq next t)))))))
 	 (if mew-decode-error 
 	     (message "MIME decoding error: %s" mew-decode-error))
+	 (setq mew-message-buffer-summary vfld)
 	 (select-window win)
 	 ;; summary buffer
 	 (mew-summary-cursor-postscript nil)
@@ -879,6 +906,7 @@ (defun mew-summary-analyze-again (&optio
     (let ((mew-decode-broken
 	   (if arg (not mew-decode-broken) mew-decode-broken))
 	  (fld (mew-summary-folder-name))
+	  (vfld (mew-summary-folder-name 'ext))
 	  (msg (mew-summary-message-number))
 	  (part (mew-syntax-nums))
 	  (win (selected-window))
@@ -897,6 +925,7 @@ (defun mew-summary-analyze-again (&optio
 	    (mew-summary-toggle-disp-msg 'on)
 	    (mew-window-configure 'message)
 	    ;; message buffer
+            (mew-set-last-message vfld msg)
 	    (mew-current-set 'fld fld) 
 	    (mew-current-set 'msg msg)
 	    (mew-current-set 'part part)
@@ -909,6 +938,7 @@ (defun mew-summary-analyze-again (&optio
 	      (mew-summary-display-part cache part)))
 	(if mew-decode-error 
 	    (message "MIME decoding error: %s" mew-decode-error))
+	(setq mew-message-buffer-summary vfld)
 	(select-window win)
 	;; summary buffer
 	(mew-summary-cursor-postscript lines))))))
@@ -926,6 +956,7 @@ (defun mew-summary-display-asis (&option
   (interactive "P")
   (mew-summary-msg
    (let* ((fld (mew-summary-folder-name))
+	  (vfld (mew-summary-folder-name 'ext))
 	  (msg (mew-summary-message-number))
 	  (win (selected-window))
 	  size)
@@ -934,6 +965,7 @@ (defun mew-summary-display-asis (&option
 	   (mew-summary-toggle-disp-msg 'on)
 	   (mew-window-configure 'message)
 	   ;; messge buffer
+           (mew-set-last-message vfld msg)
 	   (mew-elet
 	    (mew-current-set 'fld fld)
 	    (mew-current-set 'msg msg)
@@ -943,11 +975,16 @@ (defun mew-summary-display-asis (&option
 	    (mew-decode-syntax-delete)
 	    (if (and (null arg)
 		     (mew-summary-message-toobig fld msg))
-		(setq size mew-file-max-size))
+                (progn
+                  (message
+                   (substitute-command-keys
+                    "Too large, truncated. To see the entire message, type 'C-u \\<mew-summary-mode-map>\\[mew-summary-display-asis]'"))
+                  (setq size mew-file-max-size)))
 	    ;;
 	    (mew-summary-display-raw fld msg size)))
        (if mew-decode-error 
 	   (message "MIME decoding error: %s" mew-decode-error))
+       (setq mew-message-buffer-summary vfld)
        (select-window win)
        ;; summary buffer
        (mew-summary-cursor-postscript nil)))))
@@ -1951,6 +1988,10 @@ (defun mew-summary-toggle-8bit ()
   (if mew-use-8bit
       (message "mew-use-8bit has been set to 't'")
     (message "mew-use-8bit has been set to 'nil'")))
+
+(defun mew-summary-goto-msg-mode ()
+  (interactive)
+  (other-window 1))
 
 ;;;
 ;;; Flushing the queue
--- ../mew-1.95b82/mew-key.el	Mon Nov 27 00:36:24 2000
+++ mew-key.el	Wed Nov 29 15:38:30 2000
@@ -74,6 +74,7 @@ (if mew-summary-mode-map
   (define-key mew-summary-mode-map "q"    'mew-summary-suspend)
   (define-key mew-summary-mode-map "Q"    'mew-summary-quit)
   (define-key mew-summary-mode-map "C"    'mew-summary-set-config)
+  (define-key mew-summary-mode-map "h"    'mew-summary-goto-msg-mode)
   (define-key mew-summary-mode-map "\C-c\C-a" 'mew-summary-addrbook-add)
   (define-key mew-summary-mode-map "\C-c\C-c" 'mew-summary-send-message)
   (define-key mew-summary-mode-map "\C-c\C-e" 'mew-summary-execute-external)
@@ -131,6 +132,7 @@ (if mew-summary-mode-map
   (define-key mew-summary-mode-map "mm"   'mew-summary-mark-make-thread)
   (define-key mew-summary-mode-map "\C-c\C-b" 'mew-summary-exchange-point)
   (define-key mew-summary-mode-map "\eo"  'mew-summary-auto-refile)
+  (define-key mew-summary-mode-map "L"    'mew-goto-last-message)
   ;;
   (if mew-xemacs-p
       (define-key mew-summary-mode-map 'button2 'mew-summary-mouse-show)
━━━━━━━━━━━━━━ここまで━━━━━━━━━━━━━━

#書いたはいいが、いまいち便利じゃない感じがしてます。

--
KOIE Hidetaka 鯉江英隆 <hide at example.com>



Mew-dist メーリングリストの案内