[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-tree-slide 28975a4492 018/144: Support displaying a sl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-tree-slide 28975a4492 018/144: Support displaying a slide number in a mode-line. |
Date: |
Tue, 18 Jan 2022 08:58:55 -0500 (EST) |
branch: elpa/org-tree-slide
commit 28975a449290beaff265c19fdd4c67638668c5fc
Author: Takaaki ISHIKAWA <takaxp@ieee.org>
Commit: Takaaki ISHIKAWA <takaxp@ieee.org>
Support displaying a slide number in a mode-line.
---
ChangeLog | 2 ++
org-tree-slide.el | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 92ebb845c5..8ee1315157 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2011-12-07 Takaaki ISHIKAWA <takaxp@ieee.org>
+ * ort-tree-slide.el: Support displaying a slide number in a mode-line.
+
* org-tree-slide.el: Adopt minor mode
org-tree-slide adopt a minor mode!
org-tree-slide-play and org-tree-slide-stop are replaced
diff --git a/org-tree-slide.el b/org-tree-slide.el
index 95428d7e7a..5c7c930f25 100644
--- a/org-tree-slide.el
+++ b/org-tree-slide.el
@@ -28,7 +28,8 @@
;; The latest version of the org-mode at http://orgmode.org/ is recommended.
;;
;;; History:
-;; v2.2.0 (2011-12-07@02:15) # Adopt minor mode
+;; v2.3.0 (2011-12-07@16:17) # Support displaying a slide number
+;; v2.2.0 (2011-12-07@02:15) # Support minor mode
;; v2.1.7 (2011-12-06@00:26) # Support TITLE/AUTHOR/EMAIL in a header
;; v2.1.5 (2011-12-05@17:08) # Fix an issue of title display
;; v2.1.3 (2011-12-05@15:08) # Fix the end of slide for skip ccontrol
@@ -56,7 +57,7 @@
(require 'org)
(require 'org-timer)
-(defconst org-tree-slide "2.2.0"
+(defconst org-tree-slide "2.3.0"
"The version number of the org-tree-slide.el")
(defgroup org-tree-slide nil
@@ -153,12 +154,15 @@
"The default key bindings for org-tree-slide.")
(defvar org-tree-slide-mode-hook nil)
+(defvar display-tree-slide-string nil)
(define-minor-mode org-tree-slide-mode
"A presentation tool for org-mode"
:lighter " TSlide"
:keymap org-tree-slide-mode-map
:group 'org-tree-slide
:require 'org
+ (setq display-tree-slide-string "")
+ (or global-mode-string (setq global-mode-string '("")))
(if org-tree-slide-mode
(progn
(ots-setup)
@@ -259,10 +263,13 @@
(defun ots-setup ()
(when (equal major-mode 'org-mode)
+ (or (memq 'display-tree-slide-string global-mode-string)
+ (setq global-mode-string
+ (append global-mode-string '(display-tree-slide-string))))
(ots-play)))
(defun ots-abort ()
- (unless (ots-active-p)
+ (when (equal major-mode 'org-mode)
(ots-stop)))
(defun ots-play ()
@@ -300,6 +307,7 @@
(show-children)
(org-cycle-hide-drawers 'all)
(org-narrow-to-subtree)
+ (setq display-tree-slide-string (ots-count-slide (point)))
(when org-tree-slide-slide-in-effect
(ots-slide-in org-tree-slide-slide-in-brank-lines))
(when org-tree-slide-header
@@ -325,11 +333,10 @@
((and (equal action 'skip) (equal direction 'previous))
(ots-outline-previous-heading))
((and (equal action 'last) (equal direction 'next))
- (ots-outline-previous-heading)
- (message "End of slide.")) ; Return back.
+ (ots-outline-previous-heading)) ; Return back.
+ ;; (message "End of slide."))
((and (equal action 'first) (equal direction 'previous))
- (ots-move-to-the-first-heading)
- (message "Beginning of slide.")) ; Stay the first heading
+ (ots-move-to-the-first-heading)) ; Stay the first heading
;; (ots-outline-previous-heading))
(t nil)))
@@ -437,6 +444,40 @@
'(org-level-3 ((t (:inherit org-tree-slide-heading-level-3-init)))))
(message "Face: OFF"))))
+(defun ots-count-slide (target-point)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (ots-move-to-the-first-heading)
+ (let
+ ((count 0)
+ (previous-point 0)
+ (current-slide 0))
+ (while (/= (point) previous-point) ; convergence point
+ (setq count (1+ count))
+ (when (<= (point) target-point)
+ (setq current-slide count))
+ (setq previous-point (point))
+ (ots-outline-next-heading))
+ (format "[%d/%d]" current-slide count)))))
+
+(defun ots-count-slide-old (&optional target-point)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (unless target-point
+ (setq target-point (point-max)))
+ (ots-move-to-the-first-heading)
+ (let
+ ((count 0)
+ (previous-point 0))
+ (while (and (<= (point) target-point)
+ (/= (point) previous-point))
+ (setq count (1+ count))
+ (setq previous-point (point))
+ (ots-outline-next-heading))
+ count))))
+
(defun ots-active-p ()
(and org-tree-slide-mode (equal major-mode 'org-mode)))
- [nongnu] elpa/org-tree-slide 2ff3a05844 109/144: Removed obsoleted hooks, (continued)
- [nongnu] elpa/org-tree-slide 2ff3a05844 109/144: Removed obsoleted hooks, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide a3b46848e4 111/144: org-tree-slide-content: Return to exact point in slide presentation (#30), ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 25a0936d0c 009/144: Version 2.0.1, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 39a6039b18 023/144: Add an option to control modeline display, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 36fefc1a2f 038/144: Update README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide faf9421439 041/144: Update README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 5d4f714052 020/144: Change descriptions, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide e835028d43 051/144: Fix README.org, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 09e99877d7 045/144: Fix a bug for an org buffer without header, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 949c77146f 025/144: org-tree-slide-skip-done set nil as default, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 28975a4492 018/144: Support displaying a slide number in a mode-line.,
ELPA Syncer <=
- [nongnu] elpa/org-tree-slide 996ed8cc6b 058/144: * README.org: update as el-get has recipe already included., ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide a3531738a8 059/144: Merge pull request #3 from yyr/master, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 6cf6e4ee84 065/144: Support buffers without headings, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 8e2ab19663 072/144: Default keymap was changed, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 933d6dc6e5 079/144: Merge pull request #14 from bennati/display-tree-with-narrow, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide dff8f1a4a6 094/144: Added a hook for CONTENT viewing mode, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 20784de420 103/144: Update ChangeLog, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 508157fb21 104/144: Avoid max-lisp-eval-depth error #29, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide aa2140f62b 126/144: Create custom variable org-tree-slide-content-margin-top, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide c9487e51b0 133/144: Add some links to useful videos, ELPA Syncer, 2022/01/18