Emacs 29+ config mainly focused in programming PHP, Clojure and Python, writing with org-mode and compatibility with GNU/Linux and MacOS.
It is based on my earlier Emacs Prelude based config (2013-) that was mostly in use for simple scripting, magit and note taking that was migrated 2023 over to more minimal Bedrock starter config including most useful pieces of Prelude and working IDE configurations for select languages and LLM tools as addition.
On original Bedrock config side, there are two files of interest: early-init.el
and init.el
. Follow original repo readme for more info. Package management is handled using standard use-package
(and straight
for git support) which embeds configuration for each package in a neat way.
Own additions are in personal/
directory while changes in other files are kept minimal, including:
- Parts of Emacs Prelude via crux.el in
personal/custom.el
and programming config inpersonal/programming.el
. - Keychord-mode
- Multiple cursors setup (with minor issues, using psi-search for compatibility)
- Org-mode “GTD” setup
- Etc.
The original Bedrock project, Prelude or some other config distribution is probably a better starting point for a new config for most people. There may be some useful config snippets however.
Language | LSP | DAP | Tree-sitter | TS “auto build” |
---|---|---|---|---|
PHP | x | x | x* | |
Python | x | x** | x | |
Clojure | x | *** | x | |
Yaml | x | x | x |
- (*) PHP tree-sitter needs to be improved to support embedded HTML and PHP eg. mixed documents. Related pull request nvim-treesitter/nvim-treesitter#5876 issue which has been updated since I looked at it the last time.
- (**) Python DAP is enabled but not tested
- (***) Clojure uses Cider which provides step debugger
Install Emacs 29+, from eg. Debian 12 Backports repo or d12frosted/homebrew-emacs-plus on Mac. Clone this repository as .emacs.d
and install tree-sitter grammars before start which needs to be manually done for PHP.
Emacs 29.1 added the handy --init-directory
flag. This means that you can run emacs --init-directory path/to/emacs-bedrock/
and all the customizations and package installations will be isolated to the project directory.
There may be some initialisation problems to diagnose after install, which I try fix once in a while when I notice them.
Currently tree-sitter grammars need to be placed at ~/.emacs.d/tree-sitter/
before start. Automatic installation method is work in progress.
To install them manually:
git clone https://github.com/casouri/tree-sitter-module.git cd tree-sitter-module ./batch mkdir ~/.emacs.d/tree-sitter mv dist/* ~/.emacs.d/tree-sitter
PHP tree-sitter mode is more in progress and is built individually:
git clone https://github.com/tree-sitter/tree-sitter-php.git cd tree-sitter-php make ln -s `pwd`/libtree-sitter-php.so ~/.emacs.d/tree-sitter
Config uses lsp-mode over (built-in) eglot which installs LSP servers automatically for languages enabled in config (hook (lsp)
).
I found the built-in eglot LSP client being bit overwhelming to get working over lsp-mode that has more IDE features built-in like DAP debugging and automatic LSP server installation. It is also quite well documented in one place, plus also in video format on System Crafters Youtube channel.
Performance-wise it seems also fine for debugging eg. a large web-app, such as full WordPress-installation with 5000+ files to watch on Skylake-era laptop CPU, comparing to experience with NeoVim (or VSCode), for now at least.
Set API keys or other environment variables in shell config, eg. `~/.zshrc` or `~/.bashrc` and then set which ones to read on Emacs startup by `exec-path-from-shell` on startup in `personal/custom.el` also on GUI Emacs started from KDE Plasma Shell menu (or MacOS app icon).
M-x copilot-login
Previously I have been coding mostly with VSCode for work and fun instead of using Emacs where it used to seem too time consuming to support IDE features for different programming languages with various 3rd party packages for syntax coloring, indendation, code intelligence, debugging tools and so on.
Situation however changed last few years with tree-sitter, LSP and DAP projects where those features are being developed in standard editor-agnostic way and can be used and configured in more generic way on editor side.