GNU bug report logs - #16328
24.3.50; [PATCH] Enable narrowing to defun with function header comments also visible

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Phil Sainty <psainty <at> orcon.net.nz>
Subject: bug#16328: closed (Re: bug#16328: 24.3.50; [PATCH] Enable
 narrowing to defun with function header comments also visible)
Date: Fri, 04 Jul 2014 02:05:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#16328: 24.3.50; [PATCH] Enable narrowing to defun with function header comments also visible

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 16328 <at> debbugs.gnu.org.

-- 
16328: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16328
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 16328-done <at> debbugs.gnu.org
Subject: Re: bug#16328: 24.3.50;
 [PATCH] Enable narrowing to defun with function header comments also
 visible
Date: Thu, 03 Jul 2014 22:04:18 -0400
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 

[Message part 3 (message/rfc822, inline)]
From: Phil Sainty <psainty <at> orcon.net.nz>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
 [PATCH] Enable narrowing to defun with function header comments
 also visible
Date: Fri, 03 Jan 2014 21:57:22 +1300
[Message part 4 (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)]

This bug report was last modified 10 years and 291 days ago.

Previous Next


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