Function: c-safe-scan-lists

c-safe-scan-lists is a macro defined in cc-defs.el.gz.

Signature

(c-safe-scan-lists FROM COUNT DEPTH &optional LIMIT)

Documentation

Like scan-lists but returns nil instead of signaling errors for unbalanced parens.

A limit for the search may be given. FROM is assumed to be on the right side of it.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-defs.el.gz
(defmacro c-safe-scan-lists (from count depth &optional limit)
  "Like `scan-lists' but returns nil instead of signaling errors
for unbalanced parens.

A limit for the search may be given.  FROM is assumed to be on the
right side of it."
  (declare (debug t))
  (let ((res (if (featurep 'xemacs)
		 `(scan-lists ,from ,count ,depth nil t)
	       `(c-safe (scan-lists ,from ,count ,depth)))))
    (if limit
	`(save-restriction
	   (let ((-limit- ,limit))
	     (when -limit-
	       ,(if (numberp count)
		    (if (< count 0)
			`(narrow-to-region -limit- (point-max))
		      `(narrow-to-region (point-min) -limit-))
		  `(if (< ,count 0)
		       (narrow-to-region -limit- (point-max))
		     (narrow-to-region (point-min) -limit-))))
	     ,res))
      res)))