logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: Re: 'Surround with tag' behaviour: msg#00006

Subject: RE: Re: 'Surround with tag' behaviour
It's already in my .emacs file, assigned to ^Cr, which is what I believe it was in PSGML. Thanks!
 
Bob


From: emacs-nxml-mode@xxxxxxxxxxxxxxx [mailto:emacs-nxml-mode@xxxxxxxxxxxxxxx] On Behalf Of drkm
Sent: Wednesday, August 03, 2005 10:12 PM
To: emacs-nxml-mode@xxxxxxxxxxxxxxx
Subject: [emacs-nxml-mode] Re: 'Surround with tag' behaviour

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 LINKS




<Prev in Thread] Current Thread [Next in Thread>