diff options
author | Case Duckworth | 2021-04-21 11:50:18 -0500 |
---|---|---|
committer | Case Duckworth | 2021-04-21 11:50:18 -0500 |
commit | b51bf89f7a76ec6eb33aa6064c62296870242e64 (patch) | |
tree | 96f07d47c68794fd071fe3239fee48422cd2c415 | |
parent | Merge branch 'main' of https://tildegit.org/acdw/emacs (diff) | |
download | emacs-b51bf89f7a76ec6eb33aa6064c62296870242e64.tar.gz emacs-b51bf89f7a76ec6eb33aa6064c62296870242e64.zip |
Add advice to kill lines and join
-rw-r--r-- | init.el | 15 |
1 files 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 @@ | |||
247 | (tooltip-mode -1) | 247 | (tooltip-mode -1) |
248 | (winner-mode +1) | 248 | (winner-mode +1) |
249 | 249 | ||
250 | ;; Bindings | 250 | ;;; Bindings |
251 | (:global "M-SPC" cycle-spacing | 251 | (:global "M-SPC" cycle-spacing |
252 | "M-/" hippie-expand | 252 | "M-/" hippie-expand |
253 | "M-=" count-words | 253 | "M-=" count-words |
254 | "C-x C-b" ibuffer | 254 | "C-x C-b" ibuffer |
255 | "C-c i" acdw/find-emacs-dotfiles | 255 | "C-c i" acdw/find-emacs-dotfiles |
256 | "C-x k" acdw/kill-a-buffer)) | 256 | "C-x k" acdw/kill-a-buffer) |
257 | |||
258 | ;;; Advice | ||
259 | ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. | ||
260 | ;; I can't simply advise `kill-line' with an override from crux because crux | ||
261 | ;; itself calls `kill-line', leading to a infinite nesting situation. | ||
262 | (advice-add 'kill-line :around | ||
263 | (defun acdw/kill-line-and-join-advice (orig &rest args) | ||
264 | "If at end of line, join with following; otherwise kill line." | ||
265 | (if (and (eolp) (not (bolp))) | ||
266 | (delete-indentation 1) | ||
267 | (apply orig args))))) | ||
257 | 268 | ||
258 | ;; Regular modes (`text-mode', `prog-mode', etc.) | 269 | ;; Regular modes (`text-mode', `prog-mode', etc.) |
259 | (defun acdw/setup-regular-modes () | 270 | (defun acdw/setup-regular-modes () |