Discussion:
Deleting a balanced tag groups from HTML - sgml-delete-tag doesn't.
(too old to reply)
Matthew Elvey
2013-06-09 17:52:49 UTC
Permalink
I can't seem to find an html-mode command for deleting a 'balanced tag group' (which extends from an opening tag through its corresponding closing tag) that C-c C-f and C-c C-b allow one to skip across.

The function sgml-delete-tag (C-C C-d) doesn't work (it doesn't delete what's _between_ the tags and sometimes doesn't work, period) Neither kill-sentence (M-k) nor kill-paragraph delete the right thing.

Surely this has been created before and is commonly needed.

If I want a function that, e.g. will delete from <tr> to </tr>, inclusively, given the snippet below, do I need to roll my own function, and if I do, should I submit it as a patch? to sgml-mode.el?

Googling hasn't helped so far, but I have noticed I'm using an old version - GNU Emacs 22.0.97.1 ... perhaps I should be trying a less ancient version of emacs? I tried web-mode; it won't compile, but C-c ed.
I tried nxhtml-mode (AKA nXML) it doesn't have this.

Just before posting this, I found almost the right code for what I want at http://stackoverflow.com/questions/4785444/delete-contents-of-an-html-tag-in-emacs but I thought I'd post anyway - will need a tweak and submission...?

snippet:
...
<tr>

<th id="cell60">

<b>ALABAMA</b><sup><b>8</b></sup></th>


<th id="cell61">
</tr>
...
XeCycle
2013-06-09 23:19:44 UTC
Permalink
Post by Matthew Elvey
I can't seem to find an html-mode command for deleting a
balanced tag group' (which extends from an opening tag through
its corresponding closing tag) that C-c C-f and C-c C-b allow one
to skip across.
The function sgml-delete-tag (C-C C-d) doesn't work (it doesn't
delete what's _between_ the tags and sometimes doesn't work,
period) Neither kill-sentence (M-k) nor kill-paragraph delete the
right thing.
Surely this has been created before and is commonly needed.
Yes. Use nxml-mode.
--
Carl Lei (XeCycle)
Department of Physics and Astronomy, SJTU
OpenPGP public key: 7795E591
Matthew Elvey
2013-06-12 02:16:51 UTC
Permalink
Post by XeCycle
Post by Matthew Elvey
I can't seem to find an html-mode command for deleting a
balanced tag group' ...
Surely this has been created before and is commonly needed.
Yes. Use nxml-mode.
What's it called? From my previous post:

I tried nxhtml-mode (AKA nXML) it doesn't have this.

Loading...