|
5 | 5 | Evaluates an S-Expression using an available Lisp language. Choose from the detected interpreters. |
6 | 6 | """ |
7 | 7 |
|
8 | | -from builtins import pow |
9 | 8 | from pathlib import Path |
| 9 | +import json |
10 | 10 | import subprocess |
11 | 11 |
|
12 | 12 | from albert import * |
|
19 | 19 | md_url = "https://github.com/albertlauncher/python/tree/main/lisp_eval/" |
20 | 20 | md_authors = "@hyiltiz" |
21 | 21 |
|
| 22 | +_config_file = 'config.yaml' |
| 23 | +_config_file = 'config.json' |
22 | 24 |
|
23 | 25 | class Plugin(PluginInstance, TriggerQueryHandler): |
24 | 26 | def __init__(self): |
25 | 27 | # search for a language supporting S-Exp: fennel, janet, elisp, clojure, racket |
26 | 28 | # TODO: this should be a configurable option |
27 | 29 | # Users should make available the executables in the system PATH |
28 | | - lang_opts = { |
29 | | - "elisp": { |
30 | | - "prog": "emacs", |
31 | | - "args": ["--batch", "--eval", "(print {})"], |
32 | | - "url": "emacs-small.png", |
33 | | - }, |
34 | | - "elisp": { |
35 | | - "prog": "Emacs", |
36 | | - "args": ["--batch", "--eval", "(print {})"], |
37 | | - "url": "emacs-small.png", |
38 | | - }, |
39 | | - "fennel": { |
40 | | - "prog": "fennel", |
41 | | - "args": ["-e", "(print {})"], |
42 | | - "url": "fennel.svg", |
43 | | - }, |
44 | | - "janet": { |
45 | | - "prog": "janet", |
46 | | - "args": ["-e", "(print {})"], |
47 | | - "url": "janet.png", |
48 | | - }, |
49 | | - "hylang": { |
50 | | - "prog": "hy", # this is a pip3 dependency: `hy` |
51 | | - "args": ["-c", "(print {})"], |
52 | | - "url": "cuddles.png", |
53 | | - }, |
54 | | - "racket": { |
55 | | - "prog": "racket", |
56 | | - "args": ["-e", "(print {})"], |
57 | | - "url": "racket.svg", |
58 | | - }, |
59 | | - } |
| 30 | + |
| 31 | + lang_opts = json.load((Path(__file__).parent / Path(_config_file)).open()) |
| 32 | + print('---------------------------') |
| 33 | + print(type(lang_opts)) |
| 34 | + print(lang_opts) |
60 | 35 | self.lang_opts = lang_opts |
61 | 36 |
|
62 | 37 | test_sexp = "(+ 1 1)" |
|
0 commit comments