Skip to content

Commit 92e26c4

Browse files
committed
(minor) emacs-ide: fix headings
1 parent 8acb8b6 commit 92e26c4

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

emacs-ide.md

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Using Emacs as an IDE
1+
---
2+
title: Emacs
3+
---
4+
5+
## Using Emacs as an IDE
26

37
This page is meant to provide an introduction to using [Emacs](https://www.gnu.org/software/emacs/) as a Lisp IDE.
48

@@ -12,7 +16,7 @@ straightforward way to get going.
1216

1317
<a name="Slide-2"></a>
1418

15-
## Why Use Emacs?
19+
### Why Use Emacs?
1620

1721
* Emacs has fantastic support for working with Lisp code
1822
* Not tying yourself into a single CL vendor's editor
@@ -32,7 +36,7 @@ straightforward way to get going.
3236

3337
<a name="Slide-3"></a>
3438

35-
## Emacs Lisp vs Common Lisp
39+
### Emacs Lisp vs Common Lisp
3640

3741
* Learning Emacs Lisp is useful and similar (but different from CL):
3842
* Dynamic scope is everywhere
@@ -50,7 +54,7 @@ straightforward way to get going.
5054

5155
<a name="Slide-slime"></a>
5256

53-
### SLIME: Superior Lisp Interaction Mode for Emacs
57+
#### SLIME: Superior Lisp Interaction Mode for Emacs
5458

5559
[SLIME](http://common-lisp.net/project/slime/) is the goto major mode
5660
for CL programming.
@@ -77,7 +81,7 @@ for CL programming.
7781

7882
Check out this **[video tutorial](https://www.youtube.com/watch?v=sBcPNr1CKKw)** ! (and the author's channel, full of great stuff)
7983

80-
#### SLIME fancy, contrib packages and other extensions
84+
##### SLIME fancy, contrib packages and other extensions
8185

8286
SLIME's functionalities live in packages and so-called [contrib
8387
modules](https://common-lisp.net/project/slime/doc/html/Contributed-Packages.html)
@@ -109,7 +113,7 @@ others
109113
- Fuzzy-search of the REPL history,
110114
- Fuzzy-search of the _apropos_ documentation.
111115

112-
#### REPL interactions
116+
##### REPL interactions
113117

114118
From the SLIME REPL, press `,` to prompt for commands. There is completion
115119
over the available systems and packages. Examples:
@@ -124,7 +128,7 @@ and many more.
124128
With the `slime-quicklisp` contrib, you can also `,ql` to list all systems
125129
available for installation.
126130

127-
### SLY: Sylvester the Cat's Common Lisp IDE
131+
#### SLY: Sylvester the Cat's Common Lisp IDE
128132

129133
[SLY](https://github.com/joaotavora/sly) is a SLIME fork that contains
130134
the following improvements:
@@ -137,7 +141,7 @@ the following improvements:
137141
* Contribs are first class SLY citizens, enabled by default, loaded with ASDF on demand.
138142
* Support for [NAMED-READTABLES](https://github.com/joaotavora/sly-named-readtables), [macrostep.el](https://github.com/joaotavora/sly-macrostep) and [quicklisp](https://github.com/joaotavora/sly-quicklisp).
139143

140-
## Finding one's way into Emacs' built-in documentation
144+
### Finding one's way into Emacs' built-in documentation
141145

142146
Emacs comes with built-in tutorials and documentation. Moreover, it is
143147
a self-documented and self-discoverable editor, capable of introspection to let you
@@ -161,7 +165,7 @@ The help keybindings start with either `C-h` or `F1`. Important ones are:
161165

162166
Some Emacs packages give even more help.
163167

164-
### More help and discoverability packages
168+
#### More help and discoverability packages
165169

166170
Sometimes, you start typing a key sequence but you can't remember it
167171
completely. Or, you wonder what other keybindings are related. Comes
@@ -179,7 +183,7 @@ See also [Helpful](https://github.com/Wilfred/helpful), an alternative to the bu
179183
<img src="assets/emacs-helpful.png" style="height: 450px"/>
180184

181185

182-
### Learn Emacs with the built-in tutorial
186+
#### Learn Emacs with the built-in tutorial
183187

184188
Emacs ships its own tutorial. You should give it a look to learn the most important keybindings and concepts.
185189

@@ -188,15 +192,15 @@ Call it with `M-x help-with-tutorial` (where `M-x` is `alt-x`).
188192

189193
<a name="Slide-9"></a>
190194

191-
## Working with Lisp Code
195+
### Working with Lisp Code
192196

193197
In this short tutorial we'll see how to:
194198

195199
* edit Lisp code
196200
* evaluate and compile Lisp code
197201
* search Lisp code
198202

199-
### Packages for structured editing
203+
#### Packages for structured editing
200204

201205
In addition to the built-in Emacs commands, you have several packages at your disposal
202206
that will help to keep the parens and/or the indentation balanced.
@@ -228,11 +232,11 @@ go up the list. See explanations and even more on
228232

229233
<a name="Slide-10"></a>
230234

231-
### Editing
235+
#### Editing
232236

233237
Emacs has, of course, built-in commands to deal with s-expressions.
234238

235-
#### Forward/Backward/Up/Down movement and selection by s-expressions
239+
##### Forward/Backward/Up/Down movement and selection by s-expressions
236240

237241
Use `C-M-f` and `C-M-b` (`forward-sexp` and `backward-sexp`) to move
238242
in units of s-expressions.
@@ -245,7 +249,7 @@ Use `C-M-@` to highlight an entire sexp. Then press `C-M-u` to expand
245249
the selection "upwards" and `C-M-d` to move forward down one level of
246250
parentheses.
247251

248-
#### Deleting s-expressions
252+
##### Deleting s-expressions
249253

250254
Use `C-M-k` (`kill-sexp`) and `C-M-backspace` (`backward-kill-sexp`) (but caution: this keybinding may restart the system on GNU/Linux).
251255

@@ -274,7 +278,7 @@ and you press `C-M-k`, you get:
274278
~~~
275279

276280

277-
#### Indenting s-expressions
281+
##### Indenting s-expressions
278282

279283
Indentation is automatic for Lisp forms.
280284

@@ -325,7 +329,7 @@ do (print j))
325329

326330
You can also select a region and call `M-x indent-region`.
327331

328-
#### Support for parenthesis
332+
##### Support for parenthesis
329333

330334
Use `M-(` to insert a pair of parenthesis (`()`), `M-x check-parens`
331335
to spot malformed sexps, `C-u <n> M-(` to enclose sexps with parens,
@@ -340,7 +344,7 @@ For example (point is before the parenthesis):
340344
(|(- 2 2))
341345
~~~
342346

343-
#### Code completion
347+
##### Code completion
344348

345349
Use the built-in `C-c TAB` to complete symbols in SLIME. You can get tooltips
346350
with [company-mode](http://company-mode.github.io/).
@@ -352,20 +356,20 @@ In the REPL, it's simply TAB.
352356
Use Emacs' hippie-expand, bound to `M-/`, to complete any string
353357
present in other open buffers.
354358

355-
#### Hiding/showing code
359+
##### Hiding/showing code
356360

357361
Use `C-x n n` (narrow-to-region) and `C-x n w` to widen back.
358362

359363
See also [code folding](http://wikemacs.org/wiki/Folding).
360364

361-
#### Comments
365+
##### Comments
362366

363367
Insert a comment, comment a region with `M-;`, adjust text with `M-q`.
364368

365369

366370
<a name="Slide-11"></a>
367371

368-
### Evaluating and Compiling Lisp in SLIME
372+
#### Evaluating and Compiling Lisp in SLIME
369373

370374
Compile the entire **buffer** by pressing `C-c C-k` (`slime-compile-and-load-file`).
371375

@@ -427,9 +431,9 @@ See also [eval-in-repl](https://github.com/kaz-yos/eval-in-repl) to send any for
427431

428432
<a name="Slide-12"></a>
429433

430-
### Searching Lisp Code
434+
#### Searching Lisp Code
431435

432-
#### Standard Emacs text search (isearch forward/backward, regexp searches, search/replace)
436+
##### Standard Emacs text search (isearch forward/backward, regexp searches, search/replace)
433437

434438
`C-s` does an incremental search forward (e.g. - as each key is
435439
the search string is entered, the source file is searched for the
@@ -450,27 +454,27 @@ and backward respectively)
450454
expression search/replace
451455

452456

453-
#### Finding occurrences (occur, grep)
457+
##### Finding occurrences (occur, grep)
454458

455459
Use `M-x grep`, `rgrep`, `occur`
456460

457461
See also interactive versions with
458462
[helm-swoop](http://wikemacs.org/wiki/Helm-swoop), helm-occur,
459463
[ag.el](https://github.com/Wilfred/ag.el).
460464

461-
#### Go to definition
465+
##### Go to definition
462466

463467
Put the cursor on any symbol and press `M-.` (`slime-edit-definition`) to go to its
464468
definition. Press `M-,` to come back.
465469

466-
#### Go to symbol, list symbols in current source
470+
##### Go to symbol, list symbols in current source
467471

468472
Use `C-u M-.` (`slime-edit-definition` with a prefix argument, also available as `M-- M-.`) to autocomplete the symbol and navigate to it. This command always asks for a symbol even if the cursor is on one. It works with any loaded definition. Here's a little [demonstration video](https://www.youtube.com/watch?v=ZAEt73JHup8).
469473

470474
You can think of it as a `imenu` completion that always work for any Lisp symbol. Add in [Slime's fuzzy completion][slime-fuzzy] for maximum powerness!
471475

472476

473-
#### Crossreferencing: find who's calling, referencing, setting a symbol
477+
##### Crossreferencing: find who's calling, referencing, setting a symbol
474478

475479
Slime has nice cross-referencing facilities. For example, you can ask
476480
what calls a particular function, what expands a macro, or where a global variable is being used.
@@ -498,14 +502,14 @@ of the above, it lists every kind of references.
498502

499503
<a name="Slide-13"></a>
500504

501-
## Lisp Documentation in Emacs - Learning About Lisp Symbols
505+
### Lisp Documentation in Emacs - Learning About Lisp Symbols
502506

503-
### Argument lists
507+
#### Argument lists
504508

505509
When you put the cursor on a function, SLIME will show its signature
506510
in the minibuffer.
507511

508-
### Documentation lookup
512+
#### Documentation lookup
509513

510514
The main shortcut to know is:
511515

@@ -518,16 +522,16 @@ Other bindings which may be useful:
518522
- **C-c C-d #** for reader macros
519523
- **C-c C-d ~** for format directives
520524

521-
### Inspect
525+
#### Inspect
522526

523527
You can call `(inspect 'symbol)` from the REPL or call it with `C-c I` from a source file.
524528

525-
### Macroexpand
529+
#### Macroexpand
526530

527531
Use `C-c M-m` to macroexpand a macro call
528532

529533

530-
### Consult the CLHS offline
534+
#### Consult the CLHS offline
531535

532536
~~~lisp
533537
(ql:quickload "clhs")
@@ -539,16 +543,16 @@ Then add this to your Emacs configuration:
539543
(load "~/.quicklisp/clhs-use-local.el" 'noerror)
540544
~~~
541545

542-
## Miscellaneous
546+
### Miscellaneous
543547

544-
### Synchronizing packages
548+
#### Synchronizing packages
545549

546550
**C-c ~** (`slime-sync-package-and-default-directory`): When run in a
547551
buffer with a lisp file it will change the current package of the REPL
548552
to the package of that file and also set the current directory of the REPL
549553
to the parent directory of the file.
550554

551-
### Calling code
555+
#### Calling code
552556

553557
**C-c C-y** (`slime-call-defun`): When the point is inside a defun and
554558
C-c C-y is pressed,
@@ -594,7 +598,7 @@ For defclass: `(make-instance ‘class-name )`.
594598

595599
(thanks to [Slime tips](https://slime-tips.tumblr.com/page/2))
596600

597-
### Exporting symbols
601+
#### Exporting symbols
598602

599603
**C-c x** (*slime-export-symbol-at-point*) from the `slime-package-fu`
600604
contrib: takes the symbol at point and modifies the `:export` clause of
@@ -628,16 +632,16 @@ or strings:
628632
(lambda (n) (format "\"%s\"" (upcase n))))
629633
~~~
630634

631-
### Project Management
635+
#### Project Management
632636

633637
ASDF is the de-facto build facility. It is shipped in most Common Lisp implementations.
634638

635639
* [ASDF](https://common-lisp.net/project/asdf/)
636640
* [ASDF best practices](https://gitlab.common-lisp.net/asdf/asdf/blob/master/doc/best_practices.md)
637641

638-
## Questions/Answers
642+
### Questions/Answers
639643

640-
### utf-8 encoding
644+
#### utf-8 encoding
641645

642646
You might want to set this to your init file:
643647

@@ -658,7 +662,7 @@ This will avoid getting `ascii stream decoding error`s when you have
658662
non-ascii characters in files you evaluate with SLIME.
659663

660664

661-
### Default cut/copy/paste keybindings
665+
#### Default cut/copy/paste keybindings
662666

663667
*I am so used to C-c, C-v and friends to copy and paste text that
664668
the default Emacs shortcuts don't make any sense to me.*
@@ -671,9 +675,9 @@ Luckily, you have a solution! Install [cua-mode](http://www.emacswiki.org/cgi-bi
671675
~~~
672676

673677

674-
## Appendix
678+
### Appendix
675679

676-
### All Slime REPL shortcuts
680+
#### All Slime REPL shortcuts
677681

678682
Here is the reference of all Slime shortcuts that work in the REPL.
679683

@@ -733,7 +737,7 @@ C-c M-i slime-fuzzy-complete-symbol
733737
C-c M-o slime-repl-clear-buffer
734738
```
735739

736-
### All other Slime shortcuts
740+
#### All other Slime shortcuts
737741

738742
Here are all the default keybindings defined by Slime mode.
739743

@@ -902,6 +906,6 @@ C-c C-v M-o slime-clear-presentations
902906

903907
[slime-fuzzy]: https://common-lisp.net/project/slime/doc/html/Fuzzy-Completion.html
904908

905-
## See also
909+
### See also
906910

907911
- [Common Lisp REPL exploration guide](https://bnmcgn.github.io/lisp-guide/lisp-exploration.html) - a concise and curated set of highlights to find one's way in the REPL.

0 commit comments

Comments
 (0)