emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-tree-slide 4214474dfa 1/3: Support skip comment inheri


From: ELPA Syncer
Subject: [nongnu] elpa/org-tree-slide 4214474dfa 1/3: Support skip comment inherit mode
Date: Sat, 26 Aug 2023 03:59:38 -0400 (EDT)

branch: elpa/org-tree-slide
commit 4214474dfa17073c19beb00c94f81be5e18350fb
Author: Takaaki ISHIKAWA <takaxp@ieee.org>
Commit: Takaaki ISHIKAWA <takaxp@ieee.org>

    Support skip comment inherit mode
---
 org-tree-slide.el | 61 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 49 insertions(+), 12 deletions(-)

diff --git a/org-tree-slide.el b/org-tree-slide.el
index e035b5c008..8bf514b36f 100644
--- a/org-tree-slide.el
+++ b/org-tree-slide.el
@@ -1,9 +1,9 @@
 ;;; org-tree-slide.el --- A presentation tool for org-mode
 ;;
-;; Copyright (C) 2011-2020 Takaaki ISHIKAWA
+;; Copyright (C) 2011-2022 Takaaki ISHIKAWA
 ;;
 ;; Author: Takaaki ISHIKAWA <takaxp at ieee dot org>
-;; Version: 2.8.18
+;; Version: 2.8.19
 ;; Package-Requires: ((emacs "24.4"))
 ;; Maintainer: Takaaki ISHIKAWA <takaxp at ieee dot org>
 ;; Twitter: @takaxp
@@ -78,7 +78,7 @@
 (require 'org)
 (require 'org-timer)
 
-(defconst org-tree-slide "2.8.18"
+(defconst org-tree-slide "2.8.19"
   "The version number of the org-tree-slide.el.")
 
 (defgroup org-tree-slide nil
@@ -156,8 +156,13 @@ nil: keep the same position."
   :group 'org-tree-slide)
 
 (defcustom org-tree-slide-skip-comments t
-  "Specify to skip COMMENT item or not."
-  :type 'boolean
+  "Specify to skip COMMENT item or not.
+t: skip the current heading with COMMENT, and child headings without COMMENT 
will be shown
+nil: show the current heading even if it has COMMENT
+inherit: skip the current heading with COMMENT and child headings.
+"
+  :type '(choice (boolean :tag "Value for each heading")
+                 (symbol :tag "Value for heading and its child headings"))
   :group 'org-tree-slide)
 
 (defcustom org-tree-slide-activate-message
@@ -496,11 +501,30 @@ Profiles:
 
 ;;;###autoload
 (defun org-tree-slide-skip-comments-toggle ()
-  "Toggle show COMMENT item or not."
+  "Toggle show COMMENT item or not.
+If `org-tree-slide-skip-comments' is specified as `inherit',
+then toggle between `inherit' and `nil'."
   (interactive)
-  (setq org-tree-slide-skip-comments (not org-tree-slide-skip-comments))
-  (if org-tree-slide-skip-comments
-      (message "COMMENT: HIDE") (message "COMMENT: SHOW")))
+  ;; Sync
+  (if (eq org-tree-slide-skip-comments 'inherit)
+      (setq org-tree-slide--skip-comments-mode 'inherit)
+    (when (eq org-tree-slide-skip-comments t)
+      (setq org-tree-slide--skip-comments-mode t)))
+  ;; Toggle
+  (if (eq org-tree-slide--skip-comments-mode 'inherit)
+      (if (eq org-tree-slide-skip-comments 'inherit)
+          (setq org-tree-slide-skip-comments nil)
+        (setq org-tree-slide-skip-comments 'inherit))
+    (setq org-tree-slide-skip-comments (not org-tree-slide-skip-comments)))
+  ;; Feedback
+  (cond ((eq org-tree-slide-skip-comments nil)
+         (message "COMMENT: HIDE"))
+        ((eq org-tree-slide-skip-comments t)
+         (message "COMMENT: SHOW"))
+        ((eq org-tree-slide-skip-comments 'inherit)
+         (message "COMMENT: SHOW (inherit)")))
+  (setq org-tree-slide--slide-number
+        (format " %s" (org-tree-slide--count-slide (point)))))
 
 ;;; Internal functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defvar org-tree-slide--slide-number nil)
@@ -536,9 +560,11 @@ This is displayed by default if 
`org-tree-slide-modeline-display' is nil.")
   "Flag to check the status of overlay for a slide header.")
 
 (defvar org-tree-slide--header-face-autoconfig nil)
+(defvar org-tree-slide--skip-comments-mode nil)
 (defun org-tree-slide--setup ()
   "Setup."
   (when (org-tree-slide--active-p)
+    (setq org-tree-slide--skip-comments-mode org-tree-slide-skip-comments)
     (org-tree-slide--play)))
 
 (defun org-tree-slide--abort ()
@@ -694,9 +720,20 @@ If HEADING-LEVEL is non-nil, the provided outline level is 
checked."
          (concat "^\\*+ " org-not-done-regexp)))))
 
 (defun org-tree-slide--heading-skip-comment-p ()
-  "Return t, if the current heading is commented."
-  (and org-tree-slide-skip-comments
-       (looking-at (concat "^\\*+ " org-comment-string))))
+  "Return t, if the current heading is commented.
+If `org-tree-slide-skip-comments' is specified as `inherit' and
+parent heading is commented, then also return t.  Otherwise, return nil."
+  (cond ((eq org-tree-slide-skip-comments 'inherit)
+         (when (org-tree-slide--parent-commented-p) t))
+        (t (and org-tree-slide-skip-comments
+                (looking-at (concat "^\\*+ " org-comment-string))))))
+
+(defun org-tree-slide--parent-commented-p ()
+  "Return nil, when no parent heading is commented."
+  (memq 0 (mapcar
+           (lambda (x)
+             (string-match (concat "^" org-comment-string) x))
+           (org-get-outline-path t))))
 
 (defun org-tree-slide--slide-in (blank-lines)
   "Apply slide in.  The slide will be moved from BLANK-LINES below to top."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]