From: Karl Fogel <kfogel@red-bean.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PROPOSAL] Use prefix arg to control scope of org-narrow-to-subtree.
Date: Wed, 24 Apr 2019 14:05:10 -0500 [thread overview]
Message-ID: <87ftq7kyvt.fsf@red-bean.com> (raw)
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
next reply other threads:[~2019-04-24 19:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 19:05 Karl Fogel [this message]
2019-04-24 21:56 ` [PROPOSAL] Use prefix arg to control scope of org-narrow-to-subtree Alan L Tyree
2019-04-24 22:02 ` Alan L Tyree
2019-04-25 8:42 ` Nicolas Goaziou
2019-05-31 7:33 ` Karl Fogel
2019-12-01 8:45 ` [PATCH] " Karl Fogel
2019-12-01 13:13 ` Marco Wahl
2019-12-01 15:25 ` Karl Fogel
2019-12-01 15:44 ` Marco Wahl
2019-12-01 15:46 ` Karl Fogel
2019-12-02 8:51 ` Eric Abrahamsen
2019-12-02 15:15 ` Marco Wahl
2019-12-02 18:06 ` Karl Fogel
2019-12-02 18:56 ` Marco Wahl
2019-12-02 19:17 ` Karl Fogel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ftq7kyvt.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).