navi2chの履歴モードでレス数を表示したい

2chを見るのにnavi2chを使ってるんだけど、僕は更新されているスレのチェックを以下ように行っている。

  1. M-x navi2chで起動。
  2. 履歴に移動。
  3. *を押して複数選択。
  4. miで選択した項目を更新。
  5. tでオフラインモードに移行。
  6. 更新フラグ(U)が立っているスレを見る。

navi2chの履歴モードにレス数が表示されないので、いつ新しいスレに切り替わったのが後で確認するのが面倒だ。ということで履歴モードにレス数を表示するpatchを作ってみた(navi2chのバージョンは、1.7.5)。クイックハックなんで、実装方法が中途半端すぎ。bookmarkモードの方にも同じような実装しないとダメだし。

diff -ru navi2ch-1.7.5.orig/navi2ch-article.el navi2ch-1.7.5/navi2ch-article.el
--- navi2ch-1.7.5.orig/navi2ch-article.el	Wed Aug 25 22:29:47 2004
+++ navi2ch-1.7.5/navi2ch-article.el	Sat Mar  5 17:21:32 2005
@@ -1013,7 +1013,8 @@
 		     (not (equal (navi2ch-article-get-current-number) number)))
 	    (navi2ch-article-goto-number number t))
 	  (navi2ch-history-add navi2ch-article-current-board
-			       navi2ch-article-current-article)
+			       navi2ch-article-current-article
+			       (length navi2ch-article-message-list))
 	  (navi2ch-bm-update-article navi2ch-article-current-board
 				     navi2ch-article-current-article))
       (when (and (buffer-live-p buffer)
diff -ru navi2ch-1.7.5.orig/navi2ch-history.el navi2ch-1.7.5/navi2ch-history.el
--- navi2ch-1.7.5.orig/navi2ch-history.el	Wed Oct  6 22:24:45 2004
+++ navi2ch-1.7.5/navi2ch-history.el	Sat Mar  5 17:21:32 2005
@@ -81,6 +81,9 @@
 (defun navi2ch-history-get-article (item)
   (nth 2 (assoc item navi2ch-history-alist)))
 
+(defun navi2ch-history-get-res (item)
+  (nth 3 (assoc item navi2ch-history-alist)))
+
 (defun navi2ch-history-exit ()
   (run-hooks 'navi2ch-history-exit-hook))
 
@@ -97,7 +100,7 @@
   (concat (cdr (assq 'uri board))
 	  (cdr (assq 'artid article))))
 
-(defun navi2ch-history-add (board article)
+(defun navi2ch-history-add (board article res)
   "BOARD と ARTICLE で表される スレッドを追加"
   (let* ((key (navi2ch-history-get-key board article))
 	 (old-node (assoc key navi2ch-history-alist))
@@ -106,7 +109,7 @@
     (setq navi2ch-history-alist (delete old-node navi2ch-history-alist))
     (setq navi2ch-history-alist
 	  (cons (if (or subject (not old-subject))
-		    (list key board article)
+		    (list key board article res)
 		  old-node)
 		navi2ch-history-alist)))
   (when (and navi2ch-history-max-line
@@ -123,7 +126,9 @@
        (navi2ch-history-get-key
 	(navi2ch-history-get-board item)
 	(navi2ch-history-get-article item)))
-   (format "[%s]" (cdr (assq 'name (navi2ch-history-get-board item))))))
+   (format "(%4s) [%s]"
+	   (navi2ch-history-get-res item)
+	   (cdr (assq 'name (navi2ch-history-get-board item))))))
 
 (defun navi2ch-history-insert-subjects ()
   (let ((i 1))
@@ -168,14 +173,16 @@
   (let ((info (mapcar
 	       (lambda (x)
 		 (let ((board (nth 1 x))
-		       (article (nth 2 x)))
+		       (article (nth 2 x))
+		       (res (nth 3 x)))
 		   (list (list
 			  (assq 'name board)
 			  (assq 'uri board)
 			  (assq 'id board))
 			 (list
 			  (assq 'subject article)
-			  (assq 'artid article)))))
+			  (assq 'artid article))
+			 res)))
 	       navi2ch-history-alist)))
     (navi2ch-save-info navi2ch-history-file info t)))
 

BUGS。

  • レスの情報が得られない場合は( nil)と表示される。
  • 画面更新のタイミングがダメダメ。M-x navi2ch-history-syncを呼ぶか、qを押して履歴モードから抜けてもう一度履歴モードに入るとかする必要がある。