From 2b0aefb48c0a4fec12466122d9b54b1894824ee3 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 16 May 2009 00:01:21 +0200 Subject: PLT: Correct identification of explicit module definitions. --- elisp/geiser-plt.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'elisp/geiser-plt.el') 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))) -- cgit v1.2.3