Skip to content

Commit

Permalink
Add sp-forward-hybrid-sexp and sp-backward-hybrid-sexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuco1 committed Jan 19, 2018
1 parent 163a593 commit 52d0fb3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -5896,6 +5896,31 @@ is the last child of the enclosing sexp as defined by
(sp-backward-sexp)))))))
re)))

;; TODO: skip empty lines?
(defun sp-forward-hybrid-sexp (&optional arg)
"Move forward over one hybrid sexp.

See `sp-get-hybrid-sexp'."
(interactive "^p")
(-when-let (sexp (sp-get-hybrid-sexp))
(sp-get sexp
;; if we did not move forward at all, let's try one more time
(if (< (point) :end-suf)
(sp-get sexp (goto-char :end-suf))
(when (= (forward-line 1) 0)
(-when-let (sexp2 (sp-get-hybrid-sexp))
(sp-get sexp2 (goto-char :end-suf))))))))

(defun sp-backward-hybrid-sexp (&optional arg)
"Move backward over one hybrid sexp.

See `sp-get-hybrid-sexp'."
(interactive "^p")
(-when-let (sexp (save-excursion
(when (sp-backward-sexp)
(sp-get-hybrid-sexp))))
(sp-get sexp (goto-char :beg-prf))))

(defun sp--raw-argument-p (arg)
"Return t if ARG represents raw argument, that is a non-empty list."
(and (listp arg) (car arg)))
Expand Down

0 comments on commit 52d0fb3

Please sign in to comment.