summaryrefslogtreecommitdiff
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2004-04-14 17:31:42 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2004-04-14 17:31:42 +0000
commita1e2d7f757128842226ee60820c5b76462788c38 (patch)
tree5aa3bb2af9c093ba1413d062d57de9845bee34be /lisp/diff-mode.el
parenta6cd3f650dbe5396be4c12c551a56abc126ea3cc (diff)
downloademacs-a1e2d7f757128842226ee60820c5b76462788c38.tar.gz
(diff-goto-source): Make it work for mouse bindings.
(diff-mouse-goto-source): Make it an alias of diff-goto-source.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el17
1 files changed, 6 insertions, 11 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index c235c8cf6d2..f6b2520a112 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -110,7 +110,7 @@ when editing big diffs)."
("}" . diff-file-next)
("{" . diff-file-prev)
("\C-m" . diff-goto-source)
- ([mouse-2] . diff-mouse-goto-source)
+ ([mouse-2] . diff-goto-source)
;; From XEmacs' diff-mode.
("W" . widen)
;;("." . diff-goto-source) ;display-buffer
@@ -547,14 +547,6 @@ Non-nil OLD means that we want the old file."
file)))))
-(defun diff-mouse-goto-source (event)
- "Run `diff-goto-source' for the diff at a mouse click."
- (interactive "e")
- (save-excursion
- (mouse-set-point event)
- (diff-goto-source)))
-
-
(defun diff-ediff-patch ()
"Call `ediff-patch-file' on the current buffer."
(interactive)
@@ -1223,16 +1215,19 @@ With a prefix argument, try to REVERSE the hunk."
(diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
-(defun diff-goto-source (&optional other-file)
+(defalias 'diff-mouse-goto-source 'diff-goto-source)
+
+(defun diff-goto-source (&optional other-file event)
"Jump to the corresponding source line.
`diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg
is given) determines whether to jump to the old or the new file.
If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument])
then `diff-jump-to-old-file' is also set, for the next invocations."
- (interactive "P")
+ (interactive (list current-prefix-arg last-input-event))
;; When pointing at a removal line, we probably want to jump to
;; the old location, and else to the new (i.e. as if reverting).
;; This is a convenient detail when using smerge-diff.
+ (if event (posn-set-point (event-end event)))
(let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
(destructuring-bind (buf line-offset pos src dst &optional switched)
(diff-find-source-location other-file rev)