2013-10-09 Better keymap for org-tree-slide

Last edit

Summary: Edit: I messed up with eval-after-load, which didn’t work here. As Michael Heerdegen pointed out, I tried to be too clever with not restarting Emacs; if I did, I’d have caught this error at once.

Changed:

< (eval-after-load 'org-tree-slide '(setq org-tree-slide-mode-map
< (let ((map (make-sparse-keymap)))
< (define-key map (kbd "<f1>") 'org-tree-slide-content)
< (define-key map (kbd "<f5>") 'org-tree-slide-move-previous-tree)
< (define-key map (kbd "<f8>") 'org-tree-slide-move-next-tree)
< map)))

to

> (setq org-tree-slide-mode-map
> (let ((map (make-sparse-keymap)))
> (define-key map (kbd "<f1>") 'org-tree-slide-content)
> (define-key map (kbd "<f5>") 'org-tree-slide-move-previous-tree)
> (define-key map (kbd "<f8>") 'org-tree-slide-move-next-tree)
> map))
> (load-file "~/some/path/org-tree-slide.el")

Changed:

< The tricky (at least for me initially) part was to debug this (I changed this keymap a few times before settling on these keys) /without/ restarting Emacs (which I don't want to do so that I can brag about my {{{emacs-uptime}}};)). It turned out that {{{eval-after-load}}} works /each time the file is loaded/, which is nice (and it is actually [[http://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks-for-Loading.html#index-eval_002dafter_002dload-896|stated clearly in the manual]]).
< So, the one of the next presentations I'm going to give will be using {{{org-tree-slide}}} (how refreshing after all these similar Beamer slidess...). And it will be about effective usage of a computer (a.k.a. lifehacking);).

to

> (//This paragraph is now obsolete, see below.//) The tricky (at least for me initially) part was to debug this (I changed this keymap a few times before settling on these keys) /without/ restarting Emacs (which I don't want to do so that I can brag about my {{{emacs-uptime}}};)). It turned out that {{{eval-after-load}}} works /each time the file is loaded/, which is nice (and it is actually [[http://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks-for-Loading.html#index-eval_002dafter_002dload-896|stated clearly in the manual]]).
> So, the one of the next presentations I'm going to give will be using {{{org-tree-slide}}} (how refreshing after all these similar Beamer slides...). And it will be about effective usage of a computer (a.k.a. lifehacking);).
> **Edit:** I messed up with {{{eval-after-load}}}, which didn't work here. As [[http://lists.gnu.org/archive/html/help-gnu-emacs/2013-10/msg00279.html|Michael Heerdegen pointed out]], I tried to be too clever with not restarting Emacs; if I did, I'd have caught this error at once.
> And btw, the lecture went quite well. The audience were high school students from my old school, where they have a special computer science group. I didn't talk about Emacs all the time, though I did mention it (and Vim, for that matter - after all, they are the only real text editors in existence, with Emacs being slightly superior, at least in my use case). I was quite delighted to hear one comment (from a high school student!) after the talk: "It's the first time I've seen a presentation done in Emacs." :)


Recently, I tried out org-tree-slide mode for presentations from within Emacs. Now I don’t have to trick Beamer to have Emacs-like slides – yay! It has a few rough edges (it is a bit strange that it binds C-x s r to nonexistent org-tree-slide-resume, for instance; but what I found really annoying is that it redefines the left and right arrow keys. Since this defies the whole point of having a live presentation (by “live” I mean editable in real time, which is really cool, especially with all the Org-mode tricks for outlines, lists, checkboxes, tables and whatnot), I decided to change this. Since the F5 and F8 keys on my keyboard have the previous/next song symbols (and I don’t use function keys in Emacs anyway, apart from F3 and F4, of course), I thought they were the best candidates. And for org-tree-slide-content I went first with F7; but it was too close to F8 and could be pressed accidentally, so I moved this function (whose effect is not easily reversible!) somewhere further, i.e., to F1. Here’s the (rather simple, and possibly not optimal – it defines the keymap from scratch, but I don’t know how to easily change an existing keymap; by “easily” I mean “in less lines of code than defining it anew”) code from my init.el:

(setq org-tree-slide-mode-map
      (let ((map (make-sparse-keymap)))
	(define-key map (kbd "<f1>") 'org-tree-slide-content)
	(define-key map (kbd "<f5>") 'org-tree-slide-move-previous-tree)
	(define-key map (kbd "<f8>") 'org-tree-slide-move-next-tree)
	map))

(load-file "~/some/path/org-tree-slide.el")

(This paragraph is now obsolete, see below.) The tricky (at least for me initially) part was to debug this (I changed this keymap a few times before settling on these keys) without restarting Emacs (which I don’t want to do so that I can brag about my emacs-uptime;)). It turned out that eval-after-load works each time the file is loaded, which is nice (and it is actually stated clearly in the manual).

So, the one of the next presentations I’m going to give will be using org-tree-slide (how refreshing after all these similar Beamer slides…). And it will be about effective usage of a computer (a.k.a. lifehacking);).

Edit: I messed up with eval-after-load, which didn’t work here. As Michael Heerdegen pointed out, I tried to be too clever with not restarting Emacs; if I did, I’d have caught this error at once.

And btw, the lecture went quite well. The audience were high school students from my old school, where they have a special computer science group. I didn’t talk about Emacs all the time, though I did mention it (and Vim, for that matter - after all, they are the only real text editors in existence, with Emacs being slightly superior, at least in my use case). I was quite delighted to hear one comment (from a high school student!) after the talk: “It’s the first time I’ve seen a presentation done in Emacs.” :)

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryOrgMode