;; Time-stamp: <2026-03-27 12h10 GMT (anker)> ;; ----------------------------------------------------------------------------- ;; Interface (tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1) (fset 'yes-or-no-p 'y-or-n-p) (setq select-enable-clipboard t select-enable-primary t save-interprogram-paste-before-kill t require-final-newline t visible-bell nil) (setq echo-keystrokes 0.1 confirm-kill-emacs 'y-or-n-p disabled-command-function nil ring-bell-function 'ignore) (size-indication-mode t) (defun enlarge-to-fill () "Stretch the buffer to accomodate `fill-column` many columns." (interactive) (let ((ww (window-width))) (when (< ww (+ 1 fill-column)) (enlarge-window-horizontally (- (+ 1 fill-column) ww))))) (global-set-key (kbd "C-c 3") (lambda () (interactive) (split-window-horizontally) (enlarge-to-fill))) (when (display-graphic-p) (add-to-list 'custom-theme-load-path "~/.config/emacs/themes/") ;; listen for theme changes (defconst dark-theme 'dracula) (defconst light-theme 'acme) (defun my-switch-to-light () (disable-theme dark-theme) (load-theme light-theme t)) (defun my-switch-to-dark () (disable-theme light-theme) (load-theme dark-theme t)) (require 'dbus) (pcase (caar (dbus-ignore-errors (dbus-call-method :session "org.freedesktop.portal.Desktop" "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings" "Read" "org.freedesktop.appearance" "color-scheme"))) (1 (my-switch-to-dark)) (2 (my-switch-to-light))) (dbus-register-signal :session "org.freedesktop.portal.Desktop" "/org/freedesktop/portal/desktop" "org.freedesktop.portal.Settings" "SettingChanged" (lambda (path var val) (when (and (string= path "org.freedesktop.appearance") (string= var "color-scheme")) (pcase (car val) (1 (my-switch-to-dark)) (2 (my-switch-to-light)))))) ;; fonts (progn (setq my-font "Commit Mono-14") (setq my-font "Berkeley Mono-14") (setq my-font "Monaspace Krypton-14") (setq my-font "Sudo-14") (setq my-font "Iosevka Term Slab-14") (setq my-font "PxPlus IBM VGA 9x16-14") (setq my-font "Myna-14") (setq my-font "BQN386 Unicode DZ-12") ;; (setq line-spacing 4) (set-frame-font my-font) (set-face-attribute 'font-lock-comment-face nil :slant 'italic)) ) (setq-default line-spacing nil) (blink-cursor-mode 0) (setq cursor-type 'box) ;; (set-cursor-color "orange") (set-fringe-style 0) ;; (set-fringe-mode 128) ;; ----------------------------------------------------------------------------- ;; Backups (setq backup-by-copying t backup-directory-alist '(("." . "/home/user/store/backups/")) delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t) (setq create-lockfiles nil) ;; ----------------------------------------------------------------------------- ;; Defaults (setq fill-column 80) (setq standard-indent 4) (setq-default tab-width 4 indent-tabs-mode nil) (add-hook 'before-save-hook #'whitespace-cleanup) (show-paren-mode t) (setq-default truncate-lines t truncate-partial-width-windows nil) (setq scroll-step 1 scroll-margin 5) (setq next-line-add-newlines nil) (setq enable-dir-local-variables nil) (global-auto-revert-mode 1) ;; ----------------------------------------------------------------------------- ;; Basic packages (use-package recentf :demand t :config (setq recentf-max-saved-items 42) (recentf-mode)) (use-package uniquify :config (setq uniquify-buffer-name-style 'forward)) (use-package tramp :defer :config (setq tramp-use-ssh-controlmaster-options nil) (setq tramp-ssh-controlmaster-options "-o ControlMaster=no -tt") (add-to-list 'tramp-connection-properties (list "/ssh:.*-vm:" "remote-shell" "/usr/bin/dash"))) (require 'saveplace) (save-place-mode) (use-package ctrlf :ensure t :config (ctrlf-mode 1)) ;; ----------------------------------------------------------------------------- ;; Scratch buffer (defun immortal-scratch () (if (eq (current-buffer) (get-buffer "*scratch*")) (progn (bury-buffer) nil) t)) (add-hook 'kill-buffer-query-functions 'immortal-scratch) ;; I couldn't understand the config options, so this is the next best thing (defun display-startup-echo-area-message () nil) (setq initial-scratch-message nil inhibit-startup-screen t initial-buffer-choice nil) (add-hook 'after-init-hook (lambda () (setq default-directory "~/")))