Compare commits
No commits in common. "7bdedf6f617072461d483610b227a7616af0298e" and "d1d3f31634a278ea40f743afefbbce2563fef192" have entirely different histories.
7bdedf6f61
...
d1d3f31634
7 changed files with 435 additions and 676 deletions
1
config/emacs/.gitignore
vendored
1
config/emacs/.gitignore
vendored
|
|
@ -1,3 +1,2 @@
|
|||
var
|
||||
undo
|
||||
elpa
|
||||
|
|
|
|||
|
|
@ -1,159 +0,0 @@
|
|||
;;; early-init.el --- Early Init -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Startup time
|
||||
(defvar rs/show-startup-time t
|
||||
"If non-nil, display startup time after Emacs loads.")
|
||||
|
||||
(defun rs/display-startup-time ()
|
||||
"Display startup time in milliseconds and seconds."
|
||||
(when rs/show-startup-time
|
||||
(let* ((time (float-time (time-subtract after-init-time before-init-time)))
|
||||
(ms (* time 1000)))
|
||||
(message "Emacs loaded in %.0fms (%.2fs) with %d garbage collections."
|
||||
ms time gcs-done))))
|
||||
|
||||
(add-hook 'emacs-startup-hook #'rs/display-startup-time 110)
|
||||
|
||||
;;; GC optimization
|
||||
(defvar rs/backup-gc-cons-threshold gc-cons-threshold)
|
||||
(defvar rs/backup-gc-cons-percentage gc-cons-percentage)
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(setq gc-cons-percentage 1.0)
|
||||
|
||||
;;; Directories
|
||||
(defvar rs/emacs-dir user-emacs-directory)
|
||||
(defvar rs/lib-dir (expand-file-name "lib/" rs/emacs-dir))
|
||||
(defvar rs/var-dir (expand-file-name "var/" rs/emacs-dir))
|
||||
|
||||
(setq package-user-dir (expand-file-name "elpa/" rs/var-dir))
|
||||
(setq user-emacs-directory rs/var-dir)
|
||||
(setq custom-file null-device)
|
||||
(setq custom-theme-directory (expand-file-name "themes/" rs/emacs-dir))
|
||||
|
||||
;;; Restore GC after startup
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold (* 64 1024 1024))
|
||||
(setq gc-cons-percentage 0.1)) 105)
|
||||
|
||||
;;; Native compilation
|
||||
(when (and (featurep 'native-compile)
|
||||
(fboundp 'native-comp-available-p)
|
||||
(native-comp-available-p))
|
||||
(setq package-native-compile t)
|
||||
(setq native-comp-async-report-warnings-errors 'silent)
|
||||
(setq native-compile-prune-cache t)
|
||||
(startup-redirect-eln-cache (expand-file-name "eln-cache/" rs/var-dir)))
|
||||
|
||||
(setq native-comp-warning-on-missing-source nil)
|
||||
(setq jka-compr-verbose nil)
|
||||
(setq byte-compile-warnings nil)
|
||||
(setq byte-compile-verbose nil)
|
||||
|
||||
;;; GCC paths for macOS
|
||||
(when-let* ((gcc-base "/opt/homebrew/opt/gcc/lib/gcc/current")
|
||||
((file-directory-p gcc-base)))
|
||||
(setenv "LIBRARY_PATH"
|
||||
(string-join
|
||||
(delq nil
|
||||
(list gcc-base
|
||||
(let ((jit-path "/opt/homebrew/opt/libgccjit/lib/gcc/current"))
|
||||
(when (file-directory-p jit-path) jit-path))
|
||||
(car (last (file-expand-wildcards
|
||||
(concat gcc-base "/gcc/aarch64-apple-darwin*/*"))))))
|
||||
":")))
|
||||
|
||||
;;; Misc performance
|
||||
(setq load-prefer-newer t)
|
||||
(setq read-process-output-max (* 2 1024 1024))
|
||||
(setq process-adaptive-read-buffering nil)
|
||||
(setq ffap-machine-p-known 'reject)
|
||||
(setq ad-redefinition-action 'accept)
|
||||
(setq warning-suppress-types '((lexical-binding)))
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
|
||||
(when (boundp 'pgtk-wait-for-event-timeout)
|
||||
(setq pgtk-wait-for-event-timeout 0.001))
|
||||
|
||||
;;; File name handler optimization
|
||||
(defvar rs/old-file-name-handler-alist (default-toplevel-value 'file-name-handler-alist))
|
||||
|
||||
(defun rs/restore-file-name-handler-alist ()
|
||||
(set-default-toplevel-value
|
||||
'file-name-handler-alist
|
||||
(delete-dups (append file-name-handler-alist rs/old-file-name-handler-alist))))
|
||||
|
||||
(unless (daemonp)
|
||||
(set-default-toplevel-value
|
||||
'file-name-handler-alist
|
||||
(if (locate-file-internal "calc-loaddefs.el" load-path)
|
||||
nil
|
||||
(list (rassq 'jka-compr-handler rs/old-file-name-handler-alist))))
|
||||
(put 'file-name-handler-alist 'initial-value rs/old-file-name-handler-alist)
|
||||
(add-hook 'emacs-startup-hook #'rs/restore-file-name-handler-alist 101))
|
||||
|
||||
;;; UI - disable before frame creation
|
||||
(setq default-frame-alist '((background-color . "#072626")
|
||||
(ns-appearance . dark)
|
||||
(ns-transparent-titlebar . t)
|
||||
(menu-bar-lines . 0)
|
||||
(tool-bar-lines . 0)
|
||||
(vertical-scroll-bars . nil)
|
||||
(horizontal-scroll-bars . nil)
|
||||
(frame-resize-pixelwise . t)))
|
||||
|
||||
(setq frame-resize-pixelwise t)
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq auto-mode-case-fold nil)
|
||||
|
||||
(setq inhibit-splash-screen t)
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq inhibit-startup-echo-area-message user-login-name)
|
||||
(setq inhibit-startup-buffer-menu t)
|
||||
(setq inhibit-x-resources t)
|
||||
(setq initial-buffer-choice nil)
|
||||
(setq initial-scratch-message nil)
|
||||
(setq initial-major-mode 'fundamental-mode)
|
||||
|
||||
(setq menu-bar-mode nil)
|
||||
(setq tool-bar-mode nil)
|
||||
(setq scroll-bar-mode nil)
|
||||
|
||||
(setq frame-title-format "%b – Emacs")
|
||||
(setq icon-title-format frame-title-format)
|
||||
|
||||
;; Bidirectional text optimization
|
||||
(setq-default bidi-display-reordering 'left-to-right)
|
||||
(setq-default bidi-paragraph-direction 'left-to-right)
|
||||
(setq bidi-inhibit-bpa t)
|
||||
|
||||
;; Suppress startup messages
|
||||
(advice-add 'display-startup-echo-area-message :override #'ignore)
|
||||
(advice-add 'display-startup-screen :override #'ignore)
|
||||
|
||||
;; Unset irrelevant command line options
|
||||
(unless (eq system-type 'darwin)
|
||||
(setq command-line-ns-option-alist nil))
|
||||
(unless (memq initial-window-system '(x pgtk))
|
||||
(setq command-line-x-option-alist nil))
|
||||
|
||||
;;; Security
|
||||
(setq gnutls-verify-error t)
|
||||
(setq tls-checktrust t)
|
||||
(setq gnutls-min-prime-bits 3072)
|
||||
|
||||
;;; Package archives
|
||||
(setq package-enable-at-startup nil)
|
||||
(setq use-package-always-ensure t)
|
||||
(setq use-package-enable-imenu-support t)
|
||||
(setq use-package-expand-minimally t)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")
|
||||
("melpa-stable" . "https://stable.melpa.org/packages/")))
|
||||
(setq package-archive-priorities '(("gnu" . 99)
|
||||
("nongnu" . 80)
|
||||
("melpa" . 70)
|
||||
("melpa-stable" . 50)))
|
||||
|
||||
;;; early-init.el ends here
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
;;; naysayer-theme.el --- The naysayer color theme -*- lexical-binding: t; -*-
|
||||
;;; naysayer-theme.el --- The naysayer color theme
|
||||
|
||||
;; Author: Nick Aversano <nickav@users.noreply.github.com>
|
||||
;; Version: 0.33
|
||||
|
|
@ -58,11 +58,11 @@
|
|||
;; *****************************************************************************
|
||||
|
||||
`(default ((t (:foreground ,text :background ,background, :weight normal))))
|
||||
`(region ((t (:foreground unspecified :background ,selection))))
|
||||
`(region ((t (:foreground nil :background ,selection))))
|
||||
`(cursor ((t (:background ,white ))))
|
||||
`(fringe ((t (:background ,background :foreground ,white))))
|
||||
`(linum ((t (:background ,background :foreground ,gutter-fg))))
|
||||
`(highlight ((t (:foreground unspecified :background ,selection))))
|
||||
`(highlight ((t (:foreground nil :background ,selection))))
|
||||
|
||||
;; Font lock faces
|
||||
;; *****************************************************************************
|
||||
|
|
@ -83,8 +83,8 @@
|
|||
|
||||
;; Plugins
|
||||
;; *****************************************************************************
|
||||
`(trailing-whitespace ((t (:foreground unspecified :background ,warning))))
|
||||
`(whitespace-trailing ((t (:background unspecified :foreground ,warning :inverse-video t))))
|
||||
`(trailing-whitespace ((t (:foreground nil :background ,warning))))
|
||||
`(whitespace-trailing ((t (:background nil :foreground ,warning :inverse-video t))))
|
||||
|
||||
`(linum ((t (:foreground ,line-fg :background ,background))))
|
||||
`(linum-relative-current-face ((t (:foreground ,white :background ,background))))
|
||||
|
|
@ -135,8 +135,8 @@
|
|||
`(powerline-inactive2 ((t (:background ,background :foreground ,text))))
|
||||
|
||||
;; better compatibility with default DOOM mode-line
|
||||
`(error ((t (:foreground unspecified :weight normal))))
|
||||
`(doom-modeline-project-dir ((t (:foreground unspecified :weight bold))))
|
||||
`(error ((t (:foreground nil :weight normal))))
|
||||
`(doom-modeline-project-dir ((t (:foreground nil :weight bold))))
|
||||
|
||||
;; js2-mode
|
||||
`(js2-function-call ((t (:inherit (font-lock-function-name-face)))))
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
50
config/emacs/pre-early-init.el
Normal file
50
config/emacs/pre-early-init.el
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
;;; pre-early-init.el --- Pre Early Initalization -*- no-byte-compile: t; lexical-binding: t; -*-
|
||||
|
||||
(defconst rs/emacs-dir minimal-emacs-user-directory)
|
||||
(defconst rs/lib-dir (concat (expand-file-name "lib" minimal-emacs-user-directory) "/"))
|
||||
|
||||
;; Reducing clutter in ~/.emacs.d by redirecting files to ~/emacs.d/var/
|
||||
(setq minimal-emacs-var-dir (expand-file-name "var/" minimal-emacs-user-directory))
|
||||
(setq package-user-dir (expand-file-name "elpa" minimal-emacs-var-dir))
|
||||
(setq user-emacs-directory minimal-emacs-var-dir)
|
||||
|
||||
;; By default, minimal-emacs-package-initialize-and-refresh is set to t, which
|
||||
;; makes minimal-emacs.d call the built-in package manager. Since Elpaca will
|
||||
;; replace the package manager, there is no need to call it.
|
||||
(setq minimal-emacs-package-initialize-and-refresh nil)
|
||||
|
||||
(setq minimal-emacs-gc-cons-threshold (* 64 1024 1024))
|
||||
|
||||
(setq custom-file null-device)
|
||||
|
||||
;; disable screen flashing because bg color hasn't initialized yet from theme
|
||||
;; (setq default-frame-alist '((background-color . "#062329")
|
||||
;; (ns-appearance . dark)
|
||||
;; (ns-transparent-titlebar . t)))
|
||||
(setq default-frame-alist '((background-color . "#072626")
|
||||
(ns-appearance . dark)
|
||||
(ns-transparent-titlebar . t)
|
||||
(frame-resize-pixelwise . t)))
|
||||
;; (setq default-frame-alist '((ns-appearance . dark)
|
||||
;; (ns-transparent-titlebar . t)))
|
||||
|
||||
;; Use dynamic GCC paths to avoid recompilation when Homebrew updates GCC
|
||||
(when-let* ((gcc-base "/opt/homebrew/opt/gcc/lib/gcc/current")
|
||||
((file-directory-p gcc-base)))
|
||||
(setenv "LIBRARY_PATH"
|
||||
(string-join
|
||||
(delq nil
|
||||
(list gcc-base
|
||||
(let ((jit-path "/opt/homebrew/opt/libgccjit/lib/gcc/current"))
|
||||
(when (file-directory-p jit-path) jit-path))
|
||||
;; Find the arch-specific directory (e.g., aarch64-apple-darwin24/15)
|
||||
(car (last (file-expand-wildcards
|
||||
(concat gcc-base "/gcc/aarch64-apple-darwin*/*"))))))
|
||||
":")))
|
||||
|
||||
;; Native compilation settings to reduce unnecessary recompilation
|
||||
(when (native-comp-available-p)
|
||||
(setq native-comp-async-report-warnings-errors 'silent)
|
||||
(setq native-compile-prune-cache t)
|
||||
;; Redirect eln-cache to writable location (default goes to read-only ~/.emacs.d/)
|
||||
(startup-redirect-eln-cache (expand-file-name "eln-cache/" minimal-emacs-var-dir)))
|
||||
62
config/emacs/pre-init.el
Normal file
62
config/emacs/pre-init.el
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
;;; pre-init.el --- Pre Initalization -*- no-byte-compile: t; lexical-binding: t; -*-
|
||||
|
||||
(defvar elpaca-installer-version 0.10)
|
||||
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
|
||||
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
|
||||
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
|
||||
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
|
||||
:ref nil :depth 1 :inherit ignore
|
||||
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
|
||||
:build (:not elpaca--activate-package)))
|
||||
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
|
||||
(build (expand-file-name "elpaca/" elpaca-builds-directory))
|
||||
(order (cdr elpaca-order))
|
||||
(default-directory repo))
|
||||
(add-to-list 'load-path (if (file-exists-p build) build repo))
|
||||
(unless (file-exists-p repo)
|
||||
(make-directory repo t)
|
||||
(when (< emacs-major-version 28) (require 'subr-x))
|
||||
(condition-case-unless-debug err
|
||||
(if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
|
||||
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
|
||||
,@(when-let* ((depth (plist-get order :depth)))
|
||||
(list (format "--depth=%d" depth) "--no-single-branch"))
|
||||
,(plist-get order :repo) ,repo))))
|
||||
((zerop (call-process "git" nil buffer t "checkout"
|
||||
(or (plist-get order :ref) "--"))))
|
||||
(emacs (concat invocation-directory invocation-name))
|
||||
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
|
||||
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
|
||||
((require 'elpaca))
|
||||
((elpaca-generate-autoloads "elpaca" repo)))
|
||||
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
|
||||
(error "%s" (with-current-buffer buffer (buffer-string))))
|
||||
((error) (warn "%s" err) (delete-directory repo 'recursive))))
|
||||
(unless (require 'elpaca-autoloads nil t)
|
||||
(require 'elpaca)
|
||||
(elpaca-generate-autoloads "elpaca" repo)
|
||||
(load "./elpaca-autoloads")))
|
||||
(add-hook 'after-init-hook #'elpaca-process-queues)
|
||||
(elpaca `(,@elpaca-order))
|
||||
|
||||
;; Optional: Install use-package support
|
||||
(elpaca elpaca-use-package
|
||||
(elpaca-use-package-mode))
|
||||
|
||||
(defun rs/get-default-font ()
|
||||
(cond
|
||||
((eq system-type 'windows-nt) "Consolas-11")
|
||||
((eq system-type 'gnu/linux) "Consolas-11")
|
||||
((eq system-type 'darwin) "Consolas-12")))
|
||||
|
||||
;; (defun rs/get-default-font ()
|
||||
;; (cond
|
||||
;; ((eq system-type 'windows-nt) "Consolas-11")
|
||||
;; ((eq system-type 'gnu/linux) "Consolas-11")
|
||||
;; ((eq system-type 'darwin) "SF Mono-11")))
|
||||
|
||||
;; Font settings
|
||||
;; (set-frame-font (font-spec :size 13))
|
||||
(set-face-font 'default (rs/get-default-font))
|
||||
;; (add-to-list 'default-frame-alist `(font . ,(rs/get-default-font)))
|
||||
;; (setq-default line-spacing 0.11)
|
||||
|
|
@ -13,25 +13,16 @@
|
|||
};
|
||||
|
||||
config = lib.mkIf config.custom.emacs.enable {
|
||||
home.packages =
|
||||
home.packages = lib.mkIf pkgs.stdenv.isLinux (
|
||||
with pkgs;
|
||||
[
|
||||
(aspellWithDicts (
|
||||
dicts: with dicts; [
|
||||
en
|
||||
en-computers
|
||||
en-science
|
||||
]
|
||||
))
|
||||
ispell
|
||||
]
|
||||
++ lib.optionals pkgs.stdenv.isLinux [
|
||||
emacs
|
||||
];
|
||||
]
|
||||
);
|
||||
|
||||
# home.file.".emacs.d" = {
|
||||
# source = "${pkgs.custom.minimal-emacs-d}";
|
||||
# };
|
||||
home.file.".emacs.d" = {
|
||||
source = "${pkgs.custom.minimal-emacs-d}";
|
||||
};
|
||||
|
||||
xdg.configFile."emacs".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/emacs";
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue