GNU bug report logs - #76176
30.0.93; Suggested command: narrow-to-thing-at-point

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Mon, 10 Feb 2025 12:35:01 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.93

To reply to this bug, email your comments to 76176 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Mon, 10 Feb 2025 12:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Phil Sainty <psainty <at> orcon.net.nz>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 10 Feb 2025 12:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Tue, 11 Feb 2025 01:33:56 +1300
[Message part 1 (text/plain, inline)]
This command occurred to me today as a useful way to leverage the
thing-at-point machinery.

I've put together the attached implementation as a first pass, based on
what I could glean of the current thing-at-point functionality.

I didn't see any existing ways of listing known/valid things.  If I'm
gathering this correctly, it might be useful to separate that bit out
into another function.

What do you think?


-Phil
[narrow-to-thing-at-point.el (text/x-lisp, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 11 Feb 2025 07:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Sat, 15 Feb 2025 11:58:02 GMT) Full text and rfc822 format available.

Message #10 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Sat, 15 Feb 2025 13:56:42 +0200
> Date: Tue, 11 Feb 2025 01:33:56 +1300
> From: Phil Sainty <psainty <at> orcon.net.nz>
> 
> This command occurred to me today as a useful way to leverage the
> thing-at-point machinery.
> 
> I've put together the attached implementation as a first pass, based on
> what I could glean of the current thing-at-point functionality.
> 
> I didn't see any existing ways of listing known/valid things.  If I'm
> gathering this correctly, it might be useful to separate that bit out
> into another function.
> 
> What do you think?

I don't see why not add this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Tue, 18 Feb 2025 00:33:02 GMT) Full text and rfc822 format available.

Message #13 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: psainty <at> orcon.net.nz, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Mon, 17 Feb 2025 19:32:35 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I see nothing outright _bad_ about this idea, but is it really useful
enough to be worth the added complexity of one more command?

There are lots of ways in Emacs of selecting some region, and los of hings
to do wiih the region.  Pick onr from column A and one from columnA B,
and you could define a command.  But we don't want to fill that whole rectangle
with rarely used commands.  Why is this one worth adding?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Tue, 18 Feb 2025 01:22:01 GMT) Full text and rfc822 format available.

Message #16 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: rms <at> gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Tue, 18 Feb 2025 14:21:45 +1300
On 2025-02-18 13:32, Richard Stallman wrote:
> I see nothing outright _bad_ about this idea, but is it really
> useful enough to be worth the added complexity of one more
> command?
> 
> There are lots of ways in Emacs of selecting some region, and
> los of hings to do wiih the region.  Pick onr from column A
> and one from columnA B, and you could define a command.  But
> we don't want to fill that whole rectangle with rarely used
> commands.  Why is this one worth adding?

We have a handful of single-purpose narrow-to-* commands already
(which I use frequently and consider to be more convenient than
"select region and narrow to region").  I saw this as a way to
add lots of new options with *only* a single new command.

The "C-x n" prefix is not crowded, so I don't think it's a
problem to add the new key binding; and the function itself
also acts as a very simple helper for users to define other
THING-specific "narrow-to-*" commands for their own use.
E.g. if someone wants a separate `narrow-to-string' command
then the body is simply (narrow-to-thing-at-point 'string),
which I think is nice.

And of course it supports custom/future THINGs for free.

I think it's worth adding for all those reasons.


-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Tue, 04 Mar 2025 02:45:02 GMT) Full text and rfc822 format available.

Message #19 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Phil Sainty <psainty <at> orcon.net.nz>, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Tue, 4 Mar 2025 02:43:52 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Tue, 11 Feb 2025 01:33:56 +1300
>> From: Phil Sainty <psainty <at> orcon.net.nz>
>>
>> This command occurred to me today as a useful way to leverage the
>> thing-at-point machinery.
>>
>> I've put together the attached implementation as a first pass, based on
>> what I could glean of the current thing-at-point functionality.
>>
>> I didn't see any existing ways of listing known/valid things.  If I'm
>> gathering this correctly, it might be useful to separate that bit out
>> into another function.
>>
>> What do you think?
>
> I don't see why not add this.

Sounds good to me.  Please install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Tue, 04 Mar 2025 02:45:04 GMT) Full text and rfc822 format available.

Message #22 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Phil Sainty <psainty <at> orcon.net.nz>, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Tue, 4 Mar 2025 02:44:31 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> Date: Tue, 11 Feb 2025 01:33:56 +1300
>>> From: Phil Sainty <psainty <at> orcon.net.nz>
>>>
>>> This command occurred to me today as a useful way to leverage the
>>> thing-at-point machinery.
>>>
>>> I've put together the attached implementation as a first pass, based on
>>> what I could glean of the current thing-at-point functionality.
>>>
>>> I didn't see any existing ways of listing known/valid things.  If I'm
>>> gathering this correctly, it might be useful to separate that bit out
>>> into another function.
>>>
>>> What do you think?
>>
>> I don't see why not add this.
>
> Sounds good to me.  Please install.

With the usual documentation fixes, NEWS, and so on, of course.




Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 04 Mar 2025 02:45:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Sun, 09 Mar 2025 12:36:01 GMT) Full text and rfc822 format available.

Message #27 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Mon, 10 Mar 2025 01:35:13 +1300
On 2025-03-04 15:44, Stefan Kangas wrote:
> Sounds good to me.  Please install.
> With the usual documentation fixes, NEWS, and so on, of course.

Will do.  I didn't get to it this weekend, but I'll attend to it
sometime soon.

-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76176; Package emacs. (Sat, 29 Mar 2025 11:21:01 GMT) Full text and rfc822 format available.

Message #30 received at 76176 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 76176 <at> debbugs.gnu.org
Subject: Re: bug#76176: 30.0.93; Suggested command: narrow-to-thing-at-point
Date: Sun, 30 Mar 2025 00:20:10 +1300
I've pushed some work-in-progress to the branch
scratch/narrow-to-thing-at-point

NEWS etc is still pending.

I did some more digging in thingatpt.el and have written a new
`thing-at-point-things' function which is more comprehensive
than the list I was obtaining previously.

After looking at `bounds-of-thing-at-point' more closely, I
realised it defers to `forward-thing' which in turn requires
nothing more than the existence of a function `forward-FOO'
for 'FOO to be a valid Thing.  This magic naming feels slightly
tenuous, but at present it's the only way to obtain a complete
list, so I'm using it.

Let me know if you have thoughts on that or other aspects.

I've included a `narrow-to-sexp-at-point' command as well
(should maybe be just `narrow-to-sexp') as I thought that
seemed like a generally useful thing.  I haven't added a
key binding for it, and the one which sprang to mind was
"C-x n (" which I thought was slightly clunky but might
be a good choice regardless.  I'm happy to ditch this if
you don't think it's a useful addition.


-Phil





This bug report was last modified 76 days ago.

Previous Next


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