From: "Mallory, Rich" <Rich.Mallory@ausinfo.com>
Subject: sgml-mode skip tag forward/back bug fix -- followup
Date: Mon, 29 Apr 2002 14:51:41 -0500 [thread overview]
Message-ID: <E0DD84E4C306394C8C897D3ED9BB17E11B4B84@aisexch.ausinfo.com> (raw)
This is a followup to the email to you included at the end of this
email, on the above subject.
Further testing revealed that the bug fix proposed in that email
was incomplete. The complete set of diffs follows, including the
diffs from the original email. The proposed fix works without the
new additions. However, the change to line 687 is needed to
keep up-list from beeping each time function sgml-skip-tag-forward
is executed. (My machine at work has no speaker, so I didn't hear
a beep and ignored the message until I got home.) The original
code for line 683 produces no beep, but the change to line 683
seems advisable.
Diffs between old sgml-mode.el (<) and new (>)
In sgml-skip-tag-backward --
656c656
< (re (concat "</?" (regexp-quote (match-string 1)))))
---
> (re (concat "</?" (regexp-quote (match-string 1)) "[/ \n\t>]")))
In sgml-skip-tag-forward --
676c676
< (re (concat "</?" (regexp-quote (match-string 1))))
---
> (re (concat "</?" (regexp-quote (match-string 1)) "[/ \n\t>]"))
683c683
< (not (up-list -1))
---
> (not (progn (backward-char 1) (up-list -1)))
687c687
> (up-list 1)
---
< (progn (backward-char 1) (up-list 1))
The changes to lines 683 and 687 are required by the change to
line 676. The latter causes the regexp 're' to match one
additional character, leaving the point after that character. If this
character is '>', the point is outside the tag matched by 're'. In
the original code, the point was inside the tag, and up-list moved
the point to the beginning of the tag. With the point after the
closing '>', up-list can't do that.
-- Rich Mallory
-----Original Message-----
From: Mallory, Rich
Sent: Friday, April 26, 2002 12:43 PM
To: 'bug-gnu-emacs@gnu.org'
Subject: sgml-mode skip tag forward/back bug fix
Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.
In GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195) of 2002-03-19 on buffy
configured using `configure --with-msvc (12.00)'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: ENU
locale-coding-system: iso-latin-1
default-enable-multibyte-characters: t
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
In editing an XML file in sgml-mode, the commands sgml-skip-tag-forward and
sgml-skip-tag-backward failed as follows. When an outer element contained an
inner element and the inner element's tag name began with the outer element's
tag name but was longer, these commands did not skip the whole outer element,
from start tag to end tag (or back), but only part of it.
For example, in the XML --
<foo>
<whatever .../>
<fooBar note="Tag name begins with 'foo', the outer tag name." />
<something .../>
</foo>
-- with the cursor before <foo>, sgml-skip-tag-forward would only skip to the
end of tag <foo>, not to the end of tag </foo>, and
-- with the the cursor after </foo>, sgml-skip-tag-backward would only skip to
the beginning of <fooBar .../>, not to the beginning of <foo>.
Proposed fix: The changelog and proposed changes to the code are shown below.
The added elements of the regexps cause the search code to look for the end of
the tag name, not just its beginning. The new code seems to work correctly.
However, I am not sure that the added regexp elements are are sufficiently
general to cover all cases.
Change log
2002-04-26 Rich Mallory <mallory@ausinfo.com>
* lisp/textmodes/sgml-mode.el (sgml-skip-tag-backward, sgml-skip-tag-forward):
Fix bug where an outer element containing an inner element whose name
began with the outer name (e.g., <foo> ... <fooBar ... /> ... </foo>)
was not properly skipped.
Diffs between old sgml-mode.el (<) and new (>)
In sgml-skip-tag-backward --
656c656
< (re (concat "</?" (regexp-quote (match-string 1)))))
---
> (re (concat "</?" (regexp-quote (match-string 1)) "[/ \n\t>]")))
In sgml-skip-tag-forward --
676c676
< (re (concat "</?" (regexp-quote (match-string 1))))
---
> (re (concat "</?" (regexp-quote (match-string 1)) "[/ \n\t>]"))
(I haven't actually modified sgml-mode.el but put the changes in another file.
The diffs above show what has been changed.)
-- Rich Mallory
next reply other threads:[~2002-04-29 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-29 19:51 Mallory, Rich [this message]
2002-04-29 23:34 ` sgml-mode skip tag forward/back bug fix -- followup Kevin Rodgers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E0DD84E4C306394C8C897D3ED9BB17E11B4B84@aisexch.ausinfo.com \
--to=rich.mallory@ausinfo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.