From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan L Tyree Subject: Re: [PROPOSAL] Use prefix arg to control scope of org-narrow-to-subtree. Date: Thu, 25 Apr 2019 08:02:24 +1000 Message-ID: References: <87ftq7kyvt.fsf@red-bean.com> Reply-To: alantyree@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:57841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJPyJ-0004C5-N8 for emacs-orgmode@gnu.org; Wed, 24 Apr 2019 18:02:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJPyI-0007Kh-B4 for emacs-orgmode@gnu.org; Wed, 24 Apr 2019 18:02:31 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:33034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJPyI-0007KP-4U for emacs-orgmode@gnu.org; Wed, 24 Apr 2019 18:02:30 -0400 Received: by mail-pf1-x42e.google.com with SMTP id h5so10026870pfo.0 for ; Wed, 24 Apr 2019 15:02:30 -0700 (PDT) Received: from ?IPv6:2001:8003:2411:ce00:c05f:e594:61f6:e942? ([2001:8003:2411:ce00:c05f:e594:61f6:e942]) by smtp.googlemail.com with ESMTPSA id 20sm26148139pfn.131.2019.04.24.15.02.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 15:02:27 -0700 (PDT) In-Reply-To: <87ftq7kyvt.fsf@red-bean.com> Content-Language: en-AU List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org On 25/4/19 5:05 am, Karl Fogel wrote: > Hi. This is a feature proposal -- if the consensus is that it would be welcomed, I'm happy to code it. I just didn't want to take the time to write it if there's no chance for it to be accepted upstream (since I don't want to be maintaining my own personal branch of Org Mode). > > It would be useful if `org-narrow-to-subtree' could optionally narrow to the next subtree(s) up, rather than only to the subtree point is currently in. For example, assume this text: > > * This is the first level > Some text here. > ** This is the second level > Some other text here. > *** This is the third level > By now we all know this song. > It is such a pretty song. > **** This is the fourth level > But do we have to sing it all day long? > This car trip is getting incong > ***** This is the fifth level > ruously unrhymed. > > Further assume that point is on the "c" of "car trip". > > In the current Org Mode, if you type `C-x n s', it will narrow to the fourth-level subtree (with the fifth level included in the narrowed buffer, of course). > > Since `org-narrow-to-subtree' takes no arguments at all right now, it's conveniently ripe for improvement :-). > > My proposal is for each raw prefix arg (each `C-u' prefix) to expand the narrowing level outward/upward by one. So in the above situation: > > - `C-u C-x n s' would narrow to the third-level subtree > > - `C-u C-u C-x n s' would narrow to the second-level subtree > > And so on. > > If you offer too many `C-u's, such that the narrowing would be wider than the current surrounding first-level subtree, then there are two possible ways we could handle it: > > 1) Extra `C-u's are ignored -- just narrow to surrounding 1st-level subtree. > > 2) Throw an error. > > I prefer (1), because it would be the more useful behavior, even though (2) would be easier to implement (since `org-back-to-heading' already throws the error). However, I'd welcome others' feedback on that question, or on any other aspect of this proposal. > > Best regards, > -Karl > Further to my previous message: there is already provision for a numerical prefix in org-tree-to-indirect-buffer.  I suppose that it and org-narrow-to-subtree should behave the same. org-narrow-to-subtree is what the old pc outliners called "hoisting". I first saw it in Thinktank and it was a blessing when writing book length documents. Cheers, Alan -- Alan L Tyree http://www2.austlii.edu.au/~alan