[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-tree-slide 6dfa0df7f9 002/144: Add start and stop func
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-tree-slide 6dfa0df7f9 002/144: Add start and stop function, display header, and change mode-line |
Date: |
Tue, 18 Jan 2022 08:58:52 -0500 (EST) |
branch: elpa/org-tree-slide
commit 6dfa0df7f9231ae9a8b77dc200c333f81e0d2c31
Author: Takaaki ISHIKAWA <takaxp@ieee.org>
Commit: Takaaki ISHIKAWA <takaxp@ieee.org>
Add start and stop function, display header, and change mode-line
---
ChangeLog | 12 ++++
org-tree-slide.el | 163 +++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 142 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000000..50c0f9c006
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,12 @@
+2011-10-28 Takaaki ISHIKAWA <takaxp@ieee.org>
+
+ * org-tree-slide.el (tree-slide-play): Add timer to count down
presentation
+
+ * org-tree-slide.el: Add play and stop function, and show slide header
+
+ * org-tree-slide.el: Add a function to change mode-line during
presentation
+
+2011-09-28 Takaaki ISHIKAWA <takaxp@ieee.org>
+
+ * org-tree-slide.el: Initial release
+
diff --git a/org-tree-slide.el b/org-tree-slide.el
index d7a88a8ac7..5e452be360 100644
--- a/org-tree-slide.el
+++ b/org-tree-slide.el
@@ -24,63 +24,114 @@
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; History:
+;; v1.1.1 (2011-10-28@16:16) # Add functions to start and stop slide view
;; v1.0.0 (2011-09-28@20:59) # Release an init version
;;
;;; Usage:
;; 1. Put this elisp into your load-path
;; 2. Add (requre 'org-tree-slide) in your .emacs
-;; 3. Open an org-mode file, just type <right>/<left>, now you in slide view
+;; 3. Open an org-mode file
+;; 4. M-x tree-slide-play, now you in slide view
+;; 5. <right>/<left> will move slides, mode line will be changed
+;; 6. M-x tree-slide-stop, return to normal view
;;
;;; Note:
;; - Make sure key maps below when you introduce this elisp.
-(defconst org-tree-slide "1.0.0"
+(require 'org-timer)
+
+(defconst org-tree-slide "1.1.1"
"The version number of the org-tree-slide.el")
-(define-key org-mode-map (kbd "<right>") 'tree-slide-move-next-tree)
-(define-key org-mode-map (kbd "<left>") 'tree-slide-move-previous-tree)
-(define-key org-mode-map (kbd "C-c s p") 'tree-slide-play)
-(define-key org-mode-map (kbd "C-c s s") 'tree-slide-stop)
+(defcustom tree-slide-title nil
+ "Specify the title of presentation. The title is shown in a header area. If
this variable is nil, the name of current buffer will be displayed as a slide
title."
+ :type 'string
+ :group 'org-tree-slide)
+
+;(defcustom tree-slide-header-background-color "#FFFFFF"
+; "Specify the color of header background."
+; :type 'string
+; :group 'org-tree-slide)
+
+;(defcustom tree-slide-header-foreground-color "#666699"
+; "Specify the color of header background."
+; :type 'string
+; :group 'org-tree-slide)
+
+(define-key org-mode-map (kbd "C-x s p") 'tree-slide-play)
+(define-key org-mode-map (kbd "C-x s s") 'tree-slide-stop)
;(define-key org-mode-map (kbd "<f5>") 'org-narrow-to-subtree)
;(define-key org-mode-map (kbd "<S-f5>") 'widen)
-(defun tree-slide-move-next-tree ()
- "Show the next slide"
- (interactive)
- (if (org-before-first-heading-p) (outline-next-heading)
- (hide-subtree)
- (widen)
- (outline-next-heading))
- (tree-slide-display-tree-with-narrow))
+(defun tree-slide-play (&optional arg)
+ "Start slide view with the first tree of the org-mode buffer. If you all
this function with a prefix (C-u), you can set a countdown timer to control
your presentation."
+ (interactive "P")
+ (unless tree-slide-active
+ (when arg
+ (org-timer-set-timer))
+ (setq tree-slide-active t)
+ (apply-control-keybindings)
+ (move-to-the-first-heading)
+ (tree-slide-display-tree-with-narrow)
+ (message "Hello! Org-tree slideshow is starting now.")))
-(defun tree-slide-move-previous-tree ()
- "Show the previous slide"
+(defun tree-slide-stop ()
+ "Stop the slide view, and redraw the org-mode buffer with OVERVIEW."
(interactive)
- (unless (org-before-first-heading-p)
- (hide-subtree)
+ (when tree-slide-active
+ (setq tree-slide-active nil)
(widen)
- (outline-previous-heading)
- (tree-slide-display-tree-with-narrow)))
+ (org-overview)
+ (move-to-the-first-heading)
+ (hide-slide-header)
+ (remove-control-keybindings)
+ (org-timer-pause-or-continue 'stop)
+ (message "Quit, Bye!")))
-(defun tree-slide-play ()
- "Start slide view with the first tree of the org-mode buffer"
- (interactive)
- (move-to-the-first-heading)
- (tree-slide-display-tree-with-narrow))
-
-(defun tree-slide-stop ()
- "Stop slide view, show the org-mode buffer with OVERVIEW"
- (interactive)
- (widen)
- (org-overview)
- (move-to-the-first-heading))
+(defvar tree-slide-active nil
+ "Flag to check if the mode is ON or OFF.")
+(defvar tree-slide-right-key-assigned nil
+ "Store the previous command assigned to <right>.")
+(defvar tree-slide-left-key-assigned nil
+ "Store the previous command assigned to <left>.")
+(defvar tree-slide-mode-line-format-assigned nil
+ "Store the previous mode-line-format.")
+(defvar tree-slide-footer-overlay nil
+ "Flag to check the status of overlay for a slide header.")
(defun tree-slide-display-tree-with-narrow ()
+ "Show a tree with narrowing and also set a header at the head of slide."
+ (hide-slide-header)
(hide-subtree)
(show-entry)
(show-children)
(org-cycle-hide-drawers 'all)
- (org-narrow-to-subtree))
+ (org-narrow-to-subtree)
+ (show-slide-header))
+
+(defun show-slide-header ()
+ (save-excursion
+ (setq tree-slide-footer-overlay
+ (make-overlay (point-min) (+ 1 (point-min))))
+ (overlay-put tree-slide-footer-overlay 'after-string " ")
+; (overlay-put tree-slide-footer-overlay
+; 'face '((background-color .
(tree-slide-header-background-color))
+; (foreground-color .
(tree-slide-header-foreground-color)));)
+ (overlay-put tree-slide-footer-overlay
+ 'face
+ '((foreground-color . "#696969")
+ (background-color . "#FFFFFF") bold))
+ (overlay-put tree-slide-footer-overlay 'display
+ (concat " [ "
+ (unless tree-slide-title
+ (buffer-name))
+ " ] (" (format-time-string "%Y-%m-%d") ")\n\n")))
+ (forward-char 1))
+
+(defun hide-slide-header ()
+ (save-excursion
+ (when tree-slide-footer-overlay
+ (delete-overlay tree-slide-footer-overlay))))
(defun move-to-the-first-heading ()
(widen)
@@ -88,6 +139,52 @@
(when (org-before-first-heading-p)
(outline-next-heading)))
+(defun tree-slide-move-next-tree ()
+ "Show the next slide"
+ (interactive)
+ (when tree-slide-active
+ (if (org-before-first-heading-p) (outline-next-heading)
+ (hide-subtree)
+ (widen)
+ (outline-next-heading))
+ (tree-slide-display-tree-with-narrow)))
+
+(defun tree-slide-move-previous-tree ()
+ "Show the previous slide"
+ (interactive)
+ (when tree-slide-active
+ (unless (org-before-first-heading-p)
+ (hide-subtree)
+ (widen)
+ (unless (org-on-heading-p)
+ (outline-previous-heading))
+ (outline-previous-heading)
+ (tree-slide-display-tree-with-narrow))))
+
+(defun save-previous-propaties ()
+ (setq tree-slide-right-key-assigned (lookup-key org-mode-map (kbd
"<right>")))
+ (setq tree-slide-left-key-assigned (lookup-key org-mode-map (kbd "<left>")))
+ (setq tree-slide-mode-line-format-assigned mode-line-format))
+
+(defun remove-control-keybindings ()
+ (define-key org-mode-map (kbd "<right>") tree-slide-right-key-assigned)
+ (define-key org-mode-map (kbd "<left>") tree-slide-left-key-assigned)
+ (setq mode-line-format tree-slide-mode-line-format-assigned))
+
+(defun apply-control-keybindings ()
+ (save-previous-propaties)
+ (define-key org-mode-map (kbd "<right>") 'tree-slide-move-next-tree)
+ (define-key org-mode-map (kbd "<left>") 'tree-slide-move-previous-tree)
+ (setq mode-line-format
+ '("-"
+ mode-line-mule-info
+ mode-line-modified
+; mode-line-frame-identification
+ mode-line-buffer-identification
+ " [slide playing] / Stop: M-x tree-slide-stop / "
+ global-mode-string
+ "-%-")))
+
(provide 'org-tree-slide)
;;; org-tree-slide.el ends here
- [nongnu] branch elpa/org-tree-slide created (now 3faa042393), ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 82ee351449 001/144: first commit, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 7e0064f6cb 004/144: Add slide-in visual effect, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 52d67fc2a0 003/144: Add slide-in visual effect, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 79aec5bbab 006/144: Fix typo, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide d2739053a0 037/144: Update README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 7daa23cc27 022/144: Support TODO pursuit in a slideshow, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 420342f50b 030/144: Update README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 8228b14520 031/144: Update README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide bc6650cbbb 027/144: Rename README, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 6dfa0df7f9 002/144: Add start and stop function, display header, and change mode-line,
ELPA Syncer <=
- [nongnu] elpa/org-tree-slide bfbd4ddb5d 008/144: Add CONTENT view to see all the subtrees, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 26269ebd8e 016/144: Support TITLE/AUTHOR/EMAIL in a header, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide f08bc4012f 019/144: Add a new profile to control narrowing status, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide be2d679c35 028/144: Add a link, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 871d75f872 055/144: Merge branch 'master' of github.com:takaxp/org-tree-slide, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide a85c6e2b9c 062/144: Added a new toggle to skip commented trees, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide b30805ac45 063/144: Fix typo, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide c9c413ba8b 064/144: Added a flag to control face setting, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 3e56b63ad1 024/144: Version 2.5.0, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 1687d83b18 046/144: Fix typo README.org, ELPA Syncer, 2022/01/18