Made show/hide cursor in the demo more resilient

Keeping track of state is hard!
This commit is contained in:
Howard Abrams 2024-10-30 22:04:06 -07:00
parent 9101e07990
commit 029a714bd7

View file

@ -175,8 +175,8 @@ Ive used [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] for yea
(demo-it--presentation-display-restore) ; Restore previous changes (demo-it--presentation-display-restore) ; Restore previous changes
(setq org-hide-emphasis-markers t) (setq org-hide-emphasis-markers t)
(ha-demo-show-mode-line) (ha-demo-show-mode-line)
(ha-demo-normalize-frame)
(ha-demo-show-cursor) (ha-demo-show-cursor)
(ha-demo-normalize-frame)
(git-gutter-mode) (git-gutter-mode)
(text-scale-set 0) (text-scale-set 0)
(flycheck-mode) (flycheck-mode)
@ -348,6 +348,7 @@ The typical presentation software has an issue for hiding the cursor when workin
(defun ha-demo-hide-cursor () (defun ha-demo-hide-cursor ()
"Hide the cursor for the current frame." "Hide the cursor for the current frame."
(interactive) (interactive)
(unless ha-demo-cursor
(setq ha-demo-cursor (setq ha-demo-cursor
(list cursor-type (list cursor-type
t ; (when (boundp 'evil-default-cursor) evil-default-cursor) t ; (when (boundp 'evil-default-cursor) evil-default-cursor)
@ -369,11 +370,12 @@ The typical presentation software has an issue for hiding the cursor when workin
evil-normal-state-cursor nil)) evil-normal-state-cursor nil))
;; And most importantly, turn off the cursor for the selected frame: ;; And most importantly, turn off the cursor for the selected frame:
(set-frame-parameter (selected-frame) 'cursor-type nil)) (set-frame-parameter (selected-frame) 'cursor-type nil)))
(defun ha-demo-show-cursor () (defun ha-demo-show-cursor ()
"Restore cursor properties turned off by `ha-demo-hide-cursor'." "Restore cursor properties turned off by `ha-demo-hide-cursor'."
(interactive) (interactive)
(when ha-demo-cursor
(setq cursor-type (car ha-demo-cursor)) (setq cursor-type (car ha-demo-cursor))
(when (boundp 'evil-default-cursor) (when (boundp 'evil-default-cursor)
@ -385,7 +387,8 @@ The typical presentation software has an issue for hiding the cursor when workin
(when (nth 4 ha-demo-cursor) (blink-cursor-mode 1)) (when (nth 4 ha-demo-cursor) (blink-cursor-mode 1))
(set-frame-parameter (selected-frame) (set-frame-parameter (selected-frame)
'cursor-type (nth 5 ha-demo-cursor))) 'cursor-type (nth 5 ha-demo-cursor))
(setq ha-demo-cursor nil)))
#+END_SRC #+END_SRC
** Hide and Show the Modeline ** Hide and Show the Modeline