@@ -29,4 +29,6 @@ Lisp editorOpenFile(Lisp args, LispError *e, LispContext ctx);
|
|||||||
|
|
||||||
Lisp editorPrintC(Lisp args, LispError *e, LispContext ctx);
|
Lisp editorPrintC(Lisp args, LispError *e, LispContext ctx);
|
||||||
|
|
||||||
|
Lisp addPackage(Lisp args, LispError *e, LispContext ctx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-2
@@ -17,11 +17,19 @@ fi
|
|||||||
echo "Create config files ..."
|
echo "Create config files ..."
|
||||||
mkdir -pv ~/.beluga/
|
mkdir -pv ~/.beluga/
|
||||||
cp -rv ./assets/ ~/.beluga/
|
cp -rv ./assets/ ~/.beluga/
|
||||||
cp -rv ./config/ ~/.beluga/
|
mkdir -pv ~/.beluga/packages/
|
||||||
|
|
||||||
|
read -p "Do you want to replace your config file or keep it (init.lisp.bak) / (init.lisp.new) ? (Y/n)" confirm
|
||||||
|
if [[ "$confirm" =~ ^[Yy]$ ]]; then
|
||||||
|
mv ~/.beluga/config/init.lisp ~/.beluga/config/init.lisp.bak
|
||||||
|
cp -rv ./config/init.lisp ~/.beluga/config/
|
||||||
|
else
|
||||||
|
cp -rv ./config/init.lisp ~/.beluga/config/init.lisp.new
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Compile the project
|
# Compile the project
|
||||||
|
|
||||||
|
|
||||||
echo "Start compilation ..."
|
echo "Start compilation ..."
|
||||||
meson setup build/
|
meson setup build/
|
||||||
meson compile -C build/
|
meson compile -C build/
|
||||||
|
|||||||
+18
-2
@@ -27,7 +27,6 @@ Lisp mapKey(Lisp args, LispError *e, LispContext ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Lisp moveCursor(Lisp args, LispError *e, LispContext ctx) {
|
Lisp moveCursor(Lisp args, LispError *e, LispContext ctx) {
|
||||||
fprintf(stderr, "Cursor is moving\n");
|
|
||||||
const char *direction = lisp_string(lisp_car(args));
|
const char *direction = lisp_string(lisp_car(args));
|
||||||
switch (direction[0]) {
|
switch (direction[0]) {
|
||||||
case 'u':
|
case 'u':
|
||||||
@@ -134,8 +133,25 @@ Lisp editorOpenFile(Lisp args, LispError *e, LispContext ctx) {
|
|||||||
|
|
||||||
|
|
||||||
Lisp editorPrintC(Lisp args, LispError *e, LispContext ctx) {
|
Lisp editorPrintC(Lisp args, LispError *e, LispContext ctx) {
|
||||||
char c = lisp_char(lisp_car(args));
|
char c = lisp_string(lisp_car(args))[0];
|
||||||
editorInsertChar(c);
|
editorInsertChar(c);
|
||||||
return lisp_null();
|
return lisp_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Lisp addPackage(Lisp args, LispError *e, LispContext ctx) {
|
||||||
|
const char *package_name = lisp_string(lisp_car(args));
|
||||||
|
char *package_dir = (char *) calloc(256, sizeof(char));
|
||||||
|
FILE *fd_package = NULL;
|
||||||
|
strcat(package_dir, getenv("HOME"));
|
||||||
|
strcat(package_dir, "/.beluga/packages/");
|
||||||
|
strcat(package_dir, package_name);
|
||||||
|
strcat(package_dir, "/init.lisp");
|
||||||
|
fd_package = fopen(package_dir, "r");
|
||||||
|
lisp_eval(lisp_read_file(fd_package, &E.ctx_error, E.ctx), &E.ctx_error,
|
||||||
|
E.ctx);
|
||||||
|
fclose(fd_package);
|
||||||
|
free(package_dir);
|
||||||
|
|
||||||
|
return lisp_null();
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ void initBuiltins() {
|
|||||||
registerBuiltin("MOVE-CURSOR-PAGE-DOWN", editorMoveCursorPageDown);
|
registerBuiltin("MOVE-CURSOR-PAGE-DOWN", editorMoveCursorPageDown);
|
||||||
registerBuiltin("EDITOR-OPEN-FILE", editorOpenFile);
|
registerBuiltin("EDITOR-OPEN-FILE", editorOpenFile);
|
||||||
registerBuiltin("EDITOR-INSERT-CHAR", editorPrintC);
|
registerBuiltin("EDITOR-INSERT-CHAR", editorPrintC);
|
||||||
|
registerBuiltin("ADD-PACKAGE", addPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initEditor() {
|
void initEditor() {
|
||||||
|
|||||||
Reference in New Issue
Block a user