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

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

[nongnu] elpa/org-tree-slide 69e8cd068e 070/144: Refine displaying slide


From: ELPA Syncer
Subject: [nongnu] elpa/org-tree-slide 69e8cd068e 070/144: Refine displaying slide number in modeline
Date: Tue, 18 Jan 2022 08:59:35 -0500 (EST)

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

    Refine displaying slide number in modeline
---
 ChangeLog         |  9 +++++++++
 README.org        |  5 +++--
 org-tree-slide.el | 41 ++++++++++++++++++++++++-----------------
 3 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b8bc449c08..18a25dafc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-02-14  Takaaki ISHIKAWA  <takaxp@ieee.org>
+
+       * org-tree-slide: Refine displaying slide number in modeline
+       - If 'lighter is specified, the slide number will be updated 
aggressively, then it's slow. On the other hand, 'outside is specified which 
will be shown quickly in the same position of 'lighter because it changes the 
number only if a slide is moved to the next/previous slide.
+
+       * org-tree-slide: Added two hooks
+       - org-tree-slide-mode-before-narrow-hook
+       - org-tree-slide-mode-after-narrow-hook
+
 2015-01-12  Takaaki ISHIKAWA  <takaxp@ieee.org>
 
        * org-tree-slide.el (ots-stop): Suppress an error message from org-timer
diff --git a/README.org b/README.org
index 731c01f4e4..d9c8d46ee8 100644
--- a/README.org
+++ b/README.org
@@ -1,8 +1,8 @@
 #+TITLE:       README for Org Tree Slide
 #+AUTHOR:      Takaaki Ishikawa
 #+EMAIL:       takaxp@ieee.org
-#+DATE:                2015-01-12
-#+UPDATE:      19:58:48
+#+DATE:                2015-02-14
+#+UPDATE:      23:48:25
 #+STARTUP:     content
 
 * 1. What's this?
@@ -219,6 +219,7 @@ see also ChangeLog
 
|---------+------------------+-------------------------------------------------|
 | Version | Date             | Description                                     
|
 
|---------+------------------+-------------------------------------------------|
+| v2.7.4  | 2015-02-14@23:30 | Refine displaying slide number in modeline      
|
 | v2.7.2  | 2015-01-12@19:56 | Suppress an error message from org-timer        
|
 | v2.7.1  | 2015-01-12@18:28 | Hide skipped slides when CONTENT mode           
|
 | v2.7.0  | 2013-07-21@05:21 | Support buffers without headings                
|
diff --git a/org-tree-slide.el b/org-tree-slide.el
index 2de9a719da..103f30538e 100644
--- a/org-tree-slide.el
+++ b/org-tree-slide.el
@@ -1,6 +1,6 @@
 ;;; org-tree-slide.el --- A presentation tool for org-mode
 ;;
-;; Copyright (C) 2011-2014 Takaaki ISHIKAWA
+;; Copyright (C) 2011-2015 Takaaki ISHIKAWA
 ;;
 ;; Author: Takaaki ISHIKAWA <takaxp at ieee dot org>
 ;; Maintainer: Takaaki ISHIKAWA <takaxp at ieee dot org>
