Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sp-navigate-parallel-stop-at-ends option #1159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,12 @@ cease to be configurable."
:type 'boolean
:group 'smartparens)

(defcustom sp-navigate-parallel-stop-at-ends nil
"If non-nil, parallel sexp movements stop when hitting the end of
the containing sexp rather than looping back to the other end."
:type 'boolean
:group 'smartparens)

(defcustom sp-sexp-prefix nil
"Alist of `major-mode' specific prefix specification.

Expand Down Expand Up @@ -5997,8 +6003,12 @@ that is the first child of the enclosing sexp as defined by
(progn
(goto-char (sp-get next :end))
next)
(goto-char (sp-get next :beg-in))
(sp-forward-sexp)))))))
(if sp-navigate-parallel-stop-at-ends
(if (= (point) (sp-get next :end-in))
(user-error "End of containing sexp")
(goto-char (sp-get next :end-in)))
(goto-char (sp-get next :beg-in))
(sp-forward-sexp))))))))
re)))

(defun sp-backward-parallel-sexp (&optional arg)
Expand Down Expand Up @@ -6030,8 +6040,12 @@ is the last child of the enclosing sexp as defined by
(progn
(goto-char (sp-get prev :beg))
prev)
(goto-char (sp-get prev :end-in))
(sp-backward-sexp)))))))
(if sp-navigate-parallel-stop-at-ends
(if (= (point) (sp-get prev :beg-in))
(user-error "End of containing sexp")
(goto-char (sp-get prev :beg-in)))
(goto-char (sp-get prev :end-in))
(sp-backward-sexp))))))))
re)))

(defun sp--raw-argument-p (arg)
Expand Down