GNU bug report logs - #80150
30.1.90; No simple way to go to a line number from Lisp while respecting widen-automatically

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Spencer Baugh <sbaugh@HIDDEN>; dated Wed, 7 Jan 2026 12:51:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 80150 <at> debbugs.gnu.org:


Received: (at 80150) by debbugs.gnu.org; 7 Jan 2026 14:42:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 09:42:14 2026
Received: from localhost ([127.0.0.1]:35402 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdUjm-00020Z-6x
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:42:14 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:45036)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vdUjj-00020K-H6
 for 80150 <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:42:12 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vdUjd-0007eW-QZ; Wed, 07 Jan 2026 09:42:05 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=IPFibQasp24r8WN1zdAwl22dRLhhunuKSiXQf8TAUug=; b=ekcH2H2x9Nyn
 YQzch4wCZuFdWBfjpBgMCwLKIGUGIWna8UxMtb1WQF5TMVryH9KJ33nuKGvXkfqjplfg21fZbI4w9
 zsOmP2i2sc15+7Fq+OgK0nwuHZ3zJk7HMegiELu5n1v52XpSEtIoCtmS7qsBo9QdrWENbABukllZL
 cut3U7hIJzle0wxqRZWfaBw6fpki88DnaBTEHDz+nDjoxmv6+iLu78nDUHr9L4+4acFyoKeYcv+tR
 fXWM9vcODfnyoK34PPElL7MuTo++aKTPD+KDeQxZCIoitj1NnXclp57VuiMHp5rqfkJznEcCRM7KW
 sUU9RVPmPhK4G3YYoiFMpg==;
Date: Wed, 07 Jan 2026 16:41:57 +0200
Message-Id: <86ikddcwne.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <iersech8qpp.fsf@HIDDEN> (message from Spencer Baugh on
 Wed, 07 Jan 2026 09:03:46 -0500)
Subject: Re: bug#80150: 30.1.90; No simple way to go to a line number from
 Lisp while respecting widen-automatically
References: <ierv7hd8u4y.fsf@HIDDEN> <86ms2pcyja.fsf@HIDDEN>
 <iersech8qpp.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80150
Cc: 80150 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: 80150 <at> debbugs.gnu.org
> Date: Wed, 07 Jan 2026 09:03:46 -0500
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Date: Wed, 07 Jan 2026 07:49:49 -0500
> >> From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >> 
> >> 
> >> There's no function to go to a line number from Lisp while respecting
> >> widen-automatically: that is, if the buffer is narrowed, automatically
> >> widen it.  goto-line does exactly this, but it's marked
> >> interactive-only.  I think we should extract the relevant part of
> >> goto-line into a separate function which can be used from Lisp.
> >> 
> >> I often need to do this because other programs produce file positions in
> >> terms of line numbers, and I need to jump the user to these positions.
> >
> > The doc string of goto-line tells you what to do non-interactively.
> > Why is doing that in your case a problem?
> 
> It doesn't respect widen-automatically.  That is, if the buffer is
> narrowed, it doesn't automatically widen it if and only if it's
> necesasry.

"We have the technology."  What you need is something as simple as the
below:

   (save-restriction
     (goto-char (point-min))
     (forward-line (1- N))
     (DO-SOMETHING))
or
   (widen)
   (goto-char (point-min))
   (forward-line (1- N))
   (DO-SOMETHING)

(depending on what you need to do in DO-SOMETHING).

I'm asking why do we need something else? and why does widening have
to happen automatically?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80150; Package emacs. Full text available.

Message received at 80150 <at> debbugs.gnu.org:


Received: (at 80150) by debbugs.gnu.org; 7 Jan 2026 14:03:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 09:03:55 2026
Received: from localhost ([127.0.0.1]:35191 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdU8g-0008Hv-TR
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:03:55 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:50723)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vdU8e-0008Hg-JU
 for 80150 <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:03:53 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80150: 30.1.90; No simple way to go to a line number from
 Lisp while respecting widen-automatically
In-Reply-To: <86ms2pcyja.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 07 Jan
 2026 16:01:13 +0200")
References: <ierv7hd8u4y.fsf@HIDDEN> <86ms2pcyja.fsf@HIDDEN>
Date: Wed, 07 Jan 2026 09:03:46 -0500
Message-ID: <iersech8qpp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1767794627;
 bh=ZZYa7zs9lEh88Zb1aHB613Pd6onpPjMyK6l/GI5kLFY=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=e2UcJUDdJOELeQcrEoee7kwRGzbAMiaR2eo/PLbIFGDQYfG2A5ZzgHcVIe4qLoC3g
 IuN2ux/pl6CMVfOorDejoh5WL1Xy4WdU/Y6zMeSnvljomB8G4BAG9lKWElPWWMSsk2
 HoIqGfdFPWcuzg8tNXAlFfCRmgPCN7UFbTfFDxgLThK7CN2+j1KcriHE15htD2Jv0u
 zNO4yps1QGkzaxJNnC9yMrNz8lG0FcIq1T3n51zaWLS/fJnue511V5uSrl3VajbbNp
 1A5knuBG5xoIvgAlLKT0qzF1lAC9E0mq4F6rSTmNd16IvHOK1liyG2jFSp9ScutgS3
 Vd7esdzGhIOVA==
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80150
Cc: 80150 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Wed, 07 Jan 2026 07:49:49 -0500
>> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> 
>> 
>> There's no function to go to a line number from Lisp while respecting
>> widen-automatically: that is, if the buffer is narrowed, automatically
>> widen it.  goto-line does exactly this, but it's marked
>> interactive-only.  I think we should extract the relevant part of
>> goto-line into a separate function which can be used from Lisp.
>> 
>> I often need to do this because other programs produce file positions in
>> terms of line numbers, and I need to jump the user to these positions.
>
> The doc string of goto-line tells you what to do non-interactively.
> Why is doing that in your case a problem?

