--- ielm.el.~1.58.~ 2008-01-08 20:44:50.000000000 +0000 +++ ielm.el 2008-02-15 00:35:37.000000000 +0000 @@ -304,6 +304,17 @@ "Return non-nil if STRING is all whitespace." (or (string= string "") (string-match "\\`[ \t\n]+\\'" string))) +(defun ielm-trim-comments (string) + "Trim comments out of STRING." + ;; FIXME: comments containing a double-quote character will not be + ;; recognized as comments. This is to allow sexp like "é". + (with-temp-buffer + (insert string) + (buffer-substring + (point-min) + (if (looking-back "[; \t]+[^\"]*" nil t) + (match-beginning 0) (point-max))))) + ;;; Evaluation (defun ielm-eval-input (ielm-string) @@ -331,6 +342,8 @@ (progn (condition-case err (let (rout) + ;; Make sure to get rid of comments + (setq ielm-string (ielm-trim-comments ielm-string)) (setq rout (read-from-string ielm-string)) (setq ielm-form (car rout)) (setq ielm-pos (cdr rout)))