From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Mallory, Rich" Newsgroups: gmane.emacs.bugs Subject: sgml-mode skip tag forward/back bug fix -- followup Date: Mon, 29 Apr 2002 14:51:41 -0500 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1020110072 13856 127.0.0.1 (29 Apr 2002 19:54:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 29 Apr 2002 19:54:32 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 172HEG-0003b9-00 for ; Mon, 29 Apr 2002 21:54:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 172HE5-0008Ke-00; Mon, 29 Apr 2002 15:54:21 -0400 Original-Received: from 168-215-253-19.ausinfo.com ([168.215.253.19] helo=aisexch.ausinfo.com) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 172HBX-00087A-00 for ; Mon, 29 Apr 2002 15:51:43 -0400 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: sgml-mode skip tag forward/back bug fix thread-index: AcHtScYFkI/n6zmYQTu8VBFCjzHvugCaRmww Original-To: Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:1033 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:1033 This is a followup to the email to you included at the end of this=20 email, on the above subject. =20 Further testing revealed that the bug fix proposed in that email=20 was incomplete. The complete set of diffs follows, including the=20 diffs from the original email. The proposed fix works without the=20 new additions. However, the change to line 687 is needed to=20 keep up-list from beeping each time function sgml-skip-tag-forward=20 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=20 code for line 683 produces no beep, but the change to line 683=20 seems advisable. Diffs between old sgml-mode.el (<) and new (>) In sgml-skip-tag-backward -- 656c656 < (re (concat " (re (concat "]"))) In sgml-skip-tag-forward -- 676c676 < (re (concat " (re (concat "]")) 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=20 line 676. The latter causes the regexp 're' to match one=20 additional character, leaving the point after that character. If this=20 character is '>', the point is outside the tag matched by 're'. In=20 the original code, the point was inside the tag, and up-list moved=20 the point to the beginning of the tag. With the point after the=20 closing '>', up-list can't do that. -- Rich Mallory -----Original Message----- From: Mallory, Rich=20 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 -- -- with the cursor before , sgml-skip-tag-forward would only skip = to the=20 end of tag , not to the end of tag , and=20 -- with the the cursor after , sgml-skip-tag-backward would only = skip to=20 the beginning of , not to the beginning of . 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 * 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., ... ... ) was not properly skipped. Diffs between old sgml-mode.el (<) and new (>) In sgml-skip-tag-backward -- 656c656 < (re (concat " (re (concat "]"))) In sgml-skip-tag-forward -- 676c676 < (re (concat " (re (concat "]")) (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