It doesn't respect widen-automatically.  That is, if the buffer is
narrowed, it doesn't automatically widen it if and only if it's
necesasry.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80150; Package emacs. Full text available.

Message received at 80150 <at> debbugs.gnu.org:


Received: (at 80150) by debbugs.gnu.org; 7 Jan 2026 14:01:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 09:01:40 2026
Received: from localhost ([127.0.0.1]:35176 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdU6W-0008Do-6y
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:01:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40862)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vdU6S-0008Da-Ui
 for 80150 <at> debbugs.gnu.org; Wed, 07 Jan 2026 09:01:37 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vdU6N-0006M0-Bv; Wed, 07 Jan 2026 09:01:31 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=yolwcJa2mZWPl3HKDd+Q5L6DYCZbhTQdQB7N0Witpsw=; b=cto5N688rFiq
 cM1mGKGIoSOOocf5XtgfXupHOMWsa/1Z9CM7592bOBJkDCQXvGvG6Ts6+sxNq4akc8lG0/Sd1O4b4
 Til+Pnah2aaQH7DHbAjZ0epGEK+2w8KMhAFcPaYqchYO3Lrv/AdC//JTE8JQRnQew3IfB6nlc/QOL
 ZA8TOp8CDA810Hgpg3V5GjW2hUIkwvZVjPc7479Y0wLDM8qYTHr3DpJJg1CkW8BNPKPMz09AtfMos
 N3Pr2/nOC/DEQ+ml5b+XLO2HRGamp3DyLJ4uBLnYhSPg6tsTgn2W8wZJRKg1mpHOY4gNav4hhQfQb
 UeHLYnzNU/Nrt+I9pZp9fA==;
Date: Wed, 07 Jan 2026 16:01:13 +0200
Message-Id: <86ms2pcyja.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <ierv7hd8u4y.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#80150: 30.1.90;
 No simple way to go to a line number from Lisp while respecting
 widen-automatically
References: <ierv7hd8u4y.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80150
Cc: 80150 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 07 Jan 2026 07:49:49 -0500
> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> There's no function to go to a line number from Lisp while respecting
> widen-automatically: that is, if the buffer is narrowed, automatically
> widen it.  goto-line does exactly this, but it's marked
> interactive-only.  I think we should extract the relevant part of
> goto-line into a separate function which can be used from Lisp.
> 
> I often need to do this because other programs produce file positions in
> terms of line numbers, and I need to jump the user to these positions.

The doc string of goto-line tells you what to do non-interactively.
Why is doing that in your case a problem?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80150; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Jan 2026 12:50:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 07 07:50:05 2026
Received: from localhost ([127.0.0.1]:34951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vdSzF-0004er-5F
	for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 07:50:05 -0500
Received: from lists.gnu.org ([2001:470:142::17]:57218)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vdSzA-0004eB-HX
 for submit <at> debbugs.gnu.org; Wed, 07 Jan 2026 07:50:03 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1vdSz3-00008n-21
 for bug-gnu-emacs@HIDDEN; Wed, 07 Jan 2026 07:49:53 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1vdSz1-0004xb-98
 for bug-gnu-emacs@HIDDEN; Wed, 07 Jan 2026 07:49:52 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.1.90; No simple way to go to a line number from Lisp while
 respecting widen-automatically
X-Debbugs-Cc: 
Date: Wed, 07 Jan 2026 07:49:49 -0500
Message-ID: <ierv7hd8u4y.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1767790189;
 bh=GlHzjk25xJ6rT9AdmygrSM5LOzjHkpu/6bThGxKwPak=;
 h=From:To:Subject:Date;
 b=RXFXAnFKNPkeOaPu6DTZVZ2r9P6W5QqJYb5YN24ver1UjRwXGifMiGDNrI6WLDGWO
 DKikixgNG5lQP28VjP7zJAqItoSGlu22e+yw64A8bLnMyv8byuFjIIWc/nVKRcoyaW
 hDjc2IQ41rXaAB5dAaDfv+5covKRiwqo8TEf3iBIiMlIiwzEdkspixrrdHjIoaJR3h
 qJ+Zxc+COFRBWBk/2CzDVKn4+bEZXr3+8cdGfWSrTlJrs2mHcQYux67NnXYp1oLXX8
 SfGSXfGx+npbOurOoQe5Za5ZOklW/gV+u7e/haoGoErLLoSXvuSGHHCDtIubLHxu6L
 SJe4t1esdBAxA==
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


There's no function to go to a line number from Lisp while respecting
widen-automatically: that is, if the buffer is narrowed, automatically
widen it.  goto-line does exactly this, but it's marked
interactive-only.  I think we should extract the relevant part of
goto-line into a separate function which can be used from Lisp.

I often need to do this because other programs produce file positions in
terms of line numbers, and I need to jump the user to these positions.


In GNU Emacs 30.1.90 (build 91, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2025-12-29 built on
 igm-qws-u22796a
Repository revision: c4a0657b9713f73300ef01bbcac94e583832a7ea
Repository branch: emacs-30
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install --with-tree-sitter
 --with-native-compilation=aot
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'




Acknowledgement sent to Spencer Baugh <sbaugh@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80150; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 7 Jan 2026 14:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.