--- ielm.el.~1.58.~ 2008-01-08 20:44:50.000000000 +0000 +++ ielm.el 2008-02-14 19:57:48.000000000 +0000 @@ -304,6 +304,14 @@ "Return non-nil if STRING is all whitespace." (or (string= string "") (string-match "\\`[ \t\n]+\\'" string))) +(defun ielm-trim-comments (string) + "Trim comments in STRING." + (let ((pos (previous-single-property-change + (length string) 'face string))) + (if (eq (get-text-property pos 'face) + 'font-lock-comment-face) + (substring string 0 pos)))) + ;;; Evaluation (defun ielm-eval-input (ielm-string) @@ -331,6 +339,8 @@ (progn (condition-case err (let (rout) + ;; Make sure there is no comment at the end of the sexp + (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)))