A blog about everything, by Jack Baty

Converting Markdown to Org-mode syntax in current buffer

There are some great tools for bringing web content into Markdown files, but few that offer the same utility for Org-mode (Orgdown) files.

For example, I use Markdownload extension all the time. It works great with nearly every site I use it on, but instead of Markdown, I’d prefer having Org syntax, so I’ve worked around it by creating a function ((I may have copied this idea from somewhere but I don’t have a reference. If it was you, I apologize for not giving credit. Send me a note! )) which converts the current region from Markdown to Org.

(defun jab/md-to-org-region (start end)
  "Convert region from markdown to org, replacing selection"
  (interactive "r")
  (shell-command-on-region start end "pandoc -f markdown -t org" t t))

I copy the Markdown from the Markdownload window, paste it into an Org buffer, and run the function. It’s not perfect, but until someone creates an Orgdownload” extension, it’ll do. (Pretty please, will someone create an Orgdownload extension?)

My first real AI moment

I’m a latecomer to AI, but I just had my first real AI revelation moment while using OpenAI’s ChatGPT. I asked it an honest question that I had and got a complete, sensible, and correct answer. It’s like if Google had a brain, or if I asked an assistant to look something up for me and report back. Here’s part of the thread:

Me, chatting with a computer about EmacsMe, chatting with a computer about Emacs

Can you imagine where this leads? I didn’t really get it, until having the above conversation. I’d love being in high school right now. It’s like being in that brief period where calculators were still rare, so having one was like cheating. AI feels like cheating, in a good way.

This feels like the first time I dragged and resized a filled shape in MacPaint on my Macintosh Plus. Or the first time I pinched-to-zoom on the original iPhone.

Keeping my Org Agenda updated based on Denote keywords

I’ve recently switched from using Org-roam to using Denote for my notes. Org-roam is powerful and cool, but I prefer the more straightforward approach of Denote.

I keep all my notes in Denote, including notes about current projects. For example, we’re planning to remodel our kitchen. This is a project and so I have a Denote file named 20221130T130143–kitchen-remodel-2023__house_project.org”. In this file, I keep a list of TODOs. In order to see these TODOs in my Org Agenda, I need to add the file to org-agenda-files. This can be done a few ways, but all are manual. I am forgetful, so I wanted a more automated way to keep my org-agenda-files up to date with Denote projects.

David of System Crafters created a video about hacking Org-roam containing something like what I was looking for in the show notes, but for Org-roam not Denote.

I took the idea and implemented it for Denote instead. All it does is search denote-directory for files with a specific pattern and append the results to my default list of org-agenda-files. It looks like this:

;; Add all Denote files tagged as "project" to org-agenda-files
(defun jab/denote-add-to-agenda-files (keyword)
  "Append list of files containing 'keyword' to org-agenda-files"
  (interactive)
  (jab/init-org-agenda-files) ;; start over
  (setq org-agenda-files (append org-agenda-files (directory-files denote-directory t keyword))))

(jab/denote-add-to-agenda-files "_project")

That’s it. Now I can keep my project TODOs in the project Org files and view them in the Agenda. You’ll notice that there’s nothing in there that actually depends on Denote. It’s all just basic Emacs stuff. That’s one of the reasons I love Denote so much; even I can riff off it. I haven’t found a good way to add newly-created project files to the agenda without reloading Emacs or calling the function manually, but I’ll get to that later.

