[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-tree-slide 6cf6e4ee84 065/144: Support buffers without
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-tree-slide 6cf6e4ee84 065/144: Support buffers without headings |
Date: |
Tue, 18 Jan 2022 08:59:32 -0500 (EST) |
branch: elpa/org-tree-slide
commit 6cf6e4ee84738b3ffc17c544ee798baac318c7d1
Author: Takaaki ISHIKAWA <takaxp@ieee.org>
Commit: Takaaki ISHIKAWA <takaxp@ieee.org>
Support buffers without headings
---
ChangeLog | 14 ++++++
README.org | 3 +-
org-tree-slide.el | 132 +++++++++++++++++++++++++++++-------------------------
3 files changed, 87 insertions(+), 62 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index af11a7f0b7..adc68aae95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2013-07-21 Takaaki ISHIKAWA <takax@ieee.org>
+
+ * org-tree-slide.el (ots-count-slide): Revised to distinguish status
+ [-/-] ... before first heading and no headings in the buffer
+ [-/%d] ... before first heading
+ [%d/%d] ... slides
+
+ * org-tree-slide.el: Support no headings
+ - org-tree-slide-move-next-tree and org-tree-slide-move-previous-tree
+ - Removed hide-subtree to avoid an error
+ - ots-display-tree-with-narrow
+ - ots-before-first-heading-p is used to wrap hide-subtree
+ - (org-cycle-hide-drawers 'all) is disabled to speed up
+
2013-02-19 Takaaki ISHIKAWA <takax@ieee.org>
* org-tree-slide.el (org-tree-slide-never-touch-face): Added a flag
diff --git a/README.org b/README.org
index ff4ba97d30..426f7d6474 100644
--- a/README.org
+++ b/README.org
@@ -2,7 +2,7 @@
#+AUTHOR: Takaaki Ishikawa
#+EMAIL: takaxp@ieee.org
#+STARTUP: content
-#+Last Update: 2013-02-19@12:50
+#+Last Update: 2013-07-21@05:21
* 1. What's this?
@@ -218,6 +218,7 @@ see also ChangeLog
|---------+------------------+-------------------------------------------------|
| Version | Date | Description
|
|---------+------------------+-------------------------------------------------|
+| v2.7.0 | 2013-07-21@05:21 | Support buffers without headings
|
| v2.6.8 | 2013-02-19@12:49 | Added a flag to control face setting
|
| v2.6.6 | 2013-02-19@11:22 | Added a new toggle to skip commented trees
|
| v2.6.4 | 2013-02-12@01:43 | Added some features (issue #2, #5, and #7)
|
diff --git a/org-tree-slide.el b/org-tree-slide.el
index 51a283c0c6..65280a2672 100644
--- a/org-tree-slide.el
+++ b/org-tree-slide.el
@@ -67,7 +67,7 @@
(require 'org-timer)
(require 'org-clock) ; org-clock-in, -out, -clocking-p
-(defconst org-tree-slide "2.6.8"
+(defconst org-tree-slide "2.7.0"
"The version number of the org-tree-slide.el")
(defgroup org-tree-slide nil
@@ -362,6 +362,8 @@ Profiles:
"Toggle show TODO item only or not"
(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)
(if org-tree-slide-skip-done
(message "TODO Pursuit: ON") (message "TODO Pursuit: OFF")))
@@ -378,36 +380,34 @@ Profiles:
(interactive)
(when (ots-active-p)
(message " Next >>")
- (cond ((or (and (ots-before-first-heading-p) (not (org-at-heading-p)))
- ;; support single top level tree
- ;; FIXME: no header org buffer + CONTENT view is not supported
- (and (= (point-at-bol) 1) (not (ots-narrowing-p))))
- (ots-outline-next-heading))
- ((or (ots-first-heading-with-narrow-p) (not (org-at-heading-p)))
- (hide-subtree)
- (widen)
- (ots-outline-next-heading))
- (t nil))
+ (cond
+ ((or
+ (or (and (ots-before-first-heading-p) (not (org-at-heading-p)))
+ (and (= (point-at-bol) 1) (not (ots-narrowing-p))))
+ (or (ots-first-heading-with-narrow-p) (not (org-at-heading-p))))
+ (widen)
+ (ots-outline-next-heading))
+ ;; stay the same slide (for CONTENT MODE, on the subtrees)
+ (t nil))
(when (and org-tree-slide-skip-done
(looking-at (concat "^\\*+ " org-not-done-regexp)))
;; (org-clock-in)
)
- (ots-display-tree-with-narrow)))
+ (ots-display-tree-with-narrow)))
(defun org-tree-slide-move-previous-tree ()
"Display the previous slide"
(interactive)
(when (ots-active-p)
(message "<< Previous")
- (hide-subtree)
- (widen)
(ots-hide-slide-header) ; for at the first heading
- (cond ((ots-before-first-heading-p)
- (message "The first slide!"))
- ((not (org-at-heading-p))
- (ots-outline-previous-heading)
- (ots-outline-previous-heading))
- (t (ots-outline-previous-heading)))
+ (widen)
+ (cond
+ ((ots-before-first-heading-p) (message "before first heading (ots)" ))
+ ((not (org-at-heading-p))
+ (ots-outline-previous-heading)
+ (ots-outline-previous-heading))
+ (t (ots-outline-previous-heading)))
(when (and org-tree-slide-skip-done
(looking-at (concat "^\\*+ " org-not-done-regexp)))
;; (org-clock-in)
@@ -417,17 +417,25 @@ Profiles:
(if (= emacs-major-version 24)
(goto-char (point-min)))))
-
;;; Internal functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar ots-slide-number " TSlide")
+(defvar ots-previous-line 0)
+
+(defun ots-line-number-at-pos ()
+ (save-excursion
+ (save-restriction
+ (widen)
+ (line-number-at-pos))))
+
(defun ots-update-modeline ()
(when (ots-active-p)
- (cond ((equal org-tree-slide-modeline-display 'lighter)
- (if (and (ots-active-p) (org-at-heading-p))
- (setq ots-slide-number (format " %s" (ots-count-slide (point))))
- ots-slide-number))
- ((equal org-tree-slide-modeline-display 'outside) "")
- (t " TSlide"))))
+ (cond
+ ((equal org-tree-slide-modeline-display 'lighter)
+ (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) "")
+ (t " TSlide"))))
(defvar ots-header-overlay nil
"Flag to check the status of overlay for a slide header.")
@@ -458,6 +466,10 @@ Profiles:
(when org-tree-slide-activate-message
(message "%s" org-tree-slide-activate-message)))
+(defvar org-tree-slide-startup "overview"
+ "If you have `#+STARTUP:' line in your org buffer, the org buffer will
+ be shown with corresponding status (content, showall, overview:default).")
+
(defun ots-stop ()
"Stop the slide view, and redraw the org-mode buffer with #+STARTUP:."
(widen)
@@ -488,15 +500,13 @@ Profiles:
(defun ots-display-tree-with-narrow ()
"Show a tree with narrowing and also set a header at the head of slide."
(goto-char (point-at-bol))
- (hide-subtree) ; support CONTENT (subtrees are shown)
- (org-show-entry)
- (show-children)
- (org-cycle-hide-drawers 'all)
- (org-narrow-to-subtree)
- (setq display-tree-slide-string
- (if (equal org-tree-slide-modeline-display 'outside)
- (ots-count-slide (point))
- ""))
+ (unless (ots-before-first-heading-p)
+ (hide-subtree) ; support CONTENT (subtrees are shown)
+ (org-show-entry)
+ (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
@@ -516,12 +526,15 @@ Profiles:
(org-outline-level))
'previous))
+(defvar ots-all-skipped t
+ "A flag to know if all trees are skipped")
+
(defun ots-outline-select-method (action direction)
(cond ((and (equal action 'last) (equal direction 'next))
- (if ots-all-skipped (setq ots-slide-number " [-/-]")
+ (unless ots-all-skipped
(ots-outline-previous-heading))) ; Return back.
((and (equal action 'first) (equal direction 'previous))
- (if ots-all-skipped (setq ots-slide-number " [-/-]")
+ (unless ots-all-skipped
(ots-move-to-the-first-heading))) ; Stay the first heading
((and (equal action 'skip) (equal direction 'next))
(ots-outline-next-heading)) ; recursive call
@@ -582,10 +595,6 @@ Profiles:
"If you have `#+AUTHOR:' line in your org buffer, it will be used as
a name of the slide author.")
-(defvar org-tree-slide-startup "overview"
- "If you have `#+STARTUP:' line in your org buffer, the org buffer will
- be shown with corresponding status (content, showall, overview:default).")
-
(defun ots-apply-local-header-to-slide-header ()
(save-excursion
(ots-move-to-the-first-heading)
@@ -649,13 +658,10 @@ Profiles:
(when ots-header-overlay
(delete-overlay ots-header-overlay)))
-(defvar ots-all-skipped t
- "A flag to know if all trees are skipped")
-
(defun ots-move-to-the-first-heading ()
(setq ots-all-skipped t)
(widen)
- (goto-char 1)
+ (goto-char 1)
(unless (looking-at "^\\*+ ")
(outline-next-heading))
(when (ots-heading-skip-p)
@@ -675,23 +681,27 @@ Profiles:
'(org-level-3 ((t (:inherit org-tree-slide-heading-level-3-init)))))
))))
-(defun ots-count-slide (target-point)
+(defun ots-count-slide (&optional pos)
(save-excursion
(save-restriction
- (ots-move-to-the-first-heading) ; include widen
- (let
- ((count 0)
- (previous-point 0)
- (current-slide 0)
- (current-point (point)))
- (while (/= current-point previous-point) ; convergence point
- (setq count (1+ count))
- (when (<= current-point target-point)
- (setq current-slide count))
- (setq previous-point current-point)
- (ots-outline-next-heading) ; will skip flagged trees
- (setq current-point (point)))
- (format "[%d/%d]" current-slide count)))))
+ (widen)
+ (goto-char (point-min))
+ (let ((count 0)
+ (current-slide 0)
+ (current-point (or pos (point))))
+ (when (and (looking-at "^\\*+ ") (not (ots-heading-skip-p)))
+ (setq count 1)
+ (setq current-slide 1))
+ (while (outline-next-heading)
+ (when (not (ots-heading-skip-p))
+ (setq count (1+ count))
+ (when (>= current-point (point))
+ (setq current-slide (1+ current-slide)))))
+ (cond
+ ((= count 0) "[-/-]") ; no headings
+ ((= current-slide 0) (format "[-/%d]" count)) ; before first heading
+ (t
+ (format "[%d/%d]" current-slide count)))))))
(defun ots-active-p ()
(and org-tree-slide-mode (equal major-mode 'org-mode)))
- [nongnu] elpa/org-tree-slide 39a6039b18 023/144: Add an option to control modeline display, (continued)
- [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, 2022/01/18
- [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 <=
- [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
- [nongnu] elpa/org-tree-slide 27f8bb6a96 140/144: Merge branch 'master' of github.com:takaxp/org-tree-slide, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide a9dcef402a 128/144: Update the docstring of org-tree-slide-content-margin-top variable, ELPA Syncer, 2022/01/18
- [nongnu] elpa/org-tree-slide 917612a0d1 142/144: Merge pull request #47 from jypma/allow-empty-date-author, ELPA Syncer, 2022/01/18