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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# Baba Yaga Emacs Mode
Major mode for the Baba Yaga programming language in Emacs.
## Installation
### Method 1: Manual Installation
1. Copy `baba-yaga-mode.el` to your Emacs load path:
```bash
cp baba-yaga-mode.el ~/.emacs.d/
```
2. Add to your `~/.emacs` or `~/.emacs.d/init.el`:
```elisp
(require 'baba-yaga-mode)
```
### Method 2: Using Package.el (Recommended)
1. Add to your `~/.emacs` or `~/.emacs.d/init.el`:
```elisp
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
```
2. Install the package:
```elisp
M-x package-install RET baba-yaga-mode RET
```
### Method 3: Using use-package
Add to your `~/.emacs` or `~/.emacs.d/init.el`:
```elisp
(use-package baba-yaga-mode
:ensure t
:mode ("\\.baba\\'" . baba-yaga-mode))
```
### Method 4: Using straight.el
Add to your `~/.emacs` or `~/.emacs.d/init.el`:
```elisp
(straight-use-package 'baba-yaga-mode)
```
## Features
- Syntax highlighting for Baba Yaga language
- Automatic filetype detection for `.baba` files
- Indentation support
- Comment handling
- Highlighting for:
- Keywords (when, then, is, with, etc.)
- Types (Bool, Int, Float, String, etc.)
- Operators (->, =>, +, -, etc.)
- Functions and variables
- Strings and numbers
- Comments (// and /* */)
- IO functions (io.out, io.in, etc.)
## Usage
Open any `.baba` file and Emacs should automatically detect the language and apply syntax highlighting.
## Customization
You can customize the mode by adding to your `~/.emacs` or `~/.emacs.d/init.el`:
```elisp
;; Customize indentation width
(setq baba-yaga-indent-width 4)
;; Customize colors (if using a theme)
(custom-set-faces
'(font-lock-keyword-face ((t (:foreground "blue"))))
'(font-lock-type-face ((t (:foreground "green"))))
'(font-lock-operator-face ((t (:foreground "red")))))
```
## Key Bindings
- `RET` - Insert newline and indent
## File Structure
```
dev/emacs/
├── baba-yaga-mode.el # Major mode definition
└── README.md # This file
```
## Building from Source
If you want to install from the source files:
1. Clone the repository
2. Add the `dev/emacs` directory to your load path:
```elisp
(add-to-list 'load-path "~/path/to/baba-yaga/dev/emacs")
(require 'baba-yaga-mode)
```
## Troubleshooting
If syntax highlighting doesn't work:
1. Check that the mode is loaded: `M-x describe-mode`
2. Verify filetype detection: `C-h v major-mode`
3. Force mode activation: `M-x baba-yaga-mode`
4. Check for errors: `M-x view-lossage`
|