[xyzzy:04544] Re: cvs-mode 0.1.1
- Subject: [xyzzy:04544] Re: cvs-mode 0.1.1
- From: nobu.nokada@xxxxxxxxxxxx
なかだです。
At Tue, 23 May 2000 16:16:20 +0900,
KAMEI Tetsuya <kamei@xxxxxxxxxxxx> wrote:
> | 思うんですが、wip/diff.l の一部をパクっちゃっても問題ないでしょ
> | うか。
>
> ぜんぜんおっけーです。
ありがとうございます。
さらにわがままいってすいませんがm(__)m、こういうのはどうでしょ
うか。
diff -ru2w lisp.orig/wip/diff.l lisp/wip/diff.l
--- lisp.orig/wip/diff.l Sun Apr 23 19:38:32 2000
+++ lisp/wip/diff.l Tue May 23 22:01:49 2000
@@ -37,9 +37,8 @@
(setq new-file (namestring new-file))
(setq old-file (namestring old-file))
- (let ((buffer nil)
- (diffs '()))
+ (let* ((buffer (create-new-buffer "*diff*"))
+ (diff
(unwind-protect
- (save-excursion
- (setq buffer (create-new-buffer "*diff*"))
+ (progn
(execute-shell-command (format nil "~A ~A \"~A\" \"~A\""
*diff-command-name*
@@ -47,8 +46,19 @@
old-file new-file)
nil buffer)
+ (setq diffs (diff-scan buffer)))
+ (delete-buffer buffer))))
+ (if diffs
+ (diff-view diffs
+ (ed::find-file-internal new-file)
+ (ed::find-file-internal old-file))
+ (msgbox "違いはありません")))
+ t)
+
+(defun diff-scan (buffer)
+ (let ((diffs '()))
+ (save-excursion
(set-buffer buffer)
(cond ((eobp)
- (msgbox "違いはありません")
- (return-from diff t))
+ (return-from diff-scan nil))
((not (looking-at *diff-output-regexp*))
(error (buffer-substring (point) (progn (goto-eol) (point))))))
@@ -65,8 +75,7 @@
(cons x (if y (parse-integer y) x))))
diffs)))
- (and buffer
- (delete-buffer buffer)))
- (let ((old-buffer (ed::find-file-internal old-file))
- (new-buffer (ed::find-file-internal new-file)))
+ (and (car diffs) diffs)))
+
+(defun diff-view (diffs new-buffer old-buffer)
(set-buffer old-buffer)
(delete-text-attributes 'diff)
@@ -84,4 +93,4 @@
*diff-new-file-foreground*
*diff-new-file-background*)))
- diffs)))
- t)
+ diffs))
+