Open wusticality opened 6 years ago
Some strict mode features work inside comments, for example you can't delete a paren with backspace or C-d
. Some do not, for example C-k
as you mention.
This is a bit unfortunate situation we're in. I can see that sp-strict-mode-affects-comments
might be useful but probably people will then want to customize subsets of commands as well... in the past these global settings did not work the best for us.
I have lot of ideas about the configuration but I don't want to make it extremly complicated... and there's a lot of things now which are not quite consistent across all the settings/modes :D The banes of legacy software hah.
Yeah I was wondering about that. Seems like it'd be good to treat comments entirely separately, that is, to have smartparens-strict-mode
enabled for regular code, but not for comments. Or perhaps to allow exactly how strict it is for comments. I realize that sounds like a nightmare.
On that front, I have a really pressing question about strings. I sometimes have stuff like this in code:
(setq foo "(")
This seems to break smartparens
everywhere else in the buffer when smartparens-strict-mode
is enabled (for example, trying to delete an arbitrary defun
will die with a message about being unbalanced). This also makes it damn near impossible to construct regular expressions in strings. I'm not sure what the workaround is for this outside of using rx
or something which isn't ideal.
I've noticed that paredit
(which I've used for awhile) will only holler about being unbalanced if you actually navigate into "("
which is really nice. Thoughts?
Having (setq foo "(")
should not be a problem at all because the balance check in code skips the strings. Can you give a repro? I put that string in an elisp buffer and can delete it without any problem.
Sure thing, let me get back to you on that, I remember it happening in my init.el
. :)
Expected behavior
Typing
C-k
(sp-kill-hybrid-sexp
) inside of a sexp in a comment should only kill to the end of the sexp, not to the end of the line whensmartparens-strict-mode
is enabled.Actual behavior
Typing
C-k
(sp-kill-hybrid-sexp
) inside of a sexp in a comment kills to the end of the line whensmartparens-strict-mode
is enabled.Steps to reproduce the problem
Open a lisp buffer, put a sexp into a comment, enable
smartparens-strict-mode
, and typeC-k
inside of the sexp.Feature Requests
A few related feature requests (not sure where to put them):
smartparens-strict-mode
could be enabled only for code (aka, not for comments). Maybe an option likesp-strict-mode-affects-comments
or something.smartparens
commands only affected code (not comments). I've experimented withsp-navigate-comments-as-sexps
but haven't had any luck (please see issue #837).Environment & version information
smartparens
version: 20171201.242M-x emacs-version
): GNU Emacs 25.3.1 (x86_64-apple-darwin16.7.0) of 2017-09-11