summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-04-12 13:15:36 -0500
committerCase Duckworth2022-04-12 13:15:36 -0500
commit9b23b33921a2d6eddf09f52dfb429bc053fdbba0 (patch)
treeab71a0e5a0b351af306e68a17c7b35e549e54403
parentStart the server if not already (diff)
downloademacs-9b23b33921a2d6eddf09f52dfb429bc053fdbba0.tar.gz
emacs-9b23b33921a2d6eddf09f52dfb429bc053fdbba0.zip
Add +crux-kill-and-join-forward
This one is visual-line-mode aware
-rw-r--r--init.el2
-rw-r--r--lisp/+crux.el10
2 files changed, 11 insertions, 1 deletions
diff --git a/init.el b/init.el index 4ea6f90..ec82d73 100644 --- a/init.el +++ b/init.el
@@ -1288,7 +1288,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
1288 (:global "C-o" #'crux-smart-open-line 1288 (:global "C-o" #'crux-smart-open-line
1289 "C-x 4 t" #'crux-transpose-windows 1289 "C-x 4 t" #'crux-transpose-windows
1290 "M-w" #'+crux-kill-ring-save 1290 "M-w" #'+crux-kill-ring-save
1291 "C-k" #'crux-kill-and-join-forward 1291 "C-k" #'+crux-kill-and-join-forward
1292 "C-c d" #'+crux-insert-date-or-time) 1292 "C-c d" #'+crux-insert-date-or-time)
1293 (crux-with-region-or-buffer indent-region) 1293 (crux-with-region-or-buffer indent-region)
1294 1294
diff --git a/lisp/+crux.el b/lisp/+crux.el index 45b4dee..c55a0b9 100644 --- a/lisp/+crux.el +++ b/lisp/+crux.el
@@ -44,5 +44,15 @@ prompt for the time format."
44 (format-time-string +crux-alternate-date-format time)) 44 (format-time-string +crux-alternate-date-format time))
45 (t (format-time-string (read-string "Time Format: ") time)))))) 45 (t (format-time-string (read-string "Time Format: ") time))))))
46 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
47(provide '+crux) 57(provide '+crux)
48;;; +crux.el ends here 58;;; +crux.el ends here