|
Re: 'Surround with tag' behaviour: msg#00002emacs.nxml.general
Josh Sled writes: > (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 ">"))) This works even in non-interactive and takes the 'tag-name' length in account: (defun surround-region-with-tag (tag-name beg end) (interactive "sTag name: \nr") (save-excursion (goto-char beg) (insert "<" tag-name ">") (goto-char (+ end 2 (length tag-name))) (insert "</" tag-name ">"))) --drkm ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hkhnk2l/M=362329.6886308.7839368.1510227/D=groups/S=1706030390:TM/Y=YAHOO/EXP=1123128878/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</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> |
|---|---|---|
| Previous by Date: | Re: 'Surround with tag' behaviour: 00002, Josh Sled |
|---|---|
| Next by Date: | Re: File changed during load: 00002, drkm |
| Previous by Thread: | Re: 'Surround with tag' behaviouri: 00002, Josh Sled |
| Next by Thread: | RE: Re: 'Surround with tag' behaviour: 00002, DuCharme, Bob (LNG-CHO) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |