aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2006-07-18 14:40:29 +0000
committerStefan Monnier2006-07-18 14:40:29 +0000
commitf65b9df2d70ad1b7cb0a0a2167a9ba56c2c0e567 (patch)
treec8a7781e180e129730c3dafa309fd1b56fd90976 /lisp
parentb0c2455471bb46cb6152ea28cd337e7ead8b0029 (diff)
downloademacs-f65b9df2d70ad1b7cb0a0a2167a9ba56c2c0e567.tar.gz
emacs-f65b9df2d70ad1b7cb0a0a2167a9ba56c2c0e567.zip
(compilation-find-file): Handle the
cases where the user selects a non-existent file.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/compile.el58
2 files changed, 46 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ffeac9d760a..885ffca4f24 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12006-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/compile.el (compilation-find-file): Handle the
4 cases where the user selects a non-existent file.
5
62006-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * bindings.el (minibuffer-local-map): Rebind TAB so it inserts a \t.
9
12006-07-17 Chong Yidong <cyd@stupidchicken.com> 102006-07-17 Chong Yidong <cyd@stupidchicken.com>
2 11
3 * subr.el (sit-for): Just sleep-for if noninteractive. 12 * subr.el (sit-for): Just sleep-for if noninteractive.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 2e60594168a..525c462d4eb 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1825,28 +1825,44 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user."
1825 (find-file-noselect name)) 1825 (find-file-noselect name))
1826 fmts (cdr fmts))) 1826 fmts (cdr fmts)))
1827 (setq dirs (cdr dirs))) 1827 (setq dirs (cdr dirs)))
1828 (or buffer 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. 1829 ;; The file doesn't exist. Ask the user where to find it.
1830 (save-excursion ;This save-excursion is probably not right. 1830 (save-excursion ;This save-excursion is probably not right.
1831 (let ((pop-up-windows t)) 1831 (let ((pop-up-windows t))
1832 (compilation-set-window (display-buffer (marker-buffer marker)) 1832 (compilation-set-window (display-buffer (marker-buffer marker))
1833 marker) 1833 marker)
1834 (let ((name (expand-file-name 1834 (let* ((name (read-file-name
1835 (read-file-name 1835 (format "Find this %s in (default %s): "
1836 (format "Find this %s in (default %s): " 1836 compilation-error filename)
1837 compilation-error filename) 1837 spec-dir filename t nil
1838 spec-dir filename t)))) 1838 ;; Try to make sure the user can only select
1839 (if (file-directory-p name) 1839 ;; a valid answer. This predicate may be ignored,
1840 (setq name (expand-file-name filename name))) 1840 ;; tho, so we still have to double-check afterwards.
1841 (setq buffer (and (file-exists-p name) 1841 ;; TODO: We should probably fix read-file-name so
1842 (find-file-noselect name))))))) 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))))))))
1843 ;; Make intangible overlays tangible. 1860 ;; Make intangible overlays tangible.
1844 ;; This is very weird: it's not even clear which is the current buffer, 1861 ;; This is weird: it's not even clear which is the current buffer,
1845 ;; so the code below can't be expected to DTRT here. --Stef 1862 ;; so the code below can't be expected to DTRT here. -- Stef
1846 (mapcar (function (lambda (ov) 1863 (dolist (ov (overlays-in (point-min) (point-max)))
1847 (when (overlay-get ov 'intangible) 1864 (when (overlay-get ov 'intangible)
1848 (overlay-put ov 'intangible nil)))) 1865 (overlay-put ov 'intangible nil)))
1849 (overlays-in (point-min) (point-max)))
1850 buffer)) 1866 buffer))
1851 1867
1852(defun compilation-get-file-structure (file &optional fmt) 1868(defun compilation-get-file-structure (file &optional fmt)