From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#36970: 26.2; invalid-read-syntax could print the location of the error Date: Sat, 30 Jan 2021 08:54:21 +0100 Message-ID: <87tuqyx3ki.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 36970@debbugs.gnu.org To: ndame Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 08:55:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1l5l67-0009Mu-4D for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 08:55:11 +0100 Original-Received: from localhost ([::1]:32974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5l65-000587-Ok for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 02:55:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5l5y-00057z-4w for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 02:55:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5l5x-0006CQ-UH for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 02:55:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l5l5x-0005kp-TK for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 02:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Jan 2021 07:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36970 X-GNU-PR-Package: emacs Original-Received: via spool by 36970-submit@debbugs.gnu.org id=B36970.161199327622079 (code B ref 36970); Sat, 30 Jan 2021 07:55:01 +0000 Original-Received: (at 36970) by debbugs.gnu.org; 30 Jan 2021 07:54:36 +0000 Original-Received: from localhost ([127.0.0.1]:53564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5l5Y-0005k3-8V for submit@debbugs.gnu.org; Sat, 30 Jan 2021 02:54:36 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:53134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5l5T-0005jm-PA for 36970@debbugs.gnu.org; Sat, 30 Jan 2021 02:54:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=aQZyrU+GtVJ4DykVtYkdn0KgyYT5vIAFZPJvIEn1PEg=; b=V+lY5l2aNUjSIJa85FFWT3e7ms lQp1triQhDXV7Yn7IbSuh/9ff/+Vuxw3JJ4mD+tsRdcuTR3bOPfXRBGAZJAAu8yFQsHczR3rzeguy 8Zy8ngGaLpFgbJeUJFqq1NPYoCj47jFU8vCY5AO8dWV/9+SEsOrMYP67ZF104VnmDjfU=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5l5K-000670-Nc; Sat, 30 Jan 2021 08:54:25 +0100 X-Now-Playing: The Ring - Savage Lover (12" Disco Mix: Long Version's _For Discos Only (3)_: "Vocal)" In-Reply-To: (ndame's message of "Thu, 8 Aug 2019 10:27:55 +0200 (CEST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198912 Archived-At: ndame writes: > It only says: > > (invalid-read-syntax ". in wrong context") > > It could also print the character location or even the line number and > the position in the line to make it easy to find the error. Poking around in read1 and friends, this doesn't seem very difficult to implement -- the errors are signalled from the invalid_syntax function. The wrinkle is that we may be reading from a string or something else based on readcharfun. However, the common case is reading from a buffer, and we could improve the error message there. So my idea here would be to change all the calls that are like this: invalid_syntax (". in wrong context"); into invalid_syntax (". in wrong context", readcharfun); and then, in that function do if (BUFFERP (readcharfun)) make_string_based_on_point () Since point is at the problematic element, that could just do a Fcount_lines/Fcurrent_column to get the line number/column number, presumably. Before starting to hack away at this, does anybody see any problems with this approach? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no