ielm – the interactive Emacs Lisp REPL

It is a wonderful thing to learn more about one’s tools.

I recently was trying to debug some Elisp code (specifically, I was writing a custom Org Mode capture function), and the behaviour was sufficiently non-obvious that I said, “I sure wish there was a REPL so I could run some test cases for my function interactively.”

Upon searching for it, I discovered that this was a built-in feature, ielm, and, to a certain bit of personal disappointment, I had probably been oblivious of this feature for 20 years or so.

Emacs is more than large enough to contain mountains of “little features” like this unnoticed.

By the way, here’s the code that took some debugging…

(defun before-gtalug (date)
  (let* ((now (decode-time)) ;;; take today
         (day (elt now 3)) ;;; extract month, year, dst, zone
         (month (elt now 4))
         (year (elt now 5))
         (dst (elt now 7))
         (zone (elt now 8))
;;; construct the 8th of the month, which is the earliest possible GTALUG date
         (eighthday (encode-time 0 0 0 8 month year zone))
;;; decode it…
         (eighth-decoded (decode-time eighthday))
;;; Grab the day of the week…
         (eighth-dow (elt eighth-decoded 6))
;;; How many days until the next tuesday???
          (mod (- (+ 9 eighth-dow)) 6))
         (gtalug-tuesday (+ (elt eighth-decoded 3) days-to-tuesday)))
  (<= day gtalug-tuesday)))
(defun gtalug-month-label ()
  (let* ((now (decode-time)) ;;; take today
         (month (elt now 4))
         (year (elt now 5))
         (is-before-gtalug (before-gtalug now)))
      (if is-before-gtalug
        (format-time-string "GTALUG Q&A Topics for %B %Y"
                            (encode-time 0 0 0 1 month year))
        (if (= month 12) ;;; if december, then shift to next year
            (format-time-string "GTALUG Q&A Topics for %B %Y"
                                (encode-time 0 0 0 1 1 (+ year 1)))
(setf gtalug-month-label "")
(defun set-gtalug-month-label ()
   (setf gtalug-month-label (gtalug-month-label))
   (setq org-capture-templates
      `(("a" "Afilias" entry (file+headline "~/GitConfig/OrgDiary/" "Afilias")
         "* %?\nEntered on %U\n %i\n WhereWasI:%a")
        ("g" "GTALUG" entry (file+headline "~/GitConfig/OrgDiary/"
      "* %?\nEntered on %U")
      ("n" "Note" entry (file+olp+datetree "~/GitConfig/OrgDiary/")
       "* %?\nEntered on %U\n %i\n WhereWasI:%a"))))

;;; Set a timer to re-evaluate the template about once a day
(run-at-time "1 sec" (* 3600 24) #'set-gtalug-month-label)

Emacsconf 2019

Operated at, this conference on “all matters Emacs” went quite well; I was very pleased to have noticed it a couple of weeks beforehand.

They had some struggles publishing video; whomever it was that had the idea of pre-recording the lightning talks was really onto something, as that gave them material to present whilst getting the glitches dealt with. Hopefully some lessons were gleaned from the struggles so that the organizers do not wind up prematurely aged 🙂

The other thing that was a fantastic thing was the “Pad” where they collected a stream of comments. In the world of social media, this sort of collection seems to head into wildly awful places. But this particular comment stream was sheer gold, collecting sets of URLs and viewers’ notes that were somewhat better than the notes I was trying to take, and which collected URLs, questions, and answers.

Actually, in going back and looking, the talk on “Emacs as My Go To Scripting Language” led to adding a discussion on the Pad on a wide set of generative approaches to building regular expressions (for an overview of ideas, see ) which was a thought-provoking addition that wasn’t remotely part of the talk. It’s a nice sort of equivalent to the in-person “Hall Discussions Track” that is often the best part of a conference.

Many thanks to the organizers, I hope they have recovered! 🙂

Trying Out org2blog

Hmm. Let’s see how works.

It requires xml-rpc.el; el-get knows about that… Splendid!

I can login to my blog… It takes a very little bit of URL surgery to figure out the apropos URL…

I think I overdid the default categories, but that’s not a huge problem.

Now, let’s see if it’ll publish the entry…

Hey, that worked fine! Cool, I can publish blog entries without looking for my web browser. Now, let’s see if I can get it to stow the password for my website in the encrypted .authinfo file that Emacs likes…

Nope, the .authinfo extension is a Gnus thing, so that possibly goes further than we can readily get. But the author’s amenable to taking a peek at it :-).

Gnus, Dovecot, OfflineIMAP

This is a followup, effectively, to Roland Mas’ article Gnus, Dovecot, OfflineIMAP, search: a HOWTO .

I went thru Roland’s HOWTO, and have a few comments on variances that I noticed:

  1. I first installed OfflineIMAP; this worked pretty much fine as described. I didn’t bother adding the extra Python code for propagating Gnus expiry material, as I generally don’t use it.
  2. I had a couple problems setting up Dovecot:
    1. By default, Dovecot uses Maildir++ folder handling, which isn’t consistent with how OfflineIMAP stores folders.There’s an additional option needed to cope with this:
      mail_location = maildir:~/Maildir:LAYOUT=fs
    2. Perhaps because of the above, I couldn’t readily get Gnus to talk over a pipe to a Dovecot process.Not a big deal – I have Gnus speak to Dovecot via talking to the socket, which is the usual thing one would do with Dovecot anyways.
  3. It seems to me as though Gnus should be able to talk directly to Maildir. It does, after all, have a protocol for it (nnmaildir).I couldn’t struggle my way thru the Gnus documentation to properly set up a virtual server for nnmaildir to do this.

    This would be pretty valuable in that it would eliminate the need for Dovecot altogether. Perhaps it’s a documentation problem that nobody seems to know how to do this.