GNU bug report logs - #24649
24.5; Why no standard error for "Trailing garbage following expression"?

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 9 Oct 2016 18:04:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.5

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 24649 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 24649 <at> debbugs.gnu.org
Subject: Re: bug#24649: 24.5; Why no standard error for "Trailing garbage
 following expression"?
Date: Sat, 27 Jul 2019 16:11:52 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

> Shouldn't this error be a standard error?  If not a new standard error,
> shouldn't it at least use one of the existing standard errors, such as
> `scan-error' or `invalid-read-syntax'?
>
> Otherwise, how to easily handle this error (e.g., to tell the user to
> correct the input being read and then read again)?

Makes sense to me.  I'm not sure what signal to use, though -- anybody
got an idea?

Tentative patch:

diff --git a/src/minibuf.c b/src/minibuf.c
index 14a0dbe762..f6cf47f1f2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -169,7 +169,8 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
 	{
 	  int c = SREF (val, i);
 	  if (c != ' ' && c != '\t' && c != '\n')
-	    error ("Trailing garbage following expression");
+	    xsignal1 (Qinvalid_read_syntax,
+		      build_string ("Trailing garbage following expression"));
 	}
     }
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.