aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-01-08 12:18:55 +0000
committerRichard M. Stallman1994-01-08 12:18:55 +0000
commit52b85866affc31bbade8eb2c49ebdc9f18858e80 (patch)
treea5d255a68e1d95a4e971a34b92f00fb5db5c8dac
parent84fa8eb54bcf68969c02cd84f7735ae2a77fc2af (diff)
downloademacs-52b85866affc31bbade8eb2c49ebdc9f18858e80.tar.gz
emacs-52b85866affc31bbade8eb2c49ebdc9f18858e80.zip
(gud-common-init): Don't crash if no file specified.
-rw-r--r--lisp/gud.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/gud.el b/lisp/gud.el
index d8544e8d878..fac1ae15705 100644
--- a/lisp/gud.el
+++ b/lisp/gud.el
@@ -809,14 +809,15 @@ comint mode, which see."
809 (setq w (cdr w))) 809 (setq w (cdr w)))
810 (car w))) 810 (car w)))
811 (args (delq file-word (cdr words))) 811 (args (delq file-word (cdr words)))
812 (file (expand-file-name (substitute-in-file-name file-word))) 812 (file (and file-word
813 (filepart (file-name-nondirectory file))) 813 (expand-file-name (substitute-in-file-name file-word))))
814 (filepart (and file-word (file-name-nondirectory file))))
814 (switch-to-buffer (concat "*gud-" filepart "*")) 815 (switch-to-buffer (concat "*gud-" filepart "*"))
815 (setq default-directory (file-name-directory file)) 816 (and file-word (setq default-directory (file-name-directory file)))
816 (or (bolp) (newline)) 817 (or (bolp) (newline))
817 (insert "Current directory is " default-directory "\n") 818 (insert "Current directory is " default-directory "\n")
818 (apply 'make-comint (concat "gud-" filepart) program nil 819 (apply 'make-comint (concat "gud-" filepart) program nil
819 (gud-massage-args file args))) 820 (if file-word (gud-massage-args file args))))
820 (gud-mode) 821 (gud-mode)
821 (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) 822 (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
822 (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) 823 (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel)