diff options
| -rw-r--r-- | lisp/vc/diff-mode.el | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index d74ff2f5c99..75fd420922a 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -551,23 +551,7 @@ next hunk if TRY-HARDER is non-nil; otherwise signal an error." | |||
| 551 | 551 | ||
| 552 | ;; Define diff-{hunk,file}-{prev,next} | 552 | ;; Define diff-{hunk,file}-{prev,next} |
| 553 | (easy-mmode-define-navigation | 553 | (easy-mmode-define-navigation |
| 554 | diff--internal-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view | 554 | diff--internal-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view) |
| 555 | (when diff-auto-refine-mode | ||
| 556 | (unless (prog1 diff--auto-refine-data | ||
| 557 | (setq diff--auto-refine-data | ||
| 558 | (cons (current-buffer) (point-marker)))) | ||
| 559 | (run-at-time 0.0 nil | ||
| 560 | (lambda () | ||
| 561 | (when diff--auto-refine-data | ||
| 562 | (let ((buffer (car diff--auto-refine-data)) | ||
| 563 | (point (cdr diff--auto-refine-data))) | ||
| 564 | (setq diff--auto-refine-data nil) | ||
| 565 | (with-local-quit | ||
| 566 | (when (buffer-live-p buffer) | ||
| 567 | (with-current-buffer buffer | ||
| 568 | (save-excursion | ||
| 569 | (goto-char point) | ||
| 570 | (diff-refine-hunk)))))))))))) | ||
| 571 | 555 | ||
| 572 | (easy-mmode-define-navigation | 556 | (easy-mmode-define-navigation |
| 573 | diff--internal-file diff-file-header-re "file" diff-end-of-file) | 557 | diff--internal-file diff-file-header-re "file" diff-end-of-file) |
| @@ -605,7 +589,26 @@ to the NEXT marker." | |||
| 605 | 589 | ||
| 606 | (when (not (looking-at header-re)) | 590 | (when (not (looking-at header-re)) |
| 607 | (goto-char start) | 591 | (goto-char start) |
| 608 | (user-error (format "No %s" what)))))) | 592 | (user-error (format "No %s" what))) |
| 593 | |||
| 594 | ;; We successfully moved to the next/prev hunk/file. Apply the | ||
| 595 | ;; auto-refinement if needed | ||
| 596 | (when diff-auto-refine-mode | ||
| 597 | (unless (prog1 diff--auto-refine-data | ||
| 598 | (setq diff--auto-refine-data | ||
| 599 | (cons (current-buffer) (point-marker)))) | ||
| 600 | (run-at-time 0.0 nil | ||
| 601 | (lambda () | ||
| 602 | (when diff--auto-refine-data | ||
| 603 | (let ((buffer (car diff--auto-refine-data)) | ||
| 604 | (point (cdr diff--auto-refine-data))) | ||
| 605 | (setq diff--auto-refine-data nil) | ||
| 606 | (with-local-quit | ||
| 607 | (when (buffer-live-p buffer) | ||
| 608 | (with-current-buffer buffer | ||
| 609 | (save-excursion | ||
| 610 | (goto-char point) | ||
| 611 | (diff-refine-hunk)))))))))))))) | ||
| 609 | 612 | ||
| 610 | ;; These functions all take a skip-hunk-start argument which controls | 613 | ;; These functions all take a skip-hunk-start argument which controls |
| 611 | ;; whether we skip pre-hunk-start text or not. In interactive uses we | 614 | ;; whether we skip pre-hunk-start text or not. In interactive uses we |