From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Guerry Newsgroups: gmane.emacs.devel Subject: Re: 23.0.50; ielm doesn't handle comments Date: Fri, 15 Feb 2008 14:27:41 +0000 Message-ID: <87odai1ehu.fsf@bzg.ath.cx> References: <9c1b17790802131614p1f113873tbba17ec5af03c8ed@mail.gmail.com> <87k5l7mlpy.fsf@bzg.ath.cx> <87ve4rl337.fsf@bzg.ath.cx> <87ir0rdpat.fsf@bzg.ath.cx> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1203085698 28036 80.91.229.12 (15 Feb 2008 14:28:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2008 14:28:18 +0000 (UTC) Cc: Lawrence Mitchell To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 15 15:28:39 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 1JQ1Y6-0004sE-Gj for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2008 15:28:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JQ1Xc-0008RJ-Fv for ged-emacs-devel@m.gmane.org; Fri, 15 Feb 2008 09:27:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JQ1XY-0008RD-Le for emacs-devel@gnu.org; Fri, 15 Feb 2008 09:27:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JQ1XW-0008R0-Hr for emacs-devel@gnu.org; Fri, 15 Feb 2008 09:27:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JQ1XW-0008Qx-D8 for emacs-devel@gnu.org; Fri, 15 Feb 2008 09:27:46 -0500 Original-Received: from py-out-1112.google.com ([64.233.166.176]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JQ1XW-0003I1-3F for emacs-devel@gnu.org; Fri, 15 Feb 2008 09:27:46 -0500 Original-Received: by py-out-1112.google.com with SMTP id u52so852367pyb.1 for ; Fri, 15 Feb 2008 06:27:45 -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:cc:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; bh=rBIiri7Pp1Iy0s92kLqS+8FVxFcyHPQT/2dDq8YrUEk=; b=XlG3hoqQ6bc99WrXvfTbaGWr31EdV/JU9ZyY6+82xveL/Ea9p7BaAMZ0XpkGJQw6Qbv6xdw+jda9EMObzEOeAHnfswRMY4rMZC3VFrzgGkVMiMczK/ijqJTqHnqcgbZr5q0R50U6cOWSjjxC7dVkuOCOPQlh3ktT41k7RKrdRQ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; b=TpTcMPqt8w2aWQepaJTsTzUdcNQ4xVRoYAsC1nwG2zc03pBNYUzA+CT/eDZMXF7PmyUIKjn+nwCNBw/B/oWGfGMYEms/CkjHvfTZp3sH/FpN+m22McXkv+lQg7m6gCzSsf9Y0zcaqPH+YND3RCTmVlcFLBRaetlVcEsdaO6PT/s= Original-Received: by 10.35.54.19 with SMTP id g19mr2998905pyk.25.1203085665042; Fri, 15 Feb 2008 06:27:45 -0800 (PST) Original-Received: from bzg.ath.cx ( [81.99.213.34]) by mx.google.com with ESMTPS id f7sm503443nfh.38.2008.02.15.06.27.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Feb 2008 06:27:43 -0800 (PST) Original-Received: by bzg.ath.cx (Postfix, from userid 1000) id B3C3B1575BD; Fri, 15 Feb 2008 14:27:41 +0000 (GMT) In-Reply-To: (Lawrence Mitchell's message of "Fri, 15 Feb 2008 08:49:56 +0000") 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-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:89160 Archived-At: --=-=-= Lawrence Mitchell writes: > Bastien wrote: > > [...] > >> Right. I have come up with another solution, not relying on font-lock, >> but this one doesn't allow the double-quote character in comments. > >> Please improve it if you can. If no objection/suggestion until next >> week, I'll apply this one. > > I think the right way to fix this is to allow ielm to read the > form as it currently does (using read-from-string) and then > discard following input if it contains either merely whitespace > (as is currently the case) or a comment. Of course, you're right. I haven't seen your first patch, sorry. I propose this slightly modified patch below: it uses "\\`[ \t\n]*\\(?:;.*\\)*\\'" ^ ^ in `ielm-is-whitespace-or-comment' so that a sexp like (message "test");; comment ^ <= no whitespace doesn't return an error. I will apply this with the ChangeLog you provided if you agree. Thanks, --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=ieml.el.patch Index: ielm.el =================================================================== RCS file: /sources/emacs/emacs/lisp/ielm.el,v retrieving revision 1.58 diff -u -r1.58 ielm.el --- ielm.el 8 Jan 2008 20:44:50 -0000 1.58 +++ ielm.el 15 Feb 2008 14:19:32 -0000 @@ -300,9 +300,10 @@ ;;; Utility functions -(defun ielm-is-whitespace (string) +(defun ielm-is-whitespace-or-comment (string) "Return non-nil if STRING is all whitespace." - (or (string= string "") (string-match "\\`[ \t\n]+\\'" string))) + (or (string= string "") + (string-match "\\`[ \t\n]*\\(?:;.*\\)*\\'" string))) ;;; Evaluation @@ -327,7 +328,7 @@ (ielm-output "") ; result to display (ielm-wbuf ielm-working-buffer) ; current buffer after evaluation (ielm-pmark (ielm-pm))) - (if (not (ielm-is-whitespace ielm-string)) + (if (not (ielm-is-whitespace-or-comment ielm-string)) (progn (condition-case err (let (rout) @@ -342,7 +343,8 @@ (setq ielm-result "Working buffer has been killed" ielm-error-type "IELM Error" ielm-wbuf (current-buffer)) - (if (ielm-is-whitespace (substring ielm-string ielm-pos)) + (if (ielm-is-whitespace-or-comment + (substring ielm-string ielm-pos)) ;; To correctly handle the ielm-local variables *, ;; ** and ***, we need a temporary buffer to be ;; current at entry to the inner of the next two let --=-=-= -- Bastien --=-=-=--