From 9b23b33921a2d6eddf09f52dfb429bc053fdbba0 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 12 Apr 2022 13:15:36 -0500 Subject: Add +crux-kill-and-join-forward This one is visual-line-mode aware --- lisp/+crux.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lisp/+crux.el') 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." (format-time-string +crux-alternate-date-format time)) (t (format-time-string (read-string "Time Format: ") time)))))) +(defun +crux-kill-and-join-forward (&optional arg) + "If at end of line, join with following; else (visual)-kill line. +In `visual-line-mode', runs command `kill-visual-line'; in other +modes, runs command `kill-line'. Passes ARG to command when +provided. Deletes whitespace at join." + (interactive "P") + (if (and (eolp) (not (bolp))) + (delete-indentation 1) + (funcall (if visual-line-mode #'kill-visual-line #'kill-line) arg))) + (provide '+crux) ;;; +crux.el ends here -- cgit 1.4.1-21-gabe81