| 229 | | ;; name as "344"). To avoid this, we disallow filenames exclusively |
|---|
| 230 | | ;; composed of digits. --Stef |
|---|
| | 229 | ;; name as "344"). To avoid this, the second line disallows filenames |
|---|
| | 230 | ;; exclusively composed of digits. --Stef |
|---|
| | 231 | ;; Similarly, we get lots of false positives with messages including |
|---|
| | 232 | ;; times of the form "HH:MM:SS" where MM is taken as a line number, so |
|---|
| | 233 | ;; the last line tries to rule out message where the info after the |
|---|
| | 234 | ;; line number starts with "SS". --Stef |
|---|
| 1826 | | (or buffer |
|---|
| 1827 | | ;; The file doesn't exist. Ask the user where to find it. |
|---|
| 1828 | | (save-excursion ;This save-excursion is probably not right. |
|---|
| 1829 | | (let ((pop-up-windows t)) |
|---|
| 1830 | | (compilation-set-window (display-buffer (marker-buffer marker)) |
|---|
| 1831 | | marker) |
|---|
| 1832 | | (let ((name (expand-file-name |
|---|
| 1833 | | (read-file-name |
|---|
| 1834 | | (format "Find this %s in (default %s): " |
|---|
| 1835 | | compilation-error filename) |
|---|
| 1836 | | spec-dir filename t)))) |
|---|
| 1837 | | (if (file-directory-p name) |
|---|
| 1838 | | (setq name (expand-file-name filename name))) |
|---|
| 1839 | | (setq buffer (and (file-exists-p name) |
|---|
| 1840 | | (find-file-noselect name))))))) |
|---|
| | 1828 | (while (null buffer) ;Repeat until the user selects an existing file. |
|---|
| | 1829 | ;; The file doesn't exist. Ask the user where to find it. |
|---|
| | 1830 | (save-excursion ;This save-excursion is probably not right. |
|---|
| | 1831 | (let ((pop-up-windows t)) |
|---|
| | 1832 | (compilation-set-window (display-buffer (marker-buffer marker)) |
|---|
| | 1833 | marker) |
|---|
| | 1834 | (let* ((name (read-file-name |
|---|
| | 1835 | (format "Find this %s in (default %s): " |
|---|
| | 1836 | compilation-error filename) |
|---|
| | 1837 | spec-dir filename t nil |
|---|
| | 1838 | ;; Try to make sure the user can only select |
|---|
| | 1839 | ;; a valid answer. This predicate may be ignored, |
|---|
| | 1840 | ;; tho, so we still have to double-check afterwards. |
|---|
| | 1841 | ;; TODO: We should probably fix read-file-name so |
|---|
| | 1842 | ;; that it never ignores this predicate, even when |
|---|
| | 1843 | ;; using popup dialog boxes. |
|---|
| | 1844 | (lambda (name) |
|---|
| | 1845 | (if (file-directory-p name) |
|---|
| | 1846 | (setq name (expand-file-name filename name))) |
|---|
| | 1847 | (file-exists-p name)))) |
|---|
| | 1848 | (origname name)) |
|---|
| | 1849 | (cond |
|---|
| | 1850 | ((not (file-exists-p name)) |
|---|
| | 1851 | (message "Cannot find file `%s'" name) |
|---|
| | 1852 | (ding) (sit-for 2)) |
|---|
| | 1853 | ((and (file-directory-p name) |
|---|
| | 1854 | (not (file-exists-p |
|---|
| | 1855 | (setq name (expand-file-name filename name))))) |
|---|
| | 1856 | (message "No `%s' in directory %s" filename origname) |
|---|
| | 1857 | (ding) (sit-for 2)) |
|---|
| | 1858 | (t |
|---|
| | 1859 | (setq buffer (find-file-noselect name)))))))) |
|---|
| 1842 | | ;; This is very weird: it's not even clear which is the current buffer, |
|---|
| 1843 | | ;; so the code below can't be expected to DTRT here. --Stef |
|---|
| 1844 | | (mapcar (function (lambda (ov) |
|---|
| 1845 | | (when (overlay-get ov 'intangible) |
|---|
| 1846 | | (overlay-put ov 'intangible nil)))) |
|---|
| 1847 | | (overlays-in (point-min) (point-max))) |
|---|
| | 1861 | ;; This is weird: it's not even clear which is the current buffer, |
|---|
| | 1862 | ;; so the code below can't be expected to DTRT here. -- Stef |
|---|
| | 1863 | (dolist (ov (overlays-in (point-min) (point-max))) |
|---|
| | 1864 | (when (overlay-get ov 'intangible) |
|---|
| | 1865 | (overlay-put ov 'intangible nil))) |
|---|