About me: My name is Solène Rapenne, pronouns she/her. I like learning and sharing knowledge. Hobbies: '(BSD OpenBSD Qubes OS Lisp cmdline gaming security QubesOS internet-stuff). I love percent and lambda characters. OpenBSD developer solene@. No AI is involved in this blog.

Contact me: solene at dataswamp dot org or @solene@bsd.network (mastodon).

I'm a freelance OpenBSD, FreeBSD, Linux and Qubes OS consultant, this includes DevOps, DevSecOps, technical writing or documentation work. If you enjoy this blog, you can sponsor my open source work financially so I can write this blog and contribute to Free Software as my daily job.

Simple emacs config

Written by Solène, on 02 May 2016.
Tags: #emacs #cheatsheet

Comments on Fediverse/Mastodon

Here is a dump of my emacs config file. That may be useful for some emacs users who begin.

If you doesn’t want to have your_filename.txt~ files with a tilde at the end (this is a default backup file), add this

; I don't want to have backup files everywhere with filename~ name 
(setq backup-inhibited t) 
(setq auto-save-default nil)

To have parenthesis highlighting on match, which is very useful, you will need this

; show match parenthesis 
(show-paren-mode 1)

I really like this one. It will save the cursor position in every file you edit. When you edit it again, you start exactly where you leaved the last time.

; keep the position of the cursor after editing 
(setq save-place-file "~/.emacs.d/saveplace") 
(setq-default save-place t) 
(require 'saveplace)`

If you write in utf-8 (which is very common now) you should add this.

; utf8 
(prefer-coding-system 'utf-8)

Emacs modes are used depending on the extension of a file. Sometime you need to edit files with a custom extension but you want to use a mode for it. So, you just need to add some line like this to get your mode automatically when you load the file.

; associate extension - mode 
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) 
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))

My Org-mode part in the config file

(require 'org)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list "~/Org/work.org" "~/Org/home.org"))

Stop mixing tabs and space when indenting

(setq indent-tabs-mode nil)