From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Josh Newsgroups: gmane.emacs.bugs Subject: bug#16328: 24.3.50; [PATCH] Enable narrowing to defun with function header comments also visible Date: Sat, 4 Jan 2014 00:41:18 -0800 Message-ID: References: <52C67B72.3010607@orcon.net.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1388824929 24501 80.91.229.3 (4 Jan 2014 08:42:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Jan 2014 08:42:09 +0000 (UTC) Cc: 16328@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 04 09:42:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VzMoB-0000Kx-FK for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jan 2014 09:42:15 +0100 Original-Received: from localhost ([::1]:53577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzMoA-0003Ql-N2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jan 2014 03:42:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzMo2-0003QS-FK for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 03:42:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzMny-0002M9-91 for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 03:42:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzMny-0002M4-5B for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 03:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VzMnx-0006b3-KD for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2014 03:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Josh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2014 08:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16328 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 16328-submit@debbugs.gnu.org id=B16328.138882491225340 (code B ref 16328); Sat, 04 Jan 2014 08:42:01 +0000 Original-Received: (at 16328) by debbugs.gnu.org; 4 Jan 2014 08:41:52 +0000 Original-Received: from localhost ([127.0.0.1]:32988 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzMnn-0006ae-T9 for submit@debbugs.gnu.org; Sat, 04 Jan 2014 03:41:52 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:52236) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzMnl-0006aV-Ps for 16328@debbugs.gnu.org; Sat, 04 Jan 2014 03:41:50 -0500 Original-Received: by mail-we0-f169.google.com with SMTP id w61so14431231wes.0 for <16328@debbugs.gnu.org>; Sat, 04 Jan 2014 00:41:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=tDiOwlriQqEyF8C44zdFdcw4EMIsf8y1H5CbGq6kLXg=; b=cVeCuVvxEhCbTM0ZKlfA2XO1kKOOPAXi/+CKUMXybNkHfH0jt1NrA/GLfNh5mu2wwT HwFDX1oMaacN+VmrR+wdPW7V8ho5Z0+QF+GMqNK9CeZ0WjHtf7kXMFcJ8HlyZmu6PlrW pcdff2FVVE9H75U9VM7WTjzczX8+Zu2KBkQ1WMjirzF3f+lv+p06UJNMY75NfAyqUww+ Qv3QFdTfkPWgpWQvI3mPISx93K03/YpyputDkqXv+hLV7RZZFhxocrZ46u69P8jK5edK N4Pk/326OPhw2DG9nnhIuQnfOF7QWYpSCHDbLRntU0X/nfbwupu0/WQiltEAGrGEPVtm e2xg== X-Gm-Message-State: ALoCoQmzqc6gjlQk2OMkTXMWnsLOUX3Asn96Dcmigut30QoW3L57LEdculwuH8dX3lLOEfq6Tjnu X-Received: by 10.194.77.106 with SMTP id r10mr2604wjw.91.1388824908877; Sat, 04 Jan 2014 00:41:48 -0800 (PST) Original-Received: by 10.194.24.7 with HTTP; Sat, 4 Jan 2014 00:41:18 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: acqfC9RgdeJOvnCtbUw3GVtlPIE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82899 Archived-At: Unpolished but related: http://paste.lisp.org/display/136136 On Fri, Jan 3, 2014 at 8:38 AM, Drew Adams 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.] > > >