Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.82k stars 195 forks source link

Double asterisk at beginning of line replaces closing quote from previous line with double asterisk #1082

Open apc opened 3 years ago

apc commented 3 years ago

Expected behavior

I'm not quite sure what to expect here, since I realize it's not clear how best to interpret '*' at the beginning of a line. So either:

This is 'odd'

**|

or

This is 'odd'

**|**

Actual behavior

Text goes from

This is 'odd'

*|

to

This is 'odd**

**|

after typing the second asterisk.

odd

Steps to reproduce the problem

I have not, unfortunately, managed to reproduce this problem starting with emacs -q. So I'm looking for help understanding what function is being called upon typing one of the delimiters that smartparens recognizes. (M-x view lossage tells me that my second * just called self-insert-command, so I guess the more fundamental problem is that I don't know how to ask the question I want, other than: what is happening when I type that second asterisk?)

Backtraces if necessary (M-x toggle-debug-on-error)

Environment & version information

In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.

The content of the buffer underneath the line was
copied to your clipboard.  You can also edit it in this buffer
and then copy the results manually.
------------------------------------------------
- `smartparens` version: 20201229.1937
- Active `major-mode`: `markdown-mode`
- Smartparens strict mode: nil
- Emacs version (`M-x emacs-version`): GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 AppKit 1671.6) of 2021-02-10
- Starterkit/Distribution: Vanilla
- OS: darwin
bcc32 commented 3 months ago

I was able to reproduce this with emacs -Q like so, with the current latest markdown-mode and smartparens:

emacs -Q -L src/markdown-mode -L src/smartparens -l markdown-mode -l smartparens-markdown /tmp/z.md --eval '(smartparens-mode)'

This bug seems to be able to cause bad effects across many intervening lines, too, e.g., typing ** at the end of this file also triggers the bug and the user may be much less likely to notice than when it is nearby:

`foo`

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Fuco1 commented 3 months ago

I can also reproduce this issue. Thanks for the report.