Finish the Quelpa conversion
This commit is contained in:
parent
30aa4e5844
commit
def29a38bc
12 changed files with 217 additions and 11 deletions
|
|
@ -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]].
|
||||
|
||||
|
|
|
|||
31
elisp/evennia-mode.el
Normal file
31
elisp/evennia-mode.el
Normal file
|
|
@ -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 <http://gitlab.com/howardabrams>
|
||||
;; 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)
|
||||
101
elisp/ob-evennia.el
Normal file
101
elisp/ob-evennia.el
Normal file
|
|
@ -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 <http://gitlab.com/howardabrams>
|
||||
;; 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 "<f6>") '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)
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
8
snippets/org-mode/expect-src-block
Normal file
8
snippets/org-mode/expect-src-block
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: expect
|
||||
# key: <x
|
||||
# --
|
||||
#+BEGIN_SRC tcl
|
||||
send "$1\n"
|
||||
expectit "$0"
|
||||
#+END_SRC
|
||||
20
snippets/org-mode/org-bibtex-article-reference
Normal file
20
snippets/org-mode/org-bibtex-article-reference
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: org-bibtex-article-reference
|
||||
# key: <ra
|
||||
# --
|
||||
|
||||
* $1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: ${1:$(downcase (string-replace " " "-" yas-text))}
|
||||
:TITLE: $1
|
||||
:BTYPE: article
|
||||
:AUTHOR: $2
|
||||
:JOURNAL: $3
|
||||
:VOLUME: $4
|
||||
:NUMBER: $5
|
||||
:YEAR: $6
|
||||
:MONTH: $7
|
||||
:END:
|
||||
|
||||
Accessed `(format-time-string "%d-%B-%Y")`
|
||||
$0
|
||||
16
snippets/org-mode/org-bibtex-book-reference
Normal file
16
snippets/org-mode/org-bibtex-book-reference
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: org-bibtex-book-reference
|
||||
# key: <rb
|
||||
# --
|
||||
* $1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: ${1:$(downcase (string-replace " " "-" yas-text))}
|
||||
:TITLE: $1
|
||||
:BTYPE: book
|
||||
:AUTHOR: $2
|
||||
:YEAR: $3
|
||||
:PUBLISHER: $4
|
||||
:END:
|
||||
|
||||
Accessed `(format-time-string "%d-%B-%Y")`
|
||||
$0
|
||||
15
snippets/org-mode/org-bibtex-online-reference
Normal file
15
snippets/org-mode/org-bibtex-online-reference
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# key: <ro
|
||||
# name: org-bibtex-online-reference
|
||||
# --
|
||||
* $1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: ${1:$(downcase (string-replace " " "-" yas-text))}
|
||||
:TITLE: $1
|
||||
:AUTHOR: $2
|
||||
:BTYPE: misc
|
||||
:YEAR: ${3:`(format-time-string "%Y")`}
|
||||
:URL: $6
|
||||
:NOTE: Online; accessed `(format-time-string "%d-%B-%Y")`
|
||||
:END:
|
||||
|
||||
$0
|
||||
17
snippets/org-mode/org-bibtex-wikipedia-reference
Normal file
17
snippets/org-mode/org-bibtex-wikipedia-reference
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# key: <rw
|
||||
# name: org-bibtex-wikipedia-reference
|
||||
# --
|
||||
|
||||
* $1
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: wiki-${1:$(downcase (string-replace " " "-" yas-text))}
|
||||
:TITLE: $1 --- Wikipedia, The Free Encyclopedia
|
||||
:AUTHOR: ${2:Wikipedia contributors}
|
||||
:BTYPE: misc
|
||||
:YEAR: ${3:`(format-time-string "%Y")`}
|
||||
:URL: ${4:https://en.wikipedia.org/w/index.php?title=${1:$(string-replace " " "_" yas-text)}&oidid=$5}
|
||||
:NOTE: Online; accessed `(format-time-string "%d-%B-%Y")`
|
||||
:END:
|
||||
|
||||
See https://en.wikipedia.org/wiki/Special:CiteThisPage
|
||||
$0
|
||||
|
|
@ -221,7 +221,7 @@ The [[https://github.com/zsh-users/zsh-syntax-highlighting][ZShell Syntax Highli
|
|||
Using the =colorize= plugin (see [[Plugins][plugins section below]]), we customize with this variable setting:
|
||||
|
||||
#+BEGIN_SRC zsh
|
||||
export ZSH_COLORIZE_STYLE="coffee"
|
||||
export ZSH_COLORIZE_STYLE="github-dark"
|
||||
#+END_SRC
|
||||
|
||||
While we are at it, let’s make it easier to read the =ls= output:
|
||||
|
|
|
|||
Loading…
Reference in a new issue