about summary refs log tree commit diff stats
path: root/lisp/+crux.el
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/+crux.el
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/+crux.el')
-rw-r--r--lisp/+crux.el46
1 files changed, 46 insertions, 0 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