+2005-02-04 OHASHI Akira <bg66@koka-in.org>
+
+ * riece-eval.el (riece-eval-form): New function.
+ (riece-eval-display-message-function): Use it.
+
2005-02-04 Daiki Ueno <ueno@unixuser.org>
* riece-000.el (riece-handle-001-message): Use
(when (and riece-eval-enabled
(riece-message-own-p message)
(string-match riece-eval-regexp (riece-message-text message)))
- (let ((form (match-string 1 (riece-message-text message)))
- object string)
- (condition-case err
- (progn
- (setq object (eval (read form)))
- (setq string
- (cond
- ((stringp object) object)
- ((and (listp object)
- (not (eq object nil)))
- (let ((string (pp-to-string object)))
- (substring string 0 (1- (length string)))))
- ((numberp object)
- (number-to-string object))
- ((eq object nil) "")
- (t (pp-to-string object)))))
- (error
- (unless riece-eval-ignore-error
- (setq string (format "Error evaluating %s: %s" form err)))))
+ (let* ((form (match-string 1 (riece-message-text message)))
+ (string (riece-eval-form form)))
(unless (equal string "")
(riece-send-string
(format "NOTICE %s :%s\r\n"
(riece-message-target message)
string 'notice))))))
+(defun riece-eval-form (form)
+ (condition-case err
+ (let ((object (eval (read form))))
+ (cond
+ ((stringp object) object)
+ ((and (listp object)
+ (not (eq object nil)))
+ (let ((string (pp-to-string object)))
+ (substring string 0 (1- (length string)))))
+ ((numberp object)
+ (number-to-string object))
+ ((eq object nil) "")
+ (t (pp-to-string object))))
+ (error
+ (unless riece-eval-ignore-error
+ (format "Error evaluating %s: %s" form err)))))
+
(defun riece-eval-insinuate ()
(add-hook 'riece-after-display-message-functions
'riece-eval-display-message-function))