Skip to content

Commit

Permalink
add cookbook about Emacs integration (#2506)
Browse files Browse the repository at this point in the history
* add cookbook about Emacs integration

This documents how to simplify usage of Scala CLI repl from within
Emacs.

(This is a followup on this discussion #2501)

* Update sidebar position for the Emacs cookbook

---------

Co-authored-by: Piotr Chabelski <ged.subfan@gmail.com>
  • Loading branch information
ag91 and Gedochao committed Nov 9, 2023
1 parent 36b541a commit 2220656
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions website/docs/cookbooks/emacs.md
@@ -0,0 +1,30 @@
---
title: Scala CLI within Emacs
sidebar_position: 14
---

Emacs users can make it easier to use Scala CLI from within their editor by
loading an extension: <https://github.com/ag91/scala-cli-repl>.

That lets you send Scala code directly from your buffer to the Scala REPL.

![scala-cli-repl-demo](/img/scala-cli-repl.jpg)

The extension also facilitates [literate
programming](https://en.wikipedia.org/wiki/Literate_programming) using
[Org Mode](https://orgmode.org/), by letting the user experiment with
source blocks looking like the following.

``` org
#+begin_src scala :scala-version 3.0.0 :dep '("com.lihaoyi::os-lib:0.9.0")
println("This is:" + os.pwd)
#+end_src
#+end_src
```

In the above you can see that you can select the Scala version and
dependencies you need for your code.

The users who use [lsp-metals](https://github.com/emacs-lsp/lsp-metals)
can also enable lsp support within a source block to access utilities as
completion and navigation from within the Org Mode file.
1 change: 1 addition & 0 deletions website/docs/cookbooks/intro.md
Expand Up @@ -29,6 +29,7 @@ To get started, try one of the cookbooks below:
- [IDEA IntelliJ](./intellij.md)
- [Scala CLI alongside SBT in IDEA IntelliJ](./intellij-sbt-with-bsp.md)
- [Multiple Scala CLI projects as separate modules in IDEA IntelliJ](./intellij-multi-bsp.md)
- [Scala CLI within Emacs](./emacs.md)

## Packaging ⚡️

Expand Down
Binary file added website/static/img/scala-cli-repl.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2220656

Please sign in to comment.