diff options
| author | Richard M. Stallman | 1994-10-29 11:14:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-10-29 11:14:05 +0000 |
| commit | 0ec5b01db42ba833501f60a60561d4c73e5425e9 (patch) | |
| tree | aff0e2eebb62ae57cdaa235bfed1a67e1433acca | |
| parent | 82c90203bd9250306b5ad45e724269d1190893f5 (diff) | |
| download | emacs-0ec5b01db42ba833501f60a60561d4c73e5425e9.tar.gz emacs-0ec5b01db42ba833501f60a60561d4c73e5425e9.zip | |
(gud-common-init): If file arg has no directory,
let the debugger search PATH, and don't set default-directory.
| -rw-r--r-- | lisp/gud.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/gud.el b/lisp/gud.el index 75e89821922..34e740bd50f 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -983,12 +983,29 @@ comint mode, which see." | |||
| 983 | (while (and w (= ?- (aref (car w) 0))) | 983 | (while (and w (= ?- (aref (car w) 0))) |
| 984 | (setq w (cdr w))) | 984 | (setq w (cdr w))) |
| 985 | (car w))) | 985 | (car w))) |
| 986 | (file-subst | ||
| 987 | (and file-word (substitute-in-file-name file-word))) | ||
| 986 | (args (delq file-word (cdr words))) | 988 | (args (delq file-word (cdr words))) |
| 989 | ;; If a directory was specified, expand the file name. | ||
| 990 | ;; Otherwise, don't expand it, so GDB can use the PATH. | ||
| 991 | ;; A file name without directory is literally valid | ||
| 992 | ;; only if the file exists in ., and in that case, | ||
| 993 | ;; omitting the expansion here has no visible effect. | ||
| 987 | (file (and file-word | 994 | (file (and file-word |
| 988 | (expand-file-name (substitute-in-file-name file-word)))) | 995 | (if (file-name-directory file-subst) |
| 996 | (expand-file-name file-subst) | ||
| 997 | file-subst))) | ||
| 989 | (filepart (and file-word (file-name-nondirectory file)))) | 998 | (filepart (and file-word (file-name-nondirectory file)))) |
| 990 | (switch-to-buffer (concat "*gud-" filepart "*")) | 999 | (switch-to-buffer (concat "*gud-" filepart "*")) |
| 991 | (and file-word (setq default-directory (file-name-directory file))) | 1000 | ;; Set default-directory to the file's directory. |
| 1001 | (and file-word | ||
| 1002 | ;; Don't set default-directory if no directory was specified. | ||
| 1003 | ;; In that case, either the file is found in the current directory, | ||
| 1004 | ;; in which case this setq is a no-op, | ||
| 1005 | ;; or it is found by searching PATH, | ||
| 1006 | ;; in which case we don't know what directory it was found in. | ||
| 1007 | (file-name-directory file) | ||
| 1008 | (setq default-directory (file-name-directory file))) | ||
| 992 | (or (bolp) (newline)) | 1009 | (or (bolp) (newline)) |
| 993 | (insert "Current directory is " default-directory "\n") | 1010 | (insert "Current directory is " default-directory "\n") |
| 994 | (apply 'make-comint (concat "gud-" filepart) program nil | 1011 | (apply 'make-comint (concat "gud-" filepart) program nil |