Install Emacs
2025-02-08, Sat
Install Emacs tends out to be more complicated than I thought. This log file intends to record huccups I've encountered.
1. on Debian GNU/Linux
Debian packages are provided in separate sections1, and emacs is available in the main section. However, this package lacks all the built-in documentation, which is somehow provided in the non-free section through package emacs-common-non-dfsg. Without documentation, the claim of "self-documenting editor" doesn't stand, so a bit tweak is needed.
- Open
/etc/apt/sources.list
and add "non-free" section after "main" - Run "apt-get update", as usual
- Run "apt-get install emacs emacs-common-non-dfsg"
2. on macOS
The GNU site already provides instructions to install pre-built binaries of Emacs on macOS 2, 3. Follow any one would be sufficient.
However, things became tricker when I tried to compile from source.
First, install libraries required, in reverse order:
- gnutls
- nettle
- gmp
- libtasn1
- help2man
The process was straightforward when I compiled these libraries from
source one by one, …until gnutls-3.7.11, which is the current
stable version provided on the official site4.
When compiling from the source file downloaded, there was error thrown
for file lib/system/certs.c
. Turns out there is a one line change
needed in the declaration of osstatus_error
, like this:
static int osstatus_error(OSStatus status)
This problem was resolved long time ago in the master branch5. So it's not like a big issue anymore. Nevertheless, the experience worths a note.
Key Takeways
- When there is error thrown while compiling source code from renowned resource, take a closer look at the error message. No need to get panic, upset, or scared.
- If a solution is found for the error, consider to submit a patch to the source repo in order to give something back to the community.
3. Notes on Common Commands
This section records common commands & keybindings for some modes, major or minor.
3.1. Major mode c-mode
Key | Binding | Description |
---|---|---|
C-c C-e | c-macro-expand | Expand C macros in the region, using the C preprocessor |
3.2. Major mode org-mode
Key | Binding | Description |
---|---|---|
C-c C-c | org-ctrl-c-ctrl-c | Multi-purpose command that does things depending on context |
3.3. Major mode emacs-lisp-mode
Key | Binding | Description |
---|---|---|
C-c C-e | elisp-eval-region-or-buffer | Evaluate forms in the active region or whole buffer |
C-M-i | completion-at-point | Perform completion on the text around point |
3.4. Major mode lisp-interaction-mode (for *scratch*
)
Key | Binding | Description |
---|---|---|
C-j | eval-print-last-sexp | Evalute sexp before point |
Footnotes:
About Debian package sections https://www.debian.org/distrib/packages
Instructions on installing Emacs https://www.gnu.org/software/emacs/download.html#nonfree
Unofficial Emacs build for macOS https://emacsformacosx.com
GnuTLS site https://www.gnutls.org/download.html
Commit that resolved the issue https://gitlab.com/gnutls/gnutls/-/blame/master/lib/system/certs.c?ref_type=heads#L292