* riece-signal.el (riece-emit-signal): Use riece-funcall-ignore-errors.
* riece-filter.el (riece-handle-numeric-reply): Use
riece-funcall-ignore-errors.
(riece-handle-message): Ditto.
* riece-ctcp.el (riece-handle-ctcp-request): Use
riece-funcall-ignore-errors.
+2005-02-19 Daiki Ueno <ueno@unixuser.org>
+
+ * riece-debug.el (riece-funcall-ignore-errors): New function.
+ * riece-signal.el (riece-emit-signal): Use riece-funcall-ignore-errors.
+ * riece-filter.el (riece-handle-numeric-reply): Use
+ riece-funcall-ignore-errors.
+ (riece-handle-message): Ditto.
+ * riece-ctcp.el (riece-handle-ctcp-request): Use
+ riece-funcall-ignore-errors.
+
2005-02-18 Steve Youngs <steve@sxemacs.org>
* riece-ctcp.el (riece-handle-ctcp-time-request): New.
(run-hook-with-args-until-success
hook prefix (car targets) message))
(if function
- (riece-ignore-errors (symbol-name function)
- (funcall function prefix (car targets) message)))
+ (riece--funcall-ignore-errors (symbol-name function)
+ function prefix (car targets)
+ message))
(riece-ignore-errors (symbol-name after-hook)
(run-hook-with-args-until-success
after-hook prefix (car targets) message))))
(run-hook-with-args-until-success
hook prefix (car targets) message))
(if function
- (riece-ignore-errors (symbol-name function)
- (funcall function prefix (car targets) message)))
+ (riece-funcall-ignore-errors
+ (symbol-name function)
+ function prefix (car targets) message))
(riece-ignore-errors (symbol-name after-hook)
(run-hook-with-args-until-success
after-hook prefix (car targets) message))))
(require 'riece-globals)
(defun riece-debug-reset-standard-output ()
+ "Reset `riece-temp-buffer' to be used as `standard-output'."
(save-excursion
(set-buffer riece-temp-buffer)
(buffer-disable-undo)
(erase-buffer)))
(defmacro riece-debug-with-backtrace (&rest body)
+ "Execute BODY and send a backtrace to `riece-temp-buffer'."
`(unwind-protect
(progn ,@body)
(riece-debug-reset-standard-output)
(put 'riece-debug-with-backtrace 'edebug-form-spec '(form body))
(defmacro riece-ignore-errors (location &rest body)
+ "Execute BODY; if an error occurs, return nil.
+Otherwise, return result of last FORM.
+If `riece-debug' is non-nil and an error occurred, it sends a
+backtrace to standard-output."
`(condition-case error
(if riece-debug
(riece-debug-with-backtrace ,@body)
(put 'riece-ignore-errors 'lisp-indent-function 1)
(put 'riece-ignore-errors 'edebug-form-spec '(form body))
+(defun riece-funcall-ignore-errors (location function &rest args)
+ "Call FUNCTION with ARGS; if an error occurs, return nil.
+Otherwise, return result of the function.
+If `riece-debug' is non-nil and an error occurred, it sends a
+backtrace to standard-output."
+ (riece-ignore-errors location
+ (apply function args)))
+
(provide 'riece-debug)
;;; riece-debug.el ends here
(format "riece-handle-default-%03d-message" base-number))))
(if (and function
(symbol-function function))
- (riece-ignore-errors (symbol-name function)
- (funcall function prefix number name
- (riece-decode-coding-string string))))))
+ (riece-funcall-ignore-errors (symbol-name function)
+ function prefix number name
+ (riece-decode-coding-string string)))))
(defun riece-handle-message (prefix message string)
(if (and prefix
(unless (riece-ignore-errors (symbol-name hook)
(run-hook-with-args-until-success hook prefix string))
(if function
- (riece-ignore-errors (symbol-name function)
- (funcall function prefix string)))
+ (riece-funcall-ignore-errors (symbol-name function)
+ function prefix string))
(riece-ignore-errors (symbol-name after-hook)
(run-hook-with-args-until-success after-hook prefix string)))))
(setq signal (riece-make-signal signal-name args)
slots (symbol-value symbol))
(while slots
- (riece-ignore-errors (format "slot function for \"%S\""
- signal-name)
- (if (or (null (riece-slot-filter (car slots)))
- (riece-ignore-errors (format "signal filter for \"%S\""
- signal-name)
- (funcall (riece-slot-filter (car slots)) signal)))
- (funcall (riece-slot-function (car slots))
- signal (riece-slot-handback (car slots)))))
+ (if (or (null (riece-slot-filter (car slots)))
+ (riece-ignore-errors (format "signal filter for \"%S\""
+ signal-name)
+ (funcall (riece-slot-filter (car slots)) signal)))
+ (riece-funcall-ignore-errors (format "slot function for \"%S\""
+ signal-name)
+ (riece-slot-function (car slots))
+ signal
+ (riece-slot-handback (car slots))))
(setq slots (cdr slots))))))
(provide 'riece-signal)