GNU bug report logs - #16508
24.3; Slash matching in HTML mode

Previous Next

Package: emacs;

Reported by: Mark Tilford <ralphmerridew <at> gmail.com>

Date: Mon, 20 Jan 2014 17:42:02 UTC

Severity: minor

Tags: patch

Found in version 24.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Mark Tilford <ralphmerridew <at> gmail.com>, 16508 <at> debbugs.gnu.org
Subject: Re: bug#16508: 24.3; Slash matching in HTML mode
Date: Tue, 21 Jan 2014 22:37:10 +0100
Hello,

On Monday 20 January 2014 11:39:34 Mark Tilford wrote:
> --text follows this line--
> In HTML mode, type
> 
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>My Web Page</title>
>   </head>
>   <body>
>     <br />
>     <h1>Heading</h1>
> 
> When typing the </h1>, it will briefly highlight the <br />.  This is
> incorrect and annoying.  Either highlight the matching <h1> or don't
> highlight anything.

I can reproduce the behaviour.  It seems this was introduced to support SGML's 
syntax for <FOO/bar/ which is apparently a shortcut for <FOO>bar</FOO>.  But I 
don't understand why it tries to match a / if it's after a <.  (I'm not very 
familiar with SGML's quirks and special syntax.)

It seems the code in `sgml-slash' actually tried to deal with that case but in 
the end still calls `sgml-slash-matching'.  The following patch would fix that

╭────
│ diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
│ index 09459d1..78fdb50 100644
│ --- a/lisp/textmodes/sgml-mode.el
│ +++ b/lisp/textmodes/sgml-mode.el
│ @@ -539,7 +539,7 @@ (defun sgml-slash (arg)
│      (delete-char -1)
│      (sgml-close-tag))
│     (t
│ -    (sgml-slash-matching arg))))
│ +    (insert-char ?/ arg))))
│ 
│  (defun sgml-slash-matching (arg)
│    "Insert `/' and display any previous matching `/'.
╰────

Until then you could use (define-key sgml-mode-map "/" nil) as a workaround to 
disable the matching in all cases.

btw. maybe `sgml-quick-keys' should be customizable.

Regards,
Rüdiger




This bug report was last modified 7 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.