unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
@ 2019-10-27  0:14 積丹尼 Dan Jacobson
  2019-10-28 15:35 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-27  0:14 UTC (permalink / raw)
  To: 37938

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"





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
  2019-10-27  0:14 bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML 積丹尼 Dan Jacobson
@ 2019-10-28 15:35 ` Lars Ingebrigtsen
  2019-10-29  1:02   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-28 15:35 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 37938

積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
  2019-10-28 15:35 ` Lars Ingebrigtsen
@ 2019-10-29  1:02   ` 積丹尼 Dan Jacobson
  2019-10-29 11:54     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-10-29  1:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37938

>>>>> "LI" == Lars Ingebrigtsen <larsi@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
  2019-10-29  1:02   ` 積丹尼 Dan Jacobson
@ 2019-10-29 11:54     ` Lars Ingebrigtsen
  2019-10-29 13:56       ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-29 11:54 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 37938

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

>>>>>> "LI" == Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
  2019-10-29 11:54     ` Lars Ingebrigtsen
@ 2019-10-29 13:56       ` Dmitry Gutov
  2019-10-29 21:24         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2019-10-29 13:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen, 積丹尼 Dan Jacobson; +Cc: 37938

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML
  2019-10-29 13:56       ` Dmitry Gutov
@ 2019-10-29 21:24         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-29 21:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 37938, 積丹尼 Dan Jacobson

Dmitry Gutov <dgutov@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-29 21:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27  0:14 bug#37938: electric-pair-mode vs. U+0027 APOSTROPHE in mixed modes like HTML 積丹尼 Dan Jacobson
2019-10-28 15:35 ` Lars Ingebrigtsen
2019-10-29  1:02   ` 積丹尼 Dan Jacobson
2019-10-29 11:54     ` Lars Ingebrigtsen
2019-10-29 13:56       ` Dmitry Gutov
2019-10-29 21:24         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).