diff --git a/dylan-opt.el b/dylan-opt.el index 1721b02..d429411 100644 --- a/dylan-opt.el +++ b/dylan-opt.el @@ -243,13 +243,14 @@ can be used to toggle the optimization highlighting on and off." (defun dylan-opt--default-file-name () "Guess a default optimization file to match the current buffer." - (let* ((path (buffer-file-name)) - (name (file-name-nondirectory path)) - (stem (substring name 0 (string-match "\\.[^.]*$" name))) - (library dylan-buffer-library)) - (expand-file-name - (concat (or (getenv "OPEN_DYLAN_USER_ROOT") "_build") - "/build/" library "/" stem ".el")))) + (and (buffer-file-name) + (let* ((path (buffer-file-name)) + (name (file-name-nondirectory path)) + (stem (substring name 0 (string-match "\\.[^.]*$" name))) + (library dylan-buffer-library)) + (expand-file-name + (concat (or (getenv "OPEN_DYLAN_USER_ROOT") "_build") + "/build/" library "/" stem ".el"))))) ;;;###autoload (defun dylan-opt (opt-file) @@ -257,7 +258,7 @@ can be used to toggle the optimization highlighting on and off." See the command `dylan-opt-mode', which this command enables." (interactive - (list (let ((default (dylan-opt--default-file-name))) + (list (let ((default (or (dylan-opt--default-file-name) ""))) (read-file-name "Dylan optimization file: " (file-name-directory default) nil t