diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-06-19 16:51:31 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-06-19 16:51:31 +0200 |
commit | fee4491e73ff69a25a320be815a64daf18246ca8 (patch) | |
tree | 48336195c354171d3075abe982376c913f101dd5 /elisp | |
parent | b6723f8fe425bde252ef02936f8864e3bef3aa53 (diff) | |
download | geiser-fee4491e73ff69a25a320be815a64daf18246ca8.tar.gz geiser-fee4491e73ff69a25a320be815a64daf18246ca8.tar.bz2 |
Directory-specific implementations.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-impl.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/elisp/geiser-impl.el b/elisp/geiser-impl.el index ccb0584..236af27 100644 --- a/elisp/geiser-impl.el +++ b/elisp/geiser-impl.el @@ -46,6 +46,18 @@ :type '(repeat symbol) :group 'geiser-impl) +(defcustom geiser-impl-implementations-alist nil + "A map from regular expressions or directories to implementations. +When opening a new file, its full path will be matched against +each one of the regular expressions or directories in this map in order to +determine its scheme flavour." + :type '(repeat (list (choice (group :tag "Regular expression" + (const regexp) regexp) + (group :tag "Directory" + (const dir) directory)) + symbol)) + :group 'geiser-impl) + ;;; Registering implementations: @@ -200,10 +212,21 @@ "Set this buffer local variable to specify the Scheme implementation to be used by Geiser.")) +(defun geiser-impl--match-impl (desc bn) + (let ((rx (if (eq (car desc) 'regexp) + (cadr desc) + (format "^%s" (regexp-quote (cadr desc)))))) + (and rx (string-match-p rx bn)))) + (defun geiser-impl--guess () (or geiser-impl--implementation geiser-scheme-implementation (catch 'impl + (let ((bn (buffer-file-name))) + (when bn + (dolist (x geiser-impl-implementations-alist) + (when (geiser-impl--match-impl (car x) bn) + (throw 'impl (cadr x)))))) (dolist (impl geiser-impl--impls) (when (geiser-impl--call-if-bound impl "guess") (throw 'impl impl)))) |