Editor indentation for Emacs and Sublime Text; container guides point to editor support (from dev 5d35f256476e)
This commit is contained in:
@@ -12,10 +12,13 @@ and load the mode. Add to `~/.emacs.d/init.el`:
|
||||
```elisp
|
||||
(add-to-list 'load-path "full-pathname-of-the-emacs-directory")
|
||||
(require 'klammertext-mode)
|
||||
(require 'klammertext-indent) ; optional, experimental: TAB indentation
|
||||
```
|
||||
|
||||
Replace `full-pathname-of-the-emacs-directory` with the full path to the
|
||||
directory that contains `klammertext-mode.el`.
|
||||
directory that contains `klammertext-mode.el`. The second require loads the
|
||||
experimental indentation support (see "Indentation" below); it is a separate
|
||||
unit — comment the line out to disable indentation entirely.
|
||||
|
||||
The mode auto-activates for `.kt` and `.k` files. (The `.k` / `.kt` distinction
|
||||
is a filing convention, not a lexical one — the same mode serves both.) You can
|
||||
@@ -153,6 +156,46 @@ opening `@name`. It uses the same matcher as the highlighting. The starting
|
||||
position is pushed to the mark ring, so `C-u C-SPC` jumps back. (Also available
|
||||
as `M-x klammertext-jump-to-match`.)
|
||||
|
||||
## Indentation (experimental)
|
||||
|
||||
With `klammertext-indent.el` loaded (the optional require above), **TAB**
|
||||
indents the current line — and `indent-region` a selection — to reflect the
|
||||
klammer nesting, two spaces per level:
|
||||
|
||||
```
|
||||
@ol
|
||||
Item one
|
||||
| Item two
|
||||
@ol
|
||||
Embedded item one
|
||||
| Embedded item two
|
||||
@
|
||||
| Item three
|
||||
@
|
||||
```
|
||||
|
||||
The rule: a line indents to 2 × depth; a line *beginning* with a bar run
|
||||
(`|`, `||`, …) or a closing delimiter sits one level less — at its owner's
|
||||
opening column. So the bars and the close line up under the `@` of the list
|
||||
they belong to, and `| ` (bar + space) puts item text exactly at the content
|
||||
column. The bar rule is dimension-independent: `||` table rows drop to the
|
||||
opener's column the same way. All three `@`-tiers indent uniformly.
|
||||
|
||||
Exceptions, all deliberate:
|
||||
|
||||
- Klammers in `klammertext-transparent-klammers` (default: `document`)
|
||||
contribute no level, so a document's ordinary paragraphs stay at the left
|
||||
margin.
|
||||
- Lines inside a literal klammer's verbatim content (`@code ... code@`), and
|
||||
inside the argument span of a klammer in `klammertext-code-klammers`
|
||||
(default: `eval` — inline Python is indentation-sensitive), are never
|
||||
touched. Neither are removed regions (`#[ ... ]#`, after `##`).
|
||||
|
||||
Nothing reformats automatically — whitespace is content in Klammertext, so
|
||||
indentation happens only when you ask for it (TAB, `indent-region`). The
|
||||
offset is `klammertext-indent-offset` (default 2); all three variables are
|
||||
customizable in the `klammertext-indent` group.
|
||||
|
||||
## Literal klammers
|
||||
|
||||
Inside a `literal` argument — for example the body of `@code ... code@` — `#`
|
||||
|
||||
Reference in New Issue
Block a user