Commit c27c1042 authored by Karl Heuer's avatar Karl Heuer
Browse files

(gud-common-init): Don't die if filename not supplied.

Omit trailing hyphen when no filename follows.
parent 2db10f13
...@@ -1118,8 +1118,9 @@ comint mode, which see." ...@@ -1118,8 +1118,9 @@ comint mode, which see."
(file-word (let ((w (cdr words))) (file-word (let ((w (cdr words)))
(while (and w (= ?- (aref (car w) 0))) (while (and w (= ?- (aref (car w) 0)))
(setq w (cdr w))) (setq w (cdr w)))
(prog1 (car w) (and w
(setcar w t)))) (prog1 (car w)
(setcar w t)))))
(file-subst (file-subst
(and file-word (substitute-in-file-name file-word))) (and file-word (substitute-in-file-name file-word)))
(args (cdr words)) (args (cdr words))
...@@ -1132,8 +1133,8 @@ comint mode, which see." ...@@ -1132,8 +1133,8 @@ comint mode, which see."
(if (file-name-directory file-subst) (if (file-name-directory file-subst)
(expand-file-name file-subst) (expand-file-name file-subst)
file-subst))) file-subst)))
(filepart (and file-word (file-name-nondirectory file)))) (filepart (and file-word (concat "-" (file-name-nondirectory file)))))
(switch-to-buffer (concat "*gud-" filepart "*")) (switch-to-buffer (concat "*gud" filepart "*"))
;; Set default-directory to the file's directory. ;; Set default-directory to the file's directory.
(and file-word (and file-word
;; Don't set default-directory if no directory was specified. ;; Don't set default-directory if no directory was specified.
...@@ -1149,8 +1150,9 @@ comint mode, which see." ...@@ -1149,8 +1150,9 @@ comint mode, which see."
(let ((w args)) (let ((w args))
(while (and w (not (eq (car w) t))) (while (and w (not (eq (car w) t)))
(setq w (cdr w))) (setq w (cdr w)))
(setcar w file)) (if w
(apply 'make-comint (concat "gud-" filepart) program nil (setcar w file)))
(apply 'make-comint (concat "gud" filepart) program nil
(if file-word (funcall massage-args file args) args))) (if file-word (funcall massage-args file args) args)))
;; Since comint clobbered the mode, we don't set it until now. ;; Since comint clobbered the mode, we don't set it until now.
(gud-mode) (gud-mode)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment