GNU bug report logs - #35496
27.0.50; smie-blink-matching-open blinks token before point after RET

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Dmitry Gutov <dgutov@HIDDEN>; dated Mon, 29 Apr 2019 20:58:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 22 Sep 2021 21:34:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 22 17:34:20 2021
Received: from localhost ([127.0.0.1]:51947 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mT9sh-0000aA-UU
	for submit <at> debbugs.gnu.org; Wed, 22 Sep 2021 17:34:20 -0400
Received: from quimby.gnus.org ([95.216.78.240]:34518)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mT9sf-0000Zu-Su
 for 35496 <at> debbugs.gnu.org; Wed, 22 Sep 2021 17:34:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mIg+s3fYdjeUE1EYWrM8uBsLeEHbkPBv8UhVdpGIztY=; b=HxyCV9Qxn2dvG9kI2z79jtqzG6
 Ggmi0ta+9jHWtuCONosS9/q1sWm5CaDg52jWM5i07BbBYFqodNaXiASZRWUwsSEhX0yZnCpd/fXQN
 TCjPPVw7nUH0ROpODMmrdici1tJMhW2JCYAJ3HcxIjZeXVkQ5EwxHR6BpVSbCFuQjkkM=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mT9sT-0007XI-OO; Wed, 22 Sep 2021 23:34:09 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#35496: 27.0.50; smie-blink-matching-open blinks token
 before point after RET
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
 <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
 <25c51540-6c49-ba79-bbb4-e60b1e616fc6@HIDDEN>
 <jwvsgtog8f5.fsf-monnier+emacs@HIDDEN>
 <572f9293-e6df-6cb0-8829-88e0acd61017@HIDDEN>
X-Now-Playing: Pet Shop Boys's _I don't wanna_: "I Don't Wanna (Album Version)"
Date: Wed, 22 Sep 2021 23:34:05 +0200
In-Reply-To: <572f9293-e6df-6cb0-8829-88e0acd61017@HIDDEN> (Dmitry Gutov's
 message of "Mon, 13 May 2019 03:52:04 +0300")
Message-ID: <87y27oqoqa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Dmitry Gutov <dgutov@HIDDEN> writes: > I've tried to move
 all checks smie-blink-matching-open into a > save-excursion and call
 blink-matching-open
 from the orignal position, > but that doesn't work alone, unfortunately,
 because newline i [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35496
Cc: 35496 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Dmitry Gutov <dgutov@HIDDEN> writes:

> I've tried to move all checks smie-blink-matching-open into a
> save-excursion and call blink-matching-open from the orignal position,
> but that doesn't work alone, unfortunately, because newline is a
> separate token. Hence the change in blink-matching-open as well. WDYT?
>
> Patch attached.

I've just skimmed this thread, but there didn't seem to be any followup
here?  Is this still an issue in the current Emacs?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 13 May 2019 00:52:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 12 20:52:16 2019
Received: from localhost ([127.0.0.1]:43766 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hPzCR-0005Te-W4
	for submit <at> debbugs.gnu.org; Sun, 12 May 2019 20:52:16 -0400
Received: from mail-lj1-f173.google.com ([209.85.208.173]:33796)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1hPzCP-0005TO-Ie
 for 35496 <at> debbugs.gnu.org; Sun, 12 May 2019 20:52:14 -0400
Received: by mail-lj1-f173.google.com with SMTP id j24so8567508ljg.1
 for <35496 <at> debbugs.gnu.org>; Sun, 12 May 2019 17:52:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=KFWL8sU904WpDD4eNY+3+SAwfll8NcElYr4DI9IcqZ4=;
 b=uBg4RaLZ58eYOnrusfNo2BN7SL+EnQABMUlUKBVuIldBFVDe8BIlsh3KjTgpxcQEgH
 rqGXzZVNRkmNwfnIWGb0ftWQKXfxffGqBiHseG2EJS2zs/F7ciEIHuECAw3xbQkwRT9x
 VSi9KiNt4p4rYQL/m5EVLBYl48rrvZsEC2YJt/AQWAPwdbBB8Can6KzSQHJ3OWUpmffJ
 7LwIJ164ThLeUDBGRK6TO7HZ0bx9R/sD+I8rqe4YXD678xjV45D62u9FjDswy73A594n
 7CE6sHPfEqoiERDxxcKizg97PuIKDdHRuUup0CMJ/gqpLmVkR9nwOlYtTwNknDsYOs/S
 GyxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language;
 bh=KFWL8sU904WpDD4eNY+3+SAwfll8NcElYr4DI9IcqZ4=;
 b=L2RKTDpr7N5FpWkLJUOiZwKTgh+3xtdOjP+J+/sPIJyL5ocdZR5MUbfYPJ5w6GaG+I
 6ITJr05aaWVq+GZ4OxKl8UsA64nA+3RhOjhBmvg4SA4Ny2jTukGZvx22ALmukpfsl1yi
 J2rfcMoilmyaJGn/P/0j2ttdBZsoOaC8I4TjT12XSQR+Pu/fsWu1Panb/TR2eDidoFUu
 LWBEhlJkK2GBWcouklgFm8g2+DY/1oId0WR3ICXwX6Jw8BHtcnDBIDWyOgfSFKydrA8l
 hjppqmrepFkAZYlmsIiKBR7hGt9apy8D1veRfGqnmEH+f2s7qpq9ydAsy9T0e5y1FlhK
 GWQQ==
X-Gm-Message-State: APjAAAVER2LRkXYUMLCm0g/z71zQXPxrDAt+xqhi51pUHYQJirEC44lt
 Mp6vSOpElzuAkXitgc8kXynMxier
X-Google-Smtp-Source: APXvYqzgGMpe+4epNKVRq+yANpjxgo8mQsYAH+t0zDOScXY1TKtgkij4tnJHj8L2tj8R+9UXl1TnJA==
X-Received: by 2002:a2e:9b96:: with SMTP id z22mr4472638lji.165.1557708727256; 
 Sun, 12 May 2019 17:52:07 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.174.23])
 by smtp.googlemail.com with ESMTPSA id m18sm184472lfj.91.2019.05.12.17.52.05
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 12 May 2019 17:52:05 -0700 (PDT)
Subject: Re: bug#35496: 27.0.50; smie-blink-matching-open blinks token before
 point after RET
To: Stefan Monnier <monnier@HIDDEN>
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
 <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
 <25c51540-6c49-ba79-bbb4-e60b1e616fc6@HIDDEN>
 <jwvsgtog8f5.fsf-monnier+emacs@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <572f9293-e6df-6cb0-8829-88e0acd61017@HIDDEN>
Date: Mon, 13 May 2019 03:52:04 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <jwvsgtog8f5.fsf-monnier+emacs@HIDDEN>
Content-Type: multipart/mixed; boundary="------------664B60B9FD51BAF3DC40E627"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35496
Cc: 35496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------664B60B9FD51BAF3DC40E627
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

On 08.05.2019 20:42, Stefan Monnier wrote:

>> But we don't end up blinking to `def` after RET, we blink to `do`.
> 
> That's not what I see when I try your recipe: it blinks to the "d" of
> "def", as it should, for me (both with Emacs'` master` and with
> Debian's Emacs-26.1).

You are right. Sorry about that.

I guess the main problem, both the cause of my misunderstanding and the 
user aggravation, is that smie-blink-matching-open calls 
blink-matching-open on a changed position. As a result the sit-for call 
is issued on the position before the newline instead of after.

Which created both the appearance of sluggishness from the original 
report, and my mistake on which token is highlighted (because the moved 
cursor is much easier to notice than the subtle paren highlighting, at 
least on the theme I'm using).

I've tried to move all checks smie-blink-matching-open into a 
save-excursion and call blink-matching-open from the orignal position, 
but that doesn't work alone, unfortunately, because newline is a 
separate token. Hence the change in blink-matching-open as well. WDYT?

Patch attached.

>> SMIE fills it automatically based on the current set of tokens.
> 
> Indeed, but you can tweak it by hand afterwards.
> 
>> If I add it myself, yeah, the behavior is better in this case.
> 
> I've been wondering for a while now if it's not just "in this case" but
> in general.

I don't know. The highlighting itself is sufficiently unobtrusive here, 
so it could work either way. If the patch I'm proposing seems like 
unwanted complexity, we can avoid it also this way, and even simplify 
more code.

>> But I kinda buy your reasoning about not having it there (even though
>> it's not a panacea: the user can type whatever token, not only ones in
>> the smie-closer-alist.
> 
> I agree that only considering smie-closer-alist is probably not a great
> choice.  It seemed obvious when I wrote it, but I don't know why, and
> I can't justify it now.
> 
> [ Maybe it's because I was working on octave-mode around that time and
>    didn't want to blink on "end" when the user likes to write the
>    full-form "endfunction"?  But even that doesn't sound like
>    a good justification.  ]

I'm guessing that with Elixir's syntax, while the user is typing the 
last two chars in

   def sum, do:

the 'd' in 'def' would blink twice. Which is maybe not ideal either.

>> Overall, I feel that the smie-blink-matching-inners might be too much as
>> default anyway.  So it's not a big deal if elixir-mode has to disable it.
> 
> I don't think it's specific to elixir-mode but is rather
> a user-preference.  Maybe it should default to nil, but I haven't
> found a mode where smie-blink-matching-inners should be disabled
> *because of the mode* rather than because that's what the user prefers.

No argument here. Just saying it's an okay workaround as well.

--------------664B60B9FD51BAF3DC40E627
Content-Type: text/x-patch;
 name="smie-blink-matching-do.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="smie-blink-matching-do.diff"

diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index f2163b243e..c68e55e0b4 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -997,46 +997,48 @@ smie-blink-matching-open
                                 (eq (char-before) last-command-event)))))
                (memq last-command-event smie-blink-matching-triggers)
                (not (nth 8 (syntax-ppss))))
-      (save-excursion
-        (setq token (funcall smie-backward-token-function))
-        (when (and (eq (point) (1- pos))
-                   (= 1 (length token))
-                   (not (rassoc token smie-closer-alist)))
-          ;; The trigger char is itself a token but is not one of the
-          ;; closers (e.g. ?\; in Octave mode), so go back to the
-          ;; previous token.
-          (setq pos (point))
-          (setq token (funcall smie-backward-token-function)))
-        (when (rassoc token smie-closer-alist)
-          ;; We're after a close token.  Let's still make sure we
-          ;; didn't skip a comment to find that token.
-          (funcall smie-forward-token-function)
-          (when (and (save-excursion
-                       ;; Skip the trigger char, if applicable.
-                       (if (eq (char-after) last-command-event)
-                           (forward-char 1))
-                       (if (eq ?\n last-command-event)
-                           ;; Skip any auto-indentation, if applicable.
-                           (skip-chars-forward " \t"))
-                       (>= (point) pos))
-                     ;; If token ends with a trigger char, don't blink for
-                     ;; anything else than this trigger char, lest we'd blink
-                     ;; both when inserting the trigger char and when
-                     ;; inserting a subsequent trigger char like SPC.
-                     (or (eq (char-before) last-command-event)
-                         (not (memq (char-before)
-                                    smie-blink-matching-triggers)))
-                     ;; FIXME: For octave's "switch ... case ... case" we flash
-                     ;; `switch' at the end of the first `case' and we burp
-                     ;; "mismatch" at the end of the second `case'.
-                     (or smie-blink-matching-inners
-                         (not (numberp (nth 2 (assoc token smie-grammar))))))
-            ;; The major mode might set blink-matching-check-function
-            ;; buffer-locally so that interactive calls to
-            ;; blink-matching-open work right, but let's not presume
-            ;; that's the case.
-            (let ((blink-matching-check-function #'smie-blink-matching-check))
-              (blink-matching-open))))))))
+      (when
+          (save-excursion
+            (setq token (funcall smie-backward-token-function))
+            (when (and (eq (point) (1- pos))
+                       (= 1 (length token))
+                       (not (rassoc token smie-closer-alist)))
+              ;; The trigger char is itself a token but is not one of the
+              ;; closers (e.g. ?\; in Octave mode), so go back to the
+              ;; previous token.
+              (setq pos (point))
+              (setq token (funcall smie-backward-token-function)))
+            (and (rassoc token smie-closer-alist)
+                 (progn
+                   ;; We're after a close token.  Let's still make sure we
+                   ;; didn't skip a comment to find that token.
+                   (funcall smie-forward-token-function)
+                   (and (save-excursion
+                          ;; Skip the trigger char, if applicable.
+                          (if (eq (char-after) last-command-event)
+                              (forward-char 1))
+                          (if (eq ?\n last-command-event)
+                              ;; Skip any auto-indentation, if applicable.
+                              (skip-chars-forward " \t"))
+                          (>= (point) pos))
+                        ;; If token ends with a trigger char, don't blink for
+                        ;; anything else than this trigger char, lest we'd blink
+                        ;; both when inserting the trigger char and when
+                        ;; inserting a subsequent trigger char like SPC.
+                        (or (eq (char-before) last-command-event)
+                            (not (memq (char-before)
+                                       smie-blink-matching-triggers)))
+                        ;; FIXME: For octave's "switch ... case ... case" we flash
+                        ;; `switch' at the end of the first `case' and we burp
+                        ;; "mismatch" at the end of the second `case'.
+                        (or smie-blink-matching-inners
+                            (not (numberp (nth 2 (assoc token smie-grammar)))))))))
+        ;; The major mode might set blink-matching-check-function
+        ;; buffer-locally so that interactive calls to
+        ;; blink-matching-open work right, but let's not presume
+        ;; that's the case.
+        (let ((blink-matching-check-function #'smie-blink-matching-check))
+          (blink-matching-open))))))
 
 (defvar-local smie--matching-block-data-cache nil)
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 4454791ad2..6a077cc55a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7648,6 +7648,7 @@ blink-matching-open
                   (condition-case ()
                       (progn
 			(syntax-propertize (point))
+                        (forward-comment -1)
                         (forward-sexp -1)
                         ;; backward-sexp skips backward over prefix chars,
                         ;; so move back to the matching paren.

--------------664B60B9FD51BAF3DC40E627--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 8 May 2019 17:42:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 08 13:42:29 2019
Received: from localhost ([127.0.0.1]:33950 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOQaK-0007jy-Tx
	for submit <at> debbugs.gnu.org; Wed, 08 May 2019 13:42:29 -0400
Received: from mail01.iro.umontreal.ca ([132.204.25.201]:45888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1hOQaJ-0007ja-5M
 for 35496 <at> debbugs.gnu.org; Wed, 08 May 2019 13:42:27 -0400
Received: from mail01.iro.umontreal.ca (mail01.iro.umontreal.ca [127.0.0.1])
 by mail01.iro.umontreal.ca (Postfix) with ESMTP id A6D9F8941C1F
 for <35496 <at> debbugs.gnu.org>; Wed,  8 May 2019 13:42:21 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 h=content-type:content-type:mime-version:user-agent:in-reply-to
 :date:date:references:message-id:subject:subject:to:from:from;
 s=dkim; t=1557337341; x=1558201342; bh=aqtRg/PkXN/kwMHwEeii4kNR
 STUSz7+37klZOgEjNT4=; b=aYnXAC+BP8XJ0vx0sCYFo1FMkxTfk+8TuVinEdIc
 j8rOv9405SaY0FHmKA2cMghAZfCg4qG16Cq3ZUdK2Ett8SjMJNhFoizCNn5z8m6c
 goVeOwPvxFB2qYTwn1JPDDpkyeQfEdDeYz2jqQT1pGJPRs9wYes10jBTR9N3RW1z
 YBjFjsc00GoMXqcJNy0q+aKvfhX7e1o3Q79jo52yRnFjFWQ4ogRq+PGuBJs5jnsn
 JkzwKCyRo+4wL0vgk6FXi/B8M9bJqf05JuI9MJwfkFtqdOHmOPTbzKM5xWdGMqdp
 y08j7ecVTMR/zASaXEmhjNC3uk3j1KLDxT39qi6rGvw+kA==
X-Virus-Scanned: amavisd-new at iro.umontreal.ca
Received: from mail01.iro.umontreal.ca ([127.0.0.1])
 by mail01.iro.umontreal.ca (mail01.iro.umontreal.ca [127.0.0.1]) (amavisd-new,
 port 10024) with ESMTP id xfsEqG6pOYZl for <35496 <at> debbugs.gnu.org>;
 Wed,  8 May 2019 13:42:21 -0400 (EDT)
Received: from alfajor (modemcable213.149-175-137.mc.videotron.ca
 [137.175.149.213])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ADFBA8941C0E;
 Wed,  8 May 2019 13:42:20 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#35496: 27.0.50;
 smie-blink-matching-open blinks token before point after RET
Message-ID: <jwvsgtog8f5.fsf-monnier+emacs@HIDDEN>
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
 <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
 <25c51540-6c49-ba79-bbb4-e60b1e616fc6@HIDDEN>
Date: Wed, 08 May 2019 13:42:19 -0400
In-Reply-To: <25c51540-6c49-ba79-bbb4-e60b1e616fc6@HIDDEN> (Dmitry Gutov's
 message of "Wed, 8 May 2019 12:51:00 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35496
Cc: 35496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>>> 1. Disable show-paren-mode if it's enabled.
>>> 2. Evalute the attached .el file (which defined a major mode).
>>> 3. Create a new bufferand type M-x foo-mode.
>>> 4. Type 'def foo do' (without quotes) and press RET.
>>> 5. Cursor will hang around on the first line even after the newline
>>> is inserted.
>>
>> It's not a bug, it's a feature: we can't highlight the matching `def`
>> when you hit the `o`  because we don't know yet whether you actually
>> intended to type `do` or a longer identifier, so we postpone the
>> blinking to the next char.
>
> But we don't end up blinking to `def` after RET, we blink to `do`.

That's not what I see when I try your recipe: it blinks to the "d" of
"def", as it should, for me (both with Emacs'` master` and with
Debian's Emacs-26.1).

> SMIE fills it automatically based on the current set of tokens.

Indeed, but you can tweak it by hand afterwards.

> If I add it myself, yeah, the behavior is better in this case.

I've been wondering for a while now if it's not just "in this case" but
in general.

> But I kinda buy your reasoning about not having it there (even though
> it's not a panacea: the user can type whatever token, not only ones in
> the smie-closer-alist.

I agree that only considering smie-closer-alist is probably not a great
choice.  It seemed obvious when I wrote it, but I don't know why, and
I can't justify it now.

[ Maybe it's because I was working on octave-mode around that time and
  didn't want to blink on "end" when the user likes to write the
  full-form "endfunction"?  But even that doesn't sound like
  a good justification.  ]

> Overall, I feel that the smie-blink-matching-inners might be too much as
> default anyway.  So it's not a big deal if elixir-mode has to disable it.

I don't think it's specific to elixir-mode but is rather
a user-preference.  Maybe it should default to nil, but I haven't
found a mode where smie-blink-matching-inners should be disabled
*because of the mode* rather than because that's what the user prefers.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 8 May 2019 09:51:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 08 05:51:13 2019
Received: from localhost ([127.0.0.1]:60347 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOJEG-0000lj-Tv
	for submit <at> debbugs.gnu.org; Wed, 08 May 2019 05:51:13 -0400
Received: from mail-lj1-f181.google.com ([209.85.208.181]:33247)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1hOJEE-0000lU-Cu
 for 35496 <at> debbugs.gnu.org; Wed, 08 May 2019 05:51:11 -0400
Received: by mail-lj1-f181.google.com with SMTP id f23so16933502ljc.0
 for <35496 <at> debbugs.gnu.org>; Wed, 08 May 2019 02:51:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=aQt72IJedcg6EHke0DcYqKLgb+x91//gzdlSWhEI0AA=;
 b=Z8PvG9I7YEWUTdzdsbKqb8C01SnH8SseOvbC449oput4YmVR7EES3mr2PBViPEIS9d
 KL0QNG200yIVYpFUj8Pcu8t3ZRAOd5auRyXlTAlnuEUsd7OiTBfxGOT7uGBvt3KxBrU+
 +QqgCVNGez3UsFf3duRAG2T9zfxJIajFcZ7xJgYnAg+NEdgHWSQii4jOSoln+VLLl1ue
 wl2N4RFH1k0j5yIJl5skr+GN7LuFs2iVuUuGN+RUo9jZSbhU3QXIvqphKdXjzTtGXB9R
 sOQDzztGdWqW7MZGcQTRhT/PHaUnRhNta0NSVhXYYuQgI/f4Xp9pi6VD7Cvn8AqoZAhx
 TE+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=aQt72IJedcg6EHke0DcYqKLgb+x91//gzdlSWhEI0AA=;
 b=ZOhWR76WfSlMIJIr1yEbAZQ3lv+dFIcB+EZtPMAAQfT3vKy5u8k5b9M/pHt0eolL/W
 Uq1P6fpjpA9FEp+Z/gbXXZfdU4mDDsmc6Wi0SlUMO1+TehwpVAl6t7iMhOernMKGfDl6
 Jcs4jIM745fSZh2iNb1aSdmo6QeNgy1tyZVw4AqiaJ1gN44FOiy/uGotJzRmufJo0ePB
 jxdnOIsezngWYjeAFcsLIQpX2Xz5FpBOQpPm4gvADkCGr913H8ETk3ltAlCrlhKsMbka
 vATZK+n5OBJUTpiVplOrlri8gATIIDK4JD2z6DVkwInl/Z8aGfsqH/mdJAjL+9wiw8Fl
 Rnkg==
X-Gm-Message-State: APjAAAVXg3O8K+PPWvkmmMjqi0cxqhnbT/UmOMI+dw6+LrbfJY3rn/6n
 bgWCDsiGq1Ovy+wBP5os5EcMeGvw
X-Google-Smtp-Source: APXvYqxYn9FO9butNflKplz7Z4FG1qHEznu81zsmWT8DstK0qRDAFL2W6p1TEIlptMFVvpPOEQKzKA==
X-Received: by 2002:a2e:5517:: with SMTP id j23mr4531798ljb.5.1557309064066;
 Wed, 08 May 2019 02:51:04 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.174.23])
 by smtp.googlemail.com with ESMTPSA id f25sm3864570lfc.46.2019.05.08.02.51.01
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 08 May 2019 02:51:02 -0700 (PDT)
Subject: Re: bug#35496: 27.0.50; smie-blink-matching-open blinks token before
 point after RET
To: Stefan Monnier <monnier@HIDDEN>
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
 <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <25c51540-6c49-ba79-bbb4-e60b1e616fc6@HIDDEN>
Date: Wed, 8 May 2019 12:51:00 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 35496
Cc: 35496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On 08.05.2019 4:44, Stefan Monnier wrote:
>> 1. Disable show-paren-mode if it's enabled.
>> 2. Evalute the attached .el file (which defined a major mode).
>> 3. Create a new bufferand type M-x foo-mode.
>> 4. Type 'def foo do' (without quotes) and press RET.
>> 5. Cursor will hang around on the first line even after the newline
>> is inserted.
> 
> It's not a bug, it's a feature: we can't highlight the matching `def`
> when you hit the `o`  because we don't know yet whether you actually
> intended to type `do` or a longer identifier, so we postpone the
> blinking to the next char.

But we don't end up blinking to `def` after RET, we blink to `do`.

There must be an opportunity to check that we don't blink to the 
preceding token.

> smie-blink-matching-triggers defaults to ?\s and ?\n so the "next char"
> where the blinking can happen is SPC or RET.
> 
> Maybe we shouldn't postpone the blinking (i.e. we should add ?o to
> smie-blink-matching-triggers)?

SMIE fills it automatically based on the current set of tokens. If I add 
it myself, yeah, the behavior is better in this case. But I kinda buy 
your reasoning about not having it there (even though it's not a 
panacea: the user can type whatever token, not only ones in the 
smie-closer-alist.

Overall, I feel that the smie-blink-matching-inners might be too much as 
default anyway. So it's not a big deal if elixir-mode has to disable it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 8 May 2019 01:44:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 07 21:44:31 2019
Received: from localhost ([127.0.0.1]:60025 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOBdG-0002sG-Ow
	for submit <at> debbugs.gnu.org; Tue, 07 May 2019 21:44:31 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:47632)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1hOBdE-0002s7-4Z
 for 35496 <at> debbugs.gnu.org; Tue, 07 May 2019 21:44:28 -0400
Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x481iPMZ020548;
 Tue, 7 May 2019 21:44:26 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id C45FD6652C; Tue,  7 May 2019 21:44:24 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#35496: 27.0.50;
 smie-blink-matching-open blinks token before point after RET
Message-ID: <jwvy33hbu5p.fsf-monnier+emacs@HIDDEN>
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
Date: Tue, 07 May 2019 21:44:24 -0400
In-Reply-To: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN> (Dmitry Gutov's
 message of "Mon, 29 Apr 2019 23:57:03 +0300")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV6541=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6541> : inlines <7074> : streams
 <1820884> : uri <2841776>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35496
Cc: 35496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> 1. Disable show-paren-mode if it's enabled.
> 2. Evalute the attached .el file (which defined a major mode).
> 3. Create a new bufferand type M-x foo-mode.
> 4. Type 'def foo do' (without quotes) and press RET.
> 5. Cursor will hang around on the first line even after the newline
> is inserted.

It's not a bug, it's a feature: we can't highlight the matching `def`
when you hit the `o`  because we don't know yet whether you actually
intended to type `do` or a longer identifier, so we postpone the
blinking to the next char.

smie-blink-matching-triggers defaults to ?\s and ?\n so the "next char"
where the blinking can happen is SPC or RET.

Maybe we shouldn't postpone the blinking (i.e. we should add ?o to
smie-blink-matching-triggers)?


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at 35496 <at> debbugs.gnu.org:


Received: (at 35496) by debbugs.gnu.org; 7 May 2019 22:39:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 07 18:39:04 2019
Received: from localhost ([127.0.0.1]:59921 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hO8jo-0006ny-I5
	for submit <at> debbugs.gnu.org; Tue, 07 May 2019 18:39:04 -0400
Received: from mail-wm1-f66.google.com ([209.85.128.66]:39876)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1hO8jm-0006nR-7y
 for 35496 <at> debbugs.gnu.org; Tue, 07 May 2019 18:39:02 -0400
Received: by mail-wm1-f66.google.com with SMTP id n25so590894wmk.4
 for <35496 <at> debbugs.gnu.org>; Tue, 07 May 2019 15:39:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:from:to:references:cc:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=XRUwBZxRFgJ0fbV1YCPggS2iGtQ8cieOxCgwFbZwy3A=;
 b=mrYAiqEMCqtG6NC0Wh0Hz/ItbY3xiwypzzTTlcBUJPzH7ClXZowy+qmeRCK9udq1JM
 /ct0pf4XzZN6T53vXKSVXbWAmVfWmWz3WonHoA9LIzyoO2HCFLFtCsrohYepjeGhLjqq
 TN9Gdxzjy6S+cnErzoDvCuOYwnB/h6Xboq0jB7sSTlaeej8NQCqJ26qTSzTQ63OigeUa
 nE47ltB8HDQFdC0mkMtYB9HSB37SnA0qX36xHzsHZdIprPJTXfP706A5N3Ep7wO0nu7u
 cMbajkUwp7nZcf/t15hrpIBIzfiArybXEbAYHSRkfukPd+dr48WL3yMlSOlF9dKvKsxl
 qVgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:from:to:references:cc:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=XRUwBZxRFgJ0fbV1YCPggS2iGtQ8cieOxCgwFbZwy3A=;
 b=sWM+C8Lk4NIWqrUxSlLVbEpiiQA8pAtYCLBMKz8KFxiw7TNWC4PFfRPHjq1hzwISZa
 jdXb/jsCbqXCBi5G5zGR809U6W44m1THfrnImHMBCil88cPHxO3/ABHiR4beocW2hcDX
 bBpEp4oFNxrO1roMg6R+9atSbebQqYe6Vyuq/MpCb5HX96Mm0qhWBDUG8G0W/XKaHKzn
 FQd/AL0vNiApu65U5RCgWjjZve0sEUxyuB0VGkPP5pQItFo6E6XM6gSPnPfW1Za5j259
 K4rVWIcWVpFCHD70dJuNcJeCrhQkemNZxFvPyjHmrSot6PY1Ukk0gqOR4FEh4Eg62K4s
 eu2A==
X-Gm-Message-State: APjAAAWXQ0RU+BX8vmLnBjG+lvadKKto1a7f2F+B44zhWjiQvwoV0GPF
 rPV5OW+CBzCu69D9ddfNt3M=
X-Google-Smtp-Source: APXvYqzOFA6PDfT5irM5C65VlZ7ZKFbO3a0DOlnQh3xAaou+S9WsQRO88iZC22+zcLW6+6JXt/n0qA==
X-Received: by 2002:a7b:c3c3:: with SMTP id t3mr504878wmj.88.1557268735441;
 Tue, 07 May 2019 15:38:55 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.174.23])
 by smtp.googlemail.com with ESMTPSA id o13sm27177148wrg.40.2019.05.07.15.38.54
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 07 May 2019 15:38:54 -0700 (PDT)
Subject: Re: bug#35496: 27.0.50; smie-blink-matching-open blinks token before
 point after RET
From: Dmitry Gutov <dgutov@HIDDEN>
To: 35496 <at> debbugs.gnu.org
References: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
Message-ID: <d307060a-d309-8fa3-0dc0-89bd9d5f7afb@HIDDEN>
Date: Wed, 8 May 2019 01:38:53 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 35496
Cc: Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Stefan, just making sure you read this.

On 29.04.2019 23:57, Dmitry Gutov wrote:
> 1. Disable show-paren-mode if it's enabled.
> 2. Evalute the attached .el file (which defined a major mode).
> 3. Create a new bufferand type M-x foo-mode.
> 4. Type 'def foo do' (without quotes) and press RET.
> 5. Cursor will hang around on the first line even after the newline is 
> inserted.
> 
> Key moments: ?o is not in smie-blink-matching-triggers because the
> grammar also defines a closer 'dop'. smie-blink-matching-inners is t
> (which it is by default).
> 
> Here's an old bug report for elixir-mode which, unfortunately, didn't
> reach the end of the investigation before the author opted for a
> workaround instead: 
> https://github.com/elixir-editors/emacs-elixir/issues/363
> 
> What would be the better workaround, by the way? I'm thinking of simply 
> disabling smie-blink-matching-inners.
> 
> In GNU Emacs 27.0.50 (build 52, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
>   of 2019-04-28 built on zappa
> Repository revision: 80822917736edbab77969c4a18dfb8dd20fe3a88
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
> System Description: Ubuntu 18.04.2 LTS





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Apr 2019 20:57:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 29 16:57:24 2019
Received: from localhost ([127.0.0.1]:39956 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hLDL1-0001fN-NQ
	for submit <at> debbugs.gnu.org; Mon, 29 Apr 2019 16:57:24 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39216)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1hLDKx-0001f8-Sc
 for submit <at> debbugs.gnu.org; Mon, 29 Apr 2019 16:57:22 -0400
Received: from lists.gnu.org ([209.51.188.17]:39931)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <raaahh@HIDDEN>) id 1hLDKs-0007G2-Iu
 for submit <at> debbugs.gnu.org; Mon, 29 Apr 2019 16:57:14 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53584)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1hLDKr-0003aV-H6
 for bug-gnu-emacs@HIDDEN; Mon, 29 Apr 2019 16:57:14 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <raaahh@HIDDEN>) id 1hLDKq-0007El-Dw
 for bug-gnu-emacs@HIDDEN; Mon, 29 Apr 2019 16:57:13 -0400
Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:39302)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <raaahh@HIDDEN>) id 1hLDKq-0007Cn-5b
 for bug-gnu-emacs@HIDDEN; Mon, 29 Apr 2019 16:57:12 -0400
Received: by mail-lf1-x130.google.com with SMTP id d12so9096026lfk.6
 for <bug-gnu-emacs@HIDDEN>; Mon, 29 Apr 2019 13:57:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:to:from:subject:message-id:date:user-agent:mime-version
 :content-language;
 bh=Vh3YCa4E4qG7XshJiCtuC30Lui4QnoZ+ZiHUCDIeV+8=;
 b=hmoT7H3GK8QJXqC/j/OL9+hv3zBX/7Yd15FHmD40TUXDmuJHq+N/cGIG4xXO/undhg
 DjbHRSFDDBxooFLh1pM8zopVepLhza+feFWTo3NEy4P7y4PWf/aQtupI+55bnNRi1c05
 b2wBQMaCZWAorobjFa5GOUTh3jv9DHv3u49YlfrJZpOJ4KK2m9omDB5nWTxuG4IkEzZA
 gLH1ELbAp4UW/37vN+4qqO35QcxSqKYZH4DfEJX9N0QqEcMfAjWv0jGZu7bgU1Z363pz
 dGKXjsx/JlgKRFuiq8QBo4q7cIte/F+SeEkOf1crQVTUn+GI2msyLHqUN3ju5oB0yrsY
 WdQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:to:from:subject:message-id:date
 :user-agent:mime-version:content-language;
 bh=Vh3YCa4E4qG7XshJiCtuC30Lui4QnoZ+ZiHUCDIeV+8=;
 b=U4DZB5C0SwdEsxvYxKbXgA/K8WcI+3tXnI2pJ0IEFhDOBGv1/ghN1+ZPqxkKKLlidn
 T9e8JUlqJ+D3+cNxIz+B9kUGHs+5/FrrbcOf8rAKaxdt/Ql3soQZMc5GPXNZgEUvdk0g
 dW2egA9vhqa0B7SL+dfy5QWmJiS7PFBO4eUU5joJWtqLwpc0iaBJ95T9Cr7nczWBebWU
 8JMyX3c7RvWTx8Xg8NYVZjNR0QREgG2KUsCmIVhEl/M9YdiVvSlcnVGnaN+ZhqtxvTNq
 j4AW2fNx1WHLMwWVydNoID+QygEMpcy2trLKJkx3aOZ7xRM9DSEJYPYw9QZV/8x5S7lm
 GDIg==
X-Gm-Message-State: APjAAAX1ChPrbOjIRkRX/IvBT0/ptK3y19Gzq6W4CJRPL3HfpURVNNL2
 rin/RQa8vxIu762nT+YDMW9p8yNW
X-Google-Smtp-Source: APXvYqw/fmZb0WsUM94pRw5OGhFmfCKj0dL+VqOnmOAdDcozDQ/z2+NsmXF5whZWKibBn16MHPJS9Q==
X-Received: by 2002:ac2:51a1:: with SMTP id f1mr23999792lfk.129.1556571427759; 
 Mon, 29 Apr 2019 13:57:07 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.174.23])
 by smtp.googlemail.com with ESMTPSA id 192sm7314378lfh.14.2019.04.29.13.57.04
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 29 Apr 2019 13:57:06 -0700 (PDT)
To: bug-gnu-emacs@HIDDEN
From: Dmitry Gutov <dgutov@HIDDEN>
Subject: 27.0.50; smie-blink-matching-open blinks token before point after RET
Message-ID: <4cfccfa9-ee9d-3bc0-30a3-36d656f96de8@HIDDEN>
Date: Mon, 29 Apr 2019 23:57:03 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.1
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------0FDAC895144AF0644C6374F6"
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::130
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.2 (--)

This is a multi-part message in MIME format.
--------------0FDAC895144AF0644C6374F6
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

1. Disable show-paren-mode if it's enabled.
2. Evalute the attached .el file (which defined a major mode).
3. Create a new bufferand type M-x foo-mode.
4. Type 'def foo do' (without quotes) and press RET.
5. Cursor will hang around on the first line even after the newline is 
inserted.

Key moments: ?o is not in smie-blink-matching-triggers because the
grammar also defines a closer 'dop'. smie-blink-matching-inners is t
(which it is by default).

Here's an old bug report for elixir-mode which, unfortunately, didn't
reach the end of the investigation before the author opted for a
workaround instead: 
https://github.com/elixir-editors/emacs-elixir/issues/363

What would be the better workaround, by the way? I'm thinking of simply 
disabling smie-blink-matching-inners.

In GNU Emacs 27.0.50 (build 52, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
  of 2019-04-28 built on zappa
Repository revision: 80822917736edbab77969c4a18dfb8dd20fe3a88
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
System Description: Ubuntu 18.04.2 LTS

--------------0FDAC895144AF0644C6374F6
Content-Type: text/x-emacs-lisp;
 name="smie-blink-matching-inners.el"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="smie-blink-matching-inners.el"

(require 'smie)

(defvar foo-smie-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((statements (statement)
                  (statement ";" statements))
      (statement ("def" non-block-expr "do" statements "end")
                 ("def" non-block-expr "COMMA" "dop" non-block-expr))
      (non-block-expr ("STRING"))))))

(define-derived-mode foo-mode prog-mode "Foo"
  (set (make-local-variable 'comment-start) "# ")
  (smie-setup foo-smie-grammar #'ignore))

--------------0FDAC895144AF0644C6374F6--




Acknowledgement sent to Dmitry Gutov <dgutov@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#35496; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 22 Sep 2021 21:45:02 UTC

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