From: Stefan Monnier Date: Tue, 19 Sep 2000 16:25:43 +0000 (+0000) Subject: Moved closer to its users. X-Git-Tag: emacs-pretest-21.0.90~1511 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7b91e0f272ce9ca0c040b6681dc710791a45e975;p=emacs.git Moved closer to its users. --- 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 @@ ;; Author: Stefan Monnier ;; Keywords: patch diff -;; Revision: $Id: diff-mode.el,v 1.15 2000/09/19 02:43:33 miles Exp $ +;; Revision: $Id: diff-mode.el,v 1.16 2000/09/19 16:24:30 monnier Exp $ ;; This file is part of GNU Emacs. @@ -447,27 +447,6 @@ Non-nil OLD means that we want the old file." (cons (cons fs file) diff-remembered-files-alist)) file))))) -(defun diff-find-source-location (&optional other-file) - "Find out (FILE LINE)." - (save-excursion - (diff-beginning-of-hunk) - (let* ((old (if (not other-file) diff-jump-to-old-file-flag - (not diff-jump-to-old-file-flag))) - ;; Find the location specification. - (loc (if (not (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")) - (error "Can't find the hunk header") - (if old (match-string 1) - (if (match-end 3) (match-string 3) - (unless (re-search-forward "^--- \\([0-9,]+\\)" nil t) - (error "Can't find the hunk separator")) - (match-string 1))))) - (file (diff-find-file-name old))) - ;; Update the user preference if he so wished. - (when (> (prefix-numeric-value other-file) 8) - (setq diff-jump-to-old-file-flag old)) - (if (null file) (error "Can't find the file") - (list file (string-to-number loc)))))) - (defun diff-mouse-goto-source (event) "Run `diff-goto-source' for the diff at a mouse click." (interactive "e") @@ -973,6 +952,27 @@ If TEXT isn't found, nil is returned." (if (> (- forw orig) (- orig back)) back forw) (or back forw)))) +(defun diff-find-source-location (&optional other-file) + "Find out (FILE LINE)." + (save-excursion + (diff-beginning-of-hunk) + (let* ((old (if (not other-file) diff-jump-to-old-file-flag + (not diff-jump-to-old-file-flag))) + ;; Find the location specification. + (loc (if (not (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")) + (error "Can't find the hunk header") + (if old (match-string 1) + (if (match-end 3) (match-string 3) + (unless (re-search-forward "^--- \\([0-9,]+\\)" nil t) + (error "Can't find the hunk separator")) + (match-string 1))))) + (file (diff-find-file-name old))) + ;; Update the user preference if he so wished. + (when (> (prefix-numeric-value other-file) 8) + (setq diff-jump-to-old-file-flag old)) + (if (null file) (error "Can't find the file") + (list file (string-to-number loc)))))) + (defun diff-apply-hunk (&optional reverse other-file dry-run popup noerror) "Apply the current hunk to the source file. By default, the new source file is patched, but if the variable