[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with sb-rss-hash (bug in luna?)
- From: David Engster <deng@xxxxxxxxxxxxxxx>
- Date: Mon, 23 Mar 2009 13:20:45 +0100
- X-ml-name: emacs-w3m
- X-mail-count: 10789
- References: <871vt76a9l.fsf@xxxxxxxxxxxxxxx> <b4mab7vh32y.fsf@xxxxxxx>
Katsumi Yamaoka <yamaoka@xxxxxxx> writes:
>> The problem is that only the constructor of shimbun-hash is called, not
>> the one from shimbun-rss (by 'constructor' I mean the
>> initialize-instance method). If I reverse the order of those two, it's
>> the other way round, so it seems it is always the first one.
[...]
> This issue was discussed in:
>
> http://news.gmane.org/group/gmane.emacs.w3m/thread=7974/force_load=t
>
> But we seem to have no smart solution so far, except for a workaround.
> That is, Arisawa-san provided the `shimbun-rss-initialize-ignored-subject'
> function and modified sb-itmedia.el and sb-opentechpress-jp.el so as to
> use it in the `initialize-instance' method as follows:
>
> ;; sb-itmedia.el
> (defvar shimbun-itmedia-ignored-subject "^PR:")
>
> (luna-define-method initialize-instance :after ((shimbun shimbun-itmedia)
> &rest init-args)
> (shimbun-rss-initialize-ignored-subject shimbun))
Unfortunately, this approach does not work with sb-rss-hash. The reason
for this is that in contrast to sb-multi, the sb-hash class defines a
new slot 'content-hash', which collides with the 'ignored-subject' slot
from sb-rss. If you call shimbun-rss-initialize-ignored-subject
explicitly from sb-rss-hash, it effectively overwrites the content-hash
slot.
Therefore, I'd like to suggest the attached patch as a workaround for
the non-functioning multiple inheritance in luna.el. It simply makes
shimbun-rss-hash-ignored-subject a normal variable for the rss-hash
shimbun, thereby simply ignoring the slot in sb-rss. It's not nice, but
it should make rss-hash at least working again.
Regards,
David
Index: sb-rss-hash.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/shimbun/sb-rss-hash.el,v
retrieving revision 1.4
diff -u -r1.4 sb-rss-hash.el
--- sb-rss-hash.el 17 Oct 2007 11:15:58 -0000 1.4
+++ sb-rss-hash.el 23 Mar 2009 12:09:00 -0000
@@ -32,6 +32,9 @@
(eval-and-compile
(luna-define-class shimbun-rss-hash (shimbun-hash shimbun-rss) ()))
+(defvar shimbun-rss-hash-ignored-subject nil
+ "Regexp for subjects which should be ignored by the rss-hash shimbun.")
+
(defvar shimbun-rss-hash-group-path-alist
'(;; name rss-url type(opt:html is t) content-start(opt) content-end(opt)
))
Index: sb-rss.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/shimbun/sb-rss.el,v
retrieving revision 1.45
diff -u -r1.45 sb-rss.el
--- sb-rss.el 22 Jan 2009 00:14:20 -0000 1.45
+++ sb-rss.el 23 Mar 2009 12:09:00 -0000
@@ -185,7 +185,9 @@
(shimbun-index-url shimbun)
(error-message-string err))
nil)))
- (ignored-subject (shimbun-rss-ignored-subject-internal shimbun))
+ (ignored-subject (if (eq (luna-class-name shimbun) 'shimbun-rss-hash)
+ shimbun-rss-hash-ignored-subject
+ (shimbun-rss-ignored-subject-internal shimbun)))
dc-ns rss-ns author hankaku headers)
(when xml
(setq dc-ns (shimbun-rss-get-namespace-prefix