[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assignment of misc packages for emacs

From: Stefan Monnier
Subject: Re: Assignment of misc packages for emacs
Date: Tue, 07 May 2002 21:47:47 -0400

> Also note that `diff-mode', which is what VC diffs are `colorized' with,
> also offers many useful features for manipulating diffs -- navigation,
> applying/unapplying of hunks, format conversion, direction reversal, and
> even sane editing of the diff file [it automatically adjusts the line
> counts for you].  It's quite snazzy...
> There was some small issue that interfered with it being used for `M-x
> diff' output, but my vague memory is that it was pretty trivial (my
> recollection is that I thought the proper solution was to say `fuck it'
> and use diff-mode anyway).

I personally use the patch below but never bothered to try and
make it into something good enough to install.  I don't even know
what is missing (if anything).
I don't have it high on my todo list, so if anybody wants to see
it happen, he'd better do it himself,


Index: diff.el
RCS file: /cvsroot/emacs/emacs/lisp/diff.el,v
retrieving revision 1.43
diff -u -r1.43 diff.el
--- diff.el     11 Oct 2001 01:20:16 -0000      1.43
+++ diff.el     8 May 2002 01:44:00 -0000
@@ -91,11 +91,8 @@
   ;; Don't reparse diffs already seen at last parse.
   (if compilation-parsing-end (goto-char compilation-parsing-end))
-  ;; Construct in REGEXP a regexp composed of all those in dired-regexp-alist.
-  (let ((regexp (mapconcat (lambda (elt)
-                            (concat "\\(" (car elt) "\\)"))
-                          diff-regexp-alist
-                          "\\|"))
+  ;; Construct in REGEXP a regexp composed of all those in diff-regexp-alist.
+  (let ((regexp (mapconcat 'car diff-regexp-alist "\\|"))
        (groups (let ((subexpr 1))
                  (mapcar (lambda (elt)
@@ -190,7 +187,7 @@
   "Find and display the differences between OLD and NEW files.
 Interactively the current buffer's file name is the default for NEW
 and a backup file for NEW is the default for OLD.
-With prefix arg, prompt for diff switches."
+With prefix arg, prompt for diff SWITCHES."
     (let (oldf newf)
@@ -247,16 +244,23 @@
                                  "No more differences" "Diff"
          (set-buffer buf)
+         ;; Replace compilation-mode with diff-mode + compilation-minor-mode.
+         (diff-mode)
+         (compilation-shell-minor-mode -1) ;diff-mode turned it on.
+         (compilation-minor-mode 1)
+         (set (make-local-variable 'compilation-parse-errors-function)
+              'diff-parse-differences)
+         (set (make-local-variable 'compilation-error-message)
+              "No more differences")
+         ;; Continue as if nothing had happened.
          (set (make-local-variable 'diff-old-file) old)
          (set (make-local-variable 'diff-new-file) new)
          (set (make-local-variable 'diff-old-temp-file) old-alt)
          (set (make-local-variable 'diff-new-temp-file) new-alt)
          (set (make-local-variable 'compilation-finish-function)
-              (function (lambda (buff msg)
-                          (if diff-old-temp-file
-                              (delete-file diff-old-temp-file))
-                          (if diff-new-temp-file
-                              (delete-file diff-new-temp-file)))))
+              (lambda (buff msg)
+                (if diff-old-temp-file (delete-file diff-old-temp-file))
+                (if diff-new-temp-file (delete-file diff-new-temp-file))))
          ;; When async processes aren't available, the compilation finish
          ;; function doesn't get chance to run.  Invoke it by hand.
          (or (fboundp 'start-process)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]