Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 6ffc7a4

Browse files
author
Hörmet Yiltiz
committed
all works
1 parent b5791b4 commit 6ffc7a4

2 files changed

Lines changed: 51 additions & 33 deletions

File tree

lisp_eval/__init__.py

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Evaluates an S-Expression using an available Lisp language. Choose from the detected interpreters.
66
"""
77

8-
from builtins import pow
98
from pathlib import Path
9+
import json
1010
import subprocess
1111

1212
from albert import *
@@ -19,44 +19,19 @@
1919
md_url = "https://github.com/albertlauncher/python/tree/main/lisp_eval/"
2020
md_authors = "@hyiltiz"
2121

22+
_config_file = 'config.yaml'
23+
_config_file = 'config.json'
2224

2325
class Plugin(PluginInstance, TriggerQueryHandler):
2426
def __init__(self):
2527
# search for a language supporting S-Exp: fennel, janet, elisp, clojure, racket
2628
# TODO: this should be a configurable option
2729
# 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)
6035
self.lang_opts = lang_opts
6136

6237
test_sexp = "(+ 1 1)"

lisp_eval/config.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"elisp": {
3+
"prog": "Emacs",
4+
"args": [
5+
"--batch",
6+
"--eval",
7+
"(print {})"
8+
],
9+
"url": "emacs-small.png"
10+
},
11+
"fennel": {
12+
"prog": "fennel",
13+
"args": [
14+
"-e",
15+
"(print {})"
16+
],
17+
"url": "fennel.svg"
18+
},
19+
"janet": {
20+
"prog": "janet",
21+
"args": [
22+
"-e",
23+
"(print {})"
24+
],
25+
"url": "janet.png"
26+
},
27+
"hylang": {
28+
"prog": "hy",
29+
"args": [
30+
"-c",
31+
"(print {})"
32+
],
33+
"url": "cuddles.png"
34+
},
35+
"racket": {
36+
"prog": "racket",
37+
"args": [
38+
"-e",
39+
"(print {})"
40+
],
41+
"url": "racket.svg"
42+
}
43+
}

0 commit comments

Comments
 (0)