Making emacs insert a user provided HTML tag pair

Geek

Active member
Joined
Jun 6, 2008
Messages
22,825
Reaction score
0
Points
36
In HTML mode, and/or in related functions available in the internet, it appears that one can do the following:

Insert a pair of HTML codes that one would then fill in with stuff.

If point is in (or at the end of) a word, have the word wrapped in a specific HTML code pair.

If a region of text is selected, have the region wrapped in a specific HTML code pair.

In all cases, there is a specific function for a given HTML code pair. If there is not a function for the HTML code you like, it is easy to copy an existing functions and alter it. Then, apply key-bindings and you're off.

The problem with this method is that one ends up needing four or five new keybindings for basic HTML pairs one uses commonly, and for the rare HTML pair that you didn't happen to program, one is SOL.

The fix is a function, bound to one key and of course callable with Meta-X functionname, which queries the user to enter an HTML code, like "em" or "strong" or "blockquote" and so on, with that code then placed in the proper format surrounding the word point is in or the selected text.

It is quite possible that such code is out there, but I've not seen exactly that.

So, I took some of the code at this very very nice web site on using emacs HTML mode, and modified it, and got this:

Read the rest of this post... | Read the comments on this post...
X2Y06vLKLs0


More...
 
Back
Top