Add advice to kill lines and join

This commit is contained in:
Case Duckworth 2021-04-21 11:50:18 -05:00
parent 71d2664f23
commit b51bf89f7a
1 changed files with 13 additions and 2 deletions

15
init.el
View File

@ -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 ()