diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-26 05:15:44 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-26 05:15:44 -0400 |
| commit | 108512df855a83cb98f330ee6cf6f22168c0d76d (patch) | |
| tree | 294d6085bc8ae4b236abec96a3ad2cefa7df9d76 | |
| parent | eb4aa232836f069ca671c6651a0e2f5dff4f7c34 (diff) | |
| download | dotemacs-108512df855a83cb98f330ee6cf6f22168c0d76d.tar.gz dotemacs-108512df855a83cb98f330ee6cf6f22168c0d76d.zip | |
chore(ibuffer): put diff on d and delete on D
In the ibuffer buffer list, d now diffs the buffer at point against its saved file (ibuffer-diff-with-file, was on =) and D marks it for deletion (was on d; x still executes the marks).
| -rw-r--r-- | modules/system-utils.el | 10 | ||||
| -rw-r--r-- | tests/test-system-utils-commands.el | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/modules/system-utils.el b/modules/system-utils.el index c76193a71..00be88906 100644 --- a/modules/system-utils.el +++ b/modules/system-utils.el @@ -147,6 +147,16 @@ detached from Emacs." ;; in `nerd-icons-config'. (keymap-global-set "<remap> <list-buffers>" #'ibuffer) +;; Swap delete and diff in the ibuffer list: d diffs the buffer at point against +;; its saved file (was on =), and D marks it for deletion (was on d; `x' still +;; executes the marks). +(defvar ibuffer-mode-map) +(declare-function ibuffer-diff-with-file "ibuffer") +(declare-function ibuffer-mark-for-delete "ibuffer") +(with-eval-after-load 'ibuffer + (keymap-set ibuffer-mode-map "d" #'ibuffer-diff-with-file) + (keymap-set ibuffer-mode-map "D" #'ibuffer-mark-for-delete)) + ;;; -------------------------- Scratch Buffer Happiness ------------------------- (defvar scratch-emacs-version-and-system diff --git a/tests/test-system-utils-commands.el b/tests/test-system-utils-commands.el index b7b61dc22..6f2099a24 100644 --- a/tests/test-system-utils-commands.el +++ b/tests/test-system-utils-commands.el @@ -90,5 +90,14 @@ and lands in a dedicated output buffer." (should saved) (should killed))) +;;; ibuffer delete/diff keybinding swap + +(ert-deftest test-system-utils-ibuffer-d-diffs-D-deletes () + "Normal: in the ibuffer list, d diffs the buffer at point against its file and +D marks it for deletion (the swap of ibuffer's default d/= bindings)." + (require 'ibuffer) + (should (eq (keymap-lookup ibuffer-mode-map "d") #'ibuffer-diff-with-file)) + (should (eq (keymap-lookup ibuffer-mode-map "D") #'ibuffer-mark-for-delete))) + (provide 'test-system-utils-commands) ;;; test-system-utils-commands.el ends here |
