aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2018-11-17 23:52:05 +0200
committerJuri Linkov2018-11-17 23:52:05 +0200
commit5d140800398287c20230dda79162a7c40016d88e (patch)
tree5aa4442afcbab0ccf9af0cb6205777c93c8ae4cd
parent8a481d29706eaf023ca786e3b905d397fbcfd685 (diff)
downloademacs-5d140800398287c20230dda79162a7c40016d88e.tar.gz
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.
-rw-r--r--lisp/vc/diff-mode.el11
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."
1742 (file (or (diff-find-file-name other noprompt) 1742 (file (or (diff-find-file-name other noprompt)
1743 (error "Can't find the file"))) 1743 (error "Can't find the file")))
1744 (revision (and other diff-vc-backend 1744 (revision (and other diff-vc-backend
1745 (nth (if reverse 1 0) diff-vc-revisions))) 1745 (if reverse (nth 1 diff-vc-revisions)
1746 (or (nth 0 diff-vc-revisions)
1747 ;; When diff shows changes in working revision
1748 (vc-working-revision file)))))
1746 (buf (if revision 1749 (buf (if revision
1747 (let ((vc-find-revision-no-save t)) 1750 (let ((vc-find-revision-no-save t))
1748 (vc-find-revision file revision diff-vc-backend)) 1751 (vc-find-revision file revision diff-vc-backend))
@@ -1883,13 +1886,13 @@ revision of the file otherwise."
1883 ;; This is a convenient detail when using smerge-diff. 1886 ;; This is a convenient detail when using smerge-diff.
1884 (if event (posn-set-point (event-end event))) 1887 (if event (posn-set-point (event-end event)))
1885 (let ((buffer (when event (current-buffer))) 1888 (let ((buffer (when event (current-buffer)))
1886 (rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) 1889 (reverse (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
1887 (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched) 1890 (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
1888 (diff-find-source-location other-file rev))) 1891 (diff-find-source-location other-file reverse)))
1889 (pop-to-buffer buf) 1892 (pop-to-buffer buf)
1890 (goto-char (+ (car pos) (cdr src))) 1893 (goto-char (+ (car pos) (cdr src)))
1891 (when buffer (next-error-found buffer (current-buffer))) 1894 (when buffer (next-error-found buffer (current-buffer)))
1892 (diff-hunk-status-msg line-offset (diff-xor rev switched) t)))) 1895 (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))))
1893 1896
1894 1897
1895(defun diff-current-defun () 1898(defun diff-current-defun ()