smartparens
smartparens copied to clipboard
smartparens not working with delete-selection-mode enabled
Expected behavior
The expression in the region should be wrapped by brackets.
Actual behavior
The region gets deleted and/or strange unpaired brackets get inserted.
Also, when trying to view sp-local-pairs, an error is raised.
Steps to reproduce the problem
For any csharp/c/c++ file on my computer, it does not work. (However, smartparens is still working in elisp mode)
Backtraces if necessary (M-x toggle-debug-on-error
)
For sp-local-pairs
,
Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 845 845)
scan-sexps(847 -1)
forward-sexp(-1)
calculate-lisp-indent((2 845 879 nil nil nil 1 nil nil (1 845) nil))
lisp-indent-calc-next(#s(lisp-indent-state :stack (1 nil) :ppss (1 1 772 nil nil nil 1 nil nil (1) nil) :ppss-point 843))
indent-sexp()
pp-buffer()
describe-variable(sp-local-pairs)
funcall-interactively(describe-variable sp-local-pairs)
call-interactively(describe-variable)
lazy-helm/describe-variable()
funcall-interactively(lazy-helm/describe-variable)
call-interactively(lazy-helm/describe-variable nil nil)
command-execute(lazy-helm/describe-variable)
Environment & version information
-
smartparens
version: 20181007.1501 - Active
major-mode
:c++-mode
- Smartparens strict mode: nil
- Emacs version (
M-x emacs-version
): GNU Emacs 26.1 (build 1, x86_64-apple-darwin18.0.0, Carbon Version 158 AppKit 1671) of 2018-10-21 - Starterkit/Distribution: Spacemacs dev
- OS: darwin
Possible reason: something from rtag break it. Didn't confirm but it works now when I disable rtag mode. It's strange that rtag does never throw any error.
I have pushed a fix which might have been related to this issue. Can you check on the latest master build? (it will be on melpa in a couple hours or you can grab the git version manually)
I'm using version 20181027.1542 from melpa and it's still broken when rtags enabled and working when rtags disabled. I might report the bug to rtags as well.
Did this ever get fixed? I am using smartparens with c/c++ mode and if I select a region and insert a parenthesis - it just wipes out entire region and leaves me with empty string. Seems to be only happening with c/c++ mode. I am not using rtags though but I do have lsp-mode enabled and delete-selection-mode enabled.
In C++ mode if I select a region and press (
, [
or {
it gets wrapped normally. Maybe there are some other "electric" settings from c++ mode interfering? I can't reproduce this issue.
I no longer actively write code in C++ and I also changed my emacs packages drastically in last few years. All I can say is it's working for me right now.
Thank you for the feedback. I will close the issue now as it was already very old (sorry for being so slow :blush:). Hopefully it is fixed now.