-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfemto.rc
79 lines (66 loc) · 2.13 KB
/
femto.rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;; -*-Lisp-*-
;;
;; FEMTO an extended Atto Emacs with a tiny lisp extension language
;; hughbarney AT googlemail.com
;;
;; The editor provides only basic buffer movement and edit functions
;; everything else is done by extending the user interface using the
;; lisp extension language. Functions can be bound to keys using set-key.
;; For example: (set-key "c-k" "(kill-to-eol)")
;;
(setq list (lambda args args))
(setq defmacro
(macro (name params . body)
(list (quote setq) name (list (quote macro) params . body))))
(defmacro defun (name params . body)
(list (quote setq) name (list (quote lambda) params . body)))
(defun string (s)
;; Convert argument to string.
;; Common Lisp
(cond
((eq nil s) "")
((numberp s) (number-to-string s))
((stringp s) s)
((symbolp s) (symbol-name s))
((consp s) (string.append (string (car s)) (string (cdr s))))
(t (signal 'wrong-type-argument (list "cannot convert to string" s)))))
(defun concat args
;; Concatenate all arguments to a string.
;; Elisp
(cond
((eq nil args) "")
((eq nil (cdr args)) (string (car args)))
(t (string.append (string (car args)) (concat (cdr args)))) ))
(defun memq (o l)
;; If object o in list l return sublist of l starting with o, else nil.
;; Elisp
(cond
((eq nil o) nil)
((eq nil l) nil)
((eq o (car l)) l)
(t (memq o (cdr l)))))
;; Features
(setq features nil)
(defun provide args
;; args: (feature [subfeature ..])
;; Elisp, subfeatures not implemented
(setq features (cons (car args) features)))
(defun require args
;; args: (feature [filename [noerror]])
;; Elisp, optional parameters not implemented
(setq feature (car args))
(cond ((memq feature features) feature)
(t
;; Emacs optionally uses provided filename here
(setq path (concat script_dir "/" (symbol-name feature) ".lsp"))
(load path)
;; Emacs checks if load fails and returns nil instead of feature.
(cond ((memq feature features) feature)))))
(provide 'core)
(setq
~ (os.getenv "HOME")
env-batch-mode (os.getenv "FEMTO_BATCH"))
(cond
((eq "0" env-batch-mode) (require 'startup))
(env-batch-mode)
(t (require 'startup)))