From d68aafc926e350256aad4e1a766922119cb366b3 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 17 Jun 2022 23:15:21 +0300 Subject: [PATCH] Add Presentation mode section --- .emacs.d/esy.org | 107 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/.emacs.d/esy.org b/.emacs.d/esy.org index 6053b50..fb6a3ee 100644 --- a/.emacs.d/esy.org +++ b/.emacs.d/esy.org @@ -348,6 +348,7 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli (set-scroll-bar-mode nil) (pixel-scroll-precision-mode) (put 'narrow-to-region 'disabled nil) + (put 'narrow-to-page 'disabled nil) (put 'suspend-frame 'disabled t) #+end_src @@ -846,6 +847,7 @@ refiling directly into deeper headings as well. (global-set-key (kbd "C-,") #'backward-delete-char) (global-set-key (kbd "C-.") #'embark-act) (global-set-key (kbd "C-;") #'avy-goto-char-timer) + (global-set-key (kbd "C-s-p") #'esy/present-buffer) (global-set-key (kbd "C-s-f") #'toggle-frame-fullscreen) (global-set-key (kbd "C-s-l") #'esy/pulse-line)) @@ -1419,6 +1421,111 @@ without asking each time. (add-to-list 'project-switch-commands '(magit-project-status "Magit") t))) #+end_src +* Presentation mode +:PROPERTIES: +:CUSTOM_ID: presentation-mode +:END: + +** Minor mode for moving between Org headings in a narrowed buffer +:PROPERTIES: +:CUSTOM_ID: org-present +:END: +#+begin_src emacs-lisp + (defun org-present-forward-heading-same-level (arg) + (interactive "p" org-mode) + (org-present-widen-and-narrow #'org-forward-heading-same-level + `(,arg t))) + + (defun org-present-backward-heading-same-level (arg) + (interactive "p" org-mode) + (org-present-widen-and-narrow #'org-backward-heading-same-level + `(,arg t))) + + (defun org-present-next-visible-heading (arg) + (interactive "p" org-mode) + (org-present-widen-and-narrow #'org-next-visible-heading + `(,arg))) + + (defun org-present-previous-visible-heading (arg) + (interactive "p" org-mode) + (org-present-widen-and-narrow #'org-previous-visible-heading + `(,arg))) + + (defun org-present-up-heading (arg) + (interactive "p" org-mode) + (org-present-widen-and-narrow #'outline-up-heading + `(,arg t))) + + (defun org-present-widen-and-narrow (f args) + (widen) + (apply f args) + (org-narrow-to-subtree) + (outline-hide-subtree) + (outline-show-branches) + (org-show-entry) + (org-show-children)) + + (define-minor-mode org-present-mode + "Minor mode for automatic widening and narrowing in Org mode." + :init-value nil + :keymap '(([ remap org-forward-heading-same-level ] + . org-present-forward-heading-same-level ) + ([ remap org-backward-heading-same-level ] + . org-present-backward-heading-same-level) + ([ remap org-next-visible-heading ] + . org-present-next-visible-heading ) + ([ remap outline-next-visible-heading ] + . org-present-next-visible-heading ) + ([ remap org-previous-visible-heading ] + . org-present-previous-visible-heading ) + ([ remap outline-previous-visible-heading ] + . org-present-previous-visible-heading ) + ([ remap outline-up-heading ] + . org-present-up-heading ))) +#+end_src + +** =logos= configuration +:PROPERTIES: +:CUSTOM_ID: logos +:END: +#+begin_src emacs-lisp + (defun esy/logos-focus () + (when (eq major-mode 'org-mode) + (org-show-all) + (logos--mode 'org-present-mode 1) + (logos--mode 'org-modern-mode 1)) + (logos--set 'cursor-type 'hbar) + (logos--set 'text-scale-mode-amount 4) + (logos--mode 'text-scale-mode 1) + (logos--mode 'display-line-numbers-mode -1) + (logos--mode 'global-hl-line-mode -1) + (logos--mode 'diff-hl-mode -1) + (logos--mode 'display-fill-column-indicator-mode -1) + (logos--mode 'flymake-mode -1)) + + (with-eval-after-load 'olivetti + (setq olivetti-body-width 80)) + + (with-eval-after-load 'logos + (setq-default logos-olivetti t + logos-hide-fringe t + logos-scroll-lock t + logos-variable-pitch nil + logos-buffer-read-only t + logos-hide-mode-line t + logos-hide-buffer-boundaries t) + + + (add-hook 'logos-focus-mode-extra-functions #'esy/logos-focus) + (add-hook 'logos-focus-mode-extra-functions #'delete-other-windows)) + + (defun esy/present-buffer () + (interactive) + (require 'outline) + (require 'logos) + (logos-focus-mode 'toggle)) +#+end_src + * Misc. settings :PROPERTIES: :CUSTOM_ID: misc -- 2.39.5