Mercurial > emacs
comparison lisp/progmodes/compile.el @ 55324:8e480ee75c47
(compilation-gcpro): New var
(compilation-fake-loc): Use it.
(compilation-forget-errors): Reset it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 02 May 2004 20:44:55 +0000 |
parents | f7017af1bd0b |
children | e95e9c689608 |
comparison
equal
deleted
inserted
replaced
55323:7e20ba796eb0 | 55324:8e480ee75c47 |
---|---|
1455 (set-marker (nth 3 col) (point)) | 1455 (set-marker (nth 3 col) (point)) |
1456 (setcdr (nthcdr 2 col) `(,(point-marker))))))))) | 1456 (setcdr (nthcdr 2 col) `(,(point-marker))))))))) |
1457 (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) | 1457 (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) |
1458 (setcdr (nthcdr 3 loc) t))) ; Set this one as visited. | 1458 (setcdr (nthcdr 3 loc) t))) ; Set this one as visited. |
1459 | 1459 |
1460 (defvar compilation-gcpro nil | |
1461 "Internal variable used to keep some values from being GC'd.") | |
1462 (make-variable-buffer-local 'compilation-gcpro) | |
1463 | |
1460 (defun compilation-fake-loc (marker file &optional line col) | 1464 (defun compilation-fake-loc (marker file &optional line col) |
1461 "Preassociate MARKER with FILE. | 1465 "Preassociate MARKER with FILE. |
1462 FILE should be ABSOLUTE-FILENAME or (RELATIVE-FILENAME . DIRNAME). | 1466 FILE should be ABSOLUTE-FILENAME or (RELATIVE-FILENAME . DIRNAME). |
1463 This is useful when you compile temporary files, but want | 1467 This is useful when you compile temporary files, but want |
1464 automatic translation of the messages to the real buffer from | 1468 automatic translation of the messages to the real buffer from |
1474 header with variable assignments and a code region), you must | 1478 header with variable assignments and a code region), you must |
1475 call this several times, once each for the last line of one | 1479 call this several times, once each for the last line of one |
1476 region and the first line of the next region." | 1480 region and the first line of the next region." |
1477 (or (consp file) (setq file (list file))) | 1481 (or (consp file) (setq file (list file))) |
1478 (setq file (compilation-get-file-structure file)) | 1482 (setq file (compilation-get-file-structure file)) |
1483 ;; Between the current call to compilation-fake-loc and the first occurrence | |
1484 ;; of an error message referring to `file', the data is only kept is the | |
1485 ;; weak hash-table compilation-locs, so we need to prevent this entry | |
1486 ;; in compilation-locs from being GC'd away. --Stef | |
1487 (push file compilation-gcpro) | |
1479 (let ((loc (compilation-assq (or line 1) (cdr file)))) | 1488 (let ((loc (compilation-assq (or line 1) (cdr file)))) |
1480 (setq loc (compilation-assq col loc)) | 1489 (setq loc (compilation-assq col loc)) |
1481 (if (cdr loc) | 1490 (if (cdr loc) |
1482 (setcdr (cddr loc) (list marker)) | 1491 (setcdr (cddr loc) (list marker)) |
1483 (setcdr loc (list line file marker))) | 1492 (setcdr loc (list line file marker))) |
1728 ;; Beware: this is not only compatiblity code. New code stil uses it. --Stef | 1737 ;; Beware: this is not only compatiblity code. New code stil uses it. --Stef |
1729 (defun compilation-forget-errors () | 1738 (defun compilation-forget-errors () |
1730 ;; In case we hit the same file/line specs, we want to recompute a new | 1739 ;; In case we hit the same file/line specs, we want to recompute a new |
1731 ;; marker for them, so flush our cache. | 1740 ;; marker for them, so flush our cache. |
1732 (setq compilation-locs (make-hash-table :test 'equal :weakness 'value)) | 1741 (setq compilation-locs (make-hash-table :test 'equal :weakness 'value)) |
1742 (setq compilation-gcpro nil) | |
1733 ;; FIXME: the old code reset the directory-stack, so maybe we should | 1743 ;; FIXME: the old code reset the directory-stack, so maybe we should |
1734 ;; put a `directory change' marker of some sort, but where? -stef | 1744 ;; put a `directory change' marker of some sort, but where? -stef |
1735 ;; | 1745 ;; |
1736 ;; FIXME: The old code moved compilation-current-error (which was | 1746 ;; FIXME: The old code moved compilation-current-error (which was |
1737 ;; virtually represented by a mix of compilation-parsing-end and | 1747 ;; virtually represented by a mix of compilation-parsing-end and |