summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el19
-rw-r--r--lisp/km-diff.el16
2 files changed, 11 insertions, 24 deletions
diff --git a/init.el b/init.el
index 68d4d5e..8c3cbc0 100644
--- a/init.el
+++ b/init.el
@@ -1421,10 +1421,18 @@
(use-package diff
:defer t
+ :init
+ (define-key km/external-map "d" #'diff)
:config
(setq diff-command "/bin/diff"
- diff-switches "-u")
- (add-hook 'diff-mode-hook #'toggle-truncate-lines))
+ diff-switches "-u"))
+
+(use-package diff-mode
+ :after diff
+ :config
+ (setq diff-default-read-only t)
+ (add-hook 'diff-mode-hook #'toggle-truncate-lines)
+ (define-key diff-mode-map (kbd "C-c C-g") #'revert-buffer))
(use-package ediff
:defer t
@@ -1436,12 +1444,7 @@
(use-package km-diff
:defer t
:init
- (bind-keys :map km/external-map
- ("o" . km/ediff-with-other-window)
- ("d" . km/diff))
- :config
- (after 'diff-mode
- (define-key diff-mode-map (kbd "C-c C-g") #'km/revert-buffer-and-view)))
+ (define-key km/external-map "o" #'km/ediff-with-other-window))
;;; Text modes
diff --git a/lisp/km-diff.el b/lisp/km-diff.el
index 69a5a64..371d1c9 100644
--- a/lisp/km-diff.el
+++ b/lisp/km-diff.el
@@ -21,23 +21,7 @@
;;; Code:
(require 'dash)
-(require 'diff)
(require 'ediff)
-(require 'view)
-
-;;;###autoload
-(defun km/diff ()
- "Run `diff' and then select buffer and turn on View mode."
- (interactive)
- (call-interactively #'diff)
- (select-window (get-buffer-window "*Diff*"))
- (view-mode 1))
-
-;;;###autoload
-(defun km/revert-buffer-and-view ()
- (interactive)
- (revert-buffer)
- (view-mode 1))
;;;###autoload
(defun km/ediff-with-other-window ()