From 30c7d8c1c246d615ba8717c06dfdee868b444e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Wed, 25 Mar 2026 13:46:42 +0100 Subject: [PATCH] feat[work]: improve presentation mode --- SwarselSystems.org | 301 +++++++++++++++++++++++++++++++------------- files/emacs/init.el | 195 ++++++++++++++++++++++------ 2 files changed, 369 insertions(+), 127 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index ea4c228..d7c3fc2 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -33620,104 +33620,225 @@ When holding presentations, I think it is important to not have too many distrac #+begin_src emacs-lisp - (use-package org-present - :bind (:map org-present-mode-keymap - ("q" . org-present-quit) - ("" . swarsel/org-present-prev) - ("" . 'ignore) - ("" . 'ignore) - ("" . swarsel/org-present-next)) - :hook ((org-present-mode . swarsel/org-present-start) - (org-present-mode-quit . swarsel/org-present-end)) - :config - (add-hook 'org-present-after-navigate-functions #'swarsel/org-present-slide) - ) + (use-package org-present + :bind (:map org-present-mode-keymap + ("q" . org-present-quit) + ("" . swarsel/org-present-prev) + ("<​up>" . 'ignore) + ("<​down>" . 'ignore) + ("" . swarsel/org-present-next)) + :hook ((org-present-mode . swarsel/org-present-start) + (org-present-mode-quit . swarsel/org-present-end)) + :config + (add-hook 'org-present-after-navigate-functions #'swarsel/org-present-slide) + (setq org-present-startup-folded t) + ) - (use-package hide-mode-line) + (use-package hide-mode-line) - (defun swarsel/org-present-start () - (setq-local face-remapping-alist '((default (:height 1.5) variable-pitch) - (header-line (:height 4.0) variable-pitch) - (org-document-title (:height 1.75) org-document-title) - (org-code (:height 1.2) org-code) - (org-verbatim (:height 1.0) org-verbatim) - (org-quote (:height 1.0) org-quote) - (org-verse (:height 1.0) org-verse) - (org-table (:height 0.8) org-table) - (org-block (:height 1.25) org-block) - (org-block-begin-line (:height 0.7) org-block) - )) - (dolist (face '((org-level-1 . 1.1) - (org-level-2 . 1.2) - (org-level-3 . 1.2) - (org-level-4 . 1.2) - (org-level-5 . 1.2) - (org-level-6 . 1.2) - (org-level-7 . 1.2) - (org-level-8 . 1.2))) - (set-face-attribute (car face) nil :font swarsel/variable-font :weight 'medium :height (cdr face))) + (defun swarsel/org-reveal-at-point () + "Reveal the org entry at point if it is a heading." + (when (and (derived-mode-p 'org-mode) + (org-at-heading-p)) + (org-show-entry) + (org-show-children))) - (setq header-line-format " ") - (setq visual-fill-column-width 90) - (setq indicate-buffer-boundaries nil) - (setq inhibit-message nil) - ;; (breadcrumb-mode 0) - (org-display-inline-images) - (global-hl-line-mode 0) - ;; (display-line-numbers-mode 0) - (org-modern-mode 0) - (evil-insert-state 1) - (beginning-of-buffer) - (org-present-read-only) - ;; (org-present-hide-cursor) - (swarsel/org-present-slide) - ) + (defun swarsel/org-present-maybe-read-only () + "Toggle read-only based on whether cursor is inside a src block." + (if (org-in-src-block-p) + (when buffer-read-only + (org-present-read-write) + (evil-insert-state 1)) + (unless buffer-read-only + (org-present-read-only) + (evil-insert-state 1)))) - (defun swarsel/org-present-end () - (setq-local face-remapping-alist '((default variable-pitch default))) - (dolist (face '((org-level-1 . 1.1) - (org-level-2 . 0.9) - (org-level-3 . 0.9) - (org-level-4 . 0.9) - (org-level-5 . 0.9) - (org-level-6 . 0.9) - (org-level-7 . 0.9) - (org-level-8 . 0.9))) - (set-face-attribute (car face) nil :font swarsel/variable-font :weight 'medium :height (cdr face))) - (setq header-line-format nil) - (setq visual-fill-column-width 150) - (setq indicate-buffer-boundaries t) - (setq inhibit-message nil) - ;; (breadcrumb-mode 1) - (global-hl-line-mode 1) - ;; (display-line-numbers-mode 1) - (org-remove-inline-images) - (org-modern-mode 1) - (evil-normal-state 1) - ;; (org-present-show-cursor) - ) - (defun swarsel/org-present-slide () - (org-overview) - (org-show-entry) - (org-show-children) - ) + (defun swarsel/org-present-narrow (orig-fn &rest args) + (cl-letf (((symbol-function 'show-all) #'ignore)) + (apply orig-fn args)) + (org-overview) + (org-show-entry)) - (defun swarsel/org-present-prev () - (interactive) - (org-present-prev) - (swarsel/org-present-slide)) + (advice-add 'org-present-narrow :around #'swarsel/org-present-narrow) - (defun swarsel/org-present-next () - (interactive) - (unless (eobp) - (org-next-visible-heading 1) - (org-fold-show-entry)) - (when (eobp) - (org-present-next) - (swarsel/org-present-slide) - )) + (defun swarsel/org-present-start () + (setq-local face-remapping-alist `((default (:height 1.5) variable-pitch) + (header-line (:height 4.0) variable-pitch) + (org-document-title (:height 1.75) org-document-title) + (org-code (:height 1.2) org-code) + (org-verbatim (:height 1.0) org-verbatim) + (org-quote (:height 1.0) org-quote) + (org-verse (:height 1.0) org-verse) + (org-table (:family ,swarsel/fixed-font :weight regular :height 1.2) org-table) + (org-block (:height 1.25) org-block) + (org-link (:underline nil) org-link) + (org-block-begin-line (:height 0.7) org-block) + )) + + (setq header-line-format " ") + (setq visual-fill-column-width 150) + (setq indicate-buffer-boundaries nil) + (setq inhibit-message nil) + (setq org-babel-eval-error-notify t) + ;; (breadcrumb-mode 0) + (org-display-inline-images) + (global-hl-line-mode 0) + ;; (display-line-numbers-mode 0) + ;; (org-modern-mode 0) + (evil-insert-state 1) + (org-present-read-only) + ;; (org-present-hide-cursor) + (org-overview) ; fold everything on start + (add-hook 'post-command-hook #'swarsel/org-reveal-at-point nil t) + (add-hook 'post-command-hook #'swarsel/org-present-maybe-read-only nil t) + ) + + (defun swarsel/org-present-end () + (setq-local face-remapping-alist `((org-verbatim (:family ,swarsel/fixed-font :weight regular) + org-verbatim) + (org-table (:family ,swarsel/fixed-font :weight regular) org-table) + (org-meta-line (:family ,swarsel/fixed-font :weight regular) org-meta-line) + (org-formula (:family ,swarsel/fixed-font :weight regular) org-formula) + (org-checkbox (:family ,swarsel/fixed-font :weight regular) org-checkbox) + (org-latex-and-related (:family ,swarsel/fixed-font :weight regular) + org-latex-and-related) + (org-indent (:family ,swarsel/fixed-font :weight regular) org-indent) + (org-code (:family ,swarsel/fixed-font :weight regular) org-code) + (org-document-info-keyword (:family ,swarsel/fixed-font :weight regular) + org-document-info-keyword) + (org-block-end-line (:family ,swarsel/fixed-font :weight regular) org-block-end-line) + (org-block-begin-line (:family ,swarsel/fixed-font :weight regular) + org-block-begin-line) + (org-block (:family ,swarsel/fixed-font :weight regular) org-block) + (mu4e-compose-header-face (:family ,swarsel/fixed-font :weight regular) + mu4e-compose-header-face) + (mu4e-compose-separator-face (:family ,swarsel/fixed-font :weight regular) + mu4e-compose-separator-face) + (mu4e-contact-face (:family ,swarsel/fixed-font :weight regular) mu4e-contact-face) + (mu4e-link-face (:family ,swarsel/fixed-font :weight regular) mu4e-link-face) + (mu4e-header-value-face (:family ,swarsel/fixed-font :weight regular) + mu4e-header-value-face) + (mu4e-header-key-face (:family ,swarsel/fixed-font :weight regular) + mu4e-header-key-face) + (message-header-other (:family ,swarsel/fixed-font :weight regular) + message-header-other) + (message-header-subject (:family ,swarsel/fixed-font :weight regular) + message-header-subject) + (message-header-xheader (:family ,swarsel/fixed-font :weight regular) + message-header-xheader) + (message-header-newsgroups (:family ,swarsel/fixed-font :weight regular) + message-header-newsgroups) + (message-header-cc (:family ,swarsel/fixed-font :weight regular) message-header-cc) + (message-header-to (:family ,swarsel/fixed-font :weight regular) message-header-to) + (message-header-name (:family ,swarsel/fixed-font :weight regular) + message-header-name) + (markdown-math-face (:family ,swarsel/fixed-font :weight regular) markdown-math-face) + (markdown-language-keyword-face (:family ,swarsel/fixed-font :weight regular) + markdown-language-keyword-face) + (markdown-language-info-face (:family ,swarsel/fixed-font :weight regular) + markdown-language-info-face) + (markdown-inline-code-face (:family ,swarsel/fixed-font :weight regular) + markdown-inline-code-face) + (markdown-gfm-checkbox-face (:family ,swarsel/fixed-font :weight regular) + markdown-gfm-checkbox-face) + (markdown-code-face (:family ,swarsel/fixed-font :weight regular) markdown-code-face) + (line-number-minor-tick (:family ,swarsel/fixed-font :weight regular) + line-number-minor-tick) + (line-number-major-tick (:family ,swarsel/fixed-font :weight regular) + line-number-major-tick) + (line-number-current-line (:family ,swarsel/fixed-font :weight regular) + line-number-current-line) + (line-number (:family ,swarsel/fixed-font :weight regular) line-number) + (font-lock-variable-name-face (:family ,swarsel/fixed-font :weight regular) + font-lock-variable-name-face) + (font-lock-type-face (:family ,swarsel/fixed-font :weight regular) + font-lock-type-face) + (font-lock-string-face (:family ,swarsel/fixed-font :weight regular) + font-lock-string-face) + (font-lock-regexp-grouping-construct (:family ,swarsel/fixed-font :weight regular) + font-lock-regexp-grouping-construct) + (font-lock-regexp-grouping-backslash (:family ,swarsel/fixed-font :weight regular) + font-lock-regexp-grouping-backslash) + (font-lock-preprocessor-face (:family ,swarsel/fixed-font :weight regular) + font-lock-preprocessor-face) + (font-lock-negation-char-face (:family ,swarsel/fixed-font :weight regular) + font-lock-negation-char-face) + (font-lock-keyword-face (:family ,swarsel/fixed-font :weight regular) + font-lock-keyword-face) + (font-lock-function-name-face (:family ,swarsel/fixed-font :weight regular) + font-lock-function-name-face) + (font-lock-doc-face (:family ,swarsel/fixed-font :weight regular) font-lock-doc-face) + (font-lock-constant-face (:family ,swarsel/fixed-font :weight regular) + font-lock-constant-face) + (font-lock-comment-delimiter-face (:family ,swarsel/fixed-font :weight regular) + font-lock-comment-delimiter-face) + (font-lock-builtin-face (:family ,swarsel/fixed-font :weight regular) + font-lock-builtin-face) + (font-latex-sectioning-5-face (:family ,swarsel/fixed-font :weight regular) + font-latex-sectioning-5-face) + (font-latex-warning-face (:family ,swarsel/fixed-font :weight regular) + font-latex-warning-face) + (font-latex-sedate-face (:family ,swarsel/fixed-font :weight regular) + font-latex-sedate-face) + (font-latex-math-face (:family ,swarsel/fixed-font :weight regular) + font-latex-math-face) + (diff-removed (:family ,swarsel/fixed-font :weight regular) diff-removed) + (diff-hunk-header (:family ,swarsel/fixed-font :weight regular) diff-hunk-header) + (diff-header (:family ,swarsel/fixed-font :weight regular) diff-header) + (diff-function (:family ,swarsel/fixed-font :weight regular) diff-function) + (diff-file-header (:family ,swarsel/fixed-font :weight regular) diff-file-header) + (diff-context (:family ,swarsel/fixed-font :weight regular) diff-context) + (diff-added (:family ,swarsel/fixed-font :weight regular) diff-added) + (default (:family "Sans Serif" :weight light) variable-pitch default) + )) + (setq header-line-format nil) + (setq visual-fill-column-width 150) + (setq indicate-buffer-boundaries t) + (setq inhibit-message nil) + (setq org-babel-no-eval-on-error nil) + ;; (breadcrumb-mode 1) + (global-hl-line-mode 1) + ;; (display-line-numbers-mode 1) + (org-remove-inline-images) + ;; (org-modern-mode 1) + (evil-normal-state 1) + ;; (org-present-show-cursor) + (remove-hook 'post-command-hook #'swarsel/org-reveal-at-point t) + (remove-hook 'post-command-hook #'swarsel/org-present-maybe-read-only t) + ) + + (defun swarsel/org-present-slide-open () + (org-overview) + (org-show-entry) + (org-show-children) + ) + + (defun swarsel/org-present-prev () + (interactive) + (beginning-of-buffer) + (org-present-prev) + (swarsel/org-present-slide-open) + ) + + (defun swarsel/org-present-next () + (interactive) + (let* ((next-heading (save-excursion + (when (outline-next-heading) (point)))) + (next-block (save-excursion + (when (re-search-forward "^#\\+begin_src" nil t) + (match-beginning 0)))) + (target (cond + ((and next-heading next-block) (min next-heading next-block)) + (next-heading next-heading) + (next-block next-block) + (t nil)))) + (if (and target (< target (point-max))) + (progn + (goto-char target) + (org-fold-show-entry)) + (org-present-next)))) #+end_src diff --git a/files/emacs/init.el b/files/emacs/init.el index b412785..9846b5b 100644 --- a/files/emacs/init.el +++ b/files/emacs/init.el @@ -1032,81 +1032,192 @@ create a new one." :bind (:map org-present-mode-keymap ("q" . org-present-quit) ("" . swarsel/org-present-prev) - ("" . 'ignore) - ("" . 'ignore) + ("<​up>" . 'ignore) + ("<​down>" . 'ignore) ("" . swarsel/org-present-next)) :hook ((org-present-mode . swarsel/org-present-start) (org-present-mode-quit . swarsel/org-present-end)) :config (add-hook 'org-present-after-navigate-functions #'swarsel/org-present-slide) + (setq org-present-startup-folded t) ) (use-package hide-mode-line) +(defun swarsel/org-reveal-at-point () + "Reveal the org entry at point if it is a heading." + (when (and (derived-mode-p 'org-mode) + (org-at-heading-p)) + (org-show-entry) + (org-show-children))) + +(defun swarsel/org-present-maybe-read-only () + "Toggle read-only based on whether cursor is inside a src block." + (if (org-in-src-block-p) + (when buffer-read-only + (org-present-read-write) + (evil-insert-state 1)) + (unless buffer-read-only + (org-present-read-only) + (evil-insert-state 1)))) + + +(defun swarsel/org-present-narrow (orig-fn &rest args) + (cl-letf (((symbol-function 'show-all) #'ignore)) + (apply orig-fn args)) + (org-overview) + (org-show-entry)) + +(advice-add 'org-present-narrow :around #'swarsel/org-present-narrow) + (defun swarsel/org-present-start () - (setq-local face-remapping-alist '((default (:height 1.5) variable-pitch) + (setq-local face-remapping-alist `((default (:height 1.5) variable-pitch) (header-line (:height 4.0) variable-pitch) (org-document-title (:height 1.75) org-document-title) (org-code (:height 1.2) org-code) (org-verbatim (:height 1.0) org-verbatim) (org-quote (:height 1.0) org-quote) (org-verse (:height 1.0) org-verse) - (org-table (:height 0.8) org-table) + (org-table (:family ,swarsel/fixed-font :weight regular :height 1.2) org-table) (org-block (:height 1.25) org-block) + (org-link (:underline nil) org-link) (org-block-begin-line (:height 0.7) org-block) )) - (dolist (face '((org-level-1 . 1.1) - (org-level-2 . 1.2) - (org-level-3 . 1.2) - (org-level-4 . 1.2) - (org-level-5 . 1.2) - (org-level-6 . 1.2) - (org-level-7 . 1.2) - (org-level-8 . 1.2))) - (set-face-attribute (car face) nil :font swarsel/variable-font :weight 'medium :height (cdr face))) (setq header-line-format " ") - (setq visual-fill-column-width 90) + (setq visual-fill-column-width 150) (setq indicate-buffer-boundaries nil) (setq inhibit-message nil) + (setq org-babel-eval-error-notify t) ;; (breadcrumb-mode 0) (org-display-inline-images) (global-hl-line-mode 0) ;; (display-line-numbers-mode 0) - (org-modern-mode 0) + ;; (org-modern-mode 0) (evil-insert-state 1) - (beginning-of-buffer) (org-present-read-only) ;; (org-present-hide-cursor) - (swarsel/org-present-slide) + (org-overview) ; fold everything on start + (add-hook 'post-command-hook #'swarsel/org-reveal-at-point nil t) + (add-hook 'post-command-hook #'swarsel/org-present-maybe-read-only nil t) ) (defun swarsel/org-present-end () - (setq-local face-remapping-alist '((default variable-pitch default))) - (dolist (face '((org-level-1 . 1.1) - (org-level-2 . 0.9) - (org-level-3 . 0.9) - (org-level-4 . 0.9) - (org-level-5 . 0.9) - (org-level-6 . 0.9) - (org-level-7 . 0.9) - (org-level-8 . 0.9))) - (set-face-attribute (car face) nil :font swarsel/variable-font :weight 'medium :height (cdr face))) + (setq-local face-remapping-alist `((org-verbatim (:family ,swarsel/fixed-font :weight regular) + org-verbatim) + (org-table (:family ,swarsel/fixed-font :weight regular) org-table) + (org-meta-line (:family ,swarsel/fixed-font :weight regular) org-meta-line) + (org-formula (:family ,swarsel/fixed-font :weight regular) org-formula) + (org-checkbox (:family ,swarsel/fixed-font :weight regular) org-checkbox) + (org-latex-and-related (:family ,swarsel/fixed-font :weight regular) + org-latex-and-related) + (org-indent (:family ,swarsel/fixed-font :weight regular) org-indent) + (org-code (:family ,swarsel/fixed-font :weight regular) org-code) + (org-document-info-keyword (:family ,swarsel/fixed-font :weight regular) + org-document-info-keyword) + (org-block-end-line (:family ,swarsel/fixed-font :weight regular) org-block-end-line) + (org-block-begin-line (:family ,swarsel/fixed-font :weight regular) + org-block-begin-line) + (org-block (:family ,swarsel/fixed-font :weight regular) org-block) + (mu4e-compose-header-face (:family ,swarsel/fixed-font :weight regular) + mu4e-compose-header-face) + (mu4e-compose-separator-face (:family ,swarsel/fixed-font :weight regular) + mu4e-compose-separator-face) + (mu4e-contact-face (:family ,swarsel/fixed-font :weight regular) mu4e-contact-face) + (mu4e-link-face (:family ,swarsel/fixed-font :weight regular) mu4e-link-face) + (mu4e-header-value-face (:family ,swarsel/fixed-font :weight regular) + mu4e-header-value-face) + (mu4e-header-key-face (:family ,swarsel/fixed-font :weight regular) + mu4e-header-key-face) + (message-header-other (:family ,swarsel/fixed-font :weight regular) + message-header-other) + (message-header-subject (:family ,swarsel/fixed-font :weight regular) + message-header-subject) + (message-header-xheader (:family ,swarsel/fixed-font :weight regular) + message-header-xheader) + (message-header-newsgroups (:family ,swarsel/fixed-font :weight regular) + message-header-newsgroups) + (message-header-cc (:family ,swarsel/fixed-font :weight regular) message-header-cc) + (message-header-to (:family ,swarsel/fixed-font :weight regular) message-header-to) + (message-header-name (:family ,swarsel/fixed-font :weight regular) + message-header-name) + (markdown-math-face (:family ,swarsel/fixed-font :weight regular) markdown-math-face) + (markdown-language-keyword-face (:family ,swarsel/fixed-font :weight regular) + markdown-language-keyword-face) + (markdown-language-info-face (:family ,swarsel/fixed-font :weight regular) + markdown-language-info-face) + (markdown-inline-code-face (:family ,swarsel/fixed-font :weight regular) + markdown-inline-code-face) + (markdown-gfm-checkbox-face (:family ,swarsel/fixed-font :weight regular) + markdown-gfm-checkbox-face) + (markdown-code-face (:family ,swarsel/fixed-font :weight regular) markdown-code-face) + (line-number-minor-tick (:family ,swarsel/fixed-font :weight regular) + line-number-minor-tick) + (line-number-major-tick (:family ,swarsel/fixed-font :weight regular) + line-number-major-tick) + (line-number-current-line (:family ,swarsel/fixed-font :weight regular) + line-number-current-line) + (line-number (:family ,swarsel/fixed-font :weight regular) line-number) + (font-lock-variable-name-face (:family ,swarsel/fixed-font :weight regular) + font-lock-variable-name-face) + (font-lock-type-face (:family ,swarsel/fixed-font :weight regular) + font-lock-type-face) + (font-lock-string-face (:family ,swarsel/fixed-font :weight regular) + font-lock-string-face) + (font-lock-regexp-grouping-construct (:family ,swarsel/fixed-font :weight regular) + font-lock-regexp-grouping-construct) + (font-lock-regexp-grouping-backslash (:family ,swarsel/fixed-font :weight regular) + font-lock-regexp-grouping-backslash) + (font-lock-preprocessor-face (:family ,swarsel/fixed-font :weight regular) + font-lock-preprocessor-face) + (font-lock-negation-char-face (:family ,swarsel/fixed-font :weight regular) + font-lock-negation-char-face) + (font-lock-keyword-face (:family ,swarsel/fixed-font :weight regular) + font-lock-keyword-face) + (font-lock-function-name-face (:family ,swarsel/fixed-font :weight regular) + font-lock-function-name-face) + (font-lock-doc-face (:family ,swarsel/fixed-font :weight regular) font-lock-doc-face) + (font-lock-constant-face (:family ,swarsel/fixed-font :weight regular) + font-lock-constant-face) + (font-lock-comment-delimiter-face (:family ,swarsel/fixed-font :weight regular) + font-lock-comment-delimiter-face) + (font-lock-builtin-face (:family ,swarsel/fixed-font :weight regular) + font-lock-builtin-face) + (font-latex-sectioning-5-face (:family ,swarsel/fixed-font :weight regular) + font-latex-sectioning-5-face) + (font-latex-warning-face (:family ,swarsel/fixed-font :weight regular) + font-latex-warning-face) + (font-latex-sedate-face (:family ,swarsel/fixed-font :weight regular) + font-latex-sedate-face) + (font-latex-math-face (:family ,swarsel/fixed-font :weight regular) + font-latex-math-face) + (diff-removed (:family ,swarsel/fixed-font :weight regular) diff-removed) + (diff-hunk-header (:family ,swarsel/fixed-font :weight regular) diff-hunk-header) + (diff-header (:family ,swarsel/fixed-font :weight regular) diff-header) + (diff-function (:family ,swarsel/fixed-font :weight regular) diff-function) + (diff-file-header (:family ,swarsel/fixed-font :weight regular) diff-file-header) + (diff-context (:family ,swarsel/fixed-font :weight regular) diff-context) + (diff-added (:family ,swarsel/fixed-font :weight regular) diff-added) + (default (:family "Sans Serif" :weight light) variable-pitch default) + )) (setq header-line-format nil) (setq visual-fill-column-width 150) (setq indicate-buffer-boundaries t) (setq inhibit-message nil) + (setq org-babel-no-eval-on-error nil) ;; (breadcrumb-mode 1) (global-hl-line-mode 1) ;; (display-line-numbers-mode 1) (org-remove-inline-images) - (org-modern-mode 1) + ;; (org-modern-mode 1) (evil-normal-state 1) ;; (org-present-show-cursor) + (remove-hook 'post-command-hook #'swarsel/org-reveal-at-point t) + (remove-hook 'post-command-hook #'swarsel/org-present-maybe-read-only t) ) -(defun swarsel/org-present-slide () +(defun swarsel/org-present-slide-open () (org-overview) (org-show-entry) (org-show-children) @@ -1114,18 +1225,28 @@ create a new one." (defun swarsel/org-present-prev () (interactive) + (beginning-of-buffer) (org-present-prev) - (swarsel/org-present-slide)) + (swarsel/org-present-slide-open) + ) (defun swarsel/org-present-next () (interactive) - (unless (eobp) - (org-next-visible-heading 1) - (org-fold-show-entry)) - (when (eobp) - (org-present-next) - (swarsel/org-present-slide) - )) + (let* ((next-heading (save-excursion + (when (outline-next-heading) (point)))) + (next-block (save-excursion + (when (re-search-forward "^#\\+begin_src" nil t) + (match-beginning 0)))) + (target (cond + ((and next-heading next-block) (min next-heading next-block)) + (next-heading next-heading) + (next-block next-block) + (t nil)))) + (if (and target (< target (point-max))) + (progn + (goto-char target) + (org-fold-show-entry)) + (org-present-next)))) (defun org-babel-execute:markdown (body params) "Just return BODY unchanged, allowing noweb expansion."