GNU bug report logs -
#16328
24.3.50; [PATCH] Enable narrowing to defun with function header comments also visible
Previous Next
Reported by: Phil Sainty <psainty <at> orcon.net.nz>
Date: Fri, 3 Jan 2014 08:59:01 UTC
Severity: wishlist
Tags: patch
Found in version 24.3.50
Fixed in version 25.1
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16328 in the body.
You can then email your comments to 16328 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16328
; Package
emacs
.
(Fri, 03 Jan 2014 08:59:01 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
.
(Fri, 03 Jan 2014 08:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
For languages where the programmer must resort to function header
comments to describe a function, I've always found it frustrating
that `narrow-to-defun' cuts out this often-critical information.
This patch provides a new function `narrow-to-defun-including-comments'
to keep these comments visible when narrowing.
As there may be multiple per-line comments instead of a single block
comment, I'm skipping back past ALL preceding comments. That seemed
reasonable instead of trying to guess how the author has structured
their comments. Stopping at an empty line would *probably* be okay,
but in the end I figured that potentially showing too much seemed
better than showing too little.
(I've included a check for page breaks within the comments, however,
as I was confident about excluding anything before one of those.)
I didn't think it was wise to encourage users to modify the behaviour
of `narrow-to-defun' itself (I certainly have programmatic uses for
that), so instead I've indicated the way to remap the interactive
bindings for users who wish to use this as standard.
-Phil
[narrow-to-defun-include-comments.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16328
; Package
emacs
.
(Fri, 03 Jan 2014 14:58:03 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
On 3/01/2014 21:57, Phil Sainty wrote:
> I didn't think it was wise to encourage users to modify the behaviour
> of `narrow-to-defun' itself (I certainly have programmatic uses for
> that)
Actually, that was a complete lie. The code I was thinking of uses
c-mark-function, not narrow-to-defun.
Maybe it would be completely fine to just make this a user option,
with no added function?
OTOH, me not using it obviously doesn't mean no one does, so the
more-cautious approach may still be preferable?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16328
; Package
emacs
.
(Fri, 03 Jan 2014 16:39:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 16328 <at> debbugs.gnu.org (full text, mbox):
> For languages where the programmer must resort to function header
> comments to describe a function, I've always found it frustrating
> that `narrow-to-defun' cuts out this often-critical information.
>
> This patch provides a new function `narrow-to-defun-including-
> comments' to keep these comments visible when narrowing.
>
> As there may be multiple per-line comments instead of a single block
> comment, I'm skipping back past ALL preceding comments. That seemed
> reasonable instead of trying to guess how the author has structured
> their comments. Stopping at an empty line would *probably* be okay,
> but in the end I figured that potentially showing too much seemed
> better than showing too little.
>
> (I've included a check for page breaks within the comments, however,
> as I was confident about excluding anything before one of those.)
>
> I didn't think it was wise to encourage users to modify the
> behaviour of `narrow-to-defun' itself (I certainly have programmatic
> uses for that), so instead I've indicated the way to remap the
> interactive bindings for users who wish to use this as standard.
Hi Phil. I wonder whether we couldn't just modify `narrow-to-defun',
changing to (interactive "P") and using the unused argument as prefix
arg to get this behavior?
Perhaps someone knows more about the history of that argument.
Grepping the Emacs sources, at least, I see no programmatic uses of
`narrow-to-defun' that pass an argument. And anyway, the argument
is ignored.
But presumably we would have kept the unused argument to allow
`narrow-to-defun' to be used as a functional argument in a context
where it might receive an argument? If there were such uses then
perhaps passing the prefix arg could prove problematic. Dunno.
Anyway, seems reasonable to try, or at least to investigate.
`C-u C-x n d' would then already be one key binding for this.
[BTW, I didn't check your code, but if it doesn't already, it could
perhaps use code similar to that of `reposition-window', to determine
the starting point for the narrowing. That command (`C-M-l') is
somewhat similar.]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16328
; Package
emacs
.
(Sat, 04 Jan 2014 08:42:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 16328 <at> debbugs.gnu.org (full text, mbox):
Unpolished but related: http://paste.lisp.org/display/136136
On Fri, Jan 3, 2014 at 8:38 AM, Drew Adams <drew.adams <at> oracle.com> wrote:
>> For languages where the programmer must resort to function header
>> comments to describe a function, I've always found it frustrating
>> that `narrow-to-defun' cuts out this often-critical information.
>>
>> This patch provides a new function `narrow-to-defun-including-
>> comments' to keep these comments visible when narrowing.
>>
>> As there may be multiple per-line comments instead of a single block
>> comment, I'm skipping back past ALL preceding comments. That seemed
>> reasonable instead of trying to guess how the author has structured
>> their comments. Stopping at an empty line would *probably* be okay,
>> but in the end I figured that potentially showing too much seemed
>> better than showing too little.
>>
>> (I've included a check for page breaks within the comments, however,
>> as I was confident about excluding anything before one of those.)
>>
>> I didn't think it was wise to encourage users to modify the
>> behaviour of `narrow-to-defun' itself (I certainly have programmatic
>> uses for that), so instead I've indicated the way to remap the
>> interactive bindings for users who wish to use this as standard.
>
> Hi Phil. I wonder whether we couldn't just modify `narrow-to-defun',
> changing to (interactive "P") and using the unused argument as prefix
> arg to get this behavior?
>
> Perhaps someone knows more about the history of that argument.
> Grepping the Emacs sources, at least, I see no programmatic uses of
> `narrow-to-defun' that pass an argument. And anyway, the argument
> is ignored.
>
> But presumably we would have kept the unused argument to allow
> `narrow-to-defun' to be used as a functional argument in a context
> where it might receive an argument? If there were such uses then
> perhaps passing the prefix arg could prove problematic. Dunno.
>
> Anyway, seems reasonable to try, or at least to investigate.
> `C-u C-x n d' would then already be one key binding for this.
>
> [BTW, I didn't check your code, but if it doesn't already, it could
> perhaps use code similar to that of `reposition-window', to determine
> the starting point for the narrowing. That command (`C-M-l') is
> somewhat similar.]
>
>
>
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Fri, 04 Jul 2014 02:05:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Phil Sainty <psainty <at> orcon.net.nz>
:
bug acknowledged by developer.
(Fri, 04 Jul 2014 02:05:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 16328-done <at> debbugs.gnu.org (full text, mbox):
Version:24.5
> This patch provides a new function `narrow-to-defun-including-comments'
> to keep these comments visible when narrowing.
I installed your patch into trunk, except that it only includes the
narrow-to-defun-include-comments variable and no new command.
Maybe we could make C-u toggle choose between the two behaviors.
Or switch between the two choices when repeating the command.
Thank you very much, and sorry for the delay,
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Aug 2014 11:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug Marked as fixed in versions 25.1.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug No longer marked as fixed in versions 24.5.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 02 Nov 2014 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.