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 | d2e8efd5b449bddaad5b416cb3634532a235576d (patch) | |
tree | 0473f49dd5971117809ab808286a3f1fdbffd552 /elisp | |
parent | a16ac6bd5df86e3541892982d7694f7c1385c5e9 (diff) | |
download | geiser-chez-d2e8efd5b449bddaad5b416cb3634532a235576d.tar.gz geiser-chez-d2e8efd5b449bddaad5b416cb3634532a235576d.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)))) |