<commit_before># Quick guide

This guide aims to be as short and informative, as possible. 

## 1. Preparations

### 1.1 Install

```
# Assuming your current directory is <...>.
# Download repository.
git clone https://github.com/Quasilyte/Go.el.git
cd 'Go.el'
# Build everything.
make all
# Install emacs packages and compiled binaries
sudo make install
```

Note that you can avoid `make install`.
This guide is written for the case when you do install it.
Look at the `Makefile` to get clues what you will miss without `install`.

Because `Go.el` is not a proper Emacs package yet,
you have to `load` it manually. 

Options:
* `(load "<...>/Go.el/build/Go.elc")`
* Visit `build/Go.elc` buffer and run `M-x RET eval-buffer`

There is `build/Go.el` file if you want to inspect package sources
before loading them.

### 1.2 Setup environment

If you did `make install`, skip this section.

Set `Go-utils-path` Emacs variable: it must point to `bin`
directory which contains `goel_translate_package`.
It can be done via `M-x customize` (`development/Go.el` group).
Value `<...>/Go.el/bin` will work.

By default, `Go.el` searches `Go` packages that are meant to
be run inside Emacs at `~/go/src/emacs/`.
For example, `(Go-translate-by-name "foo")`
will look for `~/go/src/emacs/foo`.
This can be customized with `Go-emacs-package-path` variable.

### 1.3 Check installation

Run `M-x Go-translate-by-name` and enter `example` package name.
You should see `*IR compile*` temporary buffer which contain
compiled Go package. 

Switch to that buffer and do `M-x eval-buffer`.

```
(Go-example.PrintFiveLetters [?a ?b ?c ?d ?e])
(Go-example.PrintMessage "Hello, Emacs!") 
;; Check *Messages* buffer.
```

You have just executed Go code inside Emacs.

To make it more convenient, you can bind a hotkey,
for example `(global-set-key (kbd "C-x g") 'Go-translate-by-name)`.

## 2. Basic usage

### 2.1 Writing Go packages for Emacs

> Mockup<commit_msg>Update quick_guide.md<commit_after># Quick guide

This guide presents a shortest way to learn `Go.el`.
Details describes elsewhere.

## 1. Preparations

### 1.1 Prerequisites

* `go` 1.6 or above
* `emacs` 24.1 or above (lexical scoping)
* Fundamental tools like `make` and `git`

### 1.2 Install

```
# Download repository.
git clone https://github.com/Quasilyte/Go.el.git
cd 'Go.el'
# Build everything.
make all
# Install bundled emacs packages and compiled binaries.
sudo make install
```

> `<...>` inside paths means "directory which contains cloned Go.el"

Note that you can avoid `make install`.
This guide is written for the case when you do install it.
Look at the `Makefile` to get clues what you will miss without `install`.

Because `Go.el` is not a proper Emacs package yet,
you have to `load` it manually. 

Options:
* `(load "<...>/Go.el/build/Go.elc")`
* Visit `build/Go.elc` buffer and run `M-x RET eval-buffer`

There is `build/Go.el` file if you want to inspect package sources
before loading them.

### 1.3 Setup environment

If you did `make install`, skip this section.

Set `Go-utils-path` Emacs variable: it must point to `bin`
directory which contains `goel_translate_package`.
It can be done via `M-x customize` (`development/Go.el` group).
Value `<...>/Go.el/bin` will work.

By default, `Go.el` searches `Go` packages that are meant to
be run inside Emacs at `~/go/src/emacs/`.
For example, `(Go-translate-by-name "foo")`
will look for `~/go/src/emacs/foo`.
This can be customized with `Go-emacs-package-path` variable.

### 1.4 Check installation

Run `M-x Go-translate-by-name` and enter `example` package name.
You should see `*IR compile*` temporary buffer which contain
compiled Go package. 

Switch to that buffer and do `M-x eval-buffer`.

```
;; You can paste this code in *Scratch* buffer and
;; evaluate it with `eval-region'.

(Go-example.PrintFiveLetters [?a ?b ?c ?d ?e])
(Go-example.PrintMessage "Hello, Emacs!") 

;; Check the *Messages* buffer.
```

You have just executed Go code inside Emacs.

> You can bind compilation to a hotkey:
> `(global-set-key (kbd "C-x g") 'Go-translate-by-name)`

## 2. Basic usage

### 2.1 Writing Go packages for Emacs

> Mockup
{'fraction_non_alphanumeric': 0.12828550759585242, 'fraction_numerical': 0.0065107306486616836, 'mean_word_length': 3.857142857142857, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7015229', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1340, 'n_words': 554}