diff options
| author | Sean Whitton | 2025-11-25 14:06:29 +0000 |
|---|---|---|
| committer | Sean Whitton | 2025-11-25 14:06:29 +0000 |
| commit | 3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b (patch) | |
| tree | 88225226cbda7eebc562b83c6a92418c18cd763b | |
| parent | 9b505dd8d40ab0568c36984215afc5d5406b9b93 (diff) | |
| download | emacs-3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b.tar.gz emacs-3f6c7d1bfb59cf8d66c7fb548f96e7d5ebc2706b.zip | |
; diff-mode-el: Improve docstrings re diff-jump-to-old-file.
| -rw-r--r-- | lisp/vc/diff-mode.el | 38 |
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." | |||
| 2046 | OTHER-FILE, if non-nil, means to look at the diff's name and line | 2046 | OTHER-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. | ||
| 2051 | REVERSE, if non-nil, switches the sense of SRC and DST (see below). | 2053 | REVERSE, if non-nil, switches the sense of SRC and DST (see below). |
| 2052 | NOPROMPT, if non-nil, means not to prompt the user. | 2054 | NOPROMPT, if non-nil, means not to prompt the user. |
| 2053 | Return a list (BUF LINE-OFFSET (BEG . END) SRC DST SWITCHED). | 2055 | Return 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 | |||
| 2256 | overlaps; otherwise, apply all hunks. | 2258 | overlaps; otherwise, apply all hunks. |
| 2257 | With a prefix argument, reverse-apply the hunks. | 2259 | With a prefix argument, reverse-apply the hunks. |
| 2258 | If applying all hunks succeeds, save the changed buffers. | 2260 | If applying all hunks succeeds, save the changed buffers. |
| 2261 | By default apply diffs to new source files; apply them to old | ||
| 2262 | files if `diff-jump-to-old-file' is non-nil. | ||
| 2259 | 2263 | ||
| 2260 | When called from Lisp, returns nil if buffers were successfully modified | 2264 | When called from Lisp, returns nil if buffers were successfully modified |
| 2261 | and saved, or the number of failed hunk applications otherwise. | 2265 | and 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 | |
| 2314 | is given) determines whether to jump to the old or the new file. | 2321 | By default, jump to the new source file; jump to the old source file |
| 2315 | If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) | 2322 | instead when either |
| 2316 | then `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) | |
| 2318 | Under 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 |
| 2319 | revision 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) |
| 2320 | revision of the file otherwise." | 2327 | In addition, if you supply a prefix argument bigger than 8 (for example |
| 2328 | with \\[universal-argument] \\[universal-argument]), \ | ||
| 2329 | the value of `diff-jump-to-old-file' is toggled for the | ||
| 2330 | remainder of this Emacs session (i.e., set to non-nil if nil, or | ||
| 2331 | set to nil if non-nil). When called from Lisp this toggling | ||
| 2332 | happens when the value of optional argument OTHER-FILE considered | ||
| 2333 | as a prefix argument has a numeric value bigger than 8. | ||
| 2334 | |||
| 2335 | Under version control, jumping to the old file means jumping to the old | ||
| 2336 | revision of the file in the manner of \\[vc-revision-other-window], \ | ||
| 2337 | and occurs only when | ||
| 2338 | point 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). |