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

Re: Evaluating forms in particular pages



>>>>> In [emacs-w3m : No.08718] Romain Francoise wrote:

>> (add-hook
>>  'w3m-fontify-after-hook
>>  (lambda nil
>>    (when (and w3m-current-url
>> 	      (string-match "\\`http://bugs\\.debian\\.org/";

It goes without saying that you can complicate this regexp as
much as you need.  For example:

"\\`http://\\(?:foo\\.org\\|bar\\.net\\|baz\\.com\\)/"

But I agree to say that gets ugly.

>> 			    w3m-current-url))
>>      (outline-minor-mode 1)
>>      (set (make-local-variable 'outline-level) (lambda () 1))
>>      (set (make-local-variable 'outline-regexp)
>> 	  "\\(Outstanding\\|Resolved\\) bugs --"))))

> That's always a possibility, but I don't find it very elegant, nor
> convenient -- it means I have to add one item per page on this hook.
> I guess my needs are too specialized...

Here's another plan:

(defvar w3m-after-load-page-alist nil)

(defun w3m-eval-after-load-page (regexp form)
  ...)

(w3m-eval-after-load-page "\\`http://bugs\\.debian\\.org/";
  '(progn
     (outline-minor-mode 1)
     (set (make-local-variable 'outline-level) (lambda () 1))
     (set (make-local-variable 'outline-regexp)
	  "\\(Outstanding\\|Resolved\\) bugs --")))

Though I'm not sure it is your taste, it doesn't seem very hard
to implement such one (don't you have time to try it? ;-).