A blog about everything by Jack Baty

Tag: Emacs

Grab the weather forecast using weatherapi.com

I like to record the weather in my journals. For several years, I’ve used https://wttr.in via curl. Recently, wttr is often unreachable or throws errors, so I took a look at weatherapi.com

Designed for developers by developers, Weather API is the ultimate weather and geolocation API

The free account limits are generous, so I created an account. The default JSON results are very thorough. I created a little shell script that uses jq to parse the JSON and returns only the high/low temps and a text summary of the forecast:

# Jack Baty, 2023 (https://baty.net)


curl -s "https://api.weatherapi.com/v1/forecast.json?key=MYAPIKEY&q=MYZIPCODE&days=1&aqi=no&alerts=no" > $weatherfile

condition=`${jq} -r .forecast.forecastday[0].day.condition.text ${weatherfile}`
high=`${jq} -r .forecast.forecastday[0].day.maxtemp_f ${weatherfile}`
low=`${jq} -r .forecast.forecastday[0].day.mintemp_f ${weatherfile}`

echo "Low ${low}, High ${high} - ${condition}"

The output looks like this:

Low 52.1, High 72.6 – Patchy rain possible

Easy enough. I wrote a small lisp function that calls the script and inserts the weather in Emacs:

(defun jab/insert-forecast ()
"Use weatherapi.com to insert the weather forecast at point"
(let ((w (shell-command-to-string "~/bin/getweather")))
(insert w)))

RSS feeds as emails using Notmuch and rss2email

I’m all-in with Emacs after once again failing to get along with Obsidian.

I’d stopped using Notmuch in Emacs for email, but I brought it back after re-reading Paul Ford’s article in Wired: I Finally Reached Computing Nirvana.

Could I too start storing things as email and find them later using Notmuch?

So far, I’ve solved RSS feeds. Rather than reading feeds in NetNewsWire or Elfeed, I’m using rss2email to convert RSS feeds to emails and reading them in Notmuch.

A good reference for getting started with rss2email is LinuxBabe’s How to Install and Use rss2email on Ubuntu

The tricky part of rss2email is actually sending the emails. I eventually got things working using msmtp, which would have been fine, but it’s a lot of extra hoohah. If only I could save the RSS items directly into Notmuch. Guess what, I can!

rss2email supports writing to Maildir files. It was as easy as adding the following to my rss2email config:

email-protocol = maildir
maildir-path = ~/Mail/Baty.net
maildir-mailbox = Feeds

rss2email supports importing OPML files, but I decided to clean things up and add feeds one at a time, like this:

r2e add BatyBlog https://baty.blog/feed.rss

Then, when I want to read my feeds I run r2e run and everything ends up right in Notmuch. I don’t want them tagged with “inbox” along with my real email, so I added a filter to the post-new hook in Notmuch.

notmuch tag +feed -inbox -- '(from:jack+rss@baty.net)'

I have the rss2email sender configured as jack+rss@baty.net so it’s easy to filter just those messages. With that hook, new RSS feed items do not appear in the inbox, but I can easily read them in Notmuch by searching for tag:feed AND tag:unread.

So there, I’ve moved my RSS feeds into emails and manage them via Notmuch.

Hiding scheduled TODO items in Org-mode

Many of my TODO items in Org-mode include a SCHEDULED property, which lets me ignore them until a specified date in the future. This keeps my Org agenda nice and tidy.

Something that always bugged me is that this worked fine in the Agenda, but not the global TODO list. It finally bothered me enough that I went looking for a solution, which I found in like twenty seconds:

(setq org-agenda-tags-todo-honor-ignore-options t)

Now, my global TODO lists don’t include future items. This is great.

One other thing I learned is that some of the ignore options take a numeric value. This means that I can set org-agenda-todo-ignore-deadlines to something like 7 and those items with a deadline more than a week out, don’t show up in global TODO lists.

org-agenda-skip-scheduled-if-done t
org-agenda-skip-deadline-if-done t
org-agenda-todo-ignore-scheduled 'future
org-agenda-todo-ignore-deadlines 7

Org-mode is cool.

Org-journal stays

My org journal. September.

I’ve been keeping a journal using Org-journal in Emacs since 2016. I’ve got the writing process nailed. I’ve configured it so that with just a few keystrokes I can export it to a nice PDF file every month for archiving and printing. I have no complaints.

The looming problem is that I can feel myself pulling away from using Emacs for everything. Org-mode uses the most powerful markup language and tooling there is, but I haven’t been feeling the need for such powerful features. I just want simple, uncomplicated tooling that doesn’t lend itself to endless fiddling. Emacs is the granddaddy of endless fiddling.

Org-mode does task management better than anything, but I’m perfectly happy with Things or OmniFocus or even Apple Reminders. Email is cool and fun to play with in Emacs, but it’s not easy and definitely too much work.

Objectively, Org-mode’s markup is superior in nearly every way, but if I’m being honest I get along fine with Markdown. As we all know, Markdown’s VHS beat Org-mode’s Beta in the mindshare race, so everything works with Markdown while almost nothing works with Org files1

My latest experiment with Obsidian for notes is going better than with earlier attempts, so one of my heaviest uses of Org-mode, note-taking, is at risk.

But nothing I’ve found is as good at journaling as Org-journal. Day One is pretty and is probably more appropriate, but I don’t like writing in it. I could use Obsidian’s daily notes feature, but I already use that for more of a lab notebook. I just really like using Org-journal, is the thing.

For now, then, my use of Emacs has been reduced to writing my journal and for when a note would benefit from a longer outline format.

  1. Please don’t send me examples proving otherwise. I know about them. ↩︎

Powered by WordPress & Theme by Anders Norén