|
38 | 38 |
|
39 | 39 | (require 'diff-hl)
|
40 | 40 |
|
| 41 | +(defgroup diff-hl-show-hunk nil |
| 42 | + "Show vc diffs in a posframe or popup." |
| 43 | + :group 'diff-hl) |
| 44 | + |
| 45 | +(defcustom diff-hl-show-hunk-ignorable-commands |
| 46 | + '(ignore |
| 47 | + diff-hl-show-hunk |
| 48 | + handle-switch-frame |
| 49 | + diff-hl-show-hunk--click) |
| 50 | + "Commands that will keep the hunk shown. |
| 51 | +Any command not on this list will cause the hunk to be hidden." |
| 52 | + :type '(repeat function) |
| 53 | + :group 'diff-hl-show-hunk) |
| 54 | + |
| 55 | +(defcustom diff-hl-show-hunk-function 'diff-hl-show-hunk-inline |
| 56 | + "The function used to render the hunk. |
| 57 | +The function receives as first parameter a buffer with the |
| 58 | +contents of the hunk, and as second parameter the line number |
| 59 | +corresponding to the clicked line in the original buffer." |
| 60 | + :type '(choice |
| 61 | + (const :tag "Show inline" diff-hl-show-hunk-inline-popup) |
| 62 | + (const :tag "Show using posframe" diff-hl-show-hunk-posframe))) |
| 63 | + |
41 | 64 | (defvar diff-hl-show-hunk-mouse-mode-map
|
42 | 65 | (let ((map (make-sparse-keymap)))
|
43 | 66 | (define-key map (kbd "<left-margin> <mouse-1>") 'diff-hl-show-hunk--click)
|
|
65 | 88 | (defvar diff-hl-show-hunk--original-overlay nil
|
66 | 89 | "Copy of the diff-hl hunk overlay.")
|
67 | 90 |
|
68 |
| -(defgroup diff-hl-show-hunk nil |
69 |
| - "Show vc diffs in a posframe or popup." |
70 |
| - :group 'diff-hl) |
71 |
| - |
72 | 91 | (defconst diff-hl-show-hunk-boundary "^@@.*@@")
|
73 | 92 | (defconst diff-hl-show-hunk--no-lines-removed-message (list "<<no lines removed>>"))
|
74 | 93 |
|
@@ -111,7 +130,7 @@ corresponding to the clicked line in the original buffer."
|
111 | 130 |
|
112 | 131 | (defun diff-hl-show-hunk-ignorable-command-p (command)
|
113 | 132 | "Decide if COMMAND is a command allowed while showing the current hunk."
|
114 |
| - (member command '(ignore diff-hl-show-hunk handle-switch-frame diff-hl-show-hunk--click))) |
| 133 | + (member command diff-hl-show-hunk-ignorable-commands)) |
115 | 134 |
|
116 | 135 | (defun diff-hl-show-hunk--compute-diffs ()
|
117 | 136 | "Compute diffs using functions of diff-hl.
|
|
0 commit comments