Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.82k stars 195 forks source link

check-paren like functionality #785

Open rgemulla opened 7 years ago

rgemulla commented 7 years ago

It would be great if smartparen could provide the functionality of Emacs check-paren command (which is unware of the paren pairs defined by smartparen).

Fuco1 commented 7 years ago

Something like this should theoretically work

(defun sp-check-parens ()
  (interactive)
  (goto-char (point-min))
  (while (sp-forward-sexp))
  (sp-skip-forward-to-symbol))

unless there are of course bugs in the parser (there are some issues in comments... which we should probably eagerly skip instead of trying to walk them).

rgemulla commented 7 years ago

Yes, that's a already helpful!

It seems to move overly aggressively, though: Nested mismatched parens are not found, e.g., it will accept (}).