smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Add macros `sp-get-when` and `sp-get-if`

Open Fuco1 opened this issue 7 years ago • 0 comments

This will allow us to reduce the nesting of forms such as this

(-when-let (ok (sp-get-sexp))
    (sp-get ok
      (kill-region :beg-in :end-in)
      (goto-char :beg-in)))

by one level. This is used a lot in SP.

Older code (before dash control macros) uses

(let ((ok (save-excursion (sp-forward-sexp arg))))
  (when ok (sp--unwrap-sexp ok))
  ok)

which can also be replaced.

Fuco1 avatar Nov 08 '17 11:11 Fuco1