# Emacs

GNU Emacs is an extensible, customizable text editor - and more. At its core is an interpreter for Emacs Lisp, a dialect of the Lisp programming language with extensions to support text editing.

Refer to the Emacs Documentation page for more detailed information.

Contents

- Emacs

  - Integration

    - PlatformIO-Mode

    - Project Generator

## Integration

Integration process consists of these steps:

1. Open system Terminal and install PlatformIO Core (CLI)

2. Create new folder for your project and change directory (`cd`) to it

3. Generate a project using PIO Core Project Generator (`platformio project init --ide`)

4. Import project in IDE.

### PlatformIO-Mode

An Emacs minor mode has been written to facilitate building and uploading from within Emacs. It can be installed from the MELPA repository using `M-x package-install`. See the MELPA Getting Started page for more information.

Setup instructions and an example config can be found at the Github page.

Code completion can optionally be provided by installing irony-mode

### Project Generator

Choose board `ID` using platformio boards or Embedded Boards Explorer command and generate project via `platformio project init --ide` command:

    platformio project init --ide emacs --board <ID>

There are 6 predefined targets for building.

- `platformio_build` - Build project without auto-uploading. (`C-c i b`)

- `platformio_clean` - Clean compiled objects. (`C-c i c`)

- `platformio_upload` - Build and upload (if no errors). (`C-c i u`)

- `platformio_programmer_upload` - Build and upload using external programmer (if no errors, see Upload using Programmer). (`C-c i p`)

- `platformio_spiffs_upload` - Upload files to file system SPIFFS (see Uploading files to file system SPIFFS). (`C-c i s`)

- `platformio_update` - Update installed platforms and libraries. (`C-c i d`)

Warning

The libraries which are added, installed or used in the project after generating process won’t be reflected in IDE. To fix it you need to reinitialize project using platformio project init (repeat it).