]> git.donarmstrong.com Git - org-ref.git/blobdiff - org-show.org
modify centering on open note, and show entry
[org-ref.git] / org-show.org
index d917a60cb572cd8814f13a5f853d33e78367c8a4..cf0ef3c7423748ceaadb007728635f43d372e95a 100644 (file)
@@ -26,12 +26,12 @@ You can have:
 2. split to show slide and full image
 3. plain text
 
 2. split to show slide and full image
 3. plain text
 
-** Title slide                                                       :slide:
+** Title slide                                                        :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (org-show-animate '("Welcome to the org-show" "John Kitchin"))
 #+END_SRC
 
 #+BEGIN_SRC emacs-lisp-slide
 (org-show-animate '("Welcome to the org-show" "John Kitchin"))
 #+END_SRC
 
-** Presentations in org-mode                                         :slide:
+** Presentations in org-mode                                          :slide:
 This should be easy
 
 1. Create your org-file. Tag headlines with :slide:
 This should be easy
 
 1. Create your org-file. Tag headlines with :slide:
@@ -43,7 +43,7 @@ This should be easy
 org-show is based on this blog post: http://sachachua.com/blog/2013/04/how-to-present-using-org-mode-in-emacs/
 
 Thanks Sacha!
 org-show is based on this blog post: http://sachachua.com/blog/2013/04/how-to-present-using-org-mode-in-emacs/
 
 Thanks Sacha!
-** Test out some themes                                                      :slide:
+** Test out some themes                                               :slide:
 
 [[elisp:(load-theme 'my)]] [[elisp:(disable-theme 'my)]]
 
 
 [[elisp:(load-theme 'my)]] [[elisp:(disable-theme 'my)]]
 
@@ -79,7 +79,7 @@ Thanks Sacha!
 
 [[elisp:(load-theme 'anti-zenburn t)]] [[elisp:(disable-theme 'anti-zenburn)]]
 
 
 [[elisp:(load-theme 'anti-zenburn t)]] [[elisp:(disable-theme 'anti-zenburn)]]
 
-** Equations                                                         :slide:
+** Equations                                                          :slide:
 It should be easy to show equations like this  $\int_0^x \frac{1}{2} \sin x dx = 6$.
 
 It is. Maybe you prefer equation environments?
 It should be easy to show equations like this  $\int_0^x \frac{1}{2} \sin x dx = 6$.
 
 It is. Maybe you prefer equation environments?
@@ -91,7 +91,7 @@ e^x = 55
 Want to see the equation source? [[elisp:(org-ctrl-c-ctrl-c)][click here]]
 
 Back to equations: C-c C-x C-l
 Want to see the equation source? [[elisp:(org-ctrl-c-ctrl-c)][click here]]
 
 Back to equations: C-c C-x C-l
-** Figures                                                           :slide:
+** Figures                                                            :slide:
 
 Figures should show up in two panes.
 The left pane shows the slide. The right pane shows the figure, scaled to fit in the window.
 
 Figures should show up in two panes.
 The left pane shows the slide. The right pane shows the figure, scaled to fit in the window.
@@ -99,7 +99,7 @@ The left pane shows the slide. The right pane shows the figure, scaled to fit in
 Here is a little screen capture:
 [[./taskbar.png]]
 
 Here is a little screen capture:
 [[./taskbar.png]]
 
-** Need a more complicated layout?                                   :slide:
+** Need a more complicated layout?                                    :slide:
 Write some code to generate it, and put it in an emacs-lisp-slide block. org-show will run it and show you the result
 
 #+BEGIN_SRC emacs-lisp
 Write some code to generate it, and put it in an emacs-lisp-slide block. org-show will run it and show you the result
 
 #+BEGIN_SRC emacs-lisp
@@ -127,7 +127,7 @@ Write some code to generate it, and put it in an emacs-lisp-slide block. org-sho
 ,#+END_SRC
 #+END_EXAMPLE
 
 ,#+END_SRC
 #+END_EXAMPLE
 
-** A complicated layout                                                      :slide:
+** A complicated layout                                               :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (delete-other-windows)
 (split-window-right)
 #+BEGIN_SRC emacs-lisp-slide
 (delete-other-windows)
 (split-window-right)
@@ -137,7 +137,7 @@ Write some code to generate it, and put it in an emacs-lisp-slide block. org-sho
 (other-window 1)
 (find-file "doi-utils.org")
 #+END_SRC
 (other-window 1)
 (find-file "doi-utils.org")
 #+END_SRC
-** Code blocks should be runnable and editable                       :slide:
+** Code blocks should be runnable and editable                        :slide:
 
 #+BEGIN_SRC python
 print 6 + 62
 
 #+BEGIN_SRC python
 print 6 + 62
@@ -145,7 +145,7 @@ print 6 + 62
 
 
 They are.
 
 
 They are.
-** We can use many languages                                         :slide:
+** We can use many languages                                          :slide:
 (of course, you must have them installed on your computer)
 
 #+BEGIN_SRC emacs-lisp
 (of course, you must have them installed on your computer)
 
 #+BEGIN_SRC emacs-lisp
@@ -173,12 +173,12 @@ print 6 + 6
 
 ** Interactivity is important  
 We get it.
 
 ** Interactivity is important  
 We get it.
-*** Snake                                                            :slide:
+*** Snake                                                             :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (snake)
 #+END_SRC
 
 #+BEGIN_SRC emacs-lisp-slide
 (snake)
 #+END_SRC
 
-*** tetris                                                           :slide:
+*** tetris                                                            :slide:
 
 #+BEGIN_SRC emacs-lisp-slide
 (when (and (boundp 'snake-buffer-name) (get-buffer snake-buffer-name))
 
 #+BEGIN_SRC emacs-lisp-slide
 (when (and (boundp 'snake-buffer-name) (get-buffer snake-buffer-name))
@@ -188,13 +188,13 @@ We get it.
 #+END_SRC
 
 
 #+END_SRC
 
 
-*** doctor                                                           :slide:
+*** doctor                                                            :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (doctor)
 #+END_SRC
 
 
 #+BEGIN_SRC emacs-lisp-slide
 (doctor)
 #+END_SRC
 
 
-*** Become a graffiti artist                                         :slide:
+*** Become a graffiti artist                                          :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (progn
   (switch-to-buffer (get-buffer-create "*artist*"))
 #+BEGIN_SRC emacs-lisp-slide
 (progn
   (switch-to-buffer (get-buffer-create "*artist*"))
@@ -206,14 +206,14 @@ We get it.
 #+END_SRC
 
 
 #+END_SRC
 
 
-*** Or draw lines                                                    :slide:
+*** Or draw lines                                                     :slide:
 #+BEGIN_SRC emacs-lisp-slide
 (progn
   (switch-to-buffer (get-buffer-create "*artist*"))
   (artist-select-op-line))
 #+END_SRC
 
 #+BEGIN_SRC emacs-lisp-slide
 (progn
   (switch-to-buffer (get-buffer-create "*artist*"))
   (artist-select-op-line))
 #+END_SRC
 
-** No seriously, we can do real work!                                :slide:
+** No seriously, we can do real work!                                 :slide:
    :PROPERTIES:
    :CUSTOM_ID: sec:data-tab-code
    :END:
    :PROPERTIES:
    :CUSTOM_ID: sec:data-tab-code
    :END:
@@ -238,7 +238,7 @@ plt.show()
 #+RESULTS:
 
 You can make links to a table like this: ref:tab-data.
 #+RESULTS:
 
 You can make links to a table like this: ref:tab-data.
-** Interactive links                                                 :slide:
+** Interactive links                                                  :slide:
 <<beginning>>
 
 You can have links that take you to places: [[beginning]], [[end]], to a [[#sec:data-tab-code][section]],
 <<beginning>>
 
 You can have links that take you to places: [[beginning]], [[end]], to a [[#sec:data-tab-code][section]],
@@ -252,7 +252,7 @@ Or links to info: [[info:org#External%20links][info:org#External links]]
 Or to open a [[http://kitchingroup.cheme.cmu.edu][website]].
 
 <<end>>
 Or to open a [[http://kitchingroup.cheme.cmu.edu][website]].
 
 <<end>>
-** Conclusions                                                       :slide:
+** Conclusions                                                        :slide:
 That is the end!
 
 #+BEGIN_SRC emacs-lisp-slide
 That is the end!
 
 #+BEGIN_SRC emacs-lisp-slide
@@ -294,8 +294,11 @@ That is the end!
 ** Some basic setup
 #+BEGIN_SRC emacs-lisp :tangle org-show.el
 (defvar org-show-presentation-file nil "File containing the presentation.")
 ** Some basic setup
 #+BEGIN_SRC emacs-lisp :tangle org-show.el
 (defvar org-show-presentation-file nil "File containing the presentation.")
+
 (defvar org-show-slide-tag "slide" "Tag that marks slides.")
 (defvar org-show-slide-tag "slide" "Tag that marks slides.")
+
 (defvar org-show-slide-tag-regexp (concat ":" (regexp-quote org-show-slide-tag) ":"))
 (defvar org-show-slide-tag-regexp (concat ":" (regexp-quote org-show-slide-tag) ":"))
+
 (defvar org-show-latex-scale 4.0 "scale for latex preview")
 
 (defvar org-show-original-latex-scale
 (defvar org-show-latex-scale 4.0 "scale for latex preview")
 
 (defvar org-show-original-latex-scale
@@ -303,16 +306,23 @@ That is the end!
   "Original scale for latex preview, so we can reset it.")
 
 (defvar org-show-text-scale 4 "scale for text in presentation")
   "Original scale for latex preview, so we can reset it.")
 
 (defvar org-show-text-scale 4 "scale for text in presentation")
+
 (defvar org-show-current-slide-number 1 "holds current slide number")
 
 (defvar org-show-mogrify-p (executable-find "mogrify"))
 
 (defvar org-show-tags-column -60 "column position to move tags to in slide mode")
 (defvar org-show-current-slide-number 1 "holds current slide number")
 
 (defvar org-show-mogrify-p (executable-find "mogrify"))
 
 (defvar org-show-tags-column -60 "column position to move tags to in slide mode")
+
 (defvar org-show-original-tags-column org-tags-column "Save value so we can change back to it")
 
 (defvar org-show-original-tags-column org-tags-column "Save value so we can change back to it")
 
-(when org-show-mogrify-p (require 'eimp))
+(defvar *org-show-flyspell-mode* (when (boundp flyspell-mode)
+                                  (flyspell-mode))
+  "whether flyspell mode is enabled at beginning of show")
 
 
+(defvar *org-show-running* nil
+  "Flag for if the show is running")
 
 
+(when org-show-mogrify-p (ignore-errors (require 'eimp)))
 #+END_SRC
 
 ** Make a minor mode and menu
 #+END_SRC
 
 ** Make a minor mode and menu
@@ -353,7 +363,24 @@ That is the end!
 \\{org-show-mode-map}"
   :lighter " org-show"
   :global t
 \\{org-show-mode-map}"
   :lighter " org-show"
   :global t
-  :keymap org-show-mode-map)
+  :keymap org-show-mode-map
+
+  (if org-show-mode
+      ;; we are in org-show mode
+      (progn
+       ;; turn off flyspell mode
+       (if flyspell-mode
+           (progn
+             (setq *org-show-flyspell-mode* t)
+             (flyspell-mode-off))
+         (setq *org-show-flyspell-mode* nil)))
+    ;; we are leaving flyspell mode
+    (when  *org-show-flyspell-mode*
+      (flyspell-mode-on))
+    
+    ;; close the show.
+    (when *org-show-running*
+       (org-show-stop-slideshow))))
 #+END_SRC
 
 ** Prepare and show the slide 
 #+END_SRC
 
 ** Prepare and show the slide 
@@ -416,7 +443,7 @@ That is the end!
       (other-window 1) ; back to slide
       (goto-char (point-min))
       (text-scale-set org-show-text-scale)
       (other-window 1) ; back to slide
       (goto-char (point-min))
       (text-scale-set org-show-text-scale)
-      (org-display-inline-images)
+      (org-remove-inline-images)
       (org-cycle-hide-drawers t)
       (org-show-subtree))
 
       (org-cycle-hide-drawers t)
       (org-show-subtree))
 
@@ -513,6 +540,7 @@ On starting, we want to map the slides so we can get slide numbers for navigatio
   "Start the slide show, at the beginning"
   (interactive)
     
   "Start the slide show, at the beginning"
   (interactive)
     
+  (setq *org-show-running* t)
   (setq org-show-presentation-file (expand-file-name (buffer-name)))
   (beginning-of-buffer)
   (setq org-tags-column org-show-tags-column)
   (setq org-show-presentation-file (expand-file-name (buffer-name)))
   (beginning-of-buffer)
   (setq org-tags-column org-show-tags-column)
@@ -541,6 +569,9 @@ On starting, we want to map the slides so we can get slide numbers for navigatio
   ;; make slide tag visible again
   (remove-from-invisibility-spec 'slide)
 
   ;; make slide tag visible again
   (remove-from-invisibility-spec 'slide)
 
+  ;; Redisplay inline images
+  (org-display-inline-images)
+
   ;; reset latex scale
   (plist-put org-format-latex-options :scale org-show-original-latex-scale)
 
   ;; reset latex scale
   (plist-put org-format-latex-options :scale org-show-original-latex-scale)
 
@@ -570,7 +601,7 @@ On starting, we want to map the slides so we can get slide numbers for navigatio
                    (abbreviate-file-name (buffer-file-name))))
   (setq org-tags-column org-show-original-tags-column)
   (org-set-tags-command '(4) t)
                    (abbreviate-file-name (buffer-file-name))))
   (setq org-tags-column org-show-original-tags-column)
   (org-set-tags-command '(4) t)
-
+  (setq *org-show-running* nil)
   (org-show-mode -1))
 
 (defalias 'stop 'org-show-stop-slideshow)
   (org-show-mode -1))
 
 (defalias 'stop 'org-show-stop-slideshow)