aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-11-25 14:06:29 +0000
committerSean Whitton2025-11-25 14:06:29 +0000
commit3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b (patch)
tree88225226cbda7eebc562b83c6a92418c18cd763b
parent9b505dd8d40ab0568c36984215afc5d5406b9b93 (diff)
downloademacs-3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b.tar.gz
emacs-3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b.zip
; diff-mode-el: Improve docstrings re diff-jump-to-old-file.
-rw-r--r--lisp/vc/diff-mode.el38
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 3e45ff045e2..70dc68e2122 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2046,8 +2046,10 @@ Whitespace differences are ignored."
2046OTHER-FILE, if non-nil, means to look at the diff's name and line 2046OTHER-FILE, if non-nil, means to look at the diff's name and line
2047 numbers for the old file. Furthermore, use `diff-vc-revisions' 2047 numbers for the old file. Furthermore, use `diff-vc-revisions'
2048 if it's available. If `diff-jump-to-old-file' is non-nil, the 2048 if it's available. If `diff-jump-to-old-file' is non-nil, the
2049 sense of this parameter is reversed. If the prefix argument is 2049 sense of this parameter is reversed. If OTHER-FILE considered
2050 8 or more, `diff-jump-to-old-file' is set to OTHER-FILE. 2050 as a raw prefix argument has a numeric value bigger than 8,
2051 toggle `diff-jump-to-old-file' for the remainder of this Emacs
2052 session, i.e., set it to nil if it's non-nil, non-nil if it's nil.
2051REVERSE, if non-nil, switches the sense of SRC and DST (see below). 2053REVERSE, if non-nil, switches the sense of SRC and DST (see below).
2052NOPROMPT, if non-nil, means not to prompt the user. 2054NOPROMPT, if non-nil, means not to prompt the user.
2053Return a list (BUF LINE-OFFSET (BEG . END) SRC DST SWITCHED). 2055Return a list (BUF LINE-OFFSET (BEG . END) SRC DST SWITCHED).
@@ -2256,6 +2258,8 @@ Interactively, if the region is active, apply all hunks that the region
2256overlaps; otherwise, apply all hunks. 2258overlaps; otherwise, apply all hunks.
2257With a prefix argument, reverse-apply the hunks. 2259With a prefix argument, reverse-apply the hunks.
2258If applying all hunks succeeds, save the changed buffers. 2260If applying all hunks succeeds, save the changed buffers.
2261By default apply diffs to new source files; apply them to old
2262files if `diff-jump-to-old-file' is non-nil.
2259 2263
2260When called from Lisp, returns nil if buffers were successfully modified 2264When called from Lisp, returns nil if buffers were successfully modified
2261and saved, or the number of failed hunk applications otherwise. 2265and saved, or the number of failed hunk applications otherwise.
@@ -2276,6 +2280,9 @@ or the number of hunks that can't be applied."
2276 (diff-beginning-of-hunk t) 2280 (diff-beginning-of-hunk t)
2277 (while (pcase-let ((`(,buf ,line-offset ,pos ,_src ,dst ,switched) 2281 (while (pcase-let ((`(,buf ,line-offset ,pos ,_src ,dst ,switched)
2278 (diff-find-source-location nil reverse test))) 2282 (diff-find-source-location nil reverse test)))
2283 ;; FIXME: Should respect `diff-apply-hunk-to-backup-file'
2284 ;; similarly to how `diff-apply-buffer' does.
2285 ;; Prompt for each relevant file.
2279 (cond ((and line-offset (not switched)) 2286 (cond ((and line-offset (not switched))
2280 (push (cons pos dst) 2287 (push (cons pos dst)
2281 (alist-get buf buffer-edits))) 2288 (alist-get buf buffer-edits)))
@@ -2310,14 +2317,25 @@ or the number of hunks that can't be applied."
2310 2317
2311(defun diff-goto-source (&optional other-file event) 2318(defun diff-goto-source (&optional other-file event)
2312 "Jump to the corresponding source line. 2319 "Jump to the corresponding source line.
2313`diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg 2320
2314is given) determines whether to jump to the old or the new file. 2321By default, jump to the new source file; jump to the old source file
2315If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) 2322instead when either
2316then `diff-jump-to-old-file' is also set, for the next invocations. 2323- `diff-jump-to-old-file' is non-nil and you don't supply a prefix
2317 2324 argument (when called from Lisp, optional argument OTHER-FILE is nil)
2318Under version control, the OTHER-FILE prefix arg means jump to the old 2325- `diff-jump-to-old-file' is nil and you supply a prefix argument
2319revision of the file if point is on an old changed line, or to the new 2326 (when called from Lisp, optional argument OTHER-FILE is non-nil)
2320revision of the file otherwise." 2327In addition, if you supply a prefix argument bigger than 8 (for example
2328with \\[universal-argument] \\[universal-argument]), \
2329the value of `diff-jump-to-old-file' is toggled for the
2330remainder of this Emacs session (i.e., set to non-nil if nil, or
2331set to nil if non-nil). When called from Lisp this toggling
2332happens when the value of optional argument OTHER-FILE considered
2333as a prefix argument has a numeric value bigger than 8.
2334
2335Under version control, jumping to the old file means jumping to the old
2336revision of the file in the manner of \\[vc-revision-other-window], \
2337and occurs only when
2338point is on an old changed line (i.e. a removed line)."
2321 (interactive (list current-prefix-arg last-input-event)) 2339 (interactive (list current-prefix-arg last-input-event))
2322 ;; When pointing at a removal line, we probably want to jump to 2340 ;; When pointing at a removal line, we probably want to jump to
2323 ;; the old location, and else to the new (i.e. as if reverting). 2341 ;; the old location, and else to the new (i.e. as if reverting).