June 2nd 2026 - Things I Worked On

Added blog function to copy all the headings of a post

This is for Intersting Finds and Things I Worked On posts so I can paste them as a summary in the index. All except the first heading should have the first letter be lowercase.

(defun blog--downcase-first-letter (str)
  "Downcase the first character of STR."
  (if (string-empty-p str)
      str
    (concat (downcase (substring str 0 1))
            (substring str 1))))

(defun blog-copy-subheadings ()
  "Copy all subheadings for use in index summaries into the kill ring."
  (interactive)
  (let* ((headings (org-map-entries
                    (lambda () (org-get-heading t t t t))
                    "LEVEL=2")))
    (if headings
        (let* ((first (car headings))
               (rest (mapcar #'blog--downcase-first-letter (cdr headings)))
               (final-list (cons first rest))
               (output (concat (string-join final-list ", ") ".")))
          (kill-new output))
      (message "No subheadings found."))))