[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] New command `outline-narrow-to-subtree'
From: |
Leo |
Subject: |
Re: [PATCH] New command `outline-narrow-to-subtree' |
Date: |
Fri, 19 Aug 2011 15:31:15 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.8) |
On 2011-08-15 22:47 +0800, Bastien wrote:
>> That key seems to be already bound to show-subtree (emacs-23 here).
>
> Right. I suggest using `C-c @ n' then.
>
>> C-x n s is a good key binding. There is no reason for org-mode to put
>> some of its commands in narrow-map which are only usable in org-mode.
>
> I assumed the purpose of `narrow-map' was to contain all commands
> related to narrowing, even if they are not globally available. But
> I'm probably wrong.
>
> Can some expert confirm this?
>
> If I'm wrong, then the `org-narrow-to-subtree' keybinding belongs to the
> `org-mode-map' the same way than `outline-narrow-to-subtree' belongs to
> the `outline-mode-map'.
How about something like this?
We add an interface function narrow-to-subtree which is bound globally
to C-x n s.
(defvar narrow-to-subtree-function nil
"Function to call to narrow to a subtree.")
(defun narrow-to-subtree ()
(interactive)
(if (functionp narrow-to-subtree-function)
(funcall narrow-to-subtree-function)
(error "Don't know how to narrow to a subtree in current buffer")))
then outline-mode, allout, org-mode and others can each provide its
specific narrow-to-subtree-function.
WDYT?
Leo