Posted in emacs

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.
Posted in emacs

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

Posted in emacs

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.

Posted in emacs

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.

Posted in emacs, linux

Uptime

Today I found out (from this tutorial ), that
Emacs has an uptime command of its own. Run `emacs-uptime` to see yours.

    
-UUU:**-Uptime.mdwn All L4 [0] (Fundamental)--Mon Mar 25 15:21---
7 days, 0 hours, 36 minutes, 31 seconds