Some org-mode keybindings

Basic keybindings

  • C-c C-n and C-c C-p to cycle between headings.
  • TAB on a heading to expand/collapse.
  • M-up and M-down to reorder sections.
  • M-left and M-right to change the level of a heading.
  • M-RET inside a list to create a new bullet.
    • TAB in a new bullet to indent it.
    • S-left and S-right to change the bullet-style.

Checkboxes

  • [ ] M-S-RET gives a checkbox.
  • [X] C-c C-c checks it.
    • [X] TAB for subdivisions.
    • [X] When all subtasks are checked, so is the main one.
  • [X] A trailing [] in the line preceding a list of checkboxes contains a summary (2/3 in this case).

Publishing/Exporting

  • C-c C-e for everything.
    • h o exports to html.
    • # brings up common templates.

Searching notes in Emacs with Deft

I have mentioned the notes system I use already. I use GNU/Emacs heavily and have come up with a neat system that fits my needs. I take notes in org-mode, commit them using git and occasionally publish them to html if I need a clean look at all of them.

For information retrieval, I use Deft in GNU/Emacs. I have it configured with the following snippet in my init.el:

;;deft for notes
(require 'deft)
(setq deft-extensions '("txt" "tex" "org"))
(setq deft-directory "~/notes")
(setq deft-recursive t)
(global-set-key [f8] 'deft)

Whenever I need to dig something up, I hit F-8 and type a string of text and that’s pretty much it. Deft recursively searches for the string and narrows the files down to the hits.

Here’s a quick gif of me searching for ‘s_client’ so I can see the exact args I need to use for openssl’s TLS client.

deft

Publishing my (Emacs/org-powered) notes online

In the past decade, I’ve amassed a single, long file called notes.txt file that has a large amount of information I’ve gathered in my day-to-day activities at work. I use GNU Emacs exclusively to edit and search it. It is now more than 21000 lines long, and when I need to find the workaround for some obscure bug I hit several months back (if not years), the answer is always a C-s away.

Still, in an attempt to reorganize my notes, I spent my free time in the past few weeks in slicing up the file into smaller categories. I decided to properly use org-mode to format them this time. As a bonus, org-publish is a lovely way to render html pages out of them.

My workflow has also improved: I use a bookmark to open the incoming.org file and just dump the content there. Later I re-file them to the appropriate section. I use deft (bound to F8) to quickly search through them.

Since they needed a permanent home, I’ve uploaded the notes to GitHub. I was happy to see that github was able to render the .org files natively. The notes are infinitely more malleable within emacs itself of course ๐Ÿ™‚

Here are the main sections:

And here is the project in GitHub: https://github.com/IndelibleStamp/notes

Update: GitLab looks really nice so I created an account and migrated my repositories there, so here’s the link for my notes repo in GitLab: https://gitlab.com/indeliblestamp/notes/tree/masterย 

Emacs animations

From this neat post on Sacha Chua’s blog, I discovered M-x animate-birthday-present, and spent some time on this lovely site. The latter link is a set of tutorials that starts with Lisp basics and very quickly dives into ASCII animations in Emacs.

Here’s a neat example: Paste the following code in a scratch buffer and evaluate it with C-x C-e.

(defun follow-sine ()
(dotimes (y 70)
(erase-buffer)
(newline (round (+ 10 (* 10 (sin (/ y 10.0))))))
(dotimes (over y)
(insert " "))
(insert "*")
(sit-for 0.1)))

Then run it in an empty buffer with this:

M-: (follow-sine)

You will get an asterisk moving across the screen in a pretty sine wave :)

More importantly, this is the first hands-on look I’ve had at how playing with Emacs Lisp functions can move stuff around on the screen. Well worth a look.

More emacs goodies

I dabbled in Emacs (a bit more than usual) last week: we had to do quite a few things at work that were difficult in a normal editor, but easy in this great one.

First up, I finally caught up with the amazing screencasts at Emacs Rocks. I’ve seen only the one on Multiple Cursors but my jaw dropped, and i’ve queued the rest for later viewing. It’s a pleasure to watch someone displaying such a complete mastery of his environment.

Next up is a nice one liner from the top answer to this StackOverflow question. In brief, running `highlight-lines-matching-regexp` and passing `.{81}` to it highlights all lines over 80 characters.