unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien Guerry <bzg@altern.org>
To: emacs-pretest-bug@gnu.org
Subject: Re: 23.0.50; ielm doesn't handle comments
Date: Thu, 14 Feb 2008 20:01:32 +0000	[thread overview]
Message-ID: <87ve4rl337.fsf@bzg.ath.cx> (raw)
In-Reply-To: <v97ih7gxpo.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Thu, 14 Feb 2008 20:11:15 +0100")

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

Reiner Steib <reinersteib+gmane@imap.cc> 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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ieml.el.patch --]
[-- Type: text/x-diff, Size: 856 bytes --]

--- 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)))

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Bastien

  reply	other threads:[~2008-02-14 20:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14  0:14 23.0.50; ielm doesn't handle comments Adam Winiecki
2008-02-14 16:10 ` Lawrence Mitchell
2008-02-15  0:03   ` Richard Stallman
2008-02-14 18:11 ` Richard Stallman
2008-02-14 18:33   ` Bastien Guerry
2008-02-14 19:11     ` Reiner Steib
2008-02-14 20:01       ` Bastien Guerry [this message]
2008-02-14 21:07         ` Lawrence Mitchell
2008-02-15  0:41           ` Bastien
2008-02-15  8:49             ` Lawrence Mitchell
2008-02-15 14:27               ` Bastien Guerry
2008-02-15 16:35                 ` Bastien Guerry
2008-02-15 19:44                   ` Lawrence Mitchell
2008-02-16 16:21                     ` Bastien
2008-02-16 17:40                       ` Lawrence Mitchell
2008-02-16 18:17                         ` Bastien Guerry
2008-02-16 23:11                         ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ve4rl337.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).