From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Guerry Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: 23.0.50; ielm doesn't handle comments Date: Thu, 14 Feb 2008 20:01:32 +0000 Message-ID: <87ve4rl337.fsf@bzg.ath.cx> References: <9c1b17790802131614p1f113873tbba17ec5af03c8ed@mail.gmail.com> <87k5l7mlpy.fsf@bzg.ath.cx> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1203019360 29078 80.91.229.12 (14 Feb 2008 20:02:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Feb 2008 20:02:40 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 14 21:03:03 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JPkHg-00025K-Nx for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 21:02:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPkHD-0002TN-1z for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 15:01:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPkH9-0002T5-35 for emacs-devel@gnu.org; Thu, 14 Feb 2008 15:01:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPkH6-0002Sp-JQ for emacs-devel@gnu.org; Thu, 14 Feb 2008 15:01:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPkH6-0002Sm-Gq for emacs-devel@gnu.org; Thu, 14 Feb 2008 15:01:40 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JPkH6-0001hf-28 for emacs-devel@gnu.org; Thu, 14 Feb 2008 15:01:40 -0500 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JPkH5-0001na-RM for emacs-pretest-bug@gnu.org; Thu, 14 Feb 2008 15:01:39 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JPkH2-0001gc-Km for emacs-pretest-bug@gnu.org; Thu, 14 Feb 2008 15:01:39 -0500 Original-Received: from ug-out-1314.google.com ([66.249.92.171]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JPkH2-0001gI-9u for emacs-pretest-bug@gnu.org; Thu, 14 Feb 2008 15:01:36 -0500 Original-Received: by ug-out-1314.google.com with SMTP id a2so1206585ugf.48 for ; Thu, 14 Feb 2008 12:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:from:to:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; bh=NjWjMrstiwz4ERpO1tls05Jcxxrg1/Xtx6TajMvxcDk=; b=A5Li+RLqkVryHfGYcpSy3Pev0phflr6f20Bb9n+cNDn5mVOLDKJs22yiUei7V+deE6pwT0CVl0hJwFpUneUaTbCGznB+OyHOa9gzPvM/OlXBR/CfemxHV5jLPk2a/vZxajX1h3CVdeIyztAAOGZzr/G6fKCl3rHTzD7cfEpN9Ws= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; b=LX07/RyPm1o7whGA11IImLyAiac8Kc/DQ/K3AFF/RnEycPxnGK73FEgShbLbPTM9X6tvfWPxa5TdnIA59mKp6YRJhpMZEvJwuRJACx8vGAH0hzpIGhyJMKE6RSMgpcwKndvkjjUWOqdpoRYp4JzBnYKr/vr1wfOsOHbBtECiMhE= Original-Received: by 10.67.103.10 with SMTP id f10mr3727812ugm.50.1203019295068; Thu, 14 Feb 2008 12:01:35 -0800 (PST) Original-Received: from bzg.ath.cx ( [81.99.213.34]) by mx.google.com with ESMTPS id 6sm4642532ugc.60.2008.02.14.12.01.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Feb 2008 12:01:33 -0800 (PST) Original-Received: by bzg.ath.cx (Postfix, from userid 1000) id 5C19F1575BD; Thu, 14 Feb 2008 20:01:31 +0000 (GMT) In-Reply-To: (Reiner Steib's message of "Thu, 14 Feb 2008 20:11:15 +0100") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89098 gmane.emacs.pretest.bugs:21094 Archived-At: --=-=-= Reiner Steib writes: > On Thu, Feb 14 2008, Bastien Guerry wrote: > >> This simple patch fixes it. > > Too simple: > > ELISP> "foo ) ; bar" > *** Read error *** End of file during parsing Right. Is this one safer? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=ieml.el.patch --- 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))) --=-=-= -- Bastien --=-=-=--