branch: externals/diff-hl commit 6c34a01036584bb794381815c910cdbabae8cbd8 Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Minor touches --- diff-hl-flydiff.el | 4 ++-- diff-hl-posframe.gif | Bin 0 -> 15696491 bytes diff-hl-show-hunk.el | 10 +++++----- diff-hl.el | 9 +++++---- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el index 3b8670f..f82e426 100644 --- a/diff-hl-flydiff.el +++ b/diff-hl-flydiff.el @@ -40,11 +40,11 @@ (defvar diff-hl-flydiff-timer nil) (make-variable-buffer-local 'diff-hl-flydiff-modified-tick) -(defun diff-hl-flydiff-buffer-with-head (file &optional _backend) +(defun diff-hl-flydiff-buffer-with-head (file &optional backend) "View the differences between FILE and its associated file in HEAD revision. This requires the external program `diff' to be in your `exec-path'." - (diff-hl-diff-buffer-with-head file " *diff-hl-diff*")) + (diff-hl-diff-buffer-with-head file " *diff-hl-diff*" backend)) (defun diff-hl-flydiff-update () (unless (or diff --git a/diff-hl-posframe.gif b/diff-hl-posframe.gif new file mode 100644 index 0000000..fbab0d2 Binary files /dev/null and b/diff-hl-posframe.gif differ diff --git a/diff-hl-show-hunk.el b/diff-hl-show-hunk.el index bb9bf8c..8935044 100644 --- a/diff-hl-show-hunk.el +++ b/diff-hl-show-hunk.el @@ -141,10 +141,10 @@ corresponding to the clicked line in the original buffer." (member command '(ignore diff-hl-show-hunk handle-switch-frame diff-hl-show-hunk--click))) (defun diff-hl-show-hunk--compute-diffs () - "Compute diffs using funcions of diff-hl. -Then put the differences in *diff-hl-show-hunk-diff-buffer* -buffer, and set the point in that buffer to the corresponding -line of the original buffer." + "Compute diffs using functions of diff-hl. +Then put the differences inside a special buffer and set the +point in that buffer to the corresponding line of the original +buffer." (defvar vc-sentinel-movepoint) (let* ((buffer (or (buffer-base-buffer) (current-buffer))) (line (line-number-at-pos)) @@ -244,7 +244,7 @@ Returns a list with the buffer and the line number of the clicked line." "Implementation to show the hunk in a inline popup. BUFFER is a buffer with the hunk." (diff-hl-inline-popup-hide) - (setq diff-hl-show-hunk--hide-function #'inline-popup-hide) + (setq diff-hl-show-hunk--hide-function #'diff-hl-inline-popup-hide) (let* ((lines (split-string (with-current-buffer buffer (buffer-string)) "[\n\r]+" )) (smart-lines diff-hl-show-hunk-inline-popup-smart-lines) (original-lines-number (cl-count-if (lambda (s) (string-prefix-p "-" s)) lines)) diff --git a/diff-hl.el b/diff-hl.el index 17e6381..d05e91e 100644 --- a/diff-hl.el +++ b/diff-hl.el @@ -761,12 +761,13 @@ the user should be returned." (delete-file filename)))))))) filename)) -(defun diff-hl-working-revision (file) +(defun diff-hl-working-revision (file &optional backend) "Like vc-working-revision, but always up-to-date" (vc-file-setprop file 'vc-working-revision - (vc-call-backend (vc-backend file) 'working-revision file))) + (vc-call-backend (or backend (vc-backend file)) + 'working-revision file))) -(defun diff-hl-diff-buffer-with-head (file &optional dest-buffer) +(defun diff-hl-diff-buffer-with-head (file &optional dest-buffer backend) "Compute the differences between FILE and its associated file in head revision. The diffs are computed in the buffer DEST-BUFFER. This requires the external program `diff' to be in @@ -781,7 +782,7 @@ your `exec-path'." (rev (diff-hl-create-revision file (or diff-hl-reference-revision - (diff-hl-working-revision file))))) + (diff-hl-working-revision file backend))))) ;; FIXME: When against staging, do it differently! (diff-no-select rev (current-buffer) "-U 0 --strip-trailing-cr" 'noasync (get-buffer-create dest-buffer))