From 938f43c447d3850d0dbc4a9fd09639ad7d4fa26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Hauspie?= <michael.hauspie@univ-lille.fr> Date: Tue, 25 Feb 2025 16:40:22 +0100 Subject: [PATCH] Updates to org-present configuration --- configuration.org | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/configuration.org b/configuration.org index 7447af7..5766335 100644 --- a/configuration.org +++ b/configuration.org @@ -246,12 +246,12 @@ If a timestamp tag is present in the file, update it when saving Define a shortcut to re-indent all buffer. This saves the current point, marks whole buffer and call =indent-region= #+begin_src emacs-lisp -(defun mh/indent-buffer() +(defun my/indent-buffer() (interactive) (save-excursion (indent-region (point-min) (point-max)))) -(global-set-key (kbd "C-c i b") 'mh/indent-buffer) +(global-set-key (kbd "C-c i b") 'my/indent-buffer) #+end_src Set the line width for fill command @@ -589,11 +589,24 @@ it with =visual-fill-column= to enhance the visual look of the presentation. ;; so that org-* face attributes are available (require 'org-faces) +;; Function to be called when changing slide +(defun my/org-present-prepare-slide (buffer-name heading) + ;; Show only top-level headlines + (org-overview) + + ;; Unfold the current entry + (org-show-entry) + + ;; Show only direct subheadings of the slide but don't expand them + (org-show-children)) + ;; What to do when starting/ending a presentation (defun my/org-present-start () (visual-fill-column-mode 1) (visual-line-mode 1) (display-line-numbers-mode 0) + (menu-bar-mode 0) + (scroll-bar-mode 0) ;; Hide emphasis markers on formatted text (setq org-hide-emphasis-markers t) @@ -641,21 +654,23 @@ it with =visual-fill-column= to enhance the visual look of the presentation. (visual-fill-column-mode 0) (visual-line-mode 0) (display-line-numbers-mode 1) + (menu-bar-mode 1) + (scroll-bar-mode 1) ;; Reset font customizations (setq-local face-remapping-alist nil) ;; Show emphasis markers on formatted text (setq org-hide-emphasis-markers nil) ;; Restore Org headings - (dolist (face '((org-level-1 . 1) - (org-level-2 . 1) - (org-level-3 . 1) - (org-level-4 . 1) - (org-level-5 . 1) - (org-level-6 . 1) - (org-level-7 . 1) - (org-level-8 . 1))) - (set-face-attribute (car face) nil :font mh-font-fixed :weight 'medium :height (cdr face))) + (dolist (face '((org-level-1) + (org-level-2) + (org-level-3) + (org-level-4) + (org-level-5) + (org-level-6) + (org-level-7) + (org-level-8))) + (set-face-attribute (car face) nil :font mh-font-fixed :weight 'medium )) ;; Remove the blank line at top of the frame (setq header-line-format nil) @@ -668,6 +683,8 @@ it with =visual-fill-column= to enhance the visual look of the presentation. (org-present-mode . my/org-present-start) (org-present-mode-quit . my/org-present-end) ) + :init + (add-hook 'org-present-after-navigate-functions 'my/org-present-prepare-slide) ) (use-package visual-fill-column :custom @@ -1184,7 +1201,7 @@ First, set =aspell= to be the spell checking program instead of =ispell= Then define a command that will run flyspell on the buffer *and* activate it #+begin_src emacs-lisp -(defun mh/spellcheck () +(defun my/spellcheck () (interactive) (flyspell-mode t) (flyspell-buffer) @@ -1194,18 +1211,18 @@ Then define a command that will run flyspell on the buffer *and* activate it And define a global binding to call it #+begin_src emacs-lisp -(global-set-key (kbd "C-c s") 'mh/spellcheck) +(global-set-key (kbd "C-c s") 'my/spellcheck) #+end_src Binding to fix a word /then/ go to the next error. #+begin_src emacs-lisp -(defun mh/cycle-spellcheck () +(defun my/cycle-spellcheck () (interactive) (flyspell-goto-next-error) (ispell-word)) -(global-set-key (kbd "C-$") 'mh/cycle-spellcheck) +(global-set-key (kbd "C-$") 'my/cycle-spellcheck) #+end_src -- GitLab