views:

113

answers:

2

Like any conscientious emacs user I edit blog posts with it all the time using "It's All Text". However I'm often inserting HTML hrefs into my text and when I come to do my final proof read they tend to get in the way. Is there a mode I can toggle into that will hide these elements?

More generally are there any pointers on how to write a mode that modifies the actual buffer view while leaving the buffer contents untouched? Or does this just involve magic hacking with font-lock?

+3  A: 

In html-mode you can use M-x sgml-tags-invisible to hide/show tags.

You can also C-c C-v to run browse-url-of-buffer, which opens the current buffer (if buffer-file-name is not nil, that is, if it's a regular file) with your default browser. This works fine enough even with partial html blocks (i.e. without <html>, <body> etc.).

giorgian
One minor snag is when the tags are hidden the display formatting isn't updated (I'm using longlines-mode) leaving rather short looking lines. Is there anyway around this?
stsquad
+1  A: 

Do you (1) directly write HTML when writing the blogpost or (2) do you use some form of wiki language for lists, tables, etc. For (1) you could have a look at org-mode and convert to HTML after proof read with org-export-region-as-html. In the second case you could look out for some special wiki mode which might hide the links (like markdown-mode).

danielpoe
I write plain text with the occasional href thrown in. I'll have to experiment with both suggested approaches.
stsquad