unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* sgml-mode skip tag forward/back bug fix
@ 2002-04-26 17:42 Mallory, Rich
  2002-04-26 18:19 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Mallory, Rich @ 2002-04-26 17:42 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sgml-mode skip tag forward/back bug fix
  2002-04-26 17:42 sgml-mode skip tag forward/back bug fix Mallory, Rich
@ 2002-04-26 18:19 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2002-04-26 18:19 UTC (permalink / raw)


>>>>> "Mallory," == Mallory, Rich <Rich.Mallory@ausinfo.com> writes:
> 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.

Note that the sgml-mode.el has been changed in the CVS repository to better
support XML, so you might want to try it out.
See http://savannah.gnu.org/projects/emacs.

> 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.

Thank you.  I'll see if it has been fixed already.
BTW, it is generally preferable to use `diff -u' or `diff -c' when sending
diffs (and not only for Emacs maintainers).


    Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-26 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-26 17:42 sgml-mode skip tag forward/back bug fix Mallory, Rich
2002-04-26 18:19 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).