refactor package manager and fix things broken on Windows.

This commit is contained in:
mir 2024-02-01 15:47:26 -09:00
parent 420b65b587
commit 16e11efbb5
4 changed files with 153 additions and 149 deletions

View File

@ -9,15 +9,15 @@
(defvar mir/default-gc-thresh gc-cons-threshold)
(defun max-gc-thresh ()
(setq gc-cons-threshold most-positive-fixnum))
(max-gc-thresh)
;; (max-gc-thresh)
(defun restore-gc-thresh ()
(setq gc-cons-threshold mir/default-gc-thresh))
(add-hook 'minibuffer-setup-hook #'max-gc-thresh)
(add-hook 'minibuffer-exit-hook #'restore-gc-thresh)
(add-hook 'elpaca-after-init-hook #'restore-gc-thresh)
(setq gc-cons-percentage 0.5)
(run-with-idle-timer 5 t #'garbage-collect)
(setq garbage-collection-messages t)
;(add-hook 'minibuffer-setup-hook #'max-gc-thresh)
;(add-hook 'minibuffer-exit-hook #'restore-gc-thresh)
;(add-hook 'elpaca-after-init-hook #'restore-gc-thresh)
;;; (setq gc-cons-percentage 0.5)
;; (run-with-idle-timer 5 t #'garbage-collect)
;(setq garbage-collection-messages t)
(defun display-startup-echo-area-message ()
"A re-definition of the function.

38
init.el
View File

@ -269,10 +269,13 @@ If the current window occupies the whole frame, split it."
(defvar bootstrap-version)
(let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t))
(setq straight-use-package-by-default t)
(straight-use-package 'dash)
(require 'dash))
;; actually, use elpaca instead
;; (require 'elpaca-bootstrap)
(defun elpaca-bootstrap ()
"Bootstrap the `elpaca' package manager."
(setq elpaca-bootstrap-file (expand-file-name "elpaca-bootstrap.el"
@ -285,7 +288,13 @@ If the current window occupies the whole frame, split it."
(let ((start (1+ (re-search-forward "```emacs-lisp")))
(end (- (re-search-forward "\n```") 3)))
(write-region start end elpaca-bootstrap-file))))
(load-file elpaca-bootstrap-file))
(load-file elpaca-bootstrap-file)
(elpaca 'dash)
(elpaca elpaca-use-package
(elpaca-use-package-mode)
(setq elpaca-use-package-by-default t))
(elpaca-process-queues)
(require 'dash))
(defun nix-bootstrap ()
"placeholder function. Ideally, load nix packages"
@ -297,11 +306,12 @@ If the current window occupies the whole frame, split it."
(straight-bootstrap)
(elpaca-bootstrap)))
(fset #'use-package--orig #'use-package)
(fset #'use-package--orig (symbol-function #'use-package))
(defmacro use-package (&rest args)
"re-definition of use-package to replace the downloader depending on system"
(require 'dash)
`(use-package--orig ,@()))
;; (require 'dash)
`(use-package--orig ,@(-replace :git :straight args)))
;; (use-package lua-mode :git nil)
;; see https://www.reddit.com/r/emacs/comments/1937vaz/emacs_291_on_windows_install_magit_requires_seq/?rdt=48529
;; ;; seq version workaround
@ -326,22 +336,22 @@ If the current window occupies the whole frame, split it."
;; (list '+elpaca-unload-eldoc 'elpaca--activate-package)))
;; (elpaca eldoc :build (+elpaca-eldoc-build-steps))
(elpaca compat)
(elpaca marginalia (marginalia-mode))
(use-package compat)
(use-package marginalia :init (marginalia-mode))
;; (elpaca gcmh (gcmh-mode))
(elpaca page-break-lines
(use-package page-break-lines
:init
(add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode))
(elpaca rainbow-mode
(use-package rainbow-mode
:init
(add-hook 'prog-mode-hook #'rainbow-mode))
(elpaca powershell
(use-package powershell
:init
(add-to-list 'auto-mode-alist '("\\.ps1\\'" . powershell-mode)))
(elpaca elpaca-use-package
(elpaca-use-package-mode)
(setq elpaca-use-package-by-default t))
;; (message "%s" elpaca--queues)
(elpaca-process-queues)
(if (fboundp #'elpaca) (elpaca-process-queues))
(require 'mir-packages)
;; (setq esup-depth 0)

View File

@ -78,7 +78,7 @@ console."
"neofetch resolution"))) "x")))
(resx (car resolution))
(resy (cadr resolution))
(font-height (/ resy 8)))
(font-height (+ 15 (/ resy 8))))
(set-face-attribute 'fixed-pitch nil :height font-height)
(set-face-attribute 'default nil :height font-height)
(set-face-attribute 'variable-pitch nil :height (+ font-height 10))))

View File

@ -17,7 +17,7 @@
:demand t
:custom (default-input-method "japanese")
:config (require 'mir-keybinds))
(elpaca-wait)
(if (fboundp #'elpaca) (elpaca-wait))
(use-package eldoc-box
:after eldoc
:diminish (eldoc-mode eldoc-box-hover-at-point-mode)
@ -64,7 +64,7 @@
(use-package altcaps
:after evil
:elpaca (:host github
:git (:host github
:repo "protesilaos/altcaps")
:general (general-define-key
:states 'visual
@ -92,7 +92,7 @@
;; show command that caused last scrollback in eshell etc
(use-package sticky-shell
:elpaca (sticky-shell
:git (sticky-shell
:host github
:repo "andyjda/sticky-shell")
:after eshell
@ -119,9 +119,8 @@
:hook (eshell-mode . exec-path-from-shell-initialize))
(use-package eat
:elpaca (eat :type git
:host codeberg
:repo "akib/emacs-eat"
:git (eat :type git
:repo "https://codeberg.org/akib/emacs-eat"
:files ("*.el" ("term" "term/*.el") "*.texi"
"*.ti" ("terminfo/e" "terminfo/e/*")
("terminfo/65" "terminfo/65/*")
@ -139,15 +138,15 @@
:after eshell
:hook (eshell-mode . eshell-syntax-highlighting-mode))
(use-package eshell-dat
:elpaca (eshell-dat
:repo "https://git.mirmarq42.xyz/mir/eshell-dat")
:git (eshell-dat
:repo "https://git.marq42.xyz/mir/eshell-dat")
:after eshell)
(use-package ansilove
:elpaca (:host gitlab
:git (:host gitlab
:repo "xgqt/emacs-ansilove")
:commands ansilove)
;; (use-package gitstatus
;; :elpaca (:host github
;; :git (:host github
;; :repo "igorepst/gitstatus-el")
;; :after eshell
;; :init
@ -156,23 +155,24 @@
;; system-architecture))
;; (add-hook 'eshell-before-prompt-hook #'gitstatus-eshell-start))
(use-package p11k
:elpaca (:repo "https://git.mirmarq42.xyz/mir/p11k")
:git (:repo "https://git.marq42.xyz/mir/p11k")
:after eshell
:hook (eshell-first-time-mode . p11k-mode))
;; File manager. Only breaks when you brag about how it doesn't.
(use-package all-the-icons
:elpaca (all-the-icons
:post-build
("emacsclient" "--eval '(all-the-icons-install-fonts t)'")))
:git (all-the-icons
;; :post-build
;; ("emacsclient" "--eval '(all-the-icons-install-fonts t)'")
))
(use-package nerd-fonts
:elpaca (:host github
:git (:host github
:repo "twlz0ne/nerd-fonts.el"))
;; (use-package nerd-icons ;has error
;; :elpaca (:host github :repo "rainstormstudio/nerd-icons.el")
;; :git (:host github :repo "rainstormstudio/nerd-icons.el")
;; :custom (nerd-icons-font-family "MesloLGS NF"))
(use-package dirvish
:elpaca (:files (:defaults "extensions/*.el"))
:git (:files (:defaults "extensions/*.el"))
:defer 0.5
:commands dirvish
:custom
@ -200,7 +200,7 @@
;; Completion framework...
(use-package vertico
:elpaca (:files (:defaults "extensions/*.el"))
:git (:files (:defaults "extensions/*.el"))
:custom (vertico-resize t)
:init (vertico-mode t)
:config
@ -221,14 +221,13 @@ see https://www.reddit.com/r/emacs/comments/xq6rpa/comment/iqynyu9/?utm_source=
(general-define-key
:prefix-map 'minibuffer-mode-map
"DEL" 'backspace-in-minibuffer))
(elpaca nil
(use-package vertico-mouse
:elpaca nil
:git nil
:after vertico
:config
(vertico-mouse-mode)))
(vertico-mouse-mode))
(use-package app-launcher
:elpaca (app-launcher
:git (app-launcher
:host github :repo "SebastienWae/app-launcher")
:after vertico
:config
@ -386,18 +385,17 @@ targets."
;; Custom Theme.
;; Not to be confused with a color theme, or a color scheme, or a custom scheme.
(use-package sv-theme
:elpaca (sv-theme
:git (sv-theme
:repo
"https://git.mirmarq42.xyz/mir/sv-theme")
"https://git.marq42.xyz/mir/sv-theme")
:config
(mir/visual-setup)
(load-theme 'airline-ravenpower t)
:init (load-theme 'sv t))
;; parentheses settingses
(elpaca (paredit :depth nil)
(use-package paredit
:elpaca nil
;; :git nil
;; elpaca declaration is broken, I just cloned it manually to .config/emacs/elpaca/repos
;; see my issue https://github.com/progfolio/elpaca/issues/40
:diminish
@ -413,7 +411,7 @@ targets."
(electric-pair-mode 1)
:custom
(show-paren-delay 0)
(show-paren-style 'parenthesis)))
(show-paren-style 'parenthesis))
(use-package evil-paredit
:after paredit)
(use-package lispyville
@ -422,7 +420,7 @@ targets."
;; org mode and messy things
(use-package org
:elpaca nil
:git nil
:diminish (org-indent-mode org-vw-mode)
:custom
;; (org-hide-leading-stars t)
@ -497,7 +495,7 @@ Return nil if DIR is not in a hugo project at all."
thisdir
(let ((updir (file-name-directory (string-trim-right thisdir "/"))))
(hugo-dir-above updir)))))))
;; (hugo-dir-above "~/.local/git/mirmarq42.github.io/content-org/")
;; (hugo-dir-above "~/.local/git/marq42.github.io/content-org/")
(defun hugo-compile (&optional dir)
(interactive)
(if (bound-and-true-p dir) nil
@ -527,9 +525,9 @@ Return nil if DIR is not in a hugo project at all."
:defer 5
:custom (which-key-idle-delay 2.5)
:init (which-key-mode t))
(use-package which-key-posframe
:after which-key
:config (which-key-posframe-mode))
;; (use-package which-key-posframe
;; :after which-key
;; :config (which-key-posframe-mode))
;; parentheses are boring
(use-package rainbow-delimiters
@ -578,8 +576,8 @@ Return nil if DIR is not in a hugo project at all."
:hook (emacs-lisp-mode . highlight-defined-mode))
(use-package relint)
(use-package elisp-autofmt
:elpaca (elisp-autofmt
:host codeberg
:git (elisp-autofmt
:host "https://codeberg.org"
:repo "ideasman42/emacs-elisp-autofmt"
:files ("*"))
:custom (elisp-autofmt-python-bin "/usr/bin/python3"))
@ -621,7 +619,7 @@ Return nil if DIR is not in a hugo project at all."
;; epic drop-down completion
(use-package corfu
:after eldoc
:elpaca (:files (:defaults "extensions/*.el"))
:git (:files (:defaults "extensions/*.el"))
;; :if (display-graphic-p) ; breaks in emacsclient
:custom
;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
@ -669,11 +667,11 @@ Return nil if DIR is not in a hugo project at all."
:after eshell)
(use-package popon
:elpaca (:type git
:git (:type git
:repo "https://codeberg.org/akib/emacs-popon")
:if (not (display-graphic-p)))
(use-package corfu-terminal
:elpaca (corfu-terminal
:git (corfu-terminal
:type git
:repo "https://codeberg.org/akib/emacs-corfu-terminal")
:after popon
@ -723,7 +721,7 @@ Return nil if DIR is not in a hugo project at all."
;; :after magit
;; :init (magit-todos-mode))
(use-package blamer
:elpaca (:host github :repo "artawower/blamer.el")
:git (:host github :repo "artawower/blamer.el")
:after magit
:custom
(blamer-view 'overlay)
@ -737,11 +735,11 @@ Return nil if DIR is not in a hugo project at all."
:italic t)))
:commands blamer-show-posframe-commit-info)
(use-package magit-stats
:elpaca (:host github :repo "LionyxML/magit-stats")
:git (:host github :repo "LionyxML/magit-stats")
:after magit
:commands magit-stats)
(use-package magit-pretty-graph
:elpaca (:host github :repo "georgek/magit-pretty-graph")
:git (:host github :repo "georgek/magit-pretty-graph")
:after magit
:commands magit-pg-repo)
;; (use-package transient-posframe
@ -754,7 +752,7 @@ Return nil if DIR is not in a hugo project at all."
;; )
(use-package hyperbole
:elpaca (:files ("*.el"
:git (:files ("*.el"
("kotl" "kotl/*.el")
"man/*.info" "man/*.texi")
:host github :repo "rswgnu/hyperbole")
@ -764,12 +762,12 @@ Return nil if DIR is not in a hugo project at all."
"RET" 'hkey-either))
(use-package dconf-mode
:elpaca (dconf-mode
:git (dconf-mode
:type git
:repo "https://git.mirmarq42.xyz/mir/dconf-mode"))
:repo "https://git.marq42.xyz/mir/dconf-mode"))
(use-package info-variable-pitch
:elpaca (info-variable-pitch
:git (info-variable-pitch
:host github
:repo "kisaragi-hiu/info-variable-pitch")
:config
@ -777,15 +775,15 @@ Return nil if DIR is not in a hugo project at all."
;; (elpaca nil
;; (use-package exwm
;; :elpaca nil
;; :git nil
;; :if (package-installed-p 'exwm)
;; :init
;; (require 'exwm-config)
;; (exwm-config-example)))
;; (use-package ani-el
;; :elpaca (ani-el
;; :repo "https://git.mirmarq42.xyz/mir/ani-el"
;; :git (ani-el
;; :repo "https://git.marq42.xyz/mir/ani-el"
;; :files ("ani-el.el" "lib")))
(use-package slime
@ -804,13 +802,13 @@ Return nil if DIR is not in a hugo project at all."
:after clojure-mode)
(use-package dwim-shell-command
:elpaca (dwim-shell-command
:git (dwim-shell-command
:files (:defaults "dwim-shell-commands.el"))
:config (require 'dwim-shell-commands)
:commands dwim-shell-commands-kill-process)
(use-package youtube-sub-extractor
:elpaca (youtube-sub-extractor
:git (youtube-sub-extractor
:host github
:repo "agzam/youtube-sub-extractor.el")
:custom (youtube-sub-extractor-timestamps 'left-margin)
@ -818,11 +816,11 @@ Return nil if DIR is not in a hugo project at all."
;; Cheat sheet
(use-package cheat-sh
:elpaca (cheat-sh :host github :repo "davep/cheat-sh.el")
:git (cheat-sh :host github :repo "davep/cheat-sh.el")
:commands cheat-sh)
(use-package pcre2el
:elpaca (:host github
:git (:host github
:repo "joddie/pcre2el")
:config
(defmacro prx (&rest expressions)
@ -851,11 +849,6 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(use-package haskell-mode)
(use-package yuck-mode)
(use-package klondike
:elpaca (:host codeberg
:repo "WammKD/Emacs-Klondike")
:commands klondike)
(use-package empv
:after embark
:custom
@ -864,7 +857,7 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(add-to-list 'empv-mpv-args "--ytdl-format=best"))
(use-package fretboard
:elpaca (:host github :repo "vifon/fretboard.el")
:git (:host github :repo "vifon/fretboard.el")
:commands fretboard)
(use-package power-mode
@ -874,7 +867,7 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
;; (use-package hypop
;; :if (display-graphic-p)
;; :elpaca (:repo "https://git.mirmarq42.xyz/mir/hypop.el")
;; :git (:repo "https://git.marq42.xyz/mir/hypop.el")
;; :demand t)
;; (use-package vertico-posframe
;; :after vertico
@ -882,7 +875,7 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
;; :config (vertico-posframe-mode))
(use-package notibox
:if (display-graphic-p)
:elpaca (:host github :repo "MirMarq42/notibox.el")
:git (:host github :repo "MitchMarq42/notibox.el")
:demand t
:custom (notibox-corner 'topright)
:config (notibox/setup-timer))
@ -905,24 +898,25 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(use-package vidframe
:if (display-graphic-p) ;we won't yet bother with
;kitty/sixel/catimg shit
:elpaca (:host github :repo "MirMarq42/vidframe.el")
:git (:host github :repo "MitchMarq42/vidframe.el")
)
;; Kitty Keyboard Protocol
(use-package kkp
:elpaca (:host github :repo "benjaminor/kkp")
:git (:host github :repo "benjaminor/kkp")
:unless (display-graphic-p)
:config (global-kkp-mode))
;; Rubix Cube
(use-package eagle
:elpaca (:repo "https://codeberg.org/akib/emacs-eagle"))
:git (:repo "https://codeberg.org/akib/emacs-eagle"))
(use-package cube
:elpaca (:repo "https://codeberg.org/akib/emacs-cube"))
:git (:repo "https://codeberg.org/akib/emacs-cube"))
;; Emacs App Framework. Definitely pretty broken but it worked once
(unless (eq system-type 'windows-nt)
(use-package eaf
:elpaca (:host github :repo "emacs-eaf/emacs-application-framework"
:git (:host github :repo "emacs-eaf/emacs-application-framework"
:files ("*.el" "*.py" "core" "app" "*.json")
:pre-build (("python" "install-eaf.py"
"--install" "pdf-viewer" "browser"
@ -958,14 +952,14 @@ This is redefined for use with `hypop' library because multiple Emacs frames may
(list frame-x frame-y)))
(t (list 0 0)))))
(use-package eaf-browser
:elpaca nil
:git nil
:after eaf
:custom
(eaf-browser-continue-where-left-off t)
(eaf-browser-enable-adblocker t)))
(eaf-browser-enable-adblocker t))))
(use-package dtache
:elpaca (:url "https://gitlab.com/niklaseklund/dtache")
:git (:repo "https://gitlab.com/niklaseklund/dtache")
:hook (after-init . dtache-setup))
;; (if (display-graphic-p)
@ -979,24 +973,24 @@ This is redefined for use with `hypop' library because multiple Emacs frames may
;; (holo-layer-enable))))
;; (use-package oauth
;; :elpaca (:fetcher codeberg
;; :git (:fetcher codeberg
;; :repo "https://codeberg.org/martianh/emacs-oauth"
;; :url "https://codeberg.org/martianh/emacs-oauth")
;; :custom (oauth-nonce-function 'oauth-internal-make-nonce))
;; ;; (elpaca-wait)
;; (use-package tumblesocks
;; :elpaca (:fetcher codeberg
;; :git (:fetcher codeberg
;; :repo "https://codeberg.org/gargle/tumblesocks"
;; :url "https://codeberg.org/gargle/tumblesocks")
;; :custom (tumblesocks-blog "mirqmarq428.tumblr.com")
;; )
(use-package org-modern-indent
:elpaca (:type git :host github :repo "jdtsmith/org-modern-indent")
:git (:type git :host github :repo "jdtsmith/org-modern-indent")
:hook (org-mode . org-modern-indent-mode))
(use-package indent-bars
:elpaca (:type git :host github :repo "jdtsmith/indent-bars")
:git (:type git :host github :repo "jdtsmith/indent-bars")
:custom
(indent-bars-prefer-character t)
(indent-bars-color '(highlight :face-bg t :blend 0.75))
@ -1008,7 +1002,7 @@ This is redefined for use with `hypop' library because multiple Emacs frames may
;;; disabled because i cant make it look good
;; (use-package prism
;; :elpaca (:host github :repo "alphapapa/prism.el")
;; :git (:host github :repo "alphapapa/prism.el")
;; :custom (prism-colors '()))
(use-package lua-mode)