summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elisp/geiser-plt.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el
index 16c0b96..7c66682 100644
--- a/elisp/geiser-plt.el
+++ b/elisp/geiser-plt.el
@@ -95,9 +95,16 @@ This function uses `geiser-plt-init-file' if it exists."
(ignore-errors
(car (read-from-string (match-string-no-properties 1)))))))
+(defsubst geiser-plt--implicit-module ()
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward "^#lang " nil t)
+ (buffer-name)
+ :f)))
+
(defun geiser-plt-get-module (&optional module)
(cond ((and (null module) (geiser-plt--explicit-module)))
- ((null module) (buffer-file-name))
+ ((null module) (geiser-plt--implicit-module))
((symbolp module) (list 'quote module))
((and (stringp module) (file-name-absolute-p module)) module)
((stringp module) (list 'quote (intern module)))