@@ -68,7 +68,7 @@
 (require 'org-timer)
 (require 'org-clock)                   ; org-clock-in, -out, -clocking-p
 
-(defconst org-tree-slide "2.7.1"
+(defconst org-tree-slide "2.7.4"
   "The version number of the org-tree-slide.el")
 
 (defgroup org-tree-slide nil
@@ -149,8 +149,8 @@
 
 (defcustom org-tree-slide-modeline-display 'outside
   "Specify how to display the slide number in mode line.
-   'outside: shown in the mode line outside of lighter
-   'lighter: shown in lighter (slow)
+   'lighter: shown in lighter (update info actively, then it's slow)
+   'outside: update infomation when moving to the next/previous slide
    nil: nothing to be shown"
   :type 'symbol
   :group 'org-tree-slide)
@@ -189,7 +189,10 @@
   "A hook run when ots-play is evaluated to start the slide show")
 (defvar org-tree-slide-mode-stop-hook nil
   "A hook run when ots-stop is evaluated to stop the slide show")
-(defvar display-tree-slide-string nil)
+(defvar org-tree-slide-mode-before-narrow-hook nil
+  "A hook run before evaluating ots-display-tree-with-narrow")
+(defvar org-tree-slide-mode-after-narrow-hook nil
+  "A hook run after evaluating ots-display-tree-with-narrow")
 
 ;;;###autoload
 (define-minor-mode org-tree-slide-mode
@@ -237,8 +240,6 @@ Profiles:
   :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
       (ots-setup)
     (ots-abort)))
@@ -365,7 +366,7 @@ Profiles:
   (interactive)
   (setq org-tree-slide-skip-done (not org-tree-slide-skip-done))
   (setq ots-previous-line -1) ; to update modeline intentionally
-  (ots-update-modeline)
+  (ots-show-slide-header)
   (if org-tree-slide-skip-done
       (message "TODO Pursuit: ON") (message "TODO Pursuit: OFF")))
 
@@ -381,7 +382,8 @@ Profiles:
   "Display the next slide"
   (interactive)
   (when (ots-active-p)
-    (message "   Next >>")
+    (unless (equal org-tree-slide-modeline-display 'outside)
+      (message "   Next >>"))
     (cond
      ((or
        (or (and (ots-before-first-heading-p) (not (org-at-heading-p)))
@@ -401,7 +403,8 @@ Profiles:
   "Display the previous slide"
   (interactive)
   (when (ots-active-p)
-    (message "<< Previous")
+    (unless (equal org-tree-slide-modeline-display 'outside)
+      (message "<< Previous"))
     (ots-hide-slide-header)            ; for at the first heading
     (widen)
     (cond
@@ -420,7 +423,9 @@ Profiles:
        (goto-char (point-min)))))
 
 ;;; Internal functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar ots-slide-number " TSlide")
+(defvar ots-slide-number nil)
+(make-variable-buffer-local 'ots-slide-number)
+(setq-default ots-slide-number " TSlide")
 (defvar ots-previous-line 0)
 
 (defun ots-line-number-at-pos ()
@@ -436,7 +441,8 @@ Profiles:
       (setq ots-slide-number (format " %s" (ots-count-slide (point))))
       (setq ots-previous-line (ots-line-number-at-pos))
       ots-slide-number)
-     ((equal org-tree-slide-modeline-display 'outside) "")
+     ;; just return the current ots-slide-number quickly.
+     ((equal org-tree-slide-modeline-display 'outside) ots-slide-number)
      (t " TSlide"))))
 
 (defvar ots-header-overlay nil
@@ -444,9 +450,6 @@ Profiles:
 
 (defun ots-setup ()
   (when (ots-active-p)
-    (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 ()
@@ -502,6 +505,10 @@ Profiles:
 
 (defun ots-display-tree-with-narrow ()
   "Show a tree with narrowing and also set a header at the head of slide."
+  (run-hooks 'org-tree-slide-mode-before-narrow-hook)
+  (when (equal org-tree-slide-modeline-display 'outside)
+    (setq ots-slide-number (format " %s" (ots-count-slide (point))))
+    (setq ots-previous-line (ots-line-number-at-pos)))
   (goto-char (point-at-bol))
   (unless (ots-before-first-heading-p)
     (hide-subtree)     ; support CONTENT (subtrees are shown)
@@ -509,11 +516,11 @@ Profiles:
     (show-children)
     ;;    (org-cycle-hide-drawers 'all) ; disabled due to performance reduction
     (org-narrow-to-subtree))
-  (ots-update-modeline)
   (when org-tree-slide-slide-in-effect
     (ots-slide-in org-tree-slide-slide-in-brank-lines))
   (when org-tree-slide-header
-    (ots-show-slide-header)))
+    (ots-show-slide-header))
+  (run-hooks 'org-tree-slide-mode-after-narrow-hook))
 
 (defun ots-outline-next-heading ()
   (ots-outline-select-method



reply via email to

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