From 43f693d750e0b5d8b1f3ba2a5c37469b004c2027 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 4 Jan 2022 00:39:03 -0600 Subject: Remove el-patch on setup Setup 1.2 (I'm pretty sure) removed the `ensure-function' and `ensure-kbd' functions, instead using an `:ensure' keyword in `setup-define'. This makes it way harder to /not/ ensure things when I don't want them, so I just have to use regular elisp when I want to do something funky. Oh well. --- lisp/+setup.el | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'lisp') diff --git a/lisp/+setup.el b/lisp/+setup.el index ac99c1f..c6bcb9e 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -24,31 +24,6 @@ (require 'setup) (require 'straight) -;; I don't like the "magic" `setup' performs to ensure a symbol is a -;; function in `:global', `:bind', `:hook', `:hook-into', and others. -;; So here, I'll just make it return the symbol unmodified. -(el-patch-feature setup) -(with-eval-after-load 'setup - (el-patch-defvar - (el-patch-add setup-ensure-function-inhibit nil - "Whether to inhibit `setup-ensure-function'.")) - (el-patch-defun setup-ensure-function (sexp) - (el-patch-concat - "Attempt to return SEXP as a quoted function name." - (el-patch-add - "\nIf `setup-ensure-function-inhibit' is non-nil, just return SEXP.")) - (el-patch-wrap 3 0 - (if (and setup-ensure-function-inhibit - (not (eq sexp (setup-get 'mode)))) - sexp - (cond ((eq (car-safe sexp) 'function) - sexp) - ((eq (car-safe sexp) 'quote) - `#',(cadr sexp)) - ((symbolp sexp) - `#',sexp) - (sexp)))))) - (setup-define :face (lambda (face spec) `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) -- cgit 1.4.1-21-gabe81 From 9a48d3bd8b7b03b27a40416ca506fbcc5570b180 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 4 Jan 2022 00:41:00 -0600 Subject: Add +remember-prefix-arg function --- lisp/acdw.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lisp') diff --git a/lisp/acdw.el b/lisp/acdw.el index 43cb5c7..a4e12f1 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -83,5 +83,11 @@ If Emacs is already started, run FUNCTION. Otherwise, add it to (funcall function) (add-hook 'after-init-hook function))) +(defun +remember-prefix-arg (p-arg P-arg) + "Display prefix ARG, in \"p\" and \"P\" `interactive' types. +I keep forgetting how they differ." + (interactive "p\nP") + (message "p: %S P: %S" p-arg P-arg)) + (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81 From 817c0ae001a1ea6cc2775e1e2898931b3ff12d8a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 4 Jan 2022 00:41:12 -0600 Subject: Add +crux.el Oops, missed this with a previous commit --- lisp/+crux.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lisp/+crux.el (limited to 'lisp') diff --git a/lisp/+crux.el b/lisp/+crux.el new file mode 100644 index 0000000..b87ec7e --- /dev/null +++ b/lisp/+crux.el @@ -0,0 +1,46 @@ +;;; +crux.el -*- lexical-binding: t; -*- + +;;; Code: + +(require 'crux) + +(defgroup +crux nil + "Extra crux customizations." + :group 'crux + :prefix "+crux-") + +(defun +crux-kill-ring-save (begin end arg) + "Copy region to the kill-ring, possibly indenting it first. +Copy from BEGIN to END using `kill-ring-save' if no argument was +passed, or with `crux-indent-rigidly-and-copy-to-clipboard' if +one was." + (interactive "r\nP") + (call-interactively (if arg #'kill-ring-save + #'crux-indent-rigidly-and-copy-to-clipboard))) + +(defcustom +crux-default-date-format "%c" + "Default date format to use for `+crux-insert-date-or-time'. +Should be a format parsable by `format-time-string'." + :type 'string) + +(defcustom +crux-alternate-date-format "%FT%T%z" + "Alternate date format to use for `+crux-insert-date-or-time'. +Should be a format parsable by `format-time-string'." + :type 'string) + +(defun +crux-insert-date-or-time (arg) + "Insert current date or time. +Called without a prefix ARG, insert the time formatted by +`+crux-default-date-format'. When called with \\[universal-argument], +format the time with `+crux-alternate-date-format'. Otherwise, +prompt for the time format." + (interactive "*P") + (let ((time (current-time))) + (insert (cond + ((null arg) (format-time-string +crux-default-date-format time)) + ((eq (car-safe arg) 4) + (format-time-string +crux-alternate-date-format time)) + (t (format-time-string (read-string "Time Format: ") time)))))) + +(provide '+crux) +;;; +crux.el ends here -- cgit 1.4.1-21-gabe81