unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
@ 2016-10-09 18:03 Drew Adams
  2019-07-27 14:11 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2016-10-09 18:03 UTC (permalink / raw)
  To: 24649

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

In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/usr --host=i686-pc-mingw32'





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2016-10-09 18:03 bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"? Drew Adams
@ 2019-07-27 14:11 ` Lars Ingebrigtsen
  2019-08-23  0:25   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-27 14:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: 24649

Drew Adams <drew.adams@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





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2019-07-27 14:11 ` Lars Ingebrigtsen
@ 2019-08-23  0:25   ` Lars Ingebrigtsen
  2019-08-23  8:06     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-23  0:25 UTC (permalink / raw)
  To: Drew Adams; +Cc: 24649

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Drew Adams <drew.adams@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?

[...]

> +	    xsignal1 (Qinvalid_read_syntax,
> +		      build_string ("Trailing garbage following expression"));

There weren't any comments, so I've now applied this.  If somebody has a
better idea for the error signal, please amend.

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2019-08-23  0:25   ` Lars Ingebrigtsen
@ 2019-08-23  8:06     ` Eli Zaretskii
  2019-08-23  8:16       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2019-08-23  8:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24649

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 23 Aug 2019 02:25:37 +0200
> Cc: 24649@debbugs.gnu.org
> 
> >> 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?
> 
> [...]
> 
> > +	    xsignal1 (Qinvalid_read_syntax,
> > +		      build_string ("Trailing garbage following expression"));
> 
> There weren't any comments, so I've now applied this.  If somebody has a
> better idea for the error signal, please amend.

Thanks, but this change needs to be reflected in the ELisp manual,
where currently invalid-read-syntax is documented for a different use
case.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2019-08-23  8:06     ` Eli Zaretskii
@ 2019-08-23  8:16       ` Lars Ingebrigtsen
  2019-08-23  9:18         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-23  8:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24649

Eli Zaretskii <eliz@gnu.org> writes:

>> > +	    xsignal1 (Qinvalid_read_syntax,
>> > +		      build_string ("Trailing garbage following expression"));
>> 
>> There weren't any comments, so I've now applied this.  If somebody has a
>> better idea for the error signal, please amend.
>
> Thanks, but this change needs to be reflected in the ELisp manual,
> where currently invalid-read-syntax is documented for a different use
> case.

Let's see...  Qargs_out_of_range would be inappropriate...  And
Qwrong_type_argument...  Perhaps the closest one of the predefined
errors would be Qend_of_file?

Or we could have a new one.  `garbage-follows-expression'?  That's
pretty explicit.

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2019-08-23  8:16       ` Lars Ingebrigtsen
@ 2019-08-23  9:18         ` Eli Zaretskii
  2019-08-23 18:43           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2019-08-23  9:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24649

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: drew.adams@oracle.com,  24649@debbugs.gnu.org
> Date: Fri, 23 Aug 2019 10:16:04 +0200
> 
> >> > +	    xsignal1 (Qinvalid_read_syntax,
> >> > +		      build_string ("Trailing garbage following expression"));
> >> 
> >> There weren't any comments, so I've now applied this.  If somebody has a
> >> better idea for the error signal, please amend.
> >
> > Thanks, but this change needs to be reflected in the ELisp manual,
> > where currently invalid-read-syntax is documented for a different use
> > case.
> 
> Let's see...  Qargs_out_of_range would be inappropriate...  And
> Qwrong_type_argument...  Perhaps the closest one of the predefined
> errors would be Qend_of_file?
> 
> Or we could have a new one.  `garbage-follows-expression'?  That's
> pretty explicit.

We don't have to invent a new symbol, we just need to document in
"Standard errors" that this error is also signaled an the situation
described in this bug report.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"?
  2019-08-23  9:18         ` Eli Zaretskii
@ 2019-08-23 18:43           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-23 18:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24649

Eli Zaretskii <eliz@gnu.org> writes:

> We don't have to invent a new symbol, we just need to document in
> "Standard errors" that this error is also signaled an the situation
> described in this bug report.

I see.  I've now done so on the trunk.

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-23 18:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-09 18:03 bug#24649: 24.5; Why no standard error for "Trailing garbage following expression"? Drew Adams
2019-07-27 14:11 ` Lars Ingebrigtsen
2019-08-23  0:25   ` Lars Ingebrigtsen
2019-08-23  8:06     ` Eli Zaretskii
2019-08-23  8:16       ` Lars Ingebrigtsen
2019-08-23  9:18         ` Eli Zaretskii
2019-08-23 18:43           ` Lars Ingebrigtsen

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