GNU bug report logs -
#37938
electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
Previous Next
To reply to this bug, email your comments to 37938 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Sun, 27 Oct 2019 03:23:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 27 Oct 2019 03:23:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
No wonder my web pages are getting filled with:
Let's go to Bob's house.''
But my email replies are thankfully still just:
Let's go to Bob's house.
Compare typing that into
$ emacs -nw -Q -f electric-pair-mode /tmp/e.html vs.
$ emacs -nw -Q -f electric-pair-mode /tmp/e.txt
Anyway, sure, within HTML angle brackets we want the automatic paring
for attributes. But most of the time we are typing content... So the
program is not smart enough.
Neither electric-pair-mode's docsrting nor (info "(emacs) Matching")
mention how to tell it 'hands off' for .html modes like it already knows
for .txt modes.
Anyways, these days you've got to double check what you typed. (And then
sometimes with some programs even then you can't be sure...)
(The back apostrophe(s) "hides" in the block cursor, so the user doesn't
realize it, getting shoved along, parked behind the newline.)
My testing shows the problem only occurs with U+0027 APOSTROPHE. All the
other pairs act great. (E.g., a welcomed paired U+0022 QUOTATION MARK in
all modes.)
So, U+0027 APOSTROPHE currently doesn't pair in text mode. Good. It should
also not pair in HTML mode. Or at least the documentation should say...
emacs-version "26.3"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Mon, 28 Oct 2019 15:37:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 37938 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
> No wonder my web pages are getting filled with:
>
> Let's go to Bob's house.''
>
> But my email replies are thankfully still just:
>
> Let's go to Bob's house.
>
> Compare typing that into
>
> $ emacs -nw -Q -f electric-pair-mode /tmp/e.html vs.
> $ emacs -nw -Q -f electric-pair-mode /tmp/e.txt
When I try this I get the following backtrace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
sgml--syntax-propertize-ppss(18)
mhtml-syntax-propertize(7 19)
syntax-propertize(19)
syntax-ppss(19)
electric-pair-syntax-info(39)
electric-pair-post-self-insert-function()
self-insert-command(1 39)
funcall-interactively(self-insert-command 1 39)
call-interactively(self-insert-command nil nil)
command-execute(self-insert-command)
To reproduce
Open /tmp/e.html
M-x electric-pair-mode
Type
Foo'
Anybody know what's that about?
Anyway, to Dan's request:
> Neither electric-pair-mode's docsrting nor (info "(emacs) Matching")
> mention how to tell it 'hands off' for .html modes like it already knows
> for .txt modes.
I'm not quite sure, but I think Dan is saying that the ' character
shouldn't be a paired character in html-mode since it isn't in
text-mode. And that sounds reasonable. Does anybody object to making
that change?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Tue, 29 Oct 2019 01:04:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 37938 <at> debbugs.gnu.org (full text, mbox):
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
LI> Anybody know what's that about?
In emacs-version "26.3" I get Foo'', no error.
LI> I'm not quite sure, but I think Dan is saying that the ' character
LI> shouldn't be a paired character in html-mode since it isn't in
LI> text-mode. And that sounds reasonable. Does anybody object to making
LI> that change?
Sounds good.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Tue, 29 Oct 2019 11:55:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 37938 <at> debbugs.gnu.org (full text, mbox):
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
>>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> LI> Anybody know what's that about?
>
> In emacs-version "26.3" I get Foo'', no error.
>
> LI> I'm not quite sure, but I think Dan is saying that the ' character
> LI> shouldn't be a paired character in html-mode since it isn't in
> LI> text-mode. And that sounds reasonable. Does anybody object to making
> LI> that change?
>
> Sounds good.
I know nothing about electric pair mode, but it seems that the behaviour
is down to the syntax class of the ' character.
(elt (syntax-table) ?\')
=> (7 . 39)
And
7 string quote 15 generic string
which makes sense, because you can have
<a foo='bar'>
and in that context it's definitely a quote character. But when you're
typing text in HTML, then it's not.
mhtml already has support for different syntaxes in CSS/JS/HTML -- is
there a way to switch the syntax table when in tags and when not?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Tue, 29 Oct 2019 13:57:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 37938 <at> debbugs.gnu.org (full text, mbox):
On 29.10.2019 13:54, Lars Ingebrigtsen wrote:
> and in that context it's definitely a quote character. But when
> you're
> typing text in HTML, then it's not.
>
> mhtml already has support for different syntaxes in CSS/JS/HTML -- is
> there a way to switch the syntax table when in tags and when not?
I'm not sure we need to go that far. sgml-syntax-propertize-rules
already changes syntax on quotes typed outside of tags.
It's probably up to electric-pair-mode to respect that.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37938
; Package
emacs
.
(Tue, 29 Oct 2019 21:25:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 37938 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> I'm not sure we need to go that far. sgml-syntax-propertize-rules
> already changes syntax on quotes typed outside of tags.
>
> It's probably up to electric-pair-mode to respect that.
Makes sense to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.