Monthly review: April 2021

| monthly, review
  • I switched from Wordpress to a static blog.
  • Lots of Emacs tweaks: getting the hang of Lispy, asynchronously tangling and compiling my config, posting to Eleventy.
  • I sewed grow bags for the strawberries and we worked on the garden. It's still a little chilly, so we've been moving plants in and out.
  • I'm still in the stage of reading a gazillion books out loud to A-. I've been sneakily using it as first-letter-of-words steno practice with the hand that's not pointing to what I'm reading, which has the side benefit of slowing my reading down so that it's easier for her to understand things. Mwahaha!
  • I bought a used Maxi Micro scooter for A-. She liked it a lot. I ordered new handles for her, too.
  • A- was excited about the big feathers I bought for use as quills and has been practising with them.
  • We made a couple of cakes because A- wanted to experiment.
  • I worked on a few more long dresses and a couple of fabric flowers for A.
  • We saw a squirrel nest fall. The mama squirrel came back for the baby squirrel.

Blog posts

Sketches

Time

Category Previous month % This month % Diff % h/wk Diff h/wk
A- 44.4 46.7 2.3 76.0 3.8
Personal 4.6 5.3 0.7 8.6 1.1
Discretionary - Play 0.6 0.7 0.1 1.1 0.2
Unpaid work 3.4 3.4 -0.0 5.5 -0.0
Discretionary - Social 0.0 0.0 0.0 0.0 0.0
Discretionary - Family 0.2 0.0 -0.2 0.0 -0.3
Business 1.8 1.0 -0.8 1.6 -1.3
Discretionary - Productive 10.4 9.6 -0.7 15.7 -1.3
Sleep 34.6 33.3 -1.3 54.2 -2.2
View or add comments

2021-04-26 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Hacker News, planet.emacslife.com, YouTube, the Emacs NEWS file and emacs-devel.

View or add comments

Emacs Hydra: Allow completion when I can't remember the command name

| emacs

So it turns out that I'm pretty much zonked after a day with the kiddo and have a hard time remembering keystrokes or speed-reading my Hydra cheat sheets. I want to be able to use M-x-like completion in my Hydra so that I can type a few characters and then maybe see the shortcuts there. Here's what it looks like:

Screenshot_20210425_232535.png

Figure 1: Hydra completion

(defun my/hydra-format-head (h)
  (let ((key-binding (elt h 0))
        (hint (elt h 2))
        (cmd (and (elt h 1) (prin1-to-string (elt h 1)))))
    (if cmd
        (format "%s (%s) - %s" hint key-binding cmd)
      (format "%s (%s)" hint key-binding))))

(defun my/hydra-current-heads-as-candidates ()
  (let ((base (replace-regexp-in-string "/body$" "" (symbol-name hydra-curr-body-fn))))
    (mapcar (lambda (h)
              (cons (my/hydra-format-head h) (hydra--head-name h (intern base))))
            (symbol-value (intern (concat base "/heads"))))))

(defun my/hydra-execute-extended (prefixarg &optional command-name typed)
  (declare (interactive-only command-execute))
  (interactive (let ((execute-extended-command--last-typed nil)
                     (candidates (my/hydra-current-heads-as-candidates)))
                 (hydra-keyboard-quit)
                 (list current-prefix-arg
                       (completing-read "Cmd: " candidates)
                       execute-extended-command--last-typed)))
  (let* ((candidates (my/hydra-current-heads-as-candidates))
         (bind (assoc-default command-name candidates 'string=)))
    (cond
     ((null bind) nil)
     ((hydra--callablep bind) (call-interactively bind)))))

This is how I add it to all my hydras:

(with-eval-after-load 'hydra
  (define-key hydra-base-map (kbd "<tab>") #'my/hydra-execute-extended))

Proooobably works? Very rough. Might be useful for those fuzzy-brain days.

This is part of my Emacs configuration.
View or add comments

Weekly review: Week ending April 23, 2021

| review, weekly
  • I added NODE_ENV=production to some of my Docker images.
  • I fixed some of my blog pages. I replaced my feeds.sachachua.com/sachac, sachac-weekly, and sachac-yearly feeds with redirects to my static feeds.
  • I reviewed a number of my old blog posts.
  • I sewed another long dress for A-.

Blog posts

Time

Category The other week % Last week % Diff % h/wk Diff h/wk
Sleep 30.6 36.1 5.4 60.6 9.1
Unpaid work 1.8 3.0 1.2 5.1 2.0
Business 0.8 1.5 0.8 2.6 1.3
A- 48.8 49.1 0.3 82.5 0.6
Discretionary - Play 0.8 0.9 0.1 1.5 0.1
Personal 4.6 4.4 -0.2 7.3 -0.4
Discretionary - Productive 12.6 5.0 -7.6 8.5 -12.7
View or add comments

2021-04-19 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Hacker News, planet.emacslife.com, YouTube, the Emacs NEWS file and emacs-devel.

View or add comments

Weekly review: Week ending April 16, 2021

| weekly, review
  • I switched my blog from Wordpress to 11ty. I figured out how to post to 11ty from an Org Mode file in the right directory, and I set up redirects for my categories and feeds using an Nginx map.
  • I got org2blog to work with my special blocks. Now I can post with multiple columns.
  • I realized that I'd gotten overexcited about setting the plants out, so I took many of them back in and I put covers on the seedlings still outside.
  • I filed our taxes.

Blog posts

Sketches

Time

Category The other week % Last week % Diff % h/wk Diff h/wk
Discretionary - Productive 8.8 12.6 3.8 21.2 6.3
A- 46.3 48.8 2.5 82.0 4.2
Discretionary - Play 0.8 0.8 0.0 1.3 0.0
Personal 4.6 4.6 -0.1 7.7 -0.1
Business 2.0 0.8 -1.2 1.3 -2.0
Sleep 32.5 30.6 -1.9 51.5 -3.1
Unpaid work 4.9 1.8 -3.1 3.1 -5.2
View or add comments

This is a test post from Org Mode to 11ty

| blogging, org, emacs

At the moment, my Org file needs to be in the proper content directory. I'm planning to copy the way ox-hugo allows me to export to a different directory and export filename. In the meantime, this is a start.

;;; ox-11ty.el --- Eleventy export for Emacs Org Mode  -*- lexical-binding: t -*-

;; Copyright (C) 2021 Sacha Chua

;; Author: Sacha Chua <sacha@sachachua.com>
;; Version: 2.17.0
;; Package-Requires: ((emacs "27"))
;; Keywords: org, eleventy, 11ty
;; Homepage: https://github.com/sachac/ox-11ty

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; A very rough starting point for exporting to 11ty from Org Mode.
;;

;;; Code:

(require 'ox-html)

(defun org-11ty-template (contents info)
  (let* ((date (org-export-data (plist-get info :date) info))
         (title (org-export-data (plist-get info :title) info))
         (permalink (org-export-data (plist-get info :permalink) info))
         (categories (org-export-data (plist-get info :categories) info))
         (collections (org-export-data (plist-get info :collections) info))
         (front-matter (json-encode
                        (list :permalink permalink
                              :date date
                              :title title
                              :categories (split-string categories)
                              :tags (split-string collections)))))
    (format
     "module.exports = class {
  data() {
    return %s;
  }
  render() {
    return %s;
  }
}"
     front-matter
     (json-encode-string contents))))

(defun org-11ty-export-as-11ty (&optional async subtreep visible-only body-only ext-plist)
  "Export current buffer as 11ty file."
  (interactive)
  (org-export-to-buffer '11ty "*org 11ty export*" async subtreep visible-only body-only ext-plist))

(defun org-11ty-export-to-11ty (&optional async subtreep visible-only body-only ext-plist)
  (interactive)
  (let* ((info
          (org-combine-plists
           (org-export--get-export-attributes '11ty subtreep visible-only)
           (org-export--get-buffer-attributes)
           (org-export-get-environment '11ty subtreep)))
         (base-file-name (concat (or
                                  (and (plist-get info :file-name)
                                       (if (string= (file-name-base (plist-get info :file-name)) "")
                                           (concat (plist-get info :file-name) "index")
                                         (plist-get info :file-name)))
                                  (org-export-output-file-name "" subtreep))
                                 ".11ty.js"))
         (file
          (if (plist-get info :base-dir)
              (expand-file-name base-file-name (plist-get info :base-dir))
            base-file-name)))
    (when (file-name-directory file)
      (make-directory (file-name-directory file) :parents))
    (org-export-to-file '11ty file
      async subtreep visible-only body-only ext-plist)))

(org-export-define-derived-backend '11ty 'html
  :menu-entry
  '(?1 "Export to 11ty JS"
       ((?b "As buffer" org-11ty-export-as-11ty) 
        (?1 "To file" org-11ty-export-to-11ty)))
  :translate-alist
  '((template . org-11ty-template))
  :options-alist
  '((:permalink "PERMALINK" nil nil)
    (:categories "CATEGORIES" nil 'split)
    (:base-dir "ELEVENTY_BASE_DIR" nil nil)
    (:file-name "FILE_NAME" nil nil)
    (:collections "ELEVENTY_COLLECTIONS" nil 'split)))

;;; ox-11ty.el ends here

https://github.com/sachac/ox-11ty/

View or add comments