journal
all all entries rss SoML excited dreams runes YRUU ultimate KTRU skate sleepy nihongo
Rob is 20,118 days old today.
prev day next day printable version

Entries this day: dear-r-emacs dear-summer work

dear r emacs

14:23 Saturday 08 July 2017 JST

Dear /r/emacs

I use Emacs to prepare text files that will be processed by a static site generator (Hugo).

The YAML topmatter can include multiple tags, so I would like the option of entering more tags into my file preparation function.

My functions ask me for Title, Tag, and date.. then produce output like this:

---
title: reddit emacs
tags: [ "emacs" ]
author: Rob Nugen
date: 2017-07-08T14:23:30+09:00
---

## 14:23 Saturday 08 July 2017 JST

I would like emacs to keep asking me for tags so it could produce output like this, for example:

---
title: reddit emacs
tags: [ "emacs", "programming", "tag3", "tag4" ]
author: Rob Nugen
date: 2017-07-08T14:23:30+09:00
---

## 14:23 Saturday 08 July 2017 JST

The full code I have so far is here https://gist.github.com/thunderrabbit/b6a3d157fd4a916d23bea75f1d10b58f

You can just save it as ~/.emacs or load it within your .emacs file with

(find-file "~/path/to/file")

The relevant code is here:

(interactive (list
              (read-string "Title: ")
              (read-string "Tag: ")
        )
      )

How can I have emacs keep asking for tags until I enter an empty tag?

18:46 Saturday 08 July 2017 JST

Thank you /u/wasamasa! https://www.reddit.com/r/emacs/comments/6lzpre/use_interactive_list_readstring_to_read_arbitrary/djxuzst/

Easy, write a helper function that constructs such a list:

(defun my-read-tags ()
  (let (tags tag done)
    (while (not done)
      (setq tag (read-string "Tag: "))
      (if (string-empty-p tag)
          (setq done t)
        (push tag tags)))
    (nreverse tags)))

You can then use it in your command:

(defun my-test (title tags)
  (interactive (list (read-string "Title: ") (my-read-tags)))
  (message "%s: %s" title tags))

20:55 Saturday 08 July 2017 JST

Nice.

I tweaked the code a bit and now I have multiple tags per journal entry.

permalink

dear summer

14:28 Saturday 08 July 2017 JST

While preparing to post my question to /r/emacs, the power went off in our house. The circuit breaker flipped. Lin's AC and my computer + monitors are apparently on the same circuit, which seems weird, but I guess it was not the neighborhood losing power.

Oh, so while my computer battery is still fine, I cannot post the post while the router has no power.

14:36 Saturday 08 July 2017 JST

Nevermind. It is the whole house. I am just going to leave it off to save energy.

16:35 Saturday 08 July 2017 JST

The breakerbox has three types of breakers. One type I have never seen before looks like a normal lightswitch, but also features two little buttons near it, red and white. After leaving the power off for a while the first time, Lin pushed the white button and flipped the breaker back on.

Just a moment ago, when she turned her AC on the breaker flipped again. Now (after not waiting as long), when she pushed the white button, the big breaker still won't stay on.

She is calling the company from which we bought the house, who offer 2 years of support, like a maintenance contract.

16:42

Warranty covers different stuff like foundation shifts (earthquakes?)

permalink

work

21:37 Saturday 08 July 2017 JST

Having trouble getting work done for AB. I finished the one thing they wanted done, but cannot seem to figure out the thing I really want to do.

permalink
prev day next day