Просмотр исходного кода

Make feature "show children" applicable to whole file

* lisp/org.el (org-ctrl-c-tab): Make function applicable to a whole
  file.  Further flag (aka hide) all content in the subtrees.
Marco Wahl 6 лет назад
Родитель
Сommit
d2a5a6e4d0
1 измененных файлов с 11 добавлено и 5 удалено
  1. 11 5
      lisp/org.el

+ 11 - 5
lisp/org.el

@@ -18070,14 +18070,20 @@ context.  See the individual commands for more information."
   (interactive)
   (org-return t))
 
-(defun org-ctrl-c-tab (&optional _arg)
+(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'."
+Otherwise, call `org-show-children'.  ARG is the level to hide."
   (interactive "p")
-  (call-interactively
-   (if (org-at-table-p) #'org-table-toggle-column-width
-     #'org-show-children)))
+  (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))))
 
 (defun org-ctrl-c-star ()
   "Compute table, or change heading status of lines.