diff options
| author | Stefan Monnier | 2000-09-19 16:25:43 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-09-19 16:25:43 +0000 |
| commit | 7b91e0f272ce9ca0c040b6681dc710791a45e975 (patch) | |
| tree | 0cf9c35a24292537af7b8ada0637776dba9141d0 | |
| parent | c0aa75f75ef4288e7f5bf52cc519085c7c08204b (diff) | |
| download | emacs-7b91e0f272ce9ca0c040b6681dc710791a45e975.tar.gz emacs-7b91e0f272ce9ca0c040b6681dc710791a45e975.zip | |
Moved closer to its users.
| -rw-r--r-- | lisp/diff-mode.el | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 3d280e7ccd5..af8535ad79f 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> | 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> |
| 6 | ;; Keywords: patch diff | 6 | ;; Keywords: patch diff |
| 7 | ;; Revision: $Id: diff-mode.el,v 1.15 2000/09/19 02:43:33 miles Exp $ | 7 | ;; Revision: $Id: diff-mode.el,v 1.16 2000/09/19 16:24:30 monnier Exp $ |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -447,27 +447,6 @@ Non-nil OLD means that we want the old file." | |||
| 447 | (cons (cons fs file) diff-remembered-files-alist)) | 447 | (cons (cons fs file) diff-remembered-files-alist)) |
| 448 | file))))) | 448 | file))))) |
| 449 | 449 | ||
| 450 | (defun diff-find-source-location (&optional other-file) | ||
| 451 | "Find out (FILE LINE)." | ||
| 452 | (save-excursion | ||
| 453 | (diff-beginning-of-hunk) | ||
| 454 | (let* ((old (if (not other-file) diff-jump-to-old-file-flag | ||
| 455 | (not diff-jump-to-old-file-flag))) | ||
| 456 | ;; Find the location specification. | ||
| 457 | (loc (if (not (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")) | ||
| 458 | (error "Can't find the hunk header") | ||
| 459 | (if old (match-string 1) | ||
| 460 | (if (match-end 3) (match-string 3) | ||
| 461 | (unless (re-search-forward "^--- \\([0-9,]+\\)" nil t) | ||
| 462 | (error "Can't find the hunk separator")) | ||
| 463 | (match-string 1))))) | ||
| 464 | (file (diff-find-file-name old))) | ||
| 465 | ;; Update the user preference if he so wished. | ||
| 466 | (when (> (prefix-numeric-value other-file) 8) | ||
| 467 | (setq diff-jump-to-old-file-flag old)) | ||
| 468 | (if (null file) (error "Can't find the file") | ||
| 469 | (list file (string-to-number loc)))))) | ||
| 470 | |||
| 471 | (defun diff-mouse-goto-source (event) | 450 | (defun diff-mouse-goto-source (event) |
| 472 | "Run `diff-goto-source' for the diff at a mouse click." | 451 | "Run `diff-goto-source' for the diff at a mouse click." |
| 473 | (interactive "e") | 452 | (interactive "e") |
| @@ -973,6 +952,27 @@ If TEXT isn't found, nil is returned." | |||
| 973 | (if (> (- forw orig) (- orig back)) back forw) | 952 | (if (> (- forw orig) (- orig back)) back forw) |
| 974 | (or back forw)))) | 953 | (or back forw)))) |
| 975 | 954 | ||
| 955 | (defun diff-find-source-location (&optional other-file) | ||
| 956 | "Find out (FILE LINE)." | ||
| 957 | (save-excursion | ||
| 958 | (diff-beginning-of-hunk) | ||
| 959 | (let* ((old (if (not other-file) diff-jump-to-old-file-flag | ||
| 960 | (not diff-jump-to-old-file-flag))) | ||
| 961 | ;; Find the location specification. | ||
| 962 | (loc (if (not (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")) | ||
| 963 | (error "Can't find the hunk header") | ||
| 964 | (if old (match-string 1) | ||
| 965 | (if (match-end 3) (match-string 3) | ||
| 966 | (unless (re-search-forward "^--- \\([0-9,]+\\)" nil t) | ||
| 967 | (error "Can't find the hunk separator")) | ||
| 968 | (match-string 1))))) | ||
| 969 | (file (diff-find-file-name old))) | ||
| 970 | ;; Update the user preference if he so wished. | ||
| 971 | (when (> (prefix-numeric-value other-file) 8) | ||
| 972 | (setq diff-jump-to-old-file-flag old)) | ||
| 973 | (if (null file) (error "Can't find the file") | ||
| 974 | (list file (string-to-number loc)))))) | ||
| 975 | |||
| 976 | (defun diff-apply-hunk (&optional reverse other-file dry-run popup noerror) | 976 | (defun diff-apply-hunk (&optional reverse other-file dry-run popup noerror) |
| 977 | "Apply the current hunk to the source file. | 977 | "Apply the current hunk to the source file. |
| 978 | By default, the new source file is patched, but if the variable | 978 | By default, the new source file is patched, but if the variable |