diff options
author | Juri Linkov <juri@linkov.net> | 2018-11-17 23:52:05 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2018-11-17 23:52:05 +0200 |
commit | 5d140800398287c20230dda79162a7c40016d88e (patch) | |
tree | 5aa4442afcbab0ccf9af0cb6205777c93c8ae4cd /lisp/vc/diff-mode.el | |
parent | 8a481d29706eaf023ca786e3b905d397fbcfd685 (diff) | |
download | emacs-5d140800398287c20230dda79162a7c40016d88e.tar.gz emacs-5d140800398287c20230dda79162a7c40016d88e.tar.bz2 emacs-5d140800398287c20230dda79162a7c40016d88e.zip |
* lisp/vc/diff-mode.el (diff-find-source-location): Use vc-working-revision
when diff shows changes in working revision. (Bug#33319)
(diff-goto-source): Rename variables to avoid ambiguity.
Diffstat (limited to 'lisp/vc/diff-mode.el')
-rw-r--r-- | lisp/vc/diff-mode.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index b86c17fe366..f200680968e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1742,7 +1742,10 @@ NOPROMPT, if non-nil, means not to prompt the user." (file (or (diff-find-file-name other noprompt) (error "Can't find the file"))) (revision (and other diff-vc-backend - (nth (if reverse 1 0) diff-vc-revisions))) + (if reverse (nth 1 diff-vc-revisions) + (or (nth 0 diff-vc-revisions) + ;; When diff shows changes in working revision + (vc-working-revision file))))) (buf (if revision (let ((vc-find-revision-no-save t)) (vc-find-revision file revision diff-vc-backend)) @@ -1883,13 +1886,13 @@ revision of the file otherwise." ;; This is a convenient detail when using smerge-diff. (if event (posn-set-point (event-end event))) (let ((buffer (when event (current-buffer))) - (rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) + (reverse (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched) - (diff-find-source-location other-file rev))) + (diff-find-source-location other-file reverse))) (pop-to-buffer buf) (goto-char (+ (car pos) (cdr src))) (when buffer (next-error-found buffer (current-buffer))) - (diff-hunk-status-msg line-offset (diff-xor rev switched) t)))) + (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))) (defun diff-current-defun () |