Created
December 4, 2018 19:46
-
-
Save ordnungswidrig/a66cabce1afaa99d8ea66231150096d0 to your computer and use it in GitHub Desktop.
presentation helper for live demo in emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun c6e/pres-forward () | |
(interactive) | |
(let ((saved (point))) | |
(forward-line) | |
(let ((beg (point))) | |
(search-forward-regexp "^;;; " nil t) | |
(if (= beg (point)) | |
(goto-char saved) | |
(progn | |
(recenter 0) | |
(beginning-of-line)))))) | |
(defun c6e/pres-backward () | |
(interactive) | |
(let ((saved (point))) | |
(search-backward-regexp "^;;; " nil t) | |
(if (not (= saved (point))) | |
(progn | |
(recenter 0) | |
(beginning-of-line))))) | |
(define-key evil-normal-state-map (kbd "<f11>") #'c6e/pres-backward) | |
(define-key evil-normal-state-map (kbd "<f12>") #'c6e/pres-forward) | |
(define-key evil-insert-state-map (kbd "<f11>") #'c6e/pres-backward) | |
(define-key evil-insert-state-map (kbd "<f12>") #'c6e/pres-forward) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Searches for the next / previous line starting with
;;;
and makes it the first line on the window.