From: bg66 Date: Fri, 4 Feb 2005 10:36:26 +0000 (+0000) Subject: * riece-eval.el (riece-eval-form): New function. X-Git-Tag: riece-1_0_7~28 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81a013e79d454edfe5a11b0915f63af070dc5ffd;p=elisp%2Friece.git * riece-eval.el (riece-eval-form): New function. (riece-eval-display-message-function): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff898b0..a912203 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2005-02-04 OHASHI Akira + + * riece-eval.el (riece-eval-form): New function. + (riece-eval-display-message-function): Use it. + 2005-02-04 Daiki Ueno * riece-000.el (riece-handle-001-message): Use diff --git a/lisp/riece-eval.el b/lisp/riece-eval.el index de08a19..c54079f 100644 --- a/lisp/riece-eval.el +++ b/lisp/riece-eval.el @@ -58,25 +58,8 @@ (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" @@ -87,6 +70,23 @@ (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))