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.83k stars 194 forks source link

sp-forward-barf-sexp edge case in org mode #1008

Open obar opened 4 years ago

obar commented 4 years ago

Expected behavior

In org mode, with two words in a pair and cursor inside (indicated as ^ in example)

The quick *^brown fox* jumps over the lazy dog.

running sp-forward-barf-sexp should result in

The quick *^brown* fox jumps over the lazy dog.

Actual behavior

Running sp-forward-barf-sexp effectively acts twice, and results in

The quick *^*brown fox jumps over the lazy dog.

This works as expected with more than two words enclosed in the pair, and works for the backward and slurp variants without any issue that I saw. The edge case doesn't exist two words and a not-org-specific pair like (). Also, this bug doesn't seem to happen in other modes (I tried text-mode and python-mode)

Perhaps related?

It does seem that for some pairs in other modes, an empty pair can slurp. That's true for () and "" in python-mode, true for () but not true for `` in text-mode… Anyway, it doesn't seem to be true for pairs in org, an empty org-specific pair cannot slurp.

Environment & version information

Fuco1 commented 4 years ago

Seems like the slurping works but only in a specific case as well

The quick *|* brown fox jumps over the lazy dog.

calling forward slurp there captures brown but does not continue further.

What you describe with the barf is definitely a bug though.