Later: Protesilaos Stavrou (known as Prot”), the author of Denote, was kind enough to send me the following code for helping automatically maintain the list of org-agenda-files…

    (defvar my-denote-to-agenda-regexp "_project"
      "Denote file names that are added to the agenda.
    See `my-add-denote-to-agenda'.")

    (defun my-denote-add-to-agenda ()
      "Add current file to the `org-agenda-files', if needed.
    The file's name must match the `my-denote-to-agenda-regexp'.

    Add this to the `after-save-hook' or call it interactively."
      (interactive)
      (when-let* ((file (buffer-file-name))
                  ((denote-file-is-note-p file))
                  ((string-match-p my-denote-to-agenda-regexp (buffer-file-name))))
        (add-to-list 'org-agenda-files file)))

    ;; Example to add the file automatically.  Uncomment it:

    ;; (add-hook 'after-save-hook #'my-denote-add-to-agenda)

    (defun my-denote-remove-from-agenda ()
      "Remove current file from the `org-agenda-files'.
    See `my-denote-add-to-agenda' for how to add files to the Org
    agenda."
      (interactive)
      (when-let* ((file (buffer-file-name))
                  ((string-match-p my-denote-to-agenda-regexp (buffer-file-name))))
        (setq org-agenda-files (delete file org-agenda-files))))

This works great. Thanks, Prot!

How I’m feeling about large format film photography

Self-portrait. Linhof Master TechnikaSelf-portrait. Linhof Master Technika

The short version is that I have a love/hate relationship with large format film photography.

I love the detail and depth. I love the tonal values and focus fall-off that seem impossible with smaller formats. I love that I can decide on a frame-by-frame basis what film, developer, or process I’m going to use. There’s no waiting until the end of a roll. It’s as close to instant gratification as one can get when shooting film. I love the big negatives!

On the other hand, everything else about large format is a pain in the ass. I thought I’d do studio and environmental portraits when I bought my first 4×5 camera in 2013. I admire the portrait work of photographers like Judy Dater and Judith Joy Ross who worked primarily with large formats. It turns out I’ve only done a handful, and most of them are self-portraits. An example…

Self-portrait. Linhof Master TechnikaSelf-portrait. Linhof Master Technika

When they work, they really work. There’s nothing like it. But when they don’t, it just ends up being a giant waste of time and money. My hit” rate is pretty low, so the net result is that I get very few images that I love and a lot more that are mediocre or worse.

And then there’s all the supporting gear needed. Loupes and dark cloths and tripods and hoods and releases and bags and film holders. Not to mention that printing 4×5 film requires a ginormous enlarger.

Film is expensive, large format film is more expensive. Per exposure prices are hovering around $2.25 for black and white and $5.50 for color. Then there’s all the gear for processing 4×5 sheets.

The more I think about it, the more I wonder if it’s all worth it. I guess if I could have a permanent studio with a camera mounted and ready to go, it would be easier to justify all the fuss. But setup and teardown introduces so many opportunities for failure that I’m less and less likely to bother.

Maybe one day I’ll decide it’s worth the trouble, but right now I’m thinking of leaving large format film photography behind.

When I feel the urge for smooth, high-detail film photography, I think that medium format (120) and the Hasselblad will do just fine, and without nearly as much fuss.

Calm Technology

I’m overwhelmed by social media right now. Visiting Twitter just makes me anxious because it’s become an even bigger shit-show and all anyone can talk about is how much of a shit-show it is.

And Mastodon is almost worse, since the only topics there right now seem to be the Twitter shit-show (but everyone calls it birdsite” for whatever stupid reason) or how Mastodon is or isn’t confusing or is or isn’t racist or else over-explaining what the fediverse” means to the future of the internet.

Everyone is just so breathy and I’m exhausted by all of it.

So, instead, I’ve been writing journal entries on my blog, updating my wiki, and sitting at my writing desk with a pen and a notebook. It’s the latter of these things that brings me a nice sort of calm. It’s not really even technology but it’s where I increasingly wish to spend my time.

Printing web pages

In 2020 I wrote,

I no longer try to read longer-form articles right away. I instead send them to Instapaper and, after a day or two, review the inbox, delete the ones I no longer care about, and print the ones I do.

Reading Long-Form Web Articles By Printing Them First

I still print web pages for later reading, but I’ve updated the way it works.

I’ve replaced Instapaper with Zotero as my read later service. Zotero is overkill for this, but it’s free, local, and makes the articles I save usable as references if needed.

When I’ve found an article that I want to print and read, I visit the page and use the excellent Markdownload web clipper extension. Markdownload grabs the meat of the article, converts the HTML to Markdown, and (optionally) adds front matter and metadata to the document. Here’s an example:

---
created: 2022-11-12T08:40:29
source: https://www.wired.com/story/tweet-dying-revolutionary-internet/
author: Paul Ford
documentclass: scrartcl
classoption:
- twocolumn
---

# A Tweet Before Dying | WIRED
source: ([www.wired.com](https://www.wired.com/story/tweet-dying-revolutionary-internet/))

> ## Excerpt
> The revolutionary internet is over, and we don’t have much to show for it. A new start is out there, somewhere.

---
i find it a good philosophical exercise to imagine the last tweet. It could come centuries hence, when a cryptobot offers a wistful adieu to another cryptobot, or in 2025, when Donald Trump, the newly ...

I add the documentclass and classoption front matter manually. These options are used by my pandoc template1 when converting the Markdown file to PDF using Pandoc. The rest is handled automatically by the extension.

Once I have the Markdown file, I convert it to PDF either via a BBEdit script or pandoc-mode in Emacs.

Here’s what the PDF looks like:

Screenshot of printed outputScreenshot of printed output

After that, it’s off to the printer.

Admittedly, the setup for this took me some time, but now that the hard part is done I can go from web page to a typographically beautiful printed document in about a minute. It’s been totally worth it.


  1. My template is just a slightly modified version of the one that comes by default with Pandoc.↩︎

It’s never the photos one expects to like

I took the above photo while waiting for a friend to arrive at the restaurant and I love it.

It’s a film photo. It’s slightly misfocused. It’s boring. But still, I keep looking at it. I made an 8×10 darkroom print that I’ll probably mount and hang.

What is it about photos like this that I like so much? Honestly, I don’t know, but I expect that it’s all about what it represents to me. The photo in the restaurant, for example, reminds me of friends. And of my favorite restaurant. And my favorite Ultimate” margarita. It may not be art, but it’s meaningful to me, and that’s become the most important part.

Sunsetting the Canonet

This is probably the last roll I’ll run through the Canonet. I can’t seem to focus it and I don’t trust the shutter speeds. Also, it has scratched a couple of negatives and the frame spacing is all over the place. It’s a nice camera to look at, so that’s how it’ll spend its remaining days.

Here are a few more from that last roll. I told you I can’t focus it.

Fancy Graphs are Fancy

All I think when I see posts like this is, So? To what end?”

“5 months results. logseq keeps logging and meaning emerges naturally.” (@hillsmao)“5 months results. logseq keeps logging and meaning emerges naturally.” (@hillsmao)

I’m sure some people actually derive value from these graphs, but I also suspect that many just get a kick out of looking at them. Nothing wrong with that, but it’s not Knowledge. It’s barely even information.

Alan Moore on comics

Watchmen author Alan Moore: I’m definitely done with comics’:

I said round about 2011 that I thought that it had serious and worrying implications for the future if millions of adults were queueing up to see Batman movies. Because that kind of infantilisation — that urge towards simpler times, simpler realities — that can very often be a precursor to fascism.

And this:

Hundreds of thousands of adults [are] lining up to see characters and situations that had been created to entertain the 12-year-old boys — and it was always boys — of 50 years ago. I didn’t really think that superheroes were adult fare.