diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index ef1a2558d..f47e0f1e5 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -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~ diff --git a/lisp/org.el b/lisp/org.el index a1c77b6b8..c63245663 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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")