[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Evaluating forms in particular pages
>>>>> In [emacs-w3m : No.08715] Romain Francoise wrote:
> I'm looking for an elegant way to evaluate arbitrary code upon loading
> of certain pages, in a similar fashion to what Local Variables do in
> regular files. I need this because I've been using outline-minor-mode
> extensively in certain web pages to hide uninteresting parts, and I need
> to set `outline-regexp' to different values depending on the page.
> For example in this page: http://bugs.debian.org/src:emacs-snapshot
> I evaluate the following form:
> (outline-minor-mode 1)
> (set (make-local-variable 'outline-level) (lambda () 1))
> (set (make-local-variable 'outline-regexp)
> "\\(Outstanding\\|Resolved\\) bugs --"))
> I can then hide long lists of uninteresting bugs with the various
> Outline commands, which is very convenient. At work I use this
> method to view wiki pages as outline documents.
I tried it in that page but I didn't see any difference. It
might mean that there's no serious bug today or that I did
> Since I keep my Emacs sessions running for weeks, having to evaluate
> forms once in a while isn't really a problem, but automating the process
> would be nice. Is there an existing way to do this? I couldn't find
> If not something like `after-load-alist' comes to mind (i.e. an alist of
> regexps for URLs and corresponding forms to evaluate).
Well, though it might not measure up to your ideal, how about
using the `w3m-fontify-after-hook'?
(when (and w3m-current-url
(set (make-local-variable 'outline-level) (lambda () 1))
(set (make-local-variable 'outline-regexp)
"\\(Outstanding\\|Resolved\\) bugs --"))))