An open API service indexing awesome lists of open source software.

https://github.com/ksqsf/emacs-config

Moderately personalized Emacs config
https://github.com/ksqsf/emacs-config

emacs emacs-configuration

Last synced: about 1 month ago
JSON representation

Moderately personalized Emacs config

Awesome Lists containing this project

README

        

* My Emacs Config

This is my personal, "slightly configured" Emacs.

There are some packages written by me for my own convenience. See the
last section.

** Supported Platforms

This configuration supports macOS, and Linux. It should work on
Windows for the most part.

The following Emacs versions are supported:

- Emacs 30, the current stable version
- Emacs 31, the current development version

** Structure

There are two kinds of configuration, Module and Volatile. The
distinction is (in my mind) very successful.

*** Module

Modules make up the functionality and keybindings. They are stable
and can be byte compiled safely and cleanly. Ideally, they use
lexical scoping.

*** Volatile

Volatile configuration files are more fragile and personal. They are
mainly temporary tests or (let's hope not) ugly hacks. A volatile
Lisp file should never be byte compiled. Typically, it's dynamically
scoped.

** Fonts

The following fonts are "blessed" in this configuration.

| Font | Point | Usage |
|----------------------+-------+-------------------------------|
| (Any monospace font) | 14 | General use (non-Chinese) |
| Sarasa Mono | 14 | For perfect Chinese alignment |

** Better Defaults

These modifications are generally in =prelude-core.el= and
=prelude-ui.el=, and a few other files. They are loaded before anything
else.

Prominent user-visible modifications are listed below.

*** UI
**** Mode line

Any of the following looks pretty good:

- Default
- Doom mode line
- Moody

**** Modal editing (Evil)

I'm not fully invested in Evil, so currently it can be disabled
*completely* by commenting out =(require 'prelude-evil)= in =init.el=.

I use Evil, because the Vi-style editing commands are the de facto
standard right now, and evil-collection is great, and I still retain
some muscle memory (I used to be a Vim user). Though, conceptually, I
like Meow better.

Evil-collection offers a large collection of consistent,
pre-configured keybindings for a variety of major modes. See its
[[https://github.com/emacs-evil/evil-collection][readme]].

I use a hybrid editing style, i.e. in the insert mode, most Emacs
commands are still available, so I can keep my muscle memory as much
as possible. This is done by customizing
=evil-disable-insert-state-bindings=. The conflicts are resolved
depending on which is most familiar to me.

**** Completion

I use Vertico, Prescient, and Orderless.

Vertico offers a lightweight yet versatile frontend to
=completion-at-point=.

Orderless significantly enhances the default completion algorithms,
though its sorting is less than ideal.

**** Side windows

Many temporary buffers pop up in the side windows.

=C-TAB= toggles whether or not side windows are displayed.

*** Editing
**** Expand region

=C-SPC C-SPC= to expand the current region meaningfully. It supports
tree-sitter-based expansion.

**** Zap up to char

=M-z= was assigned to =zap-up-to-char=. You can easily achieve what
=zap-to-char= does with =M-z C-d=.

At first, I thought =M-z t= and =M-z f= would be cool, but it turned
out to be a horrible idea, because one must stop to think which key to
press.

**** Structured Editing

Structured editing operates on the level of syntactical structures, be
it identifiers, expressions, or statements.

I use paredit for the Lisp family. For tree-sitter-powered major
modes, use combobulate-mode.

*** Programming
**** LSP

I've fully embraced LSP! (Used to be a skeptic.)

- =eglot= as the LSP client. (Easier to hack than =lsp-mode=.)
- =corfu= as the universal completion frontend.

Language servers can be installed via Homebrew or Nix. Eglot is
intelligent enough to work with any server without special
configuration.

**** REPL

Many major modes support REPL, but their keybindings are often
very different. The following keychords are adopted by Emacs
itself, so they are preferred when possible.

| Key | Function |
|---------+----------------------|
| C-c C-c | Send buffer |
| C-c C-l | Send file |
| C-x C-e | Send this expression |
| C-M-x | Send this function |

***** Haskell, Idris

Haskell-mode has Interactive Haskell mode supporting ghci. Due to
Haskell's specialness, all you can do is =C-c C-l=.

***** Python

Elpy defined a bunch of send functions, but they turn out to be not so
helpful.

***** Coq

Coq is an interactive proof assistant, whose Emacs interface is Proof
General, which defines its own set of commands.

** Unlimited Lisp Works
This repo hosts some other Emacs Lisp works made by me for my own
convenience. It might be useful for you, too, so I made a list here
for better discoverability.

| Who | Where | What |
|----------------+--------------------------+------------------------------------|
| pest-mode | github ksqsf/pest-mode | Major mode for Pest files |
| treefold | ./lisp/treefold.el | Fold any tree-like text |
| smtlib2-mode | ./lisp/smtlib2-mode.el | Major mode for SMT scripts |
| lojban | ./lisp/lojban.el | Zbalermorna input and rendering |
| bionic-reading | ./lisp/bionic-reading.el | A (sort of) bionic reader in Emacs |
| clipboard | ./lisp/clipboard.el | clipboard inspector |
| clipmgr | ./lisp/clipmgr.el | (WIP) a clipboard manager |
| region-mark | ./lisp/region-mark.el | |
| fish-protector | ./lisp/fish-protector.el | 魚の護衛者 |
| logseq | ./lisp/logseq.el | Logseq HTTP API |
| leitner | ./lisp/leitner.el | The Leitner system (a kind of SRS) |
| org-xlatex | github ksqsf/org-xlatex | instant latex preview |
| flygpt | ./lisp/flygpt.el | semantic flymake based on GPT |