unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: master e38e7b7: Make syntax errors say the line/column they appear at
Date: Mon, 01 Feb 2021 14:47:41 -0500	[thread overview]
Message-ID: <jwv8s87r2us.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20210201161425.6B83A20DFD@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Mon,  1 Feb 2021 11:14:24 -0500 (EST)")

> +static AVOID
> +invalid_syntax_lisp (Lisp_Object s, Lisp_Object readcharfun)
> +{
> +  if (BUFFERP (readcharfun))
> +    {
> +      xsignal1 (Qinvalid_read_syntax,
> +		CALLN (Fformat, build_string ("%s (line %d, column %d)"),
> +		       s,
> +		       /* We should already be in the readcharfun
> +			  buffer when this error is called, so no need
> +			  to switch to it first. */
> +		       make_fixnum (count_lines (BEGV_BYTE, PT_BYTE) + 1),
> +		       make_fixnum (current_column ())));

Including this info is great, thanks.

But, FWIW, I'd much rather that the error object contains "raw data"
rather than "human-readable" data.  I.e. something like:

    xsignal2 (Qinvalid_read_syntax, s, PT);

and then convert the buf-pos to line+column later on, when the error
is displayed.
[ And if we don't have any ready-made place where we can put
  this display-time conversion, then we should probably change that
  as well.  ]


        Stefan




       reply	other threads:[~2021-02-01 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210201161423.6054.53972@vcs0.savannah.gnu.org>
     [not found] ` <20210201161425.6B83A20DFD@vcs0.savannah.gnu.org>
2021-02-01 19:47   ` Stefan Monnier [this message]
2021-02-02  8:34     ` master e38e7b7: Make syntax errors say the line/column they appear at Lars Ingebrigtsen

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=jwv8s87r2us.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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).