The Mark Ring in emacs

Each time you mark with C-<SPC>, Emacs saves the mark in the mark ring.

You can step back through your mark ring with C-u C-<SPC>.

You can swap point and mark with C-x C-x.

Indenting of comments in emacs-lisp mode

Emacs-lisp mode indents comments based on the number of semi-colons prefixing them.

One semi-colon indents to column 40.
Two semi-colons indent to the same level as the block you are in.
Three semi-colons indent to wherever you place it and don’t move if you press <TAB>

;;; column:
                                        ; one semi-colon
(when (some case)
  ;; two semi-colons indents to the appropriate level
  (second line)
;; two semi-colons indents to the appropriate level

      ;;; I want this comment to stay right here

Re-reading the emacs tutorial

It came upon me to re-read the emacs tutorial. Last time I read it was probably about 17 years ago. Things might have changed since then.

I picked up two things:

C-/ is undo and is equivalent to C-_
C-h c gives you brief help on a keyboard shortcut. I was using C-h k but that opens a new window which can be annoying sometimes.

C-h t takes you to the tutorial.

emacs keyboard macros

If you haven’t explored the power of keyboard macros in emacs, you should.

You only need to remember a few keys to get going:

<F3> Start recording a macro

<F4> End recording a macro

C-x e to repeat the macro

Give it a go!

Expadirk: a hack to split PDFs and email based on instructions within

Sune Vuorela wrote a post asking people to make sure their private hacks become public. That inspired me to publish Expadirk.

Expadirk is my solution to my accounting software provider requiring me to purchase yet more proprietary software in order to send statements, purchase orders and invoices by email.

The accounting package has a way of outputting print runs as PDF. In order to email them, the user has to set up  BroadGun Software’s PDFMachine. PDFMachine provides a virtual printer that processes incoming PDFs, splits them into individual PDFs and emails them off as per instructions embedded within the PDF.

It seemed like a perfect task for a bit of perl. I wrote it about two years ago but never got around to posting it. In that time it has successfully sent thousands of emails including our monthly statement run which is about 200-300 emails.

I installed Expadirk on my linux box as a cups-pdf printer and shared that printer via samba. Then I connected the Windows machines to the shared printer to give them the PDF emailing capability.

I added 2 features not in PDFMachine. Our accounting package had no way of specifying the from email address, so I added a <from></from> tag to the email body. Expadirk will use whatever is in the from tag as the from address if it finds one.

Our accounting package did not have a way to specify that you want to print and email particular documents so I added a <print> tag. If Expadirk finds <print> in the body of the email it will send the PDF to the printer as well and emailing it.

You can find the code on github.