comparison lisp/progmodes/compile.el @ 26990:5d153e0fe112

(compilation-goto-locus): Delete hideshow overlays if they interfere. (compilation-find-file): Make intangible overlays tangible.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Sun, 26 Dec 1999 12:59:52 +0000
parents bfcbc828fdbc
children 6452df59183b
comparison
equal deleted inserted replaced
26989:340ed24f202a 26990:5d153e0fe112
1625 ;; going to the right place, widen. 1625 ;; going to the right place, widen.
1626 (or (= (point) (marker-position (cdr next-error))) 1626 (or (= (point) (marker-position (cdr next-error)))
1627 (progn 1627 (progn
1628 (widen) 1628 (widen)
1629 (goto-char (cdr next-error)))) 1629 (goto-char (cdr next-error))))
1630 ;; If hideshow got in the way of
1631 ;; seeing the right place, open permanently.
1632 (mapcar (function (lambda (ov)
1633 (when (eq 'hs (overlay-get ov 'invisible))
1634 (delete-overlay ov)
1635 (goto-char (cdr next-error)))))
1636 (overlays-at (point)))
1630 1637
1631 ;; Show compilation buffer in other window, scrolled to this error. 1638 ;; Show compilation buffer in other window, scrolled to this error.
1632 (let* ((pop-up-windows t) 1639 (let* ((pop-up-windows t)
1633 ;; Use an existing window if it is in a visible frame. 1640 ;; Use an existing window if it is in a visible frame.
1634 (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible) 1641 (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible)
1644 A nil in compilation-search-path means to try the 1651 A nil in compilation-search-path means to try the
1645 current directory, which is passed in DIR. 1652 current directory, which is passed in DIR.
1646 If FILENAME is not found at all, ask the user where to find it. 1653 If FILENAME is not found at all, ask the user where to find it.
1647 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." 1654 Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
1648 (or formats (setq formats '("%s"))) 1655 (or formats (setq formats '("%s")))
1649 (let ((dirs compilation-search-path) 1656 (save-excursion
1650 buffer thisdir fmts name) 1657 (let ((dirs compilation-search-path)
1651 (if (file-name-absolute-p filename) 1658 buffer thisdir fmts name)
1659 (if (file-name-absolute-p filename)
1652 ;; The file name is absolute. Use its explicit directory as 1660 ;; The file name is absolute. Use its explicit directory as
1653 ;; the first in the search path, and strip it from FILENAME. 1661 ;; the first in the search path, and strip it from FILENAME.
1654 (setq filename (abbreviate-file-name (expand-file-name filename)) 1662 (setq filename (abbreviate-file-name (expand-file-name filename))
1655 dirs (cons (file-name-directory filename) dirs) 1663 dirs (cons (file-name-directory filename) dirs)
1656 filename (file-name-nondirectory filename))) 1664 filename (file-name-nondirectory filename)))
1657 ;; Now search the path. 1665 ;; Now search the path.
1658 (while (and dirs (null buffer)) 1666 (while (and dirs (null buffer))
1659 (setq thisdir (or (car dirs) dir) 1667 (setq thisdir (or (car dirs) dir)
1660 fmts formats) 1668 fmts formats)
1661 ;; For each directory, try each format string. 1669 ;; For each directory, try each format string.
1662 (while (and fmts (null buffer)) 1670 (while (and fmts (null buffer))
1663 (setq name (expand-file-name (format (car fmts) filename) thisdir) 1671 (setq name (expand-file-name (format (car fmts) filename) thisdir)
1664 buffer (and (file-exists-p name) 1672 buffer (and (file-exists-p name)
1665 (find-file-noselect name)) 1673 (find-file name))
1666 fmts (cdr fmts))) 1674 fmts (cdr fmts)))
1667 (setq dirs (cdr dirs))) 1675 (setq dirs (cdr dirs)))
1668 (or buffer 1676 (or buffer
1669 ;; The file doesn't exist. 1677 ;; The file doesn't exist.
1670 ;; Ask the user where to find it. 1678 ;; Ask the user where to find it.
1671 ;; If he hits C-g, then the next time he does 1679 ;; If he hits C-g, then the next time he does
1672 ;; next-error, he'll skip past it. 1680 ;; next-error, he'll skip past it.
1673 (let* ((pop-up-windows t) 1681 (let* ((pop-up-windows t)
1674 (w (display-buffer (marker-buffer marker)))) 1682 (w (display-buffer (marker-buffer marker))))
1675 (set-window-point w marker) 1683 (set-window-point w marker)
1676 (set-window-start w marker) 1684 (set-window-start w marker)
1677 (let ((name (expand-file-name 1685 (let ((name (expand-file-name
1678 (read-file-name 1686 (read-file-name
1679 (format "Find this error in: (default %s) " 1687 (format "Find this error in: (default %s) "
1680 filename) 1688 filename)
1681 dir filename t)))) 1689 dir filename t))))
1682 (if (file-directory-p name) 1690 (if (file-directory-p name)
1683 (setq name (expand-file-name filename name))) 1691 (setq name (expand-file-name filename name)))
1684 (and (file-exists-p name) 1692 (setq buffer (and (file-exists-p name)
1685 (find-file-noselect name))))))) 1693 (find-file name))))))
1694 ;; Make intangible overlays tangible.
1695 (mapcar (function (lambda (ov)
1696 (when (overlay-get ov 'intangible)
1697 (overlay-put ov 'intangible nil))))
1698 (overlays-in (point-min) (point-max)))
1699 buffer)))
1700
1686 1701
1687 ;; Set compilation-error-list to nil, and unchain the markers that point to the 1702 ;; Set compilation-error-list to nil, and unchain the markers that point to the
1688 ;; error messages and their text, so that they no longer slow down gap motion. 1703 ;; error messages and their text, so that they no longer slow down gap motion.
1689 ;; This would happen anyway at the next garbage collection, but it is better to 1704 ;; This would happen anyway at the next garbage collection, but it is better to
1690 ;; do it right away. 1705 ;; do it right away.
1691 (defun compilation-forget-errors () 1706 (defun compilation-forget-errors ()
1692 (while compilation-old-error-list 1707 (while compilation-old-error-list
1693 (let ((next-error (car compilation-old-error-list))) 1708 (let ((next-error (car compilation-old-error-list)))
1694 (set-marker (car next-error) nil) 1709 (set-marker (car next-error) nil)
1695 (if (markerp (cdr next-error)) 1710 (if (markerp (cdr next-error))
1696 (set-marker (cdr next-error) nil))) 1711 (set-marker (cdr next-error) nil)))
1858 ;; If linenum is not a number then it must be 1873 ;; If linenum is not a number then it must be
1859 ;; a function returning an error position 1874 ;; a function returning an error position
1860 ;; descriptor or nil (meaning no position). 1875 ;; descriptor or nil (meaning no position).
1861 (save-excursion 1876 (save-excursion
1862 (funcall linenum filename column)))) 1877 (funcall linenum filename column))))
1863 1878
1864 ;; We have an error position descriptor. 1879 ;; We have an error position descriptor.
1865 ;; If we have found as many new errors as the user 1880 ;; If we have found as many new errors as the user
1866 ;; wants, or if we are past the buffer position he 1881 ;; wants, or if we are past the buffer position he
1867 ;; indicated, then we continue to parse until we have 1882 ;; indicated, then we continue to parse until we have
1868 ;; seen all consecutive errors in the same file. This 1883 ;; seen all consecutive errors in the same file. This