Another straightforward synch from GNU Emacs.
2014-01-27 Michael Sperber <mike(a)xemacs.org>
* lisp.el (check-parens): Add, from GNU Emacs.
diff --git a/lisp/lisp.el b/lisp/lisp.el
＠＠ -328,6 +328,26 ＠＠
+(defun check-parens () ; lame name?
+ "Check for unbalanced parentheses in the current buffer.
+More accurately, check the narrowed part of the buffer for unbalanced
+expressions (\"sexps\") in general. This is done according to the
+current syntax table and will find unbalanced brackets or quotes as
+appropriate. (See Info node `(emacs)Parentheses'.) If imbalance is
+found, an error is signaled and point is left at the first unbalanced
+ (condition-case data
+ ;; Buffer can't have more than (point-max) sexps.
+ (scan-sexps (point-min) (point-max))
+ (scan-error (goto-char (nth 2 data))
+ ;; Could print (nth 1 data), which is either
+ ;; "Containing expression ends prematurely" or
+ ;; "Unbalanced parentheses", but those may not be so
+ ;; accurate/helpful, e.g. quotes may actually be
+ ;; mismatched.
+ (error "Unmatched bracket or quote"))))
(defun lisp-complete-symbol ()
"Perform completion on Lisp symbol preceding point.
XEmacs-Patches mailing list