Open wusticality opened 6 years ago
What this does is that if you turn it on it will treat the entire comment as a sexp for the purposes of jumping up out of it. So if you call sp-up-sexp
it will move you out of the comment. Also it overrides the value of sp-navigate-close-if-unbalanced
and makes it to be always false when inside comments.
What that does is that if you have a code like
(asdasd
with autoclosing it will try to balance this and add a closing paren. If you put it in a comment it won't because it might actually be intentional that the code is broken inside a comment (for example, it is a literal example of something).
Is there any reason why you would not want to navigate by structure inside a comment?
If the docstring is not clear enough I'm happy to accept some additional text or changes. If you can describe it better please let me know and we can adjust the text so it better fits the reality!
Ah I see what you're saying.
Quick question - I noticed that when sp-navigate-comments-as-sexps
is true (which is the default I think) that sp-up-sexp
jumps forward up out of the comment, but sp-backward-up-sexp
does not jump to the beginning of the comment, but to the end of the previous non-comment sexp. Is there a reason for this? When I first saw the docstring for this variable I assumed that all navigation commands would work as if the comment were a sexp, but that doesn't seem to be the case.
I can't think of any reason. Maybe it was convenient somehow for me to do the combination of gotoend + gotobegin and select the comment then delete it, I might have liked the behaviour and kept it so. I really don't remember :D
What you describe is probably more consistent, I think no harm done if we change it to be so.
EDIT: I may be misunderstanding this setting, if so please let me know! :)
Expected behavior
Unless I'm misunderstanding something, setting
sp-navigate-comments-as-sexps
tonil
should disablesmartparens
commands like structural navigation from working inside comments.Actual behavior
The various
smartparens
commands appear to work even whensp-navigate-comments-as-sexps
is set tonil
. For example, I can structurally navigate a sexp in a comment in a lisp buffer even whensp-navigate-comments-as-sexps
is set tonil
.Steps to reproduce the problem
Set
sp-navigate-comments-as-sexps
tonil
, enablesmartparens
in a lisp buffer, put a sexp into a comment, and then try usingsmartparens
structural navigation commands within said sexp.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