Introduction
Introduction Statistics Contact Development Disclaimer Help
A GNU Emacs experience throught NixOS
2025-02-26
Last edit: 2025-02-26
---------------------
I have always used
VSCode](https://code.visualstudio.com/) as a code editor. I've already tried us…
, but only for testing purposes and not with the aim of changing text editors.
This time, I decided to use a
FLOSS](https://www.gnu.org/philosophy/floss-and-foss.html) code editor in the t…
indefinitely. This blog post is actually written with it.
It is none other than
Emacs](https://www.gnu.org/s/emacs/). For the convenience of writing and readin…
project.
## Why
Why did I leave
VSCode](https://code.visualstudio.com/) and decide to switch to [Emacs
?
### Leaving VSCode
Because it's a RAM-hungry graphics application. You shouldn't need that much me…
Also, I don't want all the additional features offered, such as file name and t…
VSCode
anymore, so it's time to say goodbye.
### Choosing Emacs
Of all the text editors out there, I chose
Emacs](https://www.gnu.org/s/emacs/). It's actually much more than that. In the…
.
> It is a programmable platform where text editing is one of the main points of…
Indeed, I see
Emacs
more as an operating system than as a text editor. The possibilities for confi…
Also, I find it an excellent UNIX citizen. The default keystroke sequences corr…
Another reason was to be able to modify any behavior, to be able to have an app…
## Learning
So I installed
Emacs
version 29.4 and started learning how to use it properly.
### Mastering Emacs, Mickey Pertersen
This book explained the important concepts of the application and gave me a sol…
Emacs
. Certain chapters, such as “The Theory of Movement” and “The Theory of E…
I highly recommend this book for anyone wishing to start learning
Emacs
.
### Emacs Lisp Intro
I've also read the “Emacs Lisp Intro” written in
Emacs
as a manual. Since most of the code is written in
Emacs
Lisp, it's essential to understand the language, or at least know how to read …
For example, I needed to write some to display line numbers at the start of
org-present
mode, and to hide them at the end of minor mode execution.
### Environment
As I said earlier,
Emacs
is a platform with a whole host of features. This makes it all the more tempti…
Emacs
modes and packages, etc.
Staying in the same environment made me more productive and faster. For compute…
Emacs
can be configured like an IDE, precisely and fully controlled.
One last very important thing to know is that any piece of
Emacs
is documented, meaning that whatever I do or try to do, I can find documentati…
Emacs
is its own documentation.
## Configuration
### Via NixOS
Concerning the tool configuration, being on [NixOS](https://nixos.org/), I deci…
Emacs
module provided by the home-manager. To remain consistent with my current conf…
Emacs
package has its own Nix module.
Here's what the file structure looks like.
```text
modules/home/editors/emacs
├── default.nix
└── packages
├── auto-save
│ └── default.nix
├── dashboard
│ └── default.nix
├── dired
│ └── default.nix
├── doom-modeline
│ └── default.nix
├── ivy
│ └── default.nix
├── lsp-mode
│ ├── bash-language-server
│ │ └── default.nix
│ ├── default.nix
│ ├── dockerfile
│ │ └── default.nix
│ ├── gopls
│ │ └── default.nix
...
```
These modules contain the dependencies, i.e. the
Emacs
packages and the
Emacs
Lisp configuration.
Here's an example with the
org-superstar
package.
```nix
{
config,
lib,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.editors.emacs.packages.org-superstar;
in
{
options.${namespace}.editors.emacs.packages.org-superstar = {
enable = mkBoolOpt false "Whether or not to enable the emacs org-superstar …
};
config = mkIf cfg.enable {
programs.emacs = {
extraPackages = (epkgs: [ epkgs.org-superstar ]);
extraConfig = ''
(use-package org-superstar
:ensure t
:after org
:hook (org-mode . org-superstar-mode)
:custom
(org-superstar-remove-leading-stars t)
(org-superstar-headline-bullets-list '("⁖" "✿" "▷" "✸")))
'';
};
};
}
```
## Notes taking on Emacs
Emacs
has a major mode called
Org
, which modifies
Emacs
behavior to create an environment suited to writing data in org format. It int…
Emacs
other features and keeps me in the application.
I used to take my notes with Obsidian. I refactored all my notes and converted …
Org
format.
## Conclusion
From now on, I intend to use
Emacs
as my main text editor, as well as for note-taking.
You are viewing proxied material from tilde.pink. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.