about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-01-04 08:31:37 -0600
committerCase Duckworth2022-01-04 08:31:37 -0600
commit5be29d6b25a5d23a71e26eb8549d06ae2a092dac (patch)
tree3ac6b8db67fe8e900743fc453696b0d10b275dba /lisp
parentShow agenda in the current window (diff)
parentAdd +crux.el (diff)
downloademacs-5be29d6b25a5d23a71e26eb8549d06ae2a092dac.tar.gz
emacs-5be29d6b25a5d23a71e26eb8549d06ae2a092dac.zip
Merge branch 'bankruptcy8' of https://tildegit.org/acdw/emacs into bankruptcy8
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+crux.el46
-rw-r--r--lisp/+setup.el25
-rw-r--r--lisp/acdw.el6
3 files changed, 52 insertions, 25 deletions
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 @@
1;;; +crux.el -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(require 'crux)
6
7(defgroup +crux nil
8 "Extra crux customizations."
9 :group 'crux
10 :prefix "+crux-")
11
12(defun +crux-kill-ring-save (begin end arg)
13 "Copy region to the kill-ring, possibly indenting it first.
14Copy from BEGIN to END using `kill-ring-save' if no argument was
15passed, or with `crux-indent-rigidly-and-copy-to-clipboard' if
16one was."
17 (interactive "r\nP")
18 (call-interactively (if arg #'kill-ring-save
19 #'crux-indent-rigidly-and-copy-to-clipboard)))
20
21(defcustom +crux-default-date-format "%c"
22 "Default date format to use for `+crux-insert-date-or-time'.
23Should be a format parsable by `format-time-string'."
24 :type 'string)
25
26(defcustom +crux-alternate-date-format "%FT%T%z"
27 "Alternate date format to use for `+crux-insert-date-or-time'.
28Should be a format parsable by `format-time-string'."
29 :type 'string)
30
31(defun +crux-insert-date-or-time (arg)
32 "Insert current date or time.
33Called without a prefix ARG, insert the time formatted by
34`+crux-default-date-format'. When called with \\[universal-argument],
35format the time with `+crux-alternate-date-format'. Otherwise,
36prompt for the time format."
37 (interactive "*P")
38 (let ((time (current-time)))
39 (insert (cond
40 ((null arg) (format-time-string +crux-default-date-format time))
41 ((eq (car-safe arg) 4)
42 (format-time-string +crux-alternate-date-format time))
43 (t (format-time-string (read-string "Time Format: ") time))))))
44
45(provide '+crux)
46;;; +crux.el ends here
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 @@
24(require 'setup) 24(require 'setup)
25(require 'straight) 25(require 'straight)
26 26
27;; I don't like the "magic" `setup' performs to ensure a symbol is a
28;; function in `:global', `:bind', `:hook', `:hook-into', and others.
29;; So here, I'll just make it return the symbol unmodified.
30(el-patch-feature setup)
31(with-eval-after-load 'setup
32 (el-patch-defvar
33 (el-patch-add setup-ensure-function-inhibit nil
34 "Whether to inhibit `setup-ensure-function'."))
35 (el-patch-defun setup-ensure-function (sexp)
36 (el-patch-concat
37 "Attempt to return SEXP as a quoted function name."
38 (el-patch-add
39 "\nIf `setup-ensure-function-inhibit' is non-nil, just return SEXP."))
40 (el-patch-wrap 3 0
41 (if (and setup-ensure-function-inhibit
42 (not (eq sexp (setup-get 'mode))))
43 sexp
44 (cond ((eq (car-safe sexp) 'function)
45 sexp)
46 ((eq (car-safe sexp) 'quote)
47 `#',(cadr sexp))
48 ((symbolp sexp)
49 `#',sexp)
50 (sexp))))))
51
52(setup-define :face 27(setup-define :face
53 (lambda (face spec) 28 (lambda (face spec)
54 `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) 29 `(custom-set-faces '(,face ,spec 'now "Customized by `setup'.")))
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
83 (funcall function) 83 (funcall function)
84 (add-hook 'after-init-hook function))) 84 (add-hook 'after-init-hook function)))
85 85
86(defun +remember-prefix-arg (p-arg P-arg)
87 "Display prefix ARG, in \"p\" and \"P\" `interactive' types.
88I keep forgetting how they differ."
89 (interactive "p\nP")
90 (message "p: %S P: %S" p-arg P-arg))
91
86(provide 'acdw) 92(provide 'acdw)
87;;; acdw.el ends here 93;;; acdw.el ends here