# HG changeset patch # User Stefan Monnier # Date 1083530695 0 # Node ID 8e480ee75c47ee863e22f7a9a4260ec5065b60f3 # Parent 7e20ba796eb0afdc69cb23c79b5830d4ea651f9f (compilation-gcpro): New var (compilation-fake-loc): Use it. (compilation-forget-errors): Reset it. diff -r 7e20ba796eb0 -r 8e480ee75c47 lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Sun May 02 19:27:59 2004 +0000 +++ b/lisp/progmodes/compile.el Sun May 02 20:44:55 2004 +0000 @@ -1457,6 +1457,10 @@ (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) (setcdr (nthcdr 3 loc) t))) ; Set this one as visited. +(defvar compilation-gcpro nil + "Internal variable used to keep some values from being GC'd.") +(make-variable-buffer-local 'compilation-gcpro) + (defun compilation-fake-loc (marker file &optional line col) "Preassociate MARKER with FILE. FILE should be ABSOLUTE-FILENAME or (RELATIVE-FILENAME . DIRNAME). @@ -1476,6 +1480,11 @@ region and the first line of the next region." (or (consp file) (setq file (list file))) (setq file (compilation-get-file-structure file)) + ;; Between the current call to compilation-fake-loc and the first occurrence + ;; of an error message referring to `file', the data is only kept is the + ;; weak hash-table compilation-locs, so we need to prevent this entry + ;; in compilation-locs from being GC'd away. --Stef + (push file compilation-gcpro) (let ((loc (compilation-assq (or line 1) (cdr file)))) (setq loc (compilation-assq col loc)) (if (cdr loc) @@ -1730,6 +1739,7 @@ ;; In case we hit the same file/line specs, we want to recompute a new ;; marker for them, so flush our cache. (setq compilation-locs (make-hash-table :test 'equal :weakness 'value)) + (setq compilation-gcpro nil) ;; FIXME: the old code reset the directory-stack, so maybe we should ;; put a `directory change' marker of some sort, but where? -stef ;;