Migrate from straight.el to elpaca.

Idk why, I only can try it.

For now the emacs-init-time whas improved.
This commit is contained in:
KJ 2023-09-16 14:05:56 -04:00
parent 04e3e2ec29
commit 503bf53890
15 changed files with 99 additions and 120 deletions

2
.gitignore vendored
View File

@ -25,3 +25,5 @@ workspace/
/request/
/smex-items
/tree-sitter/
/elpaca/
/tramp

View File

@ -20,31 +20,60 @@
))
;; Instalar straight.el (reemplpazando package.el)
(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/master/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(defvar elpaca-installer-version 0.5)
(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
:files (:defaults (: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 (call-process "git" nil buffer t "clone"
(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))
;; Instalar use-package si no está instalado
(straight-use-package 'use-package)
(setq use-package-always-ensure t)
(elpaca elpaca-use-package
;; Enable :elpaca use-package keyword.
(elpaca-use-package-mode)
;; Assume :elpaca t unless otherwise specified.
(setq elpaca-use-package-by-default t))
;; Block until current queue processed.
(elpaca-wait)
;; Theme
(use-package dracula-theme
:straight t
:defer t
:hook (after-init . (lambda()
(load-theme 'dracula t)
(set-face-attribute 'default nil :font "Fira Code Retina" :height 112) ; Font
))
:init
(load-theme 'dracula t)
:config
(set-face-attribute 'default nil :font "Fira Code Retina" :height 112) ; Font
)
(defconst private-dir (expand-file-name "private" user-emacs-directory))
@ -119,9 +148,7 @@
(setup-daemon))))
(message "Corriendo en modo normal."))
;(add-hook 'window-setup-hook 'toggle-frame-maximized t)
(load custom-file)
(add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'noerror)))
(provide 'init-base)
;;; init-base.el ends here

View File

@ -17,7 +17,7 @@
(use-package corfu
:defer t
:straight (corfu :files (:defaults "extensions/*")
:elpaca (:files (:defaults "extensions/*")
:includes (corfu-info corfu-history))
:hook ((after-init . global-corfu-mode)
(corfu-mode . corfu-popupinfo-mode))
@ -38,14 +38,13 @@
(use-package orderless
:defer t
:straight t
:config
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use-package cape
:straight (cape :type git :host github :repo "minad/cape")
:elpaca (:host github :repo "minad/cape")
:after corfu
:init
;; (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
@ -58,7 +57,7 @@
;; Hacer que corfu funcione en la terminal
(unless (display-graphic-p)
(use-package corfu-terminal
:straight (corfu-terminal :type git :repo "https://codeberg.org/akib/emacs-corfu-terminal.git")
:elpaca (:repo "https://codeberg.org/akib/emacs-corfu-terminal.git")
:config
(corfu-terminal-mode +1))
)
@ -66,7 +65,6 @@
;; Iconos en corfu
(use-package kind-icon
:ensure t
:straight t
:after corfu
:custom
(kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly

View File

@ -19,7 +19,6 @@
(use-package citre
:defer t
:ensure t
:straight t
:diminish
:bind (("C-x c ." . citre-jump)
("C-x c ," . citre-jump-back)

View File

@ -31,7 +31,7 @@
(use-package eglot
:defer t
:straight (:type built-in)
:elpaca nil
:hook ((css-mode . eglot-ensure)
(html-mode . eglot-ensure)
(php-mode . eglot-ensure)
@ -50,7 +50,6 @@
;; Emmet (mientras veo como hacer funcionar emmet-ls)
(use-package emmet-mode
:defer t
:straight t
:hook
((html-mode . emmet-mode)
(web-mode . emmet-mode))
@ -59,7 +58,7 @@
;; Revisar por errores en el código
(use-package flymake
:defer t
:straight (:type built-in)
:elpaca nil
:hook (prog-mode . (lambda ()
(unless (derived-mode-p 'makefile-mode)
(flymake-mode))))
@ -70,7 +69,7 @@
;; Mostar los errores de flymake en un popup-tip
(use-package flymake-diagnostic-at-point
:defer t
:straight t
:elpaca t
:after flymake
:hook (flymake-mode . flymake-diagnostic-at-point-mode))

View File

@ -14,7 +14,6 @@
;;; Code:
(use-package evil
:defer t
:straight t
:hook (after-init . evil-mode)
:config
;; Configuraciones básicas

View File

@ -13,7 +13,6 @@
;; Autocompletado y sugerencias para el minibuffer
(use-package counsel
:defer t
:straight t
:diminish ivy-mode counsel-mode
:bind (("C-s" . swiper-isearch)
("C-r" . counsel-rg)
@ -99,7 +98,6 @@
;; Integración entre projectile y counsel
(use-package counsel-projectile
:defer t
:straight t
:bind*
("C-x p" . counsel-projectile)
:hook (counsel-mode . counsel-projectile-mode)
@ -108,7 +106,6 @@
;; Autocompletado, sugerencias y menú de búsqueda mejorados (este paquete incluye counsel y swiper)
(use-package ivy
:defer t
:straight t
:hook (after-init . ivy-mode)
:config
(setq ivy-use-virtual-buffers nil))
@ -116,7 +113,6 @@
;; Ivy pero con más detalles en pantalla
(use-package ivy-rich
:defer t
:straight t
:ensure t
:hook ((counsel-projectile-mode . ivy-rich-mode) ; MUST after `counsel-projectile'
(ivy-rich-mode . ivy-rich-project-root-cache-mode)
@ -131,19 +127,16 @@
;; nerd-icons en ivy
(use-package nerd-icons-ivy-rich
:defer t
:straight t
:ensure t
:hook (after-init . nerd-icons-ivy-rich-mode))
;; nerd-icons en ibuffer
(use-package nerd-icons-ibuffer
:straight t
:defer t
:hook (ibuffer-mode . nerd-icons-ibuffer-mode))
;; Ordenar los comandos usados en M-x (por uso y luego alfabéticamente)
(use-package smex
:straight t
:defer t
:after (counsel))

View File

@ -50,7 +50,7 @@
;; org-mode
(use-package org
:defer t
:straight (:type built-in)
:elpaca nil
:bind (("C-c a" . org-agenda)
("C-c c" . org-capture))
:hook
@ -139,24 +139,23 @@
(buffer-substring-no-properties (point) (point-max)))
(message "Download of image \"%s\" failed" link)
nil)))
)
;; Org-yt para soportar embebidos.
(use-package org-yt
:elpaca (:host github :repo "TobiasZawada/org-yt")
:config
(org-link-set-parameters "http" :image-data-fun #'org-http-image-data-fn)
(org-link-set-parameters "https" :image-data-fun #'org-http-image-data-fn)
(use-package org-yt
:defer t
:straight (org-yt :type git :host github :repo "TobiasZawada/org-yt"))
)
;; Los head "*" se ven como puntos
(use-package org-bullets
:defer t
:straight t
:hook
(org-mode . org-bullets-mode))
(use-package visual-fill-column
:straight t
:defer t
:after (org)
:config
@ -171,7 +170,6 @@
;; Segundo cerebro: Base de conocimientos en formato Zettelkasten
(use-package org-roam
:defer t
:straight t
:ensure t
:bind (("<f4>" . org-roam-node-insert)
("<f3>" . org-roam-node-find))
@ -187,7 +185,6 @@
;; Interface web para navegar en mi base de conocimientos.
(use-package org-roam-ui
:defer t
:straight t
:ensure t
:config
(setq org-roam-ui-sync-theme t
@ -197,13 +194,11 @@
;; Continúa el formato de la lista cuando presionas enter.
(use-package org-autolist
:straight t
:ensure t
:hook (org-mode . org-autolist-mode))
;; Emojis en lugar de letras para las prioridades en org-mode.
(use-package org-fancy-priorities
:straight t
:defer t
:ensure t
:hook (org-mode . org-fancy-priorities-mode)
@ -216,7 +211,6 @@
;; Org mode en modo presentación
(use-package org-present
:straight t
:defer t
:after (org)
:config

View File

@ -17,7 +17,6 @@
;; Intercamiar buffers de lugar
(use-package buffer-move
:defer t
:straight t
:bind (("M-S-<up>" . buf-move-up)
("M-S-<down>" . buf-move-down)
("M-S-<left>" . buf-move-left)
@ -26,19 +25,16 @@
;; Mostrar la ayuda de eldoc/documentación en un childframe
(use-package eldoc-box
:straight t
:defer t
:bind ("<f1>" . eldoc-box-help-at-point))
;; Seleccionar por regiones (similar a mark-sexp, pero toma en cuenta hacia atrás del cursor también)
(use-package expand-region
:straight t
:defer t
:bind ("C-+" . er/expand-region))
;; Major mode para archivos CSV
(use-package csv-mode
:straight t
:defer t
:hook ((csv-mode . csv-align-mode)
(csv-mode . csv-header-line))
@ -46,7 +42,6 @@
;; Un bonito y sencillo panel de inicio
(use-package dashboard
:straight t
:defer t
:init
(dashboard-setup-startup-hook)
@ -66,7 +61,6 @@
;; Sidebar a la derecha con los archivos
(use-package dired-sidebar
:straight t
:defer t
:hook (dired-mode . hl-line-mode)
:ensure t
@ -81,18 +75,16 @@
;; Mover líneas o regiones
(use-package drag-stuff
:defer t
:straight t
:hook
(after-init . drag-stuff-global-mode)
(elpaca-after-init . drag-stuff-global-mode)
:config
(drag-stuff-define-keys))
;; La línea bonita esa de abajo
(use-package doom-modeline
:defer t
:straight t
:ensure t
:hook (after-init . doom-modeline-mode)
:hook (elpaca-after-init . doom-modeline-mode)
:config
(setq doom-modeline-project-detection 'auto
doom-modeline-buffer-file-name-style 'relative-from-project
@ -104,21 +96,19 @@
;; Emparejamiento automático de comillas, paréntesis, corchetes y llaves
(use-package electric-pair
:defer t
:straight (:type built-in)
:hook (after-init . electric-pair-mode)
:elpaca nil
:hook (elpaca-after-init . electric-pair-mode)
:config
(setq electric-pair-delete-adjacent-pairs nil))
;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package git-gutter
:defer t
:straight t
:hook
(after-init . global-git-gutter-mode))
(elpaca-after-init . global-git-gutter-mode))
;; Resalta los escapes de secuencia
(use-package highlight-escape-sequences
:straight t
:defer t
:hook (prog-mode . hes-mode)
:config
@ -141,7 +131,6 @@
;; Mostrar lo que se está presionando en pantalla
(use-package keypression
:straight t
:defer t
:config
(setq keypression-use-child-frame t
@ -157,23 +146,19 @@
;; Generador automatizado de archivos de licencia
(use-package license-templates
:straight t
:defer t)
;; Magia para git
(use-package magit
:defer t
:straight t)
:defer t)
;; Modo markdown
(use-package markdown-mode
:defer t
:straight t)
:defer t)
;; Multiple vterm
(use-package multi-vterm
:defer t
:straight t
:bind* (("<f5>" . multi-vterm-dedicated-toggle)
("C-x tt" . multi-vterm-dedicated-toggle)
("C-x tf" . multi-vterm)
@ -184,19 +169,16 @@
;; Iconos bonitos para varias cosas
(use-package nerd-icons
:straight t
:defer t)
;; Usar nerd-icons en dired
(use-package nerd-icons-dired
:straight t
:defer t
:hook (dired-mode . nerd-icons-dired-mode))
;; Mecanografía
(use-package speed-type
:defer t
:straight t
:diminish
:config
(setq speed-type-gb-book-list '(66867 66866 66591 57303)
@ -205,13 +187,11 @@
;; Des-minifica / ordena el código
(use-package prettier
:defer t
:straight t)
:defer t)
;; Paquete para manejo de proyectos
(use-package projectile
:defer t
:straight t
:bind ("C-c p" . projectile-command-map)
:diminish projectile-mode
:custom ((projectile-completion-system 'ivy))
@ -260,7 +240,7 @@
;; Recentf - Guarda registro de los archivos abiertos recientemente
(use-package recentf
:defer t
:straight t
:elpaca nil
:bind ("C-x C-r" . recentf-open-files)
:config
(setq recentf-save-file
@ -270,9 +250,8 @@
;; Busqueda rápida con ripgrep
(use-package rg
:defer t
:straight t
:defines projectile-command-map
:hook (after-init . rg-enable-default-bindings)
:hook (elpaca-after-init . rg-enable-default-bindings)
:bind (:map rg-global-map
("c" . rg-dwim-current-dir)
("f" . rg-dwim-current-file)
@ -287,8 +266,8 @@
;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir.
(use-package saveplace
:straight t
:hook (after-init . save-place-mode)
:elpaca nil
:hook (elpaca-after-init . save-place-mode)
:config
(setq save-place-file (locate-user-emacs-file (concat temp-dir "/places"))))
@ -296,13 +275,12 @@
(use-package silicon
:ensure t
:defer t
:straight (silicon :type git :host github :repo "iensu/silicon-el"))
:elpaca (:host github :repo "iensu/silicon-el"))
;; Mejorando el scroll
(use-package smooth-scrolling
:defer t
:straight t
:hook (after-init . smooth-scrolling-mode)
:hook (elpaca-after-init . smooth-scrolling-mode)
:config
(setq mouse-wheel-scroll-amount
'(8 ((shift) . 1) ((control) . nil))) ; Cambia el scroll a 8 líneas a la vez, 1 cuando se preciona SHIFT y saltos de página cuando presionas CTRL
@ -312,8 +290,7 @@
;; Ayuda a manipular los archivos con líneas demasiado largas
(use-package so-long
:defer t
:straight (:type built-in)
;; :hook (after-init . global-so-long-mode)
:elpaca nil
:bind (:map so-long-mode-map
("C-s" . isearch-forward)
("C-r" . isearch-backward))
@ -332,7 +309,7 @@
;; Tree-sitter :)
(use-package treesit
:defer t
:straight (:type built-in)
:elpaca nil
:commands (treesit-install-language-grammar nf/treesit-install-all-languages)
:config
(setq treesit-language-source-alist
@ -367,38 +344,37 @@
;; Cuando presionas enter en un bloque de comentario sigue el estilo del bloque.
(use-package vs-comment-return
:straight (vs-comment-return :type git :host github :repo "emacs-vs/vs-comment-return")
:elpaca (:host github :repo "emacs-vs/vs-comment-return")
:defer t
:hook (prog-mode . vs-comment-return-mode)
)
;; Mostrar el último commit que modificó la linea actual
(use-package vc-msg
:straight t
:defer t
:bind (("C-c v" . vc-msg-show)
("C-c C-v" . vc-msg-show))
)
;; Terminal
(use-package vterm :ensure t :defer t :straight t)
(use-package vterm
:ensure t
:defer t)
;; Cuando iniicias un atajo de teclas te muestra las posibilidades
(use-package which-key
:defer t
:straight t
:hook (after-init . which-key-mode))
:hook (elpaca-after-init . which-key-mode))
;; Restaurar el estado de los frames
(use-package winner
:elpaca nil
:defer t
:straight t
:hook (after-init . winner-mode))
:hook (elpaca-after-init . winner-mode))
;; Emacs Start Up Profiler
(use-package esup
:ensure t
:straight t)
:defer t)
(provide 'init-packages)
;;; init-packages.el ends here

View File

@ -10,7 +10,6 @@
;;; Code:
(use-package go-mode
:straight t
:defer t)
(provide 'lang-go)

View File

@ -10,7 +10,6 @@
;;; Code:
(use-package web-mode
:straight t
:defer t
:config
(setq web-mode-markup-indent-offset 2
@ -23,7 +22,7 @@
(use-package auto-rename-tag
:straight t (auto-rename-tag :type git :host github :repo "jcs-elpa/auto-rename-tag")
:elpaca (:host github :repo "jcs-elpa/auto-rename-tag")
:defer t
:hook ((html-mode . auto-rename-tag-mode)
(web-mode . auto-rename-tag-mode))

View File

@ -11,7 +11,7 @@
(use-package js
:defer t
:straight t
:elpaca nil
:mode
("\\.js$" . js-mode)
:hook
@ -22,7 +22,6 @@
;; json-mode
(use-package json-mode
:defer t
:straight t
:ensure t
:mode
("\\.json$" . json-mode)

View File

@ -11,7 +11,6 @@
(use-package php-mode
:defer t
:straight t
:bind ("C-c d b" . kj/php-doc-block)
:config
(defun kj/php-doc-block ()
@ -28,7 +27,7 @@
)
(use-package php-doc-block
:straight (php-doc-block :type git :host github :repo "moskalyovd/emacs-php-doc-block")
:elpaca (:host github :repo "moskalyovd/emacs-php-doc-block")
)
(provide 'lang-php)

View File

@ -11,21 +11,9 @@
(use-package rust-mode
:defer t
:straight t
:ensure t
:config
(setq rust-format-on-save t))
;; Rustic es necesario solamente si se usa lsp-mode + flycheck.
;; (use-package rustic
;; :defer t
;; :straight t
;; :ensure t
;; :config
;; ;;(setq rustic-lsp-server 'rls)
;; (setq rustic-lsp-client 'lsp)
;; ;;(setq rustic-lsp-client nil)
;; (push 'rustic-clippy flycheck-checkers))
(provide 'lang-rust)
;;; lang-rust.el ends here

View File

@ -33,7 +33,7 @@
(setq gc-cons-percentage (get 'gc-cons-percentage 'value-during-init))
;; Color de fondo similar al theme para evitar que se vea blanco al iniciar
(add-to-list 'default-frame-alist '(background-color . "#282a36"))
;; (add-to-list 'default-frame-alist '(background-color . "#282a36"))
;; Permitir solo la búsqueda de archivos a cargar en la config en case sensitive.
(setq auto-mode-case-fold nil)
@ -46,6 +46,14 @@
;; (add-to-list 'initial-frame-alist '(fullscreen . maximized)) ; frame inicial
;; (add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Cada frame
(add-hook 'window-setup-hook 'toggle-frame-maximized t) ; Hacerlo mediante window-setup-hook (se maximiza al terminar de cargar la ventana)
(push '(ns-transparent-titlebar . t) default-frame-alist)
;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; font. By inhibiting this, we easily halve startup times with fonts that are
;; larger than the system default.
(setq frame-inhibit-implied-resize t
frame-resize-pixelwise t)
;; Recommended by
;; https://github.com/raxod502/straight.el#getting-started to prevent