diff options
author | Marco Wahl <marcowahlsoft@gmail.com> | 2020-07-07 00:39:35 +0200 |
---|---|---|
committer | Marco Wahl <marcowahlsoft@gmail.com> | 2020-07-07 00:39:35 +0200 |
commit | ab864a29bea00d54ece19d4095de58fc0c6f6724 (patch) | |
tree | d339c6513b5df5d1c43e551f002f11147d56b43f | |
parent | 8b92bcd827f538bb78f79c12378764ab99c689a5 (diff) | |
download | org-mode-ab864a29bea00d54ece19d4095de58fc0c6f6724.tar.gz |
org: Improve consistency for org-ctrl-c-tab and children folding
* lisp/org.el (org-ctrl-c-tab): Don't move point when acting on
outline level 0 (which is before first heading). This is consistent to
the behavior for level > 0. And refactor some. And correct the
docstring.
-rw-r--r-- | lisp/org.el | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el index e16f2b3..748c058 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17802,17 +17802,19 @@ When inserting a newline, indent the new line if (defun org-ctrl-c-tab (&optional arg) "Toggle columns width in a table, or show children. Call `org-table-toggle-column-width' if point is in a table. -Otherwise, call `org-show-children'. ARG is the level to hide." +Otherwise provide a compact view of the children. ARG is the +level to hide." (interactive "p") - (if (org-at-table-p) - (call-interactively #'org-table-toggle-column-width) - (if (org-before-first-heading-p) - (progn - (org-flag-above-first-heading) - (outline-hide-sublevels (or arg 1)) - (goto-char (point-min))) - (outline-hide-subtree) - (org-show-children arg)))) + (cond + ((org-at-table-p) + (call-interactively #'org-table-toggle-column-width)) + ((org-before-first-heading-p) + (save-excursion + (org-flag-above-first-heading) + (outline-hide-sublevels (or arg 1)))) + (t + (outline-hide-subtree) + (org-show-children arg)))) (defun org-ctrl-c-star () "Compute table, or change heading status of lines. |