logo       

Re: 'Surround with tag' behaviour: msg#00001

emacs.nxml.general

Subject: Re: 'Surround with tag' behaviour

On Sat, 2005-07-23 at 10:24 +0000, pepeggg wrote:
> Now I am an emacs newbie too, and I am sorry if my question doesn't
> make sense, but a feature I am missing in nxml is the ability to
> select a piece of text and surround it with a tag. This can be done

This is a very basic version of what you're after:

(defun surround-region-with-tag (tag-name)
(interactive "stag name: ")
(save-excursion
(goto-char (region-beginning))
(insert (concat "<" tag-name ">")))
(goto-char (region-end))
(insert (concat "</" tag-name ">")))

It will prompt for the tag name, and insert "<tag-name>" and
"</tag-name>" at the beginning and end of the region.

My elisp-fu is not so good; it obviously doesn't allow any interactivity
with nxml with respect to which tags may be relevant ... nor does it do
any error checking. But it does basically work.

...jsled

--
http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`


------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h69i5ge/M=362131.6882499.7825260.1510227/D=groups/S=1706030390:TM/Y=YAHOO/EXP=1123119228/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->


Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/emacs-nxml-mode/

<*> To unsubscribe from this group, send an email to:
emacs-nxml-mode-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise