From def29a38bc269a651dc1b7fb351c337db2a8d653 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Fri, 16 Oct 2026 10:52:47 -0700 Subject: [PATCH] Finish the Quelpa conversion --- bootstrap.org | 2 +- elisp/evennia-mode.el | 31 ++++++ elisp/ob-evennia.el | 101 ++++++++++++++++++ ha-programming-python.org | 8 +- ha-programming-ruby.org | 4 +- ha-programming.org | 4 +- snippets/org-mode/expect-src-block | 8 ++ .../org-mode/org-bibtex-article-reference | 20 ++++ snippets/org-mode/org-bibtex-book-reference | 16 +++ snippets/org-mode/org-bibtex-online-reference | 15 +++ .../org-mode/org-bibtex-wikipedia-reference | 17 +++ zshell.org | 2 +- 12 files changed, 217 insertions(+), 11 deletions(-) create mode 100644 elisp/evennia-mode.el create mode 100644 elisp/ob-evennia.el create mode 100644 snippets/org-mode/expect-src-block create mode 100644 snippets/org-mode/org-bibtex-article-reference create mode 100644 snippets/org-mode/org-bibtex-book-reference create mode 100644 snippets/org-mode/org-bibtex-online-reference create mode 100644 snippets/org-mode/org-bibtex-wikipedia-reference diff --git a/bootstrap.org b/bootstrap.org index ac778de..93d562c 100644 --- a/bootstrap.org +++ b/bootstrap.org @@ -36,7 +36,7 @@ A literate programming file for bootstraping my Emacs Configuration. * Introduction This file contains all the variable definitions and library loading for the other files in my project. -I'm installing everything using the [[https://github.com/raxod502/straight.el#getting-started][straight.el]] for package installation and management. This is initialization code configured in [[file:initialize][initialize]], and calls to =use-package= now accepts a =:straight= parameter that allows me to retrieve special versions of some packages. +I'm installing everything using the [[https://github.com/raxod502/straight.el#getting-started][straight.el]] for package installation and management. This is initialization code configured in [[file:initialize][initialize]], and calls to =use-package= now accepts a =:quelpa= parameter that allows me to retrieve special versions of some packages. See the details in [[https://dev.to/jkreeftmeijer/emacs-package-management-with-straight-el-and-use-package-3oc8][this essay]]. diff --git a/elisp/evennia-mode.el b/elisp/evennia-mode.el new file mode 100644 index 0000000..06c77be --- /dev/null +++ b/elisp/evennia-mode.el @@ -0,0 +1,31 @@ +;;; evennia-mode --- Syntax coloring for Evennia code -*- lexical-binding: t; -*- +;; +;; © 2025 Howard X. Abrams +;; Licensed under a Creative Commons Attribution 4.0 International License. +;; See http://creativecommons.org/licenses/by/4.0/ +;; +;; Author: Howard X. Abrams +;; Maintainer: Howard X. Abrams +;; Created: January 18, 2025 +;; +;; While obvious, GNU Emacs does not include this file or project. +;; +;; *NB:* Do not edit this file. Instead, edit the original literate file at: +;; /Users/howard/src/hamacs/pud.org +;; And tangle the file to recreate this one. +;; +;;; Code: + +(define-derived-mode evennia-mode ruby-mode "Evennia" + "Major mode for editing evennia batch command files. + \\{evennia-mode-map} + Turning on Evennia mode runs the normal hook `evennia-mode-hook'." + (setq-local require-final-newline mode-require-final-newline) + (setq-local comment-start "# ") + (setq-local comment-start-skip "#+\\s-*")) + +;; Add the mode to the auto-mode-alist for specific file extensions +(add-to-list 'auto-mode-alist '("\\.ev\\'" . evennia-mode)) + +;; Provide the mode for use +(provide 'evennia-mode) diff --git a/elisp/ob-evennia.el b/elisp/ob-evennia.el new file mode 100644 index 0000000..4bd2478 --- /dev/null +++ b/elisp/ob-evennia.el @@ -0,0 +1,101 @@ +;;; ob-evennia --- Evennia source blocks in Org -*- lexical-binding: t; -*- +;; +;; © 2025 Howard X. Abrams +;; Licensed under a Creative Commons Attribution 4.0 International License. +;; See http://creativecommons.org/licenses/by/4.0/ +;; +;; Author: Howard X. Abrams +;; Maintainer: Howard X. Abrams +;; Created: January 18, 2025 +;; +;; While obvious, GNU Emacs does not include this file or project. +;; +;; *NB:* Do not edit this file. Instead, edit the original literate file at: +;; /Users/howard/src/hamacs/pud.org +;; And tangle the file to recreate this one. +;; +;;; Code: + +(defun pud-get-all-buffers () + "Return a list of all buffers with a live PUD connection." + (save-window-excursion + (seq-filter (lambda (buf) + (switch-to-buffer buf) + (and + (eq major-mode 'pud-mode) + (get-buffer-process (current-buffer)))) + (buffer-list)))) + +(defun pud-current-world () + "Return buffer based on user choice of current PUD connections." + (let ((pud-buffers (pud-get-all-buffers))) + (cond + ((null pud-buffers) nil) + ((length= pud-buffers 1) (car pud-buffers)) + (t + (completing-read "Choose connection: " + (seq-map (lambda (buf) (buffer-name buf)) + pud-buffers)))))) + +(defun pud-send-string (buf-name text) + "Send TEXT to a comint buffer, BUF-NAME." + (save-window-excursion + (save-excursion + (pop-to-buffer buf-name) + (goto-char (point-max)) + (comint-send-string (get-buffer-process (current-buffer)) + (format "%s\n" text))))) + +(defun pud-send-line (world) + "Send the current line or region to WORLD." + (interactive (list (pud-current-world))) + (unless world + (error "No current MUD connection.")) + + (let ((text (buffer-substring-no-properties + (if (region-active-p) (region-beginning) + (beginning-of-line-text) (point)) + (if (region-active-p) (region-end) + (end-of-line) (point))))) + (pud-send-string world text))) + +(global-set-key (kbd "") 'pud-send-line) + +(defun pud-send-block (world) + "Send the current Org block to WORLD." + (interactive (list (pud-current-world))) + (unless world + (error "No current MUD connection.")) + (let ((text (thread-last (org-element-at-point) + (org-src--contents-area) + (nth 2)))) + (pud-send-string world + (replace-regexp-in-string + (rx (one-or-more space)) " " text)))) + +(require 'ob) + +(defvar org-babel-default-header-args:evennia '()) + +(defun org-babel-execute:evennia (body params) + "Execute evennia BODY. + + PARAMS can contain the following: + :session - The buffer to send the block + + Called by `org-babel-execute-src-block'." + (let* ((session (cdr (assq :session params))) + (buffer (or session (pud-current-world)))) + (if session + (setq buffer (format "*%s*" session))) + + (pud-send-string buffer + (replace-regexp-in-string + (rx (one-or-more space)) " " body)) + (message "No connected world."))) + +(defun org-babel-prep-session:evennia (_session _params) + "Signal error; Evennia does not (currently) support sessions." + (error "Evennia sessions are nonsensical")) + +(provide 'ob-evennia) diff --git a/ha-programming-python.org b/ha-programming-python.org index c9afb10..68a00f9 100644 --- a/ha-programming-python.org +++ b/ha-programming-python.org @@ -3,8 +3,6 @@ #+date: 2021-11-16 #+tags: emacs python programming -import re - A literate programming file for configuring Python. #+begin_src emacs-lisp :exports none @@ -66,7 +64,7 @@ Instead of memorizing all the Emacs-specific keybindings, we use [[https://githu "Entirety" (("f" python-shell-send-file "File") ("b" python-shell-send-buffer "Buffer") - ("r" elpy-shell-send-region-or-buffer "Region")))) + ("r" python-shell-send-region "Region")))) (pretty-hydra-define python-refactor (:color blue :quit-key "C-g" :title ha-python-refactor-title) @@ -355,7 +353,7 @@ The built-in Eglot package natively supports [[https://github.com/Microsoft/pyri #+begin_src emacs-lisp (use-package eglot - :straight nil + :quelpa (:type built-in) :after python :defer t :hook (python-mode . eglot-ensure) @@ -370,7 +368,7 @@ Keybindings for the eglot-based LSP sub-menu, wired into the existing =python-mo (defvar ha-python-lsp-title (font-icons 'faicon "python" :title "Python LSP")) (use-package eglot - :straight nil + :quelpa (:type built-in) :after major-mode-hydra :config (pretty-hydra-define python-lsp (:color blue :quit-key "q" diff --git a/ha-programming-ruby.org b/ha-programming-ruby.org index 477d518..1dee17d 100644 --- a/ha-programming-ruby.org +++ b/ha-programming-ruby.org @@ -268,7 +268,7 @@ The built-in Eglot package natively supports [[https://github.com/castwide/solar #+begin_src emacs-lisp (use-package eglot - :straight nil + :quelpa (:type built-in) :after ruby-mode :defer t :hook (ruby-mode . eglot-ensure)) @@ -278,7 +278,7 @@ Keybindings for the eglot-based LSP sub-menu, wired into the =ruby-mode= local l #+begin_src emacs-lisp (use-package eglot - :straight nil + :quelpa (:type built-in) :after ruby-mode :config (ha-local-leader 'ruby-mode-map diff --git a/ha-programming.org b/ha-programming.org index 6ebe8d9..3ec7abb 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -690,7 +690,7 @@ Emacs has two LSP projects, and while I have used [[LSP Mode]], but since I don #+begin_src emacs-lisp (use-package eglot - :straight nil + :quelpa (:type built-in) :commands eglot-ensure :config (setq eglot-autoshutdown t)) @@ -701,7 +701,7 @@ The [[https://github.com/flycheck/flycheck-eglot][flycheck-eglot]] package bridg (use-package flycheck-eglot :after (flycheck eglot) :config - (global-flycheck-eglot-mode 1)) + (global-flycheck-eglot-mode -1)) #+end_src ** General Code Editing *** iEdit diff --git a/snippets/org-mode/expect-src-block b/snippets/org-mode/expect-src-block new file mode 100644 index 0000000..a1a548b --- /dev/null +++ b/snippets/org-mode/expect-src-block @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: expect +# key: