* Re: xml-mode (from sgml-mode) tag skipping fix
[not found] <v1tfzun8wxy.fsf@miyazima.lti.cs.cmu.edu>
@ 2002-10-31 20:51 ` Stefan Monnier
2002-10-31 21:29 ` md5i
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Stefan Monnier @ 2002-10-31 20:51 UTC (permalink / raw)
Cc: emacs-devel
> The included patch allows `xml-mode' from sgml-mode.el to understand
> how to skip around XML-style empty tags:
>
> Example:
>
> <?xml version="1.0"?>
> <foo>
> <bar>
> <foo/>
> <bar/>
> </bar>
> </foo>
>
> `C-c C-f' before the first <bar> should go to the end of the </bar>.
> `C-c C-b' after the last </foo> should go to the beginning of the
> first <foo>.
Thanks. I believe that SGML should handle that as well (although
I'm not quite sure what <foo/> means in SGML) so I think we
could/should use the patch below instead.
Does anybody know better ?
Stefan
--- sgml-mode.el.~1.91.~ Wed Oct 30 20:55:54 2002
+++ sgml-mode.el Thu Oct 31 15:47:20 2002
@@ -691,43 +691,46 @@
(if (looking-at "</\\([^ \n\t>]+\\)")
;; end tag, skip any nested pairs
(let ((case-fold-search t)
- (re (concat "</?" (regexp-quote (match-string 1)))))
+ (re (concat "</?" (regexp-quote (match-string 1))
+ ;; Ignore empty tags like <foo/>.
+ "\\([^>]*[^/]\\)?>")))
(while (and (re-search-backward re nil t)
(eq (char-after (1+ (point))) ?/))
(forward-char 1)
(sgml-skip-tag-backward 1))))
(setq arg (1- arg))))
-(defun sgml-skip-tag-forward (arg &optional return)
+(defun sgml-skip-tag-forward (arg)
"Skip to end of tag or matching closing tag if present.
With prefix argument ARG, repeat this ARG times.
Return t iff after a closing tag."
(interactive "p")
- (setq return t)
+ (let ((return t))
(while (>= arg 1)
(skip-chars-forward "^<>")
(if (eq (following-char) ?>)
(up-list -1))
- (if (looking-at "<\\([^/ \n\t>]+\\)")
+ (if (looking-at "<\\([^/ \n\t>]+\\)\\([^>]*[^/]\\)?>")
;; start tag, skip any nested same pairs _and_ closing tag
(let ((case-fold-search t)
- (re (concat "</?" (regexp-quote (match-string 1))))
+ (re (concat "</?" (regexp-quote (match-string 1))
+ ;; Ignore empty tags like <foo/>.
+ "\\([^>]*[^/]\\)?>"))
point close)
(forward-list 1)
(setq point (point))
(while (and (re-search-forward re nil t)
(not (setq close
(eq (char-after (1+ (match-beginning 0))) ?/)))
- (not (up-list -1))
+ (goto-char (match-beginning 0))
(sgml-skip-tag-forward 1))
(setq close nil))
- (if close
- (up-list 1)
+ (unless close
(goto-char point)
- (setq return)))
+ (setq return nil)))
(forward-list 1))
(setq arg (1- arg)))
- return)
+ return))
(defun sgml-delete-tag (arg)
"Delete tag on or after cursor, and matching closing or opening tag.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-10-31 20:51 ` xml-mode (from sgml-mode) tag skipping fix Stefan Monnier
@ 2002-10-31 21:29 ` md5i
2002-11-01 4:02 ` Karl Eichwalder
2002-11-01 13:43 ` md5i
2 siblings, 0 replies; 10+ messages in thread
From: md5i @ 2002-10-31 21:29 UTC (permalink / raw)
Cc: emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
> Thanks. I believe that SGML should handle that as well (although
> I'm not quite sure what <foo/> means in SGML) so I think we
> could/should use the patch below instead.
>
> Does anybody know better ?
As far as I am concerned, you can change it this way. I've looked at
the SGML standard, and it doesn't seem to allow tags of the type
<foo/> anyway. It does allow tage of the form
<phone-number/555-5555/
but sgml-mode.el doesn't handle these, so I think we're fine. Seems
like a real wart anyway.
--
Michael Welsh Duggan
(md5i@cs.cmu.edu)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-10-31 20:51 ` xml-mode (from sgml-mode) tag skipping fix Stefan Monnier
2002-10-31 21:29 ` md5i
@ 2002-11-01 4:02 ` Karl Eichwalder
2002-11-01 16:06 ` Stefan Monnier
2002-11-01 13:43 ` md5i
2 siblings, 1 reply; 10+ messages in thread
From: Karl Eichwalder @ 2002-11-01 4:02 UTC (permalink / raw)
Cc: md5i, emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
> (although I'm not quite sure what <foo/> means in SGML)
Linkname: Web SGML Adaptations Extension
URL: http://www.sgml.u-net.com/book/sgml-4.htm#Extensions
Web SGML Adaptations Extension
When the Web SGML adaptations provided by Annex K of SGML are available an
optional net-enabling start-tag close (NESTC) delimiter can be defined in additon
to the null-end tag delimiter. When this delimiter has been defined, the start-tag
of an element to be ended with a null end-tag must end with the NESTC delimiter.
Note: If no NESTC delimiter is defined it is assumed to have the same definition
as the NET delimiter
The Reference Concrete Syntax used by DocBook, HTML, etc. does not
define a NESTC. Check the SGML declaration (.dcl or .decl) coming with
DTD; xml.dcl features the following definition:
DELIM
GENERAL SGMLREF
HCRO "&#x" -- 38 is the number for ampersand --
NESTC "/"
NET ">"
PIC "?>"
SHORTREF NONE
The Reference Concrete Syntax just says:
DELIM
GENERAL SGMLREF
SHORTREF SGMLREF
Note: Annex K "was approved by ISO's SGML technical committee on 5th
December 1997" (Martin Bryan 1997, http://www.sgml.u-net.com/book/ ).
Note 2: As it stands, XML is SGML.
--
ke@suse.de (work) / keichwa@gmx.net (home): |
http://www.gnu.franken.de/ke/ | ,__o
Free Translation Project: | _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-10-31 20:51 ` xml-mode (from sgml-mode) tag skipping fix Stefan Monnier
2002-10-31 21:29 ` md5i
2002-11-01 4:02 ` Karl Eichwalder
@ 2002-11-01 13:43 ` md5i
2 siblings, 0 replies; 10+ messages in thread
From: md5i @ 2002-11-01 13:43 UTC (permalink / raw)
Cc: emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
> Thanks. I believe that SGML should handle that as well (although
> I'm not quite sure what <foo/> means in SGML) so I think we
> could/should use the patch below instead.
Small fix. The "\\([^>]*[^/]\\)?>" references should probably read:
"\\([^>]*[^/>]\\)?>" instead.
--
Michael Welsh Duggan
(md5i@cs.cmu.edu)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 4:02 ` Karl Eichwalder
@ 2002-11-01 16:06 ` Stefan Monnier
2002-11-01 16:46 ` md5i
2002-11-01 16:49 ` Karl Eichwalder
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2002-11-01 16:06 UTC (permalink / raw)
Cc: Stefan Monnier, md5i, emacs-devel
> "Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
>
> > (although I'm not quite sure what <foo/> means in SGML)
>
> Linkname: Web SGML Adaptations Extension
> URL: http://www.sgml.u-net.com/book/sgml-4.htm#Extensions
>
> Web SGML Adaptations Extension
> When the Web SGML adaptations provided by Annex K of SGML are available an
> optional net-enabling start-tag close (NESTC) delimiter can be defined in additon
> to the null-end tag delimiter. When this delimiter has been defined, the start-tag
> of an element to be ended with a null end-tag must end with the NESTC delimiter.
>
> Note: If no NESTC delimiter is defined it is assumed to have the same definition
> as the NET delimiter
>
> The Reference Concrete Syntax used by DocBook, HTML, etc. does not
> define a NESTC. Check the SGML declaration (.dcl or .decl) coming with
> DTD; xml.dcl features the following definition:
>
> DELIM
> GENERAL SGMLREF
> HCRO "&#x" -- 38 is the number for ampersand --
> NESTC "/"
> NET ">"
> PIC "?>"
> SHORTREF NONE
>
> The Reference Concrete Syntax just says:
>
> DELIM
> GENERAL SGMLREF
> SHORTREF SGMLREF
>
>
> Note: Annex K "was approved by ISO's SGML technical committee on 5th
> December 1997" (Martin Bryan 1997, http://www.sgml.u-net.com/book/ ).
>
> Note 2: As it stands, XML is SGML.
Can anybody translate it into English for me ?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 16:06 ` Stefan Monnier
@ 2002-11-01 16:46 ` md5i
2002-11-01 16:51 ` Stefan Monnier
2002-11-01 16:49 ` Karl Eichwalder
1 sibling, 1 reply; 10+ messages in thread
From: md5i @ 2002-11-01 16:46 UTC (permalink / raw)
Cc: Karl Eichwalder, emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
>> Note 2: As it stands, XML is SGML.
>
> Can anybody translate it into English for me ?
Reading through it, and perusing the included web site, it seems to
say that SGML can be set up to handle self-closing tags like <foo/>.
--
Michael Welsh Duggan
(md5i@cs.cmu.edu)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 16:06 ` Stefan Monnier
2002-11-01 16:46 ` md5i
@ 2002-11-01 16:49 ` Karl Eichwalder
2002-11-01 16:55 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: Karl Eichwalder @ 2002-11-01 16:49 UTC (permalink / raw)
Cc: md5i, emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
>> Note: Annex K "was approved by ISO's SGML technical committee on 5th
>> December 1997" (Martin Bryan 1997, http://www.sgml.u-net.com/book/ ).
>>
>> Note 2: As it stands, XML is SGML.
>
> Can anybody translate it into English for me ?
Last time I tried to explain the mysteries about SGML declarations and
you asked for a web reference. This time I posted such a reference:
http://www.sgml.u-net.com/book/ -- Martin Bryan's book is worth reading.
SGML documents can look very different, depending on the SGML
declaration in use.
--
ke@suse.de (work) / keichwa@gmx.net (home): |
http://www.gnu.franken.de/ke/ | ,__o
Free Translation Project: | _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 16:46 ` md5i
@ 2002-11-01 16:51 ` Stefan Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2002-11-01 16:51 UTC (permalink / raw)
Cc: Stefan Monnier, Karl Eichwalder, emacs-devel
> >> Note 2: As it stands, XML is SGML.
> >
> > Can anybody translate it into English for me ?
>
> Reading through it, and perusing the included web site, it seems to
> say that SGML can be set up to handle self-closing tags like <foo/>.
Thanks. I thus installed the patch I suggested with the little
fixup of [^/] -> [^/>] you just sent.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 16:49 ` Karl Eichwalder
@ 2002-11-01 16:55 ` Stefan Monnier
2002-11-01 17:31 ` Karl Eichwalder
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2002-11-01 16:55 UTC (permalink / raw)
Cc: Stefan Monnier, md5i, emacs-devel
> >> Note: Annex K "was approved by ISO's SGML technical committee on 5th
> >> December 1997" (Martin Bryan 1997, http://www.sgml.u-net.com/book/ ).
> >>
> >> Note 2: As it stands, XML is SGML.
> >
> > Can anybody translate it into English for me ?
>
> Last time I tried to explain the mysteries about SGML declarations and
> you asked for a web reference. This time I posted such a reference:
> http://www.sgml.u-net.com/book/ -- Martin Bryan's book is worth reading.
>
> SGML documents can look very different, depending on the SGML
> declaration in use.
Sure. I just wanted to know whether it's safe for sgml-mode
to treat <foo/> in the same way as xml-mode does.
I know that tags can use something else than < and >, but sgml-mode
doesn't try to handle those cases.
I.e. my question didn't have much to do with the SGML definition
but more with the way SGML is usually used.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xml-mode (from sgml-mode) tag skipping fix
2002-11-01 16:55 ` Stefan Monnier
@ 2002-11-01 17:31 ` Karl Eichwalder
0 siblings, 0 replies; 10+ messages in thread
From: Karl Eichwalder @ 2002-11-01 17:31 UTC (permalink / raw)
Cc: md5i, emacs-devel
"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:
> I.e. my question didn't have much to do with the SGML definition
> but more with the way SGML is usually used.
By definition, <foo/> is neither allowed for HTML documents
(cf. html.d[e]?cl) nor for DocBook documents (docbook.dcl). Thus it's
usually not used.
--
ke@suse.de (work) / keichwa@gmx.net (home): |
http://www.gnu.franken.de/ke/ | ,__o
Free Translation Project: | _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-11-01 17:31 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <v1tfzun8wxy.fsf@miyazima.lti.cs.cmu.edu>
2002-10-31 20:51 ` xml-mode (from sgml-mode) tag skipping fix Stefan Monnier
2002-10-31 21:29 ` md5i
2002-11-01 4:02 ` Karl Eichwalder
2002-11-01 16:06 ` Stefan Monnier
2002-11-01 16:46 ` md5i
2002-11-01 16:51 ` Stefan Monnier
2002-11-01 16:49 ` Karl Eichwalder
2002-11-01 16:55 ` Stefan Monnier
2002-11-01 17:31 ` Karl Eichwalder
2002-11-01 13:43 ` md5i
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.