bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16328: 24.3.50; [PATCH] Enable narrowing to defun with function head


From: Phil Sainty
Subject: bug#16328: 24.3.50; [PATCH] Enable narrowing to defun with function header comments also visible
Date: Fri, 03 Jan 2014 21:57:22 +1300
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

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

Attachment: narrow-to-defun-include-comments.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]