bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16508: 24.3; Slash matching in HTML mode


From: Rüdiger Sonderfeld
Subject: bug#16508: 24.3; Slash matching in HTML mode
Date: Tue, 21 Jan 2014 22:37:10 +0100
User-agent: KMail/4.11.3 (Linux/3.11.0-14-generic; KDE/4.11.3; x86_64; ; )

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]