Skip to content

Instantly share code, notes, and snippets.

View jwiegley's full-sized avatar

John Wiegley jwiegley

View GitHub Profile
;;; -*- lexical-binding: t -*-
(require 'cl-lib)
(let* ((mutex (make-mutex))
(cond-var (make-condition-variable mutex))
waiting
(thread-a
(make-thread
#'(lambda ()

PARA and the value of meaningful distinctions

There have been many trends in the data and task management world, from day planners, to GTD, to bullet journals, to the PARA method – and many more. This article takes a look at PARA in particular, but also pulls back a bit as

@jwiegley
jwiegley / emacs-llvm-jit.diff
Created June 18, 2025 18:46
Initial implementation of a JIT for Emacs bytecode
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 3e79cae4..1db39bae 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -669,7 +669,18 @@ scan_c_file (char *filename, const char *mode)
int extension = filename[strlen (filename) - 1];
if (extension == 'o')
- filename[strlen (filename) - 1] = 'c';
+ {
*Prompt*: Emacs lisp code to sort the first column alphabetically, and delete all columns containing "N/A" in buffer "test.csv". /no_think
*Response*:
Here's an Emacs Lisp script to:
1. Open the buffer =test.csv=.
2. Sort the buffer alphabetically by the *first column*.
3. Delete all rows where *any column contains "N/A"*.
#+begin_src elisp
*Response*:
Here's the Emacs Lisp code to set the *second column (DRAFT)* to =8000= for rows where it's empty:
#+begin_src emacs-lisp
(defun set-draft-column ()
"Set empty DRAFT column to 8000 in current CSV buffer."
(interactive)
(goto-char (point-min))
(forward-line 1) ; Skip header
(while (not (eobp))
(use-package gptel-commit
:no-require t
:after (gptel git-commit)
:preface
(defun my/gptel-commit-summary ()
"Insert a commit message header line in the format I use, followed by a
standard magit (GNU style) changelog.
Don't get the LLM to write the commit message itself, because it's bad
at inferring my intent.
warning: 'show-derivation' is a deprecated alias for 'derivation show'
{
"/nix/store/8y906wkzzx91i4948y4f9x8vs8c6wpxy-libarchive-3.7.8.drv": {
"args": [
"-e",
"/nix/store/vj1c3wf9c11a0qs6p3ymfvrnsdgsdcbq-source-stdenv.sh",
"/nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh"
],
"builder": "/nix/store/p8972c250zr90fph2sgxr71m3ic45xck-bash-5.2p37/bin/bash",
"env": {
(defun synchronous (func)
"Make any asynchronous function into a synchronous one.
FUNC is called with a callback to be called when the asynchronous
function is finished. For example, in the case where make-thread
is used to run a function asynchronously, which when complete,
finishes the synchronous call.
(synchronous
#'(lambda (k)
(make-thread #'(lambda ()
(defun eshell/gptel (&rest args)
(eshell-eval-using-options
"gptel" args
'((?h "help" nil nil "show this usage screen")
(?n "dry-run" nil dry-run "Only show what would happen")
(?m "model" nil model "LLM model to use")
(?s "system" nil system "System prompt to use (optional, can be a symbol)")
(?S "stream" nil stream "Whether to stream the output")
:usage "[OPTION...] [PROMPT]
Send prompt (or context, or both) to an LLM.")
(cl-defstruct (eshell-function-target
(:constructor nil)
(:constructor eshell-function-target-create
(output-function &optional close-function)))
"An Eshell target that calls an OUTPUT-FUNCTION."
output-function close-function)
(defun eshell-exec-lisp (printer errprint func-or-form args form-p)
"Execute a Lisp FUNC-OR-FORM, maybe passing ARGS.
PRINTER and ERRPRINT are functions to use for printing regular