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

Evaluating forms in particular pages


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[1].  At work I use this
method to view wiki pages as outline documents.

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).


Romain Francoise <romain@xxxxxxxxxxxxx> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter
[1] Example result: http://orebokech.com/tmp/shot-w3m-outl.png