[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: customizable w3m-next-url w3m-previous-url


First of all, thank you for your suggesting good idea.

However, I think that your idea should be realized by using
w3m-relationshinp-estimate-rules, which is a generic framework to
estimate relationship between pages.

>> On Sat, 18 Feb 2012 17:04:15 +0100
>> laynor@xxxxxxxxx (Alessandro Piras) said as follows:

>I think it would be a good idea to have next-url and previous-url
>matching customizable (to a certain extent) by the user.
>I modified my copy of w3m.el like this (I downloaded emacs-w3m from
>this git mirror: https://github.com/jwiegley/emacs-w3m):

>diff --git a/w3m.el b/w3m.el
>index 87f9e1b..24bfced 100644
>--- a/w3m.el
>+++ b/w3m.el
>@@ -3561,6 +3561,16 @@ The database is kept in `w3m-entity-table'."
> (error nil))
> (and w3m-imitate-widget-button t)))

>+(defcustom w3m-next-url-words (list "next")
>+  "Words matching ``next page'' links."
>+  :type '(repeat string)
>+  :group 'w3m)
>+(defcustom w3m-previous-url-words (list "prev" "previous")
>+  "Words matching ``previous page'' links."
>+  :type '(repeat string)
>+  :group 'w3m)
> (defun w3m-fontify-anchors ()
> "Fontify anchor tags in the buffer which contains halfdump."
> (let ((help (w3m-make-help-echo w3m-balloon-help))
>@@ -3626,6 +3636,11 @@ The database is kept in `w3m-entity-table'."
> "\n"
> (w3m-url-readable-string href))))
> (setq bhhref (w3m-url-readable-string href)))
>+           (let ((link-text (buffer-substring start end)))
>+             (cond ((member link-text w3m-next-url-words)
>+                    (setq w3m-next-url href))
>+                   ((member link-text w3m-previous-url-words)
>+                    (setq w3m-previous-url href))))
> (w3m-add-text-properties start end
> (list 'w3m-href-anchor href
> 'w3m-balloon-help bhhref
>I think this could be extended adding support for link text regexps instead
>of whole string comparison.
>Please let me know what you think about it :-)
>Alessandro Piras

TSUCHIYA Masatoshi