aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2025-04-29 15:46:06 +0200
committerNicholas Rodrigues Lordello <[email protected]>2025-04-29 15:46:06 +0200
commitb6f93e3a55a58396c33ce45ee43145a14eeb1e29 (patch)
tree6ea5fd921598e376dadddb125a26adeae778914f /config
parenta8ec5d4199546781a7ebb070145de9eef26793b5 (diff)
Support Flatpak Emacs
Add support for Flatpak Emacs, which notably uses a different XDG configuration directory (`.var/app/org.gnu.emacs/config`), so we need to load relative to `init.el` instead of assuming `.config/emacs`.
Diffstat (limited to 'config')
-rw-r--r--config/emacs/init.el23
-rw-r--r--config/emacs/sanemacs.el9
2 files changed, 18 insertions, 14 deletions
diff --git a/config/emacs/init.el b/config/emacs/init.el
index b4460bf..4f56d56 100644
--- a/config/emacs/init.el
+++ b/config/emacs/init.el
@@ -1,15 +1,13 @@
;;; -*- lexical-binding: t -*-
;;; TODO(nlordell):
-;; 1. Emacs over devcontainers/docker with TRAMP
+;; 1. Emacs over TRAMP with `flatpak-spawn --host podman`
;; <https://happihacking.com/blog/posts/2023/dev-containers-emacs/>
;; 2. Setup LLM coding: gptel, aidermacs
;; 3. Try out neocaml - tree-sitter based OCaml mode
;; 4. Take some stuff from Emacs NANO
;; <https://github.com/rougier/nano-emacs>
-(load "~/.config/emacs/sanemacs.el" nil t)
-
(defcustom system-flavour 'plain
"The flavour of system.
@@ -19,11 +17,18 @@
(const :tag "Development" development))
:group 'convenience)
+(defun init/load (name &rest kargs)
+ "Loads an init file."
+ (let* ((init-directory (file-name-directory (or load-file-name (buffer-file-name))))
+ (file-name (file-name-concat init-directory name))
+ (is-optional (plist-get kargs :optional))
+ (should-load (or (not is-optional) (file-exists-p file-name))))
+ (when should-load
+ (load file-name nil t))))
+
+(init/load "sanemacs.el")
(when (eq system-flavour 'development)
- (load "~/.config/emacs/flavours/development.el" nil t))
+ (init/load "flavours/development.el"))
(when (eq system-type 'darwin)
- (load "~/.config/emacs/flavours/macos.el" nil t))
-
-(let ((local-init "~/.config/emacs/local-init.el"))
- (when (file-exists-p local-init)
- (load local-init nil t)))
+ (init/load "flavours/macos.el"))
+(init/load "local-init.el" :optional t)
diff --git a/config/emacs/sanemacs.el b/config/emacs/sanemacs.el
index 5615971..5de05f4 100644
--- a/config/emacs/sanemacs.el
+++ b/config/emacs/sanemacs.el
@@ -18,13 +18,12 @@
(setq-default
cursor-type 'bar
indent-tabs-mode nil
- show-trailing-whitespace t
tab-width 4)
(load-theme 'modus-vivendi)
-(defun sanemacs/hide-trailing-whitespace ()
- "Hides trailing whitespace for the current buffer."
- (setq show-trailing-whitespace nil))
-(add-hook 'Buffer-menu-mode-hook #'sanemacs/hide-trailing-whitespace)
+(defun sanemacs/show-trailing-whitespace ()
+ "Shows trailing whitespace for the current buffer."
+ (setq show-trailing-whitespace t))
+(add-hook 'prog-mode-hook #'sanemacs/show-trailing-whitespace)
;; Configure features to use `.cache` directory
(setq