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

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

[nongnu] elpa/dslide 7bea90a632 09/21: Babel block :direction parameter.


From: ELPA Syncer
Subject: [nongnu] elpa/dslide 7bea90a632 09/21: Babel block :direction parameter. No more spam!
Date: Tue, 17 Dec 2024 13:00:53 -0500 (EST)

branch: elpa/dslide
commit 7bea90a6329666e1719b08f879e13731aebd6361
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>

    Babel block :direction parameter.  No more spam!
    
    - Removed affiliated keyword for setting directions
    - Introduced :direction parameter
    - Can ignore blocks with :eval never
    - Babel block is now a default action
    
    The demo is soooo much better
---
 NEWS.org       |  23 ++++++++++
 doc/manual.org |  41 +++++++++++++-----
 dslide.el      | 100 +++++++++++++++++++++++--------------------
 test/demo.org  | 133 ++++++++++++++++-----------------------------------------
 4 files changed, 143 insertions(+), 154 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 7b9aba3dde..014c6be377 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -13,7 +13,30 @@
 
 * v0.6.0 Fighting Spam πŸ’Œ :latest:
 ** Added βž•
+- Babel blocks, which will now all be executed by default, respect the =:eval= 
parameter.  Values such as =never= or =never-export= will skip the block.  
Other values are equivalent to =yes=.  Values like =query= do *not* ask yet.  
Expect that in 0.7.0. 🚧
+  #+begin_src org
+    ,#+begin_src elisp :eval never
+      (message "All blocks are now on by default!  You must opt out!")
+    ,#+end_src
+  #+end_src
+- =init= is now recognized as a direction by babel blocks and counts for both 
=begin= and =end=.  It always runs when entering a slide, regardless of 
direction.  It is the counterpart to =final=, which always runs when exiting a 
slide.
 ** Changed πŸ™…
+- Babel blocks are no longer configured with =#+attr_dslide:= affiliated 
keywords.  Instead, =direction= as a normal babel block parameter.  ⚠️ Old 
style will warn.
+  #+begin_src org
+    ,#+begin_src elisp :dslide backwards
+      (message "The old #+attr_dslide: backward style is no more!")
+    ,#+end_src
+  #+end_src
+  To provide multiple directions, you can use quoted lists and vectors, like 
so:
+  #+begin_src org
+    ,#+begin_src elisp :dslide '(begin backwards)
+      (message "Lists must be quoted or Org mode tries to evaluate them")
+    ,#+end_src
+
+    ,#+begin_src elisp :dslide [begin backwards]
+      (message "It may be better to just use a vector πŸ’‘")
+    ,#+end_src
+  #+end_src
 - Image action is now a default action (although default actions are going 
away.)
 - Image action defaults =:standalone-display= to =nil=.  If you want 
fullscreen display, you need to set the option in the property drawer, the way 
it has been.  This was to support turning the image action on by default.
 - ⚠️ Propertize action now warns on unquoted lists.  Please use quoted lists.  
In my opinion, all lists should be considered quoted in org, but this change is 
consistent with babel parameters being evaluated when unquoted.
diff --git a/doc/manual.org b/doc/manual.org
index 3f8dc6f040..ca11b4936e 100644
--- a/doc/manual.org
+++ b/doc/manual.org
@@ -215,13 +215,9 @@ Configuring is usually done by adding plist-style =:key 
value= arguments after t
 :END:
 #+findex: dslide-action-babel
 #+cindex: scripting babel steps
-In the future the babel action may become a default, using the 
=#+attr_dslide_babel= affiliated keyword or =:noeval= to decide a block should 
not be executed.  As of this version of dslide, either add 
~dslide-action-babel~ to your ~dslide-default-actions~ or add it to the actions 
list via the property drawer.
 You can write custom scripts into your presentation as Org Babel blocks.  
These are executed with the ~dslide-action-babel~ action.  Easy peazy.
 #+begin_src org
   ,* My Heading With Babel Blocks
-  :PROPERTIES:
-  :DSLIDE_ACTIONS: dslide-action-babel
-  :END:
   ,#+begin_src elisp
     (message "Good job!")
   ,#+end_src
@@ -230,21 +226,44 @@ You can write custom scripts into your presentation as 
Org Babel blocks.  These
 :PROPERTIES:
 :DESCRIPTION: When will this block be called?
 :END:
+By default blocks only execute going forward, one block per step.  You need to 
label your blocks with [[*Life Cycles][lifecycle]] methods if you want to 
perform setup (can be forward or backward) and teardown.  See the 
~dslide-action-babel~ class and examples in [[demo.org][./test/demo.org]].
 
