do not edit — generated by btf.
git.druid.rocksindexdruid520radiumradium-defaults.el

radium-defaults.el


;;; radium-defaults.el, sane defaults, tty-only, full fontification -*- lexical-binding: t; -*-
 
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(setq inhibit-startup-screen t
      initial-scratch-message nil
      ring-bell-function 'ignore
      visible-bell nil)
 
;; netbsd wscons console (TERM=wsvt25) isn't in every terminfo db as a
;; 256-color terminal even though this console is; tell emacs to treat
;; it like xterm-256color instead of falling back to 16 colors.
(when (member (getenv "TERM") '("wsvt25" "wsvt25m"))
  (add-to-list 'term-file-aliases '("wsvt25" . "xterm-256color")))
 
;; full syntax highlighting, everywhere - the colored popups i love (the
;; gtags *ggtags-global* window, compile errors, completion) already look
;; like this; the actual editor buffers should just match them instead of
;; sitting plain. structural faces (mode-line, isearch) stay live on top.
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(when (boundp 'treesit-font-lock-level)
  (setq treesit-font-lock-level 3))
 
;; no auto-reindent while typing: RET should just be a plain newline,
;; not emacs guessing at a line's indentation before i've finished
;; typing the construct it belongs to (a `for'/`if'/`sub' header before
;; its brace even exists yet, say) - that guess is often wrong for my
;; exact brace style and the tabs it inserts land before i'm ready for
;; them. TAB / indent-region still compute the real, correct indent on
;; demand (per-mode offsets are all still configured normally) -
;; nothing here changes what "correct" means, just when it happens.
(electric-indent-mode -1)
 
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8-unix)
 
;; modal-less repeating: after any repeatable command (C-n, C-x o,
;; M-n, ...) its single-key follow-ups keep working without the prefix.
(repeat-mode 1)
 
;; typing over an active region replaces it, like every other editor.
(delete-selection-mode 1)
 
;; tty scrolling: recenter a line at a time instead of half-page jumps,
;; keep point off the very edge of the window.
(setq scroll-conservatively 101
      scroll-margin 3)
 
(setq-default indent-tabs-mode t
              tab-width 8
              fill-column 78)
 
;; tabs, always, everywhere - real tab characters, 8 wide, no matter
;; what. modes that sneak in spaces (sh's old 4-space offset, lisp's
;; 2-space offset, anything) get beaten back here, after the mode body
;; has run and before any mode hook can re-sneak them in.
(add-hook 'after-change-major-mode-hook
          (lambda ()
            (setq-local indent-tabs-mode t)
            (setq-local tab-width 8)))
 
(setq backup-directory-alist
      `(("." . ,(expand-file-name "backups" user-emacs-directory)))
      auto-save-file-name-transforms
      `((".*" ,(expand-file-name "autosaves/" user-emacs-directory) t))
      auto-save-list-file-prefix
      (expand-file-name "autosaves/.saves-" user-emacs-directory)
      backup-by-copying t
      delete-old-versions t
      version-control t
      kept-new-versions 10
      kept-old-versions 2
      create-lockfiles nil)
(dolist (dir (list (expand-file-name "backups" user-emacs-directory)
                    (expand-file-name "autosaves" user-emacs-directory)))
  (unless (file-directory-p dir) (make-directory dir t)))
 
(require 'recentf)
(setq recentf-max-saved-items 500)
(recentf-mode 1)
 
(require 'savehist)
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
(savehist-mode 1)
 
(require 'saveplace)
(save-place-mode 1)
 
;; buffers/window layout survive across emacsclient logins to the daemon
(require 'desktop)
(setq desktop-restore-eager 10
      desktop-load-locked-desktop t
      desktop-path (list user-emacs-directory))
(desktop-save-mode 1)
 
(setq use-short-answers t
      require-final-newline t
      sentence-end-double-space nil)
 
;; a fresh emacsclient -nw connection to the daemon can hit a real,
;; if intermittent, bug: vertico's candidate-window resize computes a
;; frame-pixel delta (window-resize ... 'pixelwise) against a just-
;; created tty frame whose own pixel/line-height bookkeeping isn't
;; settled yet, and emacs's window--resize-mini-window can compute an
;; out-of-range negative target height from that - caught internally
;; by vertico's own handler ("Vertico detected an error:" in
;; *Messages*, args-out-of-range), not a hard crash, but the candidate
;; list doesn't render right when it happens. reproduced once with a
;; full backtrace (scripted keystrokes over a real emacsclient -nw
;; connection, radium-completion.el's own commit has the trace - that's
;; where corfu/vertico are actually configured, not this file) but not
;; reliably a second time even varying reconnect order and timing, so
;; this is a known-real, not-fully-pinned-down race, not a guess.
;; forcing two real redisplay cycles the moment a new frame actually
;; exists - server-after-make-frame-hook fires only for a genuine
;; client frame, never the daemon's own placeholder one at boot -
;; gives the frame's pixel bookkeeping a chance to settle before
;; anything asks it to resize pixelwise. harmless either way (two
;; redisplays cost nothing noticeable), not proven to close the race
;; outright.
(add-hook 'server-after-make-frame-hook
          (lambda ()
            (redisplay t)
            (sit-for 0.1)
            (redisplay t)))
 
;; the daemon runs for weeks; buffers from files/grep/compile/ggtags
;; runs i'm long done with just pile up over that time. midnight.el is
;; the real stdlib answer, not a package: clean-buffer-list runs once
;; a day (midnight-delay, an hour after midnight by default) and kills
;; anything not displayed in 3+ days - its own built-in guards already
;; do exactly the right thing without any config here: never a buffer
;; with a live process (comint/kona/shell/compile-while-running), never
;; a modified file-visiting buffer, never anything currently on screen.
;; requiring the library is the whole setup - its own defcustom for
;; the timer delay arms midnight-timer as soon as it's loaded.
(require 'midnight)
 
(defun radium-header-guard-name ()
  "FOO_BAR_H for a file named foo-bar.h - i use it in both
radium-autoinsert.el and the `![guard]` macro in radium-macros.el."
  (let ((base (if buffer-file-name (file-name-base buffer-file-name) "H")))
    (concat (upcase (replace-regexp-in-string "[^A-Za-z0-9]" "_" base)) "_H")))
 
(provide 'radium-defaults)
powered by btf.