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: Sun, 31 Jan 2021 10:14:59 +0100 Message-ID: <87wnvttqlo.fsf@gnus.org> References: <87tuqyx3ki.fsf@gnus.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="14545"; 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 Sun Jan 31 10:16:28 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 1l68qK-0003gV-G0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jan 2021 10:16:28 +0100 Original-Received: from localhost ([::1]:49666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l68qJ-0005qp-HY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Jan 2021 04:16:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l68pu-0005qc-2R for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2021 04:16:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l68pt-0004o7-RG for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2021 04:16:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l68pt-00015t-MA for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2021 04:16: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: Sun, 31 Jan 2021 09:16: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.16120845214157 (code B ref 36970); Sun, 31 Jan 2021 09:16:01 +0000 Original-Received: (at 36970) by debbugs.gnu.org; 31 Jan 2021 09:15:21 +0000 Original-Received: from localhost ([127.0.0.1]:56394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l68pD-00014y-UI for submit@debbugs.gnu.org; Sun, 31 Jan 2021 04:15:20 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:35932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l68pA-00014f-1N for 36970@debbugs.gnu.org; Sun, 31 Jan 2021 04:15:18 -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=az2MhvzdGx6djGBdAbUTMRebCXstiKrOoIFMwQJjPFQ=; b=JNktX+i+wP2+g0kRX8RqOVGtKN qRNxwvS44boV2aMxUsWD07Mqz0a6uBtHMkXgvL+VtL29kMewr+lLI2soq3UvfcAkocMFqX6gp0qK/ v1kza6GDI3fn94J8SJLE90dc3gRUadEeVe9qB51x7z7nxD4lHTeX0vp8b//ph0xaNElk=; 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 1l68oy-00047L-2n; Sun, 31 Jan 2021 10:15:09 +0100 X-Now-Playing: Joan as Police Woman's _Joanthology (2)_: "Holy City" In-Reply-To: <87tuqyx3ki.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 30 Jan 2021 08:54:21 +0100") 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:198989 Archived-At: Lars Ingebrigtsen writes: > 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. I started tinkering with this, but there's a couple of things that are less obvious to me than I thought: Should the line/column numbers be based on what Fcount_lines return, or should they be the actual line number of the buffer? That is, taking selective display etc into consideration or not? Ignoring all that and just counting newlines would make sense in many situations (it's more like when compiling a file), but not in others? And... I'm slightly nervous about calling out to something as complicated as Fcount_lines. There's no efficiency considerations here (this is for error handling only), so I think calling that would be OK, but it'd be un-fun if the error handling bugged out. So I was poking through the Emacs lisp code to see whether there's any function that will just tell me what line I'm on, and there's... display_count_lines in xdisp.c, but that doesn't really seem like a good fit, since that's in redisplay, and not lread.c context. Isn't there any function that will just return the line number at point? I've been grepping for half an hour without finding anything. So I wrote a current_line function, which is trivial enough (and fast) if we're just looking for newlines and ignoring everything else... which... may be what we want here? Or not? Any opinions? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no