From b51bf89f7a76ec6eb33aa6064c62296870242e64 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 21 Apr 2021 11:50:18 -0500 Subject: Add advice to kill lines and join --- init.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index c2d4b2b..18cc30d 100644 --- a/init.el +++ b/init.el @@ -247,13 +247,24 @@ (tooltip-mode -1) (winner-mode +1) - ;; Bindings + ;;; Bindings (:global "M-SPC" cycle-spacing "M-/" hippie-expand "M-=" count-words "C-x C-b" ibuffer "C-c i" acdw/find-emacs-dotfiles - "C-x k" acdw/kill-a-buffer)) + "C-x k" acdw/kill-a-buffer) + + ;;; Advice + ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. + ;; I can't simply advise `kill-line' with an override from crux because crux + ;; itself calls `kill-line', leading to a infinite nesting situation. + (advice-add 'kill-line :around + (defun acdw/kill-line-and-join-advice (orig &rest args) + "If at end of line, join with following; otherwise kill line." + (if (and (eolp) (not (bolp))) + (delete-indentation 1) + (apply orig args))))) ;; Regular modes (`text-mode', `prog-mode', etc.) (defun acdw/setup-regular-modes () -- cgit 1.4.1-21-gabe81