branch: master
commit f360eadca3263624bb9e3380eb5cd2f7ab728c9c
Author: rocky <[email protected]>
Commit: rocky <[email protected]>

    Allow nil as file parameter in realgud-exec-shell
    
    Fixes #165
---
 realgud/common/core.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/realgud/common/core.el b/realgud/common/core.el
index d7dade7..25de3d7 100644
--- a/realgud/common/core.el
+++ b/realgud/common/core.el
@@ -228,15 +228,16 @@ NO-RESET is nil, then that information which may point 
into other
 buffers and source buffers which may contain marks and fringe or
 marginal icons is reset."
 
-  (let* ((current-directory
-         (or (file-name-directory script-filename)
+  (let* ((non-nil-filename (or script-filename "+No filename+"))
+        (current-directory
+         (or (file-name-directory non-nil-filename)
              default-directory "./"))
         (cmdproc-buffer-name
          (replace-regexp-in-string
           "\s+" "\s"
           (format "*%s %s shell*"
                   (file-name-nondirectory debugger-name)
-                  (file-name-nondirectory script-filename))))
+                  (file-name-nondirectory non-nil-filename))))
         (cmdproc-buffer (get-buffer-create cmdproc-buffer-name))
         (realgud-buf (current-buffer))
         (cmd-args (cons program args))
@@ -302,7 +303,7 @@ marginal icons is reset."
          (let ((src-buffer)
                (cmdline-list (cons program args)))
            ;; is this right?
-           (when (and (file-exists-p script-filename)
+           (when (and script-filename (file-exists-p script-filename)
                       (not (realgud:binary script-filename)))
              (setq src-buffer (find-file-noselect script-filename))
              (point-max)

Reply via email to