[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command 'diff' visits files prematurely
From: |
Juri Linkov |
Subject: |
Re: Command 'diff' visits files prematurely |
Date: |
12 Oct 2003 19:29:44 +0300 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
As I see from discussion in bug-gnu-emacs the default value of
compile-auto-highlight was changed from nil to t to correct the
erratic behavior where lines were not highlighted initially.
To retain the correct behavior a better solution is to change diff.el
to not visit compared files initially.
The diff.el sets the variable compilation-error-list to inform
compile.el about location of differences. The variable
compilation-error-list has two formats:
(MESSAGE-MARKER (FILE DIRECTORY) LINE [COLUMN])
(MESSAGE-MARKER . TEXT-MARKER)
Currently diff.el uses the second format with TEXT-MARKER. It visits
compared files to return markers for location of differences.
I propose to use the first format, which don't require initial file
visiting. Files are visited only by compile.el when user calls the
next-error.
The following patch does this:
(FILE is absolute, so DIRECTORY is set to nil)
Index: emacs/lisp/diff.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/diff.el,v
retrieving revision 1.48
diff -c -r1.48 diff.el
*** emacs/lisp/diff.el 1 Sep 2003 15:45:09 -0000 1.48
--- emacs/lisp/diff.el 12 Oct 2003 16:11:09 -0000
***************
*** 118,124 ****
(function (lambda (file subexpr)
(setq compilation-error-list
(cons
! (cons (save-excursion
;; Report location of message
;; at beginning of line.
(goto-char
--- 118,124 ----
(function (lambda (file subexpr)
(setq compilation-error-list
(cons
! (list (save-excursion
;; Report location of message
;; at beginning of line.
(goto-char
***************
*** 126,141 ****
(beginning-of-line)
(point-marker))
;; Report location of corresponding text.
! (let ((line (string-to-int
! (buffer-substring
! (match-beginning subexpr)
! (match-end subexpr)))))
! (save-excursion
! (save-match-data
! (set-buffer (find-file-noselect file)))
! (save-excursion
! (goto-line line)
! (point-marker)))))
compilation-error-list)))))
(found-desired nil)
--- 126,137 ----
(beginning-of-line)
(point-marker))
;; Report location of corresponding text.
! (list file nil)
! (string-to-int
! (buffer-substring
! (match-beginning subexpr)
! (match-end subexpr)))
! nil)
compilation-error-list)))))
(found-desired nil)
--
http://www.jurta.org/emacs/