summary refs log tree commit diff stats
path: root/lisp/+crux.el
diff options
context:
space:
mode:
authorCase Duckworth2022-10-17 21:41:28 -0500
committerCase Duckworth2022-10-17 21:41:28 -0500
commitaab5bfd074e57d06a79e39d7c7c4760e1f385a06 (patch)
tree7b111190a44458a970355f7a327cc5278c850293 /lisp/+crux.el
parentasoi (diff)
downloademacs-aab5bfd074e57d06a79e39d7c7c4760e1f385a06.tar.gz
emacs-aab5bfd074e57d06a79e39d7c7c4760e1f385a06.zip
Bankruptcy 9
Diffstat (limited to 'lisp/+crux.el')
-rw-r--r--lisp/+crux.el58
1 files changed, 0 insertions, 58 deletions
diff --git a/lisp/+crux.el b/lisp/+crux.el deleted file mode 100644 index c55a0b9..0000000 --- a/lisp/+crux.el +++ /dev/null
@@ -1,58 +0,0 @@
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
19 #'crux-indent-rigidly-and-copy-to-clipboard
20 #'kill-ring-save))
21 (pulse-momentary-highlight-region begin end))
22
23(defcustom +crux-default-date-format "%c"
24 "Default date format to use for `+crux-insert-date-or-time'.
25Should be a format parsable by `format-time-string'."
26 :type 'string)
27
28(defcustom +crux-alternate-date-format "%FT%T%z"
29 "Alternate date format to use for `+crux-insert-date-or-time'.
30Should be a format parsable by `format-time-string'."
31 :type 'string)
32
33(defun +crux-insert-date-or-time (arg)
34 "Insert current date or time.
35Called without a prefix ARG, insert the time formatted by
36`+crux-default-date-format'. When called with \\[universal-argument],
37format the time with `+crux-alternate-date-format'. Otherwise,
38prompt for the time format."
39 (interactive "*P")
40 (let ((time (current-time)))
41 (insert (cond
42 ((null arg) (format-time-string +crux-default-date-format time))
43 ((eq (car-safe arg) 4)
44 (format-time-string +crux-alternate-date-format time))
45 (t (format-time-string (read-string "Time Format: ") time))))))
46
47(defun +crux-kill-and-join-forward (&optional arg)
48 "If at end of line, join with following; else (visual)-kill line.
49In `visual-line-mode', runs command `kill-visual-line'; in other
50modes, runs command `kill-line'. Passes ARG to command when
51provided. Deletes whitespace at join."
52 (interactive "P")
53 (if (and (eolp) (not (bolp)))
54 (delete-indentation 1)
55 (funcall (if visual-line-mode #'kill-visual-line #'kill-line) arg)))
56
57(provide '+crux)
58;;; +crux.el ends here