summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-02-14 12:41:47 -0500
committerKyle Meyer <kyle@kyleam.com>2016-02-14 12:41:47 -0500
commit2ff55eb5efb4f1a4116d92ff25cd1d71831d1c33 (patch)
tree29716298983e65b61dd51542edf31502b4fd2214
parentc41c945776558eca41f3be05598410882e85f5c6 (diff)
downloademacs.d-2ff55eb5efb4f1a4116d92ff25cd1d71831d1c33.tar.gz
diff: Add command to lock buffer name
-rw-r--r--init.el4
-rw-r--r--lisp/km-diff.el9
2 files changed, 12 insertions, 1 deletions
diff --git a/init.el b/init.el
index 8c3cbc0..e7d7e99 100644
--- a/init.el
+++ b/init.el
@@ -1444,7 +1444,9 @@
(use-package km-diff
:defer t
:init
- (define-key km/external-map "o" #'km/ediff-with-other-window))
+ (define-key km/external-map "o" #'km/ediff-with-other-window)
+ (after 'diff-mode
+ (define-key diff-mode-map (kbd "C-c C-l") #'km/diff-lock-buffer)))
;;; Text modes
diff --git a/lisp/km-diff.el b/lisp/km-diff.el
index 371d1c9..05a8d0b 100644
--- a/lisp/km-diff.el
+++ b/lisp/km-diff.el
@@ -24,6 +24,15 @@
(require 'ediff)
;;;###autoload
+(defun km/diff-lock-buffer ()
+ "Rename current diff buffer to include new file name."
+ (interactive)
+ (rename-buffer
+ (format "*Diff: %s*"
+ (abbreviate-file-name
+ (substring-no-properties (diff-find-file-name))))))
+
+;;;###autoload
(defun km/ediff-with-other-window ()
"Run `ediff' on current window's file and other window's file."
(interactive)