branch: elpa/org-tree-slide
commit a715f1b70583a357811d40e9c1b6c754ff787cd8
Author: Takaaki ISHIKAWA <tak...@ieee.org>
Commit: Takaaki ISHIKAWA <tak...@ieee.org>

    Add a file for compatibility
---
 org-tree-slide-compt.el | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/org-tree-slide-compt.el b/org-tree-slide-compt.el
new file mode 100644
index 0000000000..a7d6534050
--- /dev/null
+++ b/org-tree-slide-compt.el
@@ -0,0 +1,50 @@
+;; These functions shall be loaded for Emacs 25.1 or earlier.
+;; outline-show-children <- show-children
+;; outline-show-subtree <- show-subtree
+;; outline-hide-subtree <- hide-subtree
+
+(defun outline-show-children (&optional level)
+  "Show all direct subheadings of this heading.
+Prefix arg LEVEL is how many levels below the current level should be shown.
+Default is enough to cause the following heading to appear."
+  (interactive "P")
+  (setq level
+       (if level (prefix-numeric-value level)
+         (save-excursion
+           (outline-back-to-heading)
+           (let ((start-level (funcall outline-level)))
+             (outline-next-heading)
+             (if (eobp)
+                 1
+               (max 1 (- (funcall outline-level) start-level)))))))
+  (let (outline-view-change-hook)
+    (save-excursion
+      (outline-back-to-heading)
+      (setq level (+ level (funcall outline-level)))
+      (outline-map-region
+       (lambda ()
+        (if (<= (funcall outline-level) level)
+            (outline-show-heading)))
+       (point)
+       (progn (outline-end-of-subtree)
+             (if (eobp) (point-max) (1+ (point)))))))
+  (run-hooks 'outline-view-change-hook))
+
+
+(defun outline-show-subtree (&optional event)
+  "Show everything after this heading at deeper levels.
+If non-nil, EVENT should be a mouse event."
+  (interactive (list last-nonmenu-event))
+  (save-excursion
+    (when (mouse-event-p event)
+      (mouse-set-point event))
+    (outline-flag-subtree nil)))
+
+(defun outline-hide-subtree (&optional event)
+  "Hide everything after this heading at deeper levels.
+If non-nil, EVENT should be a mouse event."
+  (interactive (list last-nonmenu-event))
+  (save-excursion
+    (when (mouse-event-p event)
+      (mouse-set-point event))
+    (outline-flag-subtree t)))

Reply via email to