* fontifying emacs w3m view source buffer
@ 2005-03-17 18:04 Peter K. Lee
2005-03-17 20:33 ` Thien-Thi Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Peter K. Lee @ 2005-03-17 18:04 UTC (permalink / raw)
I'm doing some server-side web stuff, and was using emacs-w3m mode to
verify generated HTML text.
I wanted to know if there were existing hooks or calls from other
emacs packages to fontify the w3m view source buffer (since it's just
HTML after all).
Since I was using NXML for authoring, I tried adding something like
the following...
(defun saint/w3m-nxml-view (url)
"Suitable for adding to `w3m-display-hook'."
(if (string-match "\\`about://source/" url)
(progn
(require 'nxml-mode)
(nxml-mode))))
(add-hook 'w3m-display-hook 'saint/w3m-nxml-view)
which does work in fontifying buffer, but you're thrown out of w3m
mode completely.
(defun saint/w3m-nxml-view (url)
"Suitable for adding to `w3m-display-hook'."
(if (string-match "\\`about://source/" url)
(progn
(require 'nxml-mode)
(nxml-fontify-buffer))))
(add-hook 'w3m-display-hook 'saint/w3m-nxml-view)
I then tried the above, but call to nxml-fontify-buffer does not seem
to work.
Any suggestions?
TIA,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fontifying emacs w3m view source buffer
2005-03-17 18:04 fontifying emacs w3m view source buffer Peter K. Lee
@ 2005-03-17 20:33 ` Thien-Thi Nguyen
2005-03-17 21:05 ` Peter K. Lee
0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2005-03-17 20:33 UTC (permalink / raw)
Peter K. Lee <saint@corenova.com> writes:
> Any suggestions?
check for applicability as you currently do, then, instead of
changing the mode of the buffer directly, copy its contents to a
new buffer which you can munge much more freely. split the
command into the check and a call to a new function (something
along the lines of "prettify-html-other-buffer"), so that you can
use the latter in other contexts. comment, document, GPL, post.
thi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fontifying emacs w3m view source buffer
2005-03-17 20:33 ` Thien-Thi Nguyen
@ 2005-03-17 21:05 ` Peter K. Lee
0 siblings, 0 replies; 3+ messages in thread
From: Peter K. Lee @ 2005-03-17 21:05 UTC (permalink / raw)
Thien-Thi Nguyen <ttn@glug.org> writes:
> Peter K. Lee <saint@corenova.com> writes:
>
>> Any suggestions?
>
> check for applicability as you currently do, then, instead of
> changing the mode of the buffer directly, copy its contents to a
> new buffer which you can munge much more freely. split the
> command into the check and a call to a new function (something
> along the lines of "prettify-html-other-buffer"), so that you can
> use the latter in other contexts. comment, document, GPL, post.
Well, I didn't have to bother with copying into new buffer and the
like, but I did get it working to my liking.
I found an existing font-lock extension to HTML helper mode, and
modified the w3m-display hook to call the entry point into that
extension.
It works beautifully for HTML, but I figure I could have it do
something similar for other types of view-source files that is NOT
HTML and fontify accordingly.
So, here's the comment, document, GPL, post.
http://home.corenova.com/projects/saint/wiki/EmacsW3MFontifyViewSource
I'll update my wiki page as I enable rest of fontification in w3m view
source mode for other extensions.
-Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-17 21:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-17 18:04 fontifying emacs w3m view source buffer Peter K. Lee
2005-03-17 20:33 ` Thien-Thi Nguyen
2005-03-17 21:05 ` Peter K. Lee
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.