Andreas Roehler writes:
below a parentese check function. Couldn't see it so
far.
Where do you propose to add it?
(when (featurep 'xemacs)
(defun check-parens ()
This can be done with defun-when-void, I think.
"Check for unbalanced parentheses. Stop at the beginning of
defective form. "
(interactive)
(let ((pos (point)))
(goto-char (point-min))
(or (condition-case nil
(while (not (eobp))
(forward-list))
(error (skip-chars-forward " \n\t")))
(progn (message "%s" "ok")
(goto-char pos))))))
For this to be robust, it needs to handle narrowed buffers. I think
it would be annoying to have it move point just because I had a
restriction in effect. Confusing, too.
Also, for XEmacs I'd write it (without handling restrictions)
;; Yeah, I know, we should be GNU-compatible here.
(defun-when-void check-parentheses ()
"Check for unbalanced parentheses.
Leaves point at the beginning of the first defective form, if any.
Otherwise, do not move point."
(interactive)
;; To handle restrictions, wrap the condition-case in `save-restriction'.
;; That's not enough, though: need to decide what behavior should be if
;; an error is not in the narrowed region!
(condition-case nil
(let ((home (point)))
(goto-char (point-min))
(while (not (eobp))
(forward-list))
(message "%s" "ok")
(goto-char home))
;; Be precise about which errors you catch; I know, the functions
;; rarely document which errors they throw ... we should fix that.
;; In the meantime, "Use the source, Luke."
(syntax-error
;; Many Lisp files use ASCII FF to denote a "page" break.
(skip-chars-forward " \n\t\f"))
(error
;; I don't know if this is the right behavior ....
(skip-chars-forward " \n\t\f")
(message "Unexpected error!"))))
Regards,
Steve
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta