Category: emacs

Convert to Roman Numerals in Emacs Lisp

Sorry I can’t get the indents to export in org2blog. Maybe a configuration issue…

Just open it in Emacs, select the whole buffer, and intent-region

(defun ba-romani-numeri (number)
  "Provide the roman numeral for a number less than 4999"
(let* ((thousands (truncate (/ number 1000)))
       (thousands-remainder (- number (* 1000 thousands)))
       (roman-thousands (cond ((= 4 thousands) "MMMM")
                              ((= 3 thousands) "MMM")
                              ((= 2 thousands) "MM")
                              ((= 1 thousands) "M")
                              ((= 0 thousands) "")))
       (hundreds (truncate (/ thousands-remainder 100)))
       (hundreds-remainder (- thousands-remainder (* 100 hundreds)))
       (roman-hundreds (cond ((= 9 hundreds) "XM")
                             ((= 8 hundreds) "DCCC")
                             ((= 7 hundreds) "DCC")
                             ((= 6 hundreds) "DC")
                             ((= 5 hundreds) "D")
                             ((= 4 hundreds) "CD")
                             ((= 3 hundreds) "CCC")
                             ((= 2 hundreds) "CC")
                             ((= 1 hundreds) "C")
                             ((= 0 hundreds) "")))
       (tens (truncate (/ hundreds-remainder 10)))
       (tens-remainder (- hundreds-remainder (* 10 tens)))
       (roman-tens (cond ((= 9 tens) "XC")
                         ((= 8 tens) "LXXX")
                         ((= 7 tens) "LXX")
                         ((= 6 tens) "LX")
                         ((= 5 tens) "L")
                         ((= 4 tens) "XL")
                         ((= 3 tens) "XXX")
                         ((= 2 tens) "XX")
                         ((= 1 tens) "X")
                         ((= 0 tens) "")))
       (ones  tens-remainder)
       (roman-ones (cond ((= 9 ones) "IX")
                         ((= 8 ones) "VIII")
                         ((= 7 ones) "VII")
                         ((= 6 ones) "VI")
                         ((= 5 ones) "V")
                         ((= 4 ones) "IV")
                         ((= 3 ones) "III")
                         ((= 2 ones) "II")
                         ((= 1 ones) "I")
                         ((= 0 ones) ""))))
  (concat roman-thousands roman-hundreds roman-tens roman-ones)))
(ba-romani-numeri 2213)

(ba-romani-numeri 2013)

(ba-romani-numeri 999)

(ba-romani-numeri 299)

(ba-romani-numeri 99)
;; "XCIX"

(ba-romani-numeri 55)
;; "LV"

(ba-romani-numeri 35)
;; "XXXV"

(ba-romani-numeri 17)
;; "XVII"

(ba-romani-numeri 15)
;; "XV"

(ba-romani-numeri 5)
;; "V"

Mind Mapping Software


Although I have used FreeMind as recently as last year, I wanted to survey what software is available that is both open source and free, as in freedom.

Some of the review articles may include applications that are not open source or not free, but I wanted to see what is out there.

In searching, I found this article that discusses the difference between outlining and mind mapping:


Emacs Org-Mode Exporter for FreeMind

A Meta-programming Language for Org-mode

Found some good examples of extended literal programming with org-mode and org-babel.

The results and reports are embeded in the org-mode document. The exported html contains the literal programming description, the source code, and the results.

The title of this section in the org-mode manual is “A Meta-programming Language for Org-mode”


Ledger & Emacs

After only a couple of days use, I am very happy with Ledger. The type of reports I can generate are perfect for my needs.

For example

ledger -b "last year" -MA reg  "Exp.*:ATM"

shows ATM withdrawals since last year on a monthly basis with running averages.

Changing to

ledger -b "this year" -WA reg  "Exp.*:ATM"

shows average ATM withdrawals this year on a weekly basis (with running averages).

Ledger – *nix cli bookkeeping


I like double entry bookkeeping systems. I just found Ledger today, 2013-05-01, and it appears that I won’t have to re-write my old bookkeeping program that used NoSQL v2.2.

What I like about Ledger

  • Ledger uses double-entry bookkeeping
  • Ledger is a *nix command line program
    • that keeps transactions in plain text
  • Ledger can read uncompressed GnuCash files
  • Ledger can export as csv
  • Ledger can export emacs-lisp sexp forms

Using Ledger with GnuCash files

Ledger & Emacs

Ledger as a data importer for R analysis

  • use GnuCash to pull transactions from my online accounts
  • convert GnuCash files to csv
  • import csv into R
  • analyze


NoSQL is a 4GL relational database language that integrates into the command line. I liked developing witn NoSQL using the data flow operator paradigm. Due to the structural changes between NoSQL 4x and 2x, I think it will be more work to update my old bookkeeping system than it will be to set up something with Org-Babel and Ledger. Additionally, working in Emacs will make R analysis easier since I use ESS.

Emacs org-mode, xml, and more

The Quest

I keep looking for the magic tool that will help me convert the following xml data to org-more:

  • wordpress xml exports
  • nixnote xml exports (nixnote is the open source client for nevernote)

Google Search

  • search: wordpress xml to org-mode
  • results
    • org2blog howto
      • includes reference to el-get, another package management tool
    • org2blog howto
      • examples of embedding html in org-mode for export
        • #+BEGIN_HTML
        • <button onclick=”alert(‘you are!’);”>I feel lucky!</button>
        • #+END_HTML
    • general org-mode examples, including org2blog
      • older post before org2blog was available through M-x list-packages, nonetheless I found the steps interesting
        • clone the repositories of Org2blog (and the needed Elisp implementation of XML-RPC) somewhere into the Emacs search path
        • get the ELPA extension retrieval package.el into
        • use el-get for retrieving the add-ons
    • org-mode – all in!
      • from swaroopch
      • includes a free python book written by the author of this blog
      • moved data to org-mode from these apps:
        • Tasks were moved from to a file called
        • Notes were moved from Evernote to a file for “I may need someday” kinda info and for things that “I want to keep in mind”.
        • Calendar events were moved from Calendar app to a file
        • Habits were moved from Daily Deeds iPhone app to a file with the habits org module enabled
        • Files were moved from Dropbox to a files folder
        • Diary entries (although rare) were moved from Evernote to a file with file+datetree configuration
        • Pomodoros and time tracking have moved from Focus Time iPhone app to simple clocking commands: C-c C-x e to set a time estimate, C-c C-x C-i clocks in for the current task, and C-c C-x C-o clocks out of the current task and it’ll show me how much time I spent on a task and it’ll even aggregate subtasks and show how much total time I took on a higher-order project/task. And all this in plain text!
        • Blog drafts have moved from WordPress to a blog_drafts folder full of .org files, including this post.
        • Archiving (C-c C-x C-a) is one of the greatest OrgMode features, where it’ll take the current t
      • mentions the google effect

Emacs Client for Google API

I’ve been wanting to get a keyboard interface to some of the Google APIs. After a while, I get tired of mousing around on a web application.

Google APIs

I’m just learning, but I think I need to enable API access for the services I want to use, go I’m going to the console:

Google API Console

Emacs Tools

I obviously need some Emacs tools, so I’m checking out these Google Client links::


Data Deduplication

Even in these days of Big Data, Data Deduplication is even more needed. Common examples include contact list deduplication. Yahoo mail offers this, but it doesn’t handle two contacts that are identical except for one field. That additional field may not be even important to you or me.

I still haven’t found a contact deduplicator that I like, though bbdb does a pretty good job. Before I write something, I’m doing a survey of what is out there in the open source world, so here are some links: