org.el: New command `org-toggle-narrow-to-subtree'

* lisp/org.el (org-toggle-narrow-to-subtree): New command.
(org-speed-commands-default): Use the new command for the "s"
speed command.
This commit is contained in:
Bastien 2018-04-28 14:00:25 +02:00
parent f2af4a37a6
commit 2debcd5b22
2 changed files with 21 additions and 4 deletions

View File

@ -305,7 +305,7 @@ beginning of a headline when using Org speed commands. Now, if there
is already a restriction at point, hitting =<= again (or =C-x C-x <=) will
remove it.
** New functions
** New commands and functions
*** ~org-insert-structure-template~
@ -323,7 +323,15 @@ See docstring for details.
See docstring for details.
** Removed functions
*** ~org-toggle-narrow-to-subtree~
Toggle the narrowing state of the buffer: when in a narrowed state,
widen, otherwise call ~org-narrow-to-subtree~ to narrow.
This is attached to the "s" speed command, so that hitting "s" twice
will go back to the widen state.
** Removed commands and functions
*** ~org-outline-overlay-data~
Use ~org-save-outline-visibility~ instead.
*** ~org-set-outline-overlay-data~
@ -336,10 +344,12 @@ It was not used throughout code base.
Use ~org-element-at-point~ instead.
*** ~org-try-structure-completion~
Org Tempo may be used as a replacement. See details above.
** Removed variables
** Removed options
*** org-babel-use-quick-and-dirty-noweb-expansion
See [[*Change to Noweb expansion][Change to Noweb expansion]] for explanations.
** Miscellaneous
*** New default value for ~org-texinfo-table-scientific-notation~

View File

@ -8447,6 +8447,13 @@ If yes, remember the marker and the distance to BEG."
(when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
(point)))))))
(defun org-toggle-narrow-to-subtree ()
"Narrow to the subtree at point or widen a narrowed buffer."
(interactive)
(if (buffer-narrowed-p)
(widen)
(org-narrow-to-subtree)))
(defun org-narrow-to-block ()
"Narrow buffer to the current block."
(interactive)
@ -19097,7 +19104,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
("c" . org-cycle)
("C" . org-shifttab)
(" " . org-display-outline-path)
("s" . org-narrow-to-subtree)
("s" . org-toggle-narrow-to-subtree)
("k" . org-cut-subtree)
("=" . org-columns)
("Outline Structure Editing")