From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master e38e7b7: Make syntax errors say the line/column they appear at Date: Mon, 01 Feb 2021 14:47:41 -0500 Message-ID: References: <20210201161423.6054.53972@vcs0.savannah.gnu.org> <20210201161425.6B83A20DFD@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3951"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 01 20:49:30 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6fCU-0000w0-GP for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Feb 2021 20:49:30 +0100 Original-Received: from localhost ([::1]:59126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6fCT-0000jX-Ax for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Feb 2021 14:49:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6fAr-0007PC-43 for emacs-devel@gnu.org; Mon, 01 Feb 2021 14:47:49 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6fAp-0001Uj-1j for emacs-devel@gnu.org; Mon, 01 Feb 2021 14:47:48 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 836AB80722; Mon, 1 Feb 2021 14:47:45 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3CC4580625; Mon, 1 Feb 2021 14:47:43 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1612208863; bh=B68tgOtNac7D+uqeMmEqu4ePuZBbdul51kc1SnOlZAM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dciW05OF2zwxjcWvprsZSx8/XAI43u6p9nZErwrdpjqR+sSp5XuNoY9gQ7CX40y1S huYcs3FtHnJwGn3Y7xJyDGljrySzVJ04WeG8VPOjF9A2RTu2edQoTc8fx0E/f2YHSv iiySMdaC9cD807Qg0ygY/1cmppUAZ13m1jrobsx2nrgUg7Fnf+KhakG2KHEu/RB/uq Dq+iWkVDPSawr9+oqGKEF6TMFSkaVVunAwOYJ1E8XI876H+1zi7abBWylxTf1NZPwW kJ4QBW7SZTZ1X9AF9yGCXqBHTm6njGAoZC76po7u6qKj4VxFI+LUTzOdzs0Dd8lf47 8ZneCCASdaqjA== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0851A12026C; Mon, 1 Feb 2021 14:47:43 -0500 (EST) In-Reply-To: <20210201161425.6B83A20DFD@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Mon, 1 Feb 2021 11:14:24 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263696 Archived-At: > +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