-By default blocks only execute going forward, one block per step.  You need to 
label your blocks with [[*Life Cycles][lifecycle]] methods if you want to 
perform setup (forward and backward) and teardown.  See the 
~dslide-action-babel~ class and examples in 
[[file:./test/demo.org][./test/demo.org]].
+The =:direction= babel block parameter is used to configure which methods will 
run the block.  Block labels that are understood:
 
-The =#+attr_dslide:= affiliated keyword is used to configure which methods 
will run the block.  Block labels that are understood:
+- =forward= and =backward= are self-explanatory.  Position your =backward= 
blocks *above* any block that they undo
 
-- =begin= and =end= are run when the slide is instantiated, going forward and 
backward respectively.  You can have several blocks with these methods, and 
they will be run from *top-to-bottom* always, making it easier to re-use code 
usually.
+- =both= runs either direction.  It will not repeat in place when reversing.  
Use separate =forward= and =backward= blocks for that πŸ’‘
 
-- =final= is called to clean up when no progress can be made or if the 
presentation is stopped.
+- =begin= and =end= are run when the slide is instantiated, going forward and 
backward respectively.  You can have several blocks with these methods, and 
they will be run from *top-to-bottom* always, making it easier to re-use code 
usually.
 
-- =forward= and =backward= are self-explanatory.  Position your =backward= 
blocks *above* any block that they undo
+- =init= is a combination of =begin= and =end= to make it easier to write.
 
-- =both= runs either direction.  It will not repeat in place when reversing.  
Use separate =forward= and =backward= blocks for that πŸ’‘
+- =final= is called to clean up when no progress can be made or if the 
presentation is stopped.
 
-These methods follow the naming and behavior of dslide's [[*Stateful 
Sequence][stateful sequence]] interface.  The babel action is basically 
delegating stateful sequence calls into the blocks of your org document.
+πŸ’‘These methods follow the naming and behavior of dslide's [[*Stateful 
Sequence][stateful sequence]] interface.  The babel action is basically 
delegating stateful sequence calls into the blocks of your org document.
 
+The =:direction= parameter goes after the block language.
+#+begin_src org
+  ,#+begin_src elisp :direction backward
+    (message "I run going backwards, on `dslide-deck-backward'")
+  ,#+end_src
+#+end_src
+You can use =[vector]= or ='(quoted list)= syntax to combine methods.
+#+begin_src org
+  ,#+begin_src elisp :direction [end forward]
+    (message "My configuration is a vector with multiple directions")
+  ,#+end_src
+#+end_src
+*** Ignoring Blocks πŸ™…
+:PROPERTIES:
+:DESCRIPTION: Hey! Don't evaluate that!
+:END:
+Use the =:eval= parameter to prevent evaluation of blocks that aren't for your 
presentation.
+#+begin_src org
+  ,#+begin_src elisp :eval never
+    (message "Who cares?  I am never evaluated")
+  ,#+end_src
+#+end_src
 *** Visibility πŸ‘»
 :PROPERTIES:
 :DESCRIPTION: Hiding blocks and their results
diff --git a/dslide.el b/dslide.el
index 684bb43de2..c0afa2a469 100644
--- a/dslide.el
+++ b/dslide.el
@@ -319,6 +319,7 @@ keyword."
 ;; TODO test the use of plist args
 (defcustom dslide-default-actions '(dslide-action-hide-markup
                                     dslide-action-propertize
+                                    dslide-action-babel
                                     dslide-action-image)
   "Actions that run within the section display action lifecycle.
 It's value is a list of symbol `dslide-action' sub-classes or (CLASS
@@ -1424,20 +1425,28 @@ only when entering a slide.  Other options seem to 
suggest
 results should not be removed or will never be written to the
 buffer anyway."))
   "Execute source blocks as steps.
-By default blocks execute one by one with forward.  You can mark a block to
-be special with the keyword:
+By default blocks execute one by one as individual steps with
+`dslide-deck-forward'.  To run blocks in another direction, set
+a :direction parameter on the block.  You can set a single
+parameter or a vector of parameters.
 
-- #+attr_dslide: begin
+- forward:  The default, only run on `dslide-deck-forward'
 
-- #+attr_dslide: forward
+- backward: Only run on `dslide-deck-backward'
 
-- #+attr_dslide: backward
+- both: Combines forward and backward
 
-- #+attr_dslide: both
+- begin: Runs when the slide is entered going forward
 
-- #+attr_dslide: end
+- end: Runs when the slide is entered going backward
 
-- #+attr_dslide: final
+- init: Combines begin and end, running on every slide entry
+
+- final: Runs on slide exit, regardless of direction
+
+The old #+attr_dslide: style will no longer be used.  This is to allow
+the keyword to be used to configure other actions, which need to be
+allowed to use the first element as the class identifier.
 
 Other than both, which executes in either step direction,
 these keywords correspond to the normal methods of the stateful
@@ -1477,18 +1486,39 @@ steps.")
              ;; seems we do not need to un-hide the results.
              (push overlay dslide-overlays))))))))
 
-(defun dslide--method-block-pred (method-names &optional unnamed)
-  "Return a predicate to match the METHOD-NAMES.
-Optional UNNAMED will return unnamed blocks as well."
+(defun dslide--method-block-pred (methods &optional unnamed)
+  "Return a predicate to match the METHODS.
+Optional UNNAMED will return unnamed blocks as well.  This is
+used when going forward, the default."
   (lambda (block)
-    (if-let* ((all-names (car (org-element-property
-                               :attr_dslide block)))
-              (names (string-split all-names)))
-        (when (seq-intersection method-names names)
-          block)
-      (when unnamed
+    (let* ((deprecated (dslide--old-babel-attr block))
+           (raw-params (org-element-property :parameters block))
+           (params (when raw-params (dslide-read-plist raw-params 0 t)))
+           (found (or (plist-get params :direction) deprecated))
+           (eval (plist-get params :eval))
+           (ignored (member eval '(no never never-export no-export))))
+      (when (and (not ignored)
+                 (or (and (null found) unnamed)
+                     (cond
+                      ((vectorp found) (seq-intersection methods found))
+                      ;; ☒️ This works for quoted lists.  Unquoted lists cannot
+                      ;; be used because org mode, not dslide, tries to
+                      ;; evaluate them like an idiot.
+                      ((listp found) (seq-intersection methods (cadr found)))
+                      ((symbolp found) (member found methods)))))
         block))))
 
+(defun dslide--old-babel-attr (block)
+  "Return directions on blocks that have the old style.
+And warn the user to update so we can deprecate."
+  (when-let ((found (org-element-property :attr_dslide block)))
+    (delay-warning '(dslide dslide-babel dslide-babel-attr-deprecated)
+                   (format "Old style babel configuration found at line %s"
+                           (without-restriction
+                             (line-number-at-pos
+                              (org-element-property :begin block)))))
+    (mapcar #'intern-soft found)))
+
 ;; Executing babel seems to widen and also creates messages, and this would
 ;; result in flashing.  Re-display is inhibited at the deck level to prevent
 ;; these unpleasantries.  The downside of just inhibiting re-display until 
after
@@ -1555,19 +1585,19 @@ The affiliated keywords look like:
 
 The possible values for METHOD-NAME correspond to the
 stateful-sequence class methods.  METHOD-NAME is a string."
-  (let ((predicate (dslide--method-block-pred (list method-name))))
+  (let ((predicate (dslide--method-block-pred method-name)))
     (dslide-section-map obj 'src-block predicate)))
 
 (cl-defmethod dslide-forward ((obj dslide-action-babel))
   (when-let* ((predicate (dslide--method-block-pred
-                          '("forward" "both") t))
+                          '(forward both) t))
               (next (dslide-section-next obj 'src-block predicate)))
     (dslide--block-execute next)
     (org-element-property :begin next)))
 
 (cl-defmethod dslide-backward ((obj dslide-action-babel))
   (when-let* ((predicate (dslide--method-block-pred
-                          '("backward" "both")))
+                          '(backward both)))
               (prev (dslide-section-previous obj 'src-block predicate)))
     (dslide--block-execute prev)
     (org-element-property :begin prev)))
@@ -1576,7 +1606,7 @@ stateful-sequence class methods.  METHOD-NAME is a 
string."
   (when (oref obj remove-results)
     (dslide--clear-all-results obj))
   (dslide--hide-non-exports obj)
-  (when-let ((block-elements (dslide--get-blocks obj "begin")))
+  (when-let ((block-elements (dslide--get-blocks obj '(begin init))))
     (mapc #'dslide--block-execute block-elements)))
 
 (cl-defmethod dslide-end ((obj dslide-action-babel))
@@ -1586,11 +1616,11 @@ stateful-sequence class methods.  METHOD-NAME is a 
string."
     (dslide--clear-all-results obj))
   (dslide--hide-non-exports obj)
   (dslide-marker obj (org-element-property :end (dslide-heading obj)))
-  (when-let ((block-elements (dslide--get-blocks obj "end")))
+  (when-let ((block-elements (dslide--get-blocks obj '(end init))))
     (mapc #'dslide--block-execute block-elements)))
 
 (cl-defmethod dslide-final :after ((obj dslide-action-babel))
-  (when-let ((block-elements (dslide--get-blocks obj "final")))
+  (when-let ((block-elements (dslide--get-blocks obj '(final))))
     (mapc #'dslide--block-execute block-elements))
   (when (oref obj remove-results)
     (dslide--clear-all-results obj)))
@@ -2970,30 +3000,6 @@ for commands without visible side effects."
           '(dslide) (cdr err))))
       (reverse classes-with-args))))
 
-(defun dslide-element-plist (property element)
-  "Return a plist from ELEMENT for PROPERTY.
-PROPERTY can be an affilated keyword property or another property.  The
-only requirement is that the value of PROPERTY must be a string or list
-of strings.  We will attempt to parse the value using `read-from-string'
-and cons the results into a plist.  `plist-get' always returns the first
-key.  It is the user's responsibility not to overload keys and expect
-more than first-key wins behavior."
-  (when-let* ((plist-strings (org-element-property property element))
-              (plist-strings (if (listp plist-strings) plist-strings
-                               (list plist-strings))))
-    (let (result)
-      (while-let ((plist-string (pop plist-strings)))
-        (let ((pos 0))
-          (condition-case nil
-              (while pos
-                (let* ((key (read-from-string plist-string pos))
-                       (val (read-from-string plist-string (cdr key))))
-                  (push (car key) result)
-                  (push (car val) result)
-                  (setq pos (cdr val))))
-            (end-of-file nil))))
-      (nreverse result))))
-
 (defun dslide--parse-class (class)
   "Return a class or signal error if CLASS is not a class."
   (when-let* ((class (intern-soft class)))
diff --git a/test/demo.org b/test/demo.org
index d08ab67bb1..41e000ed69 100644
--- a/test/demo.org
+++ b/test/demo.org
@@ -167,25 +167,18 @@ Add text properties to an element using the 
=attr_dslide_propertize= affiliated
 This is some fancy text
 
 * Babel Integration
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
-To make your blocks interactive, set the =:DSLIDE_ACTIONS:= property to 
=dslide-action-babel= in the property drawer.
+By default, blocks will run as steps.
 #+begin_src elisp
   (message "By default, a block is just a forward step.")
 #+end_src
 
 ** Forwards & Backwards
-- Blocks can be marked with the =#+attr_dslide:= affiliated keyword to execute 
in a certain order.  (unmarked default is forward)
+- The direction of a block can be set using the =:direction= parameter, the 
same as other babel block parameters
 - Blocks can be marked =forward=, =backward=, or =both= to run via 
~dslide-deck-forward~ or ~dslide-deck-backward~.
 - The markup keywords are hidden during presentation by default.  Use 
~dslide-deck-develop~ to see both markup and presentation simultaneously. 
(Executed blocks are highlighted! πŸ’‘)
 - Note, if there is no =backward= block, when entering the slide going 
backward, the slide will begin as if going forward because there is no backward 
step.
 *** Example
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
-#+attr_dslide: backward
-#+begin_src elisp
+#+begin_src elisp :direction backward
   ;; Called when going backward
   (random 100)
 #+end_src
@@ -196,43 +189,34 @@ To make your blocks interactive, set the 
=:DSLIDE_ACTIONS:= property to =dslide-
   (random 100)
 #+end_src
 
-#+attr_dslide: both
-#+begin_src elisp
+#+begin_src elisp :direction both
   ;; Called when going either way
   (random 100)
 #+end_src
 
-#+attr_dslide: forward
-#+begin_src elisp
+#+begin_src elisp :direction forward
   ;; An explicitly forward marked block
   (random 100)
 #+end_src
 
-** Begin, End, and Final
-If you need to initialize some code, the =begin= and =end= methods can be 
used.  To clean up, use a =final= block.
+** Begin, End, Init, and Final
+If you need to initialize some code, the =begin= and =end= methods can be 
used.  They run when entering the slide going forwards or backwards, 
respectively.  To run when entering the slide either way, use =init=.  It is 
just a combination of =begin= and =end=.  To clean up, use a =final= block.  It 
always runs when leaving a slide.
 
 Enter this slide going backwards to observe the "end" behavior.
 *** Example
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
-#+attr_dslide: begin
-#+begin_src elisp
+#+begin_src elisp :direction begin
   (setq-local my-dslide-var 'beginning)
 #+end_src
 
-#+attr_dslide: both
-#+begin_src elisp
+#+begin_src elisp :direction both
   (message "Entered slide at: %s" my-dslide-var)
 #+end_src
 
-#+attr_dslide: end
-#+begin_src elisp
+#+begin_src elisp :direction end
   (setq-local my-dslide-var 'end)
 #+end_src
 
-#+attr_dslide: final
-#+begin_src elisp
+#+begin_src elisp :direction final
   (kill-local-variable 'my-dslide-var)
 #+end_src
 
@@ -241,11 +225,7 @@ Multiple blocks can have the =begin=, =end=, and =final= 
method.  They are alway
 
 Go 2-3 steps forwards and then backwards.  This slide also supports starting 
at the end.  Just go to the next slide and back up.
 *** Example
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
-#+attr_dslide: begin end
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction init
   (setq-local overlays nil)
   (goto-char (point-min))
   (while (re-search-forward "overlay" nil t)
@@ -254,35 +234,29 @@ Go 2-3 steps forwards and then backwards.  This slide 
also supports starting at
       (push overlay overlays)))
 #+end_src
 
-#+attr_dslide: backward
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction backward
   (mapc (lambda (o) (overlay-put o 'display nil)) overlays)
 #+end_src
 
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (mapc (lambda (o) (overlay-put o 'display "πŸ₯ž")) overlays)
 #+end_src
 
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (mapc (lambda (o) (overlay-put o 'display "πŸ₯žπŸ₯ž")) overlays)
 #+end_src
 
-#+attr_dslide: forward end
-#+begin_src elisp :results none
+# Use vector syntax [like this] or quoted list syntax '(like this) to provide
+# multiple directions
+#+begin_src elisp :results none :direction [forward end]
   (mapc (lambda (o) (overlay-put o 'display "πŸ₯žπŸ₯žπŸ₯ž")) overlays)
 #+end_src
 
-#+attr_dslide: final
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction final
   (mapc #'delete-overlay overlays)
   (makunbound 'overlays)
 #+end_src
 ** Hiding Blocks
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 The babel block header argument =exports= is recognized and controls 
visibility of the block and its results.  The babel blocks in this slide are 
not visible at all.  The blocks find and updates the text below:
 
 Can has display?
@@ -290,8 +264,7 @@ Can has display?
 Try forwards and backwards.  There are several hidden steps.
 
 ⚠️ This example also uses =:results none=, not because they would be visible, 
but because the return type is an overlay that babel can't serialize as output.
-#+attr_dslide: end begin
-#+begin_src elisp :exports none :results none
+#+begin_src elisp :exports none :results none :direction init
   ;; No need to deal with restriction or restore point.
   (org-back-to-heading t)
   (if (re-search-forward "\?" nil t)
@@ -300,63 +273,50 @@ Try forwards and backwards.  There are several hidden 
steps.
     (error "Ouchie, the document changed!"))
 #+end_src
 
-#+attr_dslide: backward
-#+begin_src elisp :exports none :results none
+#+begin_src elisp :exports none :results none :direction backward
   (overlay-put dslide-can-has-overlay 'after-string nil)
 #+end_src
 
-#+attr_dslide: both
-#+begin_src elisp :exports none :results none
+#+begin_src elisp :exports none :results none :direction both
   (overlay-put dslide-can-has-overlay 'after-string
                (propertize "  No display!  Only execute!"
                            'face 'error))
 #+end_src
 
-#+attr_dslide: forward end
-#+begin_src elisp :exports none :results none
+# Use vector syntax [like this] or quoted list syntax '(like this) to provide
+# multiple directions
+#+begin_src elisp :exports none :results none :direction '(forward end)
   (overlay-put dslide-can-has-overlay 'after-string
                (propertize "  No display!  Only execute!"
                            'face 'success))
 #+end_src
 
-#+attr_dslide: final
-#+begin_src elisp :exports none :results none
+#+begin_src elisp :exports none :results none :direction final
   (when (bound-and-true-p dslide-can-has-overlay)
     (delete-overlay dslide-can-has-overlay)
     (makunbound 'dslide-can-has-overlay))
 #+end_src
 ** Results Only
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 The babel in this block will show results after being called but the block 
itself is never visible.
 #+begin_src elisp :exports results
   '(a b c)
 #+end_src
 
 ** Silent Results
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 For blocks you want to be visible but are only running for effects, you can 
use the built-in babel block header argument =results= and set it to =none=
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (let* ((block (org-element-at-point))
          (overlay (make-overlay (org-element-property :begin block)
                                 (org-element-property :end block))))
     (overlay-put overlay 'face '(:inverse-video t))
     (setq-local dslide--example-overlay overlay))
 #+end_src
-#+attr_dslide: final
-#+begin_src elisp :results none :exports none
+#+begin_src elisp :results none :exports none :direction final
   (when (bound-and-true-p dslide--example-overlay)
     (delete-overlay dslide--example-overlay)
     (makunbound 'dslide--example-overlay))
 #+end_src
 ** Package Integration
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 - You need the [[https://github.com/positron-solutions/moc][Master of 
Ceremonies]] package installed to complete this slide.  Use the contents 
navigation to skip this slide if you didn't install it.
 - Let arbitrary buffers be shown while still completing steps within the 
slide-show.
 - Run babel against other buffers 😈.
@@ -364,39 +324,28 @@ For blocks you want to be visible but are only running 
for effects, you can use
 # Master of Ceremonies remains in development.  The :version keys for playback
 # expressions may be updated when you find this demo.
 
-#+attr_dslide: begin
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction begin
   (require 'moc)
 #+end_src
-#+attr_dslide: final backward
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction final backward
   (when-let ((buffer (get-buffer "*MoC Focus*")))
     (kill-buffer buffer))
 #+end_src
-
-#+attr_dslide: both
-  #+begin_src elisp :results none
+  #+begin_src elisp :results none :direction both
   (moc-focus :version 0 :text "πŸ–ŠοΈ")
   #+end_src
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (moc-focus :version 0 :text "πŸ–ŠοΈπŸ")
   #+end_src
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (moc-focus :version 0 :text "πŸ–ŠοΈπŸπŸŽ")
   #+end_src
-#+attr_dslide: both
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction both
   (moc-focus :version 0 :text "πŸ–ŠοΈπŸπŸŽπŸ–ŠοΈ")
   #+end_src
 ** Babel is every Feature
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 If a feature seems like it's missing, it can probably be added.  There is a 
babel block below this paragraph, but if you are viewing this presentation, you 
won't see it because it has hidden itself with an overlay.  File an issue, but 
don't be held back.  A quick hunk of [[info:elisp#Top][elisp]] can solve every 
problem.
-#+attr_dslide: begin end
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction init
   (let* ((block (org-element-at-point))
          (overlay (make-overlay (org-element-property :begin block)
                                 (org-element-property :end block))))
@@ -404,14 +353,10 @@ If a feature seems like it's missing, it can probably be 
added.  There is a babe
     (push overlay dslide-overlays))
 #+end_src
 ** Babel to Call Processes
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 Not everything can be displayed within Emacs.  However, Emacs launches 
processes with ease.  Let's use babel to take advantage of this.
 
 The babel block below, which is not visible during the presentation, will call 
VLC to show the video.  VLC supports some options that make it convenient to 
integrate into our slideshow without interacting with its window, but if you 
are using EXWM or the application exposes a local interface such as DBus or a 
network socket, you can control it that way.
-#+attr_dslide: forward
-#+begin_src elisp :results none
+#+begin_src elisp :results none :direction forward
   (if-let ((vlc (executable-find "vlc"))
            (output (generate-new-buffer "*VLC Output*")))
       (progn
@@ -444,15 +389,11 @@ Positron is cheating and also apply custom line-spacing 
and line-height.  While
 ** Bindings
 Bind the command ~dslide-deck-start~ in the ~org-mode-map~.  Any key will do.
 ** Custom Actions
-:PROPERTIES:
-:DSLIDE_ACTIONS: dslide-action-babel
-:END:
 The babel block below is a custom action supporting both forward, each step 
making a paragraph red when going forward or removing the red when going 
backward.  Key methods you want to use in your custom actions:
 - ~dslide-section-next~
 - ~dslide-section-previous~
 - ~dslide-section-marker~
-#+attr_dslide: begin end
-#+begin_src elisp elisp :results none
+#+begin_src elisp elisp :results none :direction init
   (defclass dslide-action-red-paragraphs (dslide-action)
     ((overlays :initform nil))
     "Paint the paragraphs red, one by one.")



reply via email to

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