emacs-w3m shimbunをopmlに対応させるべくがんばっているが…

最新版こっちです。
lightcyan / my-shimbun
https://github.com/lightcyan/my-shimbun/

sb-opml-rss.elという事でsb-cnet-rss.el由来のコードを変更しているところです。

;;; sb-opml-rss.el --- shimbun backend for american-rss

;; Modified from sb-cnet-rss.el by Hiroyuki KUROSAKI <noir@st.rim.or.jp>
;; Below is the original copyright notice of sb-cnet-rss.el.
;;
;; Copyright (C) 2003 NAKAJIMA Mikio <minakaji@namazu.org>

;; Author: NAKAJIMA Mikio <minakaji@namazu.org>
;; Keywords: news
;; Created: Jun 14, 2003

;; This file is a part of shimbun.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.

;;; Commentary:

;;; Code:

(require 'shimbun)
(require 'sb-rss)

(luna-define-class shimbun-opml-rss (shimbun-rss) ())

(defvar shimbun-opml-rss-counter 1) ;; **コンストラクタで1に初期化したかったが使い方が分からないのでこうした。
(defvar shimbun-opml-rss-file "~/opml.xml")
(defvar shimbun-opml-rss-groups '("1" "2" "3" "4" "5")) ;; **関数化したいが、何か他のファイルを弄る必要あり?
(defvar shimbun-opml-rss-from-address  "")
(defvar shimbun-opml-rss-content-start "<h3>.*</h3>\\|<!-- エントリー -->\\|<DIV CLASS=POST_BODY>") ;; 適当
(defvar shimbun-opml-rss-content-end "<div class=\".*comment.*\">\\|<!-- /エントリー -->") ;; 適当

;; <〜面とかにアクセスするためのURL> → opmlからblogのfeedを返させる。
(luna-define-method shimbun-index-url ((shimbun shimbun-opml-rss))
  (let ((num (shimbun-opml-rss-internal)))
    (set-buffer (get-buffer-create " *w3m opml*"))
    (insert-file-contents shimbun-opml-rss-file)
    (let ((i 0))
      (while (and (< i num)
		  (re-search-forward "xmlUrl=\"\\(http://.*\\)\"" nil t)
		  (setq i (1+ i))))
      (match-string 1))))

;; 次にopmlの中の何番目のurlを読むべきか返す。
;; shimbun-current-group-internal がgroupを返すのを真似ている。
(defun shimbun-opml-rss-internal ()
  (setq shimbun-opml-rss-counter(1+ shimbun-opml-rss-counter)))

;; ;; mew-shimbun-folder-groups のGroupを返す 
;; ;; …と思ったが、なんかうまく行かず、とりあえず defvar にした。
;; (luna-define-method shimbun-opml-rss-groups ((shimbun shimbun-opml-rss))
;;   (assoc "opml-rss" mew-shimbun-folder-groups))

;; <〜面から記事へアクセスするためのURL> → feedからblogのartcleを返させる。
(luna-define-method shimbun-get-headers ((shimbun shimbun-opml-rss)
					 &optional range)
  (shimbun-opml-rss-get-headers shimbun))

(defun shimbun-opml-rss-get-headers (shimbun)
  (sit-for 0) ;; 何も書かないのもあれなので。
  )

(luna-define-method shimbun-rss-build-message-id
  ((shimbun shimbun-opml-rss) url date)
  (unless (string-match "http://\\(.+\\)" url)
    (error "Cannot find message-id base"))
  (concat (match-string-no-properties 1 url) ""))

(provide 'sb-opml-rss)

;;; sb-opml-rss.el ends here

お聞きしたい事として、**付けた、
コンストラクタで1に初期化したかったが使い方が分からないのでこうした。(これはダメならダメでこのままでもいいかと思っています)

関数化したいが、何か他のファイルを弄る必要あり?(これは今はopmlの中のフィードを5個しか処理しないこと言うことなので、このままではちょっと悲しいです)

テストしてみたいと言う方は .mew

(setq mew-shimbun-folder-groups
      '(("opml-rss"
 	 ("opml-rss.1" . last)
 	 ("opml-rss.2" . last)
 	 ("opml-rss.3" . last)
 	 ("opml-rss.4" . last)
 	 ("opml-rss.5" . last))))

と書いてください。(これも一番大きい数を書くだけで何とかしたいです)

他にもなにか気づいた事ございましたら教えていただきたいと思います。ちなみに今 shimbun-get-headers を書いているところです。