emacs.d

bloated emacs configuration
git clone git://git.ckyln.com/~cem/emacs.d.git
Log | Files | Refs | README

commit ad4ce00498de60ad963f56e613c78e949f4622ea
parent f3519106f91d74ecb2629f168baaebdbc5d39c36
Author: Cem Keylan <cem@ckyln.com>
Date:   Wed, 15 Jul 2020 13:28:54 +0300

init: revert from straight.el to package.el

I am so unhappy for doing this.

Diffstat:
Minit.org | 201++++++++++++++++++++++++++-----------------------------------------------------
1 file changed, 65 insertions(+), 136 deletions(-)

diff --git a/init.org b/init.org @@ -62,8 +62,6 @@ this file itself. - [[#set-browser][Set Browser]] - [[#local-init-file][Local init file]] - [[#end-of-the-file][End of the file]] -- [[#notes][Notes]] - - [[#reverting-to-packageel][Reverting to package.el]] ** Installation Instructions @@ -170,46 +168,30 @@ them to 0. ** Package management -I have switched to straight.el for package management. It is overall faster than -package.el, and I don't want to use every package that I have tried out. The -following is the one time bootstrapping script that straight.el uses to install -itself. +I have recently reverted to package.el for package management. Even though +=straight.el= is overall the better solution, I have had some issues significant +enough to switch back. This might be re-reverted if my issues persist. #+BEGIN_SRC emacs-lisp - (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/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - - (eval-when-compile - (add-to-list 'load-path (concat user-emacs-directory "straight/repos/straight.el")) - (add-to-list 'load-path (concat user-emacs-directory "straight/repos/use-package")) - (require 'straight)) -#+END_SRC - -*** Straight default configurations - -I don't want straight to do complete clones of the package repositories I am -building from. - -#+BEGIN_SRC emacs-lisp - (setq straight-vc-git-default-clone-depth 1) + (require 'package) + (setq package-archives + '( + ("elpa" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) + (package-initialize) #+END_SRC *** use-package -We need use-package for maintaining other packages. +We need =use-package= for maintaining other packages. =use-package= is a macro +for configuring and loading packages in a clean, fast, lazy, and a tidy way. It +is not a package manager, but it can interface with other package managers. #+BEGIN_SRC emacs-lisp - (straight-use-package 'use-package) + (unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + (require 'use-package) #+END_SRC @@ -241,9 +223,9 @@ You can install the generated emc script by doing #+END_SRC #+BEGIN_SRC emacs-lisp - (require 'server) - (or (server-running-p) - (server-start)) + (use-package server + :if window-system + :hook (after-init . server-start)) #+END_SRC ** cheatsheet @@ -252,7 +234,7 @@ be loaded as one of the first packages. #+BEGIN_SRC emacs-lisp (use-package cheatsheet - :straight t + :ensure t :bind ("C-c s c" . cheatsheet-show) :config (cheatsheet-add-group 'Common @@ -277,7 +259,7 @@ am using Emacs. Let's begin with the evil-mode itself. #+BEGIN_SRC emacs-lisp (use-package evil - :straight t + :ensure t :custom (evil-want-C-u-scroll nil) (evil-want-keybinding nil) @@ -293,7 +275,7 @@ We didn't ask for the keybindings yet, because we are going to get the (use-package evil-collection :requires evil :after evil - :straight t + :ensure t :config (evil-collection-init)) #+END_SRC @@ -307,7 +289,7 @@ for me. (use-package evil-surround :requires evil :after evil - :straight t + :ensure t :config (global-evil-surround-mode 1)) #+END_SRC @@ -321,7 +303,7 @@ section. #+BEGIN_SRC emacs-lisp (use-package org - :straight org-plus-contrib + :ensure t :functions org-babel-tangle :after evil :bind (("C-c l" . org-store-link) ;; See the cheatsheet configuration @@ -387,7 +369,7 @@ I am quite serious on this vim stuff now. I want it everywhere. #+BEGIN_SRC emacs-lisp (use-package evil-org - :straight t + :ensure t :after (evil org) :functions evil-org-agenda-set-keys :hook (org-mode . evil-org-mode) @@ -405,7 +387,7 @@ to manually edit hunks for specific commits. I use evil-magit along with it. #+BEGIN_SRC emacs-lisp (use-package magit - :straight t + :ensure t :bind ("C-x g" . magit-status) :config (cheatsheet-add-group 'Magit @@ -424,7 +406,7 @@ to manually edit hunks for specific commits. I use evil-magit along with it. #+BEGIN_SRC emacs-lisp (use-package evil-magit - :straight t + :ensure t :after (evil magit) :config (evil-magit-init)) #+END_SRC @@ -435,7 +417,7 @@ I like being able to interact with PR's and issues on Github from the comfort of Emacs. Forge is a good one on that. Less web browsing, the better. #+BEGIN_SRC emacs-lisp - (use-package forge :straight t :after magit) + (use-package forge :ensure t :after magit) #+END_SRC ** Flycheck @@ -446,7 +428,7 @@ and buggy on Vim. #+BEGIN_SRC emacs-lisp (use-package flycheck - :straight t + :ensure t :config (global-flycheck-mode) (cheatsheet-add-group '"Syntax Checking" @@ -455,7 +437,7 @@ and buggy on Vim. '(:key "C-c ! l" :description "list flycheck errors")) ) (use-package flycheck-pos-tip - :straight t + :ensure t :hook (flycheck-mode . flycheck-pos-tip-mode)) #+END_SRC @@ -467,7 +449,7 @@ much yet. Pretty simple config. #+BEGIN_SRC emacs-lisp (use-package company - :straight t + :ensure t :custom (company-idle-delay 1) (company-minimum-prefix-length 1) @@ -483,7 +465,7 @@ far as I can wrap my head-around. #+BEGIN_SRC emacs-lisp :tangle no (use-package company-lsp - :straight t + :ensure t :after company :init (push 'company-lsp company-backends)) @@ -496,7 +478,7 @@ keybindings that executes commands on a project level. #+BEGIN_SRC emacs-lisp (use-package projectile - :straight t + :ensure t :bind-keymap ("C-c p" . projectile-command-map) :config (projectile-mode +1) (cheatsheet-add-group 'Projectile @@ -516,7 +498,7 @@ information when I startup Emacs. #+BEGIN_SRC emacs-lisp (use-package dashboard - :straight t + :ensure t :custom (dashboard-center-content t) (show-week-agenda-p nil) @@ -533,12 +515,12 @@ file with elfeed-org. #+BEGIN_SRC emacs-lisp :tangle no (use-package elfeed - :straight t + :ensure t :after org :bind ("C-x w" . elfeed)) (use-package elfeed-org - :straight t + :ensure t :after (elfeed org) :custom (rmh-elfeed-org-files (list (concat user-emacs-directory "feed.org"))) :config @@ -571,7 +553,7 @@ and many more. #+BEGIN_SRC emacs-lisp (use-package helm - :straight t + :ensure t :commands (helm-find-files helm-buffers-list) :config (bind-key "C-x C-f" 'helm-find-files) @@ -585,11 +567,11 @@ and many more. '(:key "C-x i" :description "helm-imenu") '(:key "C-x b" :description "helm-buffers-list"))) (use-package helm-descbinds - :straight t + :ensure t :config (bind-key "C-x C-d" 'helm-descbinds) (cheatsheet-add :group "Helm" :key "C-x C-d" :description "helm-descbinds")) - (use-package helm-swoop :straight t) + (use-package helm-swoop :ensure t) #+END_SRC ** Academics @@ -604,18 +586,18 @@ I find them extremely useful. #+BEGIN_SRC emacs-lisp :tangle no (use-package org-noter :after org - :straight t) + :ensure t) (use-package org-roam :after org - :straight t) + :ensure t) #+END_SRC *** Bibliography stuff I am using helm-bibtex, which is extremely useful navigating bibliography files. #+BEGIN_SRC emacs-lisp (use-package helm-bibtex - :straight t) + :ensure t) #+END_SRC *** PDF Tools @@ -643,7 +625,7 @@ that is as follows. #+BEGIN_SRC emacs-lisp (use-package pdf-tools - :straight t + :ensure t :config (pdf-loader-install)) #+END_SRC @@ -657,7 +639,7 @@ These don't really deserve their own sections, but I prefer to use them. This is a package for re-initiating a file as root. #+BEGIN_SRC emacs-lisp - (use-package sudo-edit :straight t) + (use-package sudo-edit :ensure t) #+END_SRC *** linum-relative @@ -666,7 +648,7 @@ the other lines. #+BEGIN_SRC emacs-lisp (use-package linum-relative - :straight t + :ensure t :bind ("C-c r" . display-line-numbers-mode) :custom (linum-relative-current-symbol "") @@ -682,7 +664,7 @@ that I write. #+BEGIN_SRC emacs-lisp (use-package markdown-mode - :straight t + :ensure t :config (setq markdown-command "/usr/bin/markdown")) #+END_SRC @@ -692,7 +674,7 @@ I sometimes output html from org-mode as it comes handy. We use htmlize for that. #+BEGIN_SRC emacs-lisp - (use-package htmlize :straight t) + (use-package htmlize :ensure t) #+END_SRC *** toc-org @@ -703,7 +685,7 @@ Github README. #+BEGIN_SRC emacs-lisp (use-package toc-org - :straight t + :ensure t :hook (org-mode . toc-org-mode)) #+END_SRC @@ -713,7 +695,7 @@ which-key-mode shows key completions when the user is stuck in a prefix key. #+BEGIN_SRC emacs-lisp (use-package which-key - :straight t + :ensure t :custom (which-key-popup-type 'side-window) :config @@ -767,7 +749,7 @@ For markdown, I want to have 4 spaces as an indentation. #+BEGIN_SRC emacs-lisp (use-package markdown-mode - :straight t + :ensure t :custom (md-indent-tabs-mode nil) (md-tab-width 4)) @@ -794,7 +776,7 @@ is the use-package #+BEGIN_SRC emacs-lisp (use-package company-jedi - :straight t + :ensure t :after company :init (add-to-list 'company-backends 'company-jedi)) @@ -815,16 +797,16 @@ This installs =irony=, =company-irony=, and =flycheck-irony=. #+BEGIN_SRC emacs-lisp (use-package irony - :straight t + :ensure t :hook (c-mode . irony-mode)) (use-package flycheck-irony - :straight t + :ensure t :after (flycheck irony) :hook (flycheck-mode . flycheck-irony-setup)) (use-package company-irony - :straight t + :ensure t :after (company irony) :config (add-to-list 'company-backends 'company-irony)) @@ -836,16 +818,16 @@ For Go, we are installing =go-mode= and =company-go=. =go-mode= is a rewrite of the built-in major mode for go. =company-go= is the company backend for go. #+BEGIN_SRC emacs-lisp - (use-package go-mode :straight t) + (use-package go-mode :ensure t) (use-package company-go - :straight t + :ensure t :after company ) #+END_SRC ** Makefile #+BEGIN_SRC emacs-lisp - (use-package helm-make :straight t) + (use-package helm-make :ensure t) #+END_SRC ** LaTeX @@ -855,7 +837,7 @@ configuration on it. #+BEGIN_SRC emacs-lisp :tangle no (use-package auctex - :straight t) + :ensure t) #+END_SRC * Themes and Buffer Customization @@ -872,7 +854,7 @@ The 'if' statement makes sure we have #+BEGIN_SRC emacs-lisp (use-package doom-themes :after all-the-icons - :straight t + :ensure t :functions doom-themes-org-config doom-themes-treemacs-config :custom (doom-themes-enable-bold t) @@ -891,10 +873,10 @@ guess. Pretty straightforward. #+BEGIN_SRC emacs-lisp (use-package all-the-icons - :straight t) + :ensure t) (use-package all-the-icons-dired - :straight t + :ensure t :after all-the-icons :hook (dired-mode . all-the-icons-dired-mode)) #+END_SRC @@ -903,7 +885,7 @@ guess. Pretty straightforward. *** Modeline #+BEGIN_SRC emacs-lisp (use-package doom-modeline - :straight t + :ensure t :config (doom-modeline-mode 1)) #+END_SRC @@ -916,7 +898,7 @@ that you appreciate having when its time comes. #+BEGIN_SRC emacs-lisp (use-package undo-tree - :straight t + :ensure t :config (cheatsheet-add :group "Common" :key "C-x u" :description "undo-tree")) #+END_SRC @@ -1006,7 +988,7 @@ inconsistency of switching between terminal and the graphical Emacs. #+BEGIN_SRC emacs-lisp (use-package xclip - :straight t + :ensure t :config (xclip-mode)) #+END_SRC @@ -1027,7 +1009,7 @@ not have a =--dired= option. Let's disable it. #+BEGIN_SRC emacs-lisp (use-package dired-explorer - :straight t + :ensure t :custom (dired-use-ls-dired nil)) #+END_SRC @@ -1067,56 +1049,3 @@ Now that all of this is done, we can load user's personal configuration (provide 'init) ;;; init.el ends here #+END_SRC - -* Notes -** Reverting to package.el -You can always revert back to =package.el= by replacing the [[Package management]] -section with the following configuration steps. This can be for many reasons. -For example I have reverted to package.el on my old laptop where I don't want -deal with compilation, and I don't want to keep git repositories of every package -that I use. However, I believe that I can deal with those problems as I learn more -about the internals of straight. - -*** Replacing the bootstrap command - -You need to replace the =straight.el= package manager bootstrapper. This is -the first code block in the section. Replace it with the following code block. - -Keep in mind that you shouldn't add =:tangle no=. - -#+BEGIN_SRC org :tangle no - ,#+BEGIN_SRC emacs-lisp - (require 'package) - (setq package-archives '( - ("elpa" . "https://elpa.gnu.org/packages/") - ("melpa" . "https://melpa.org/packages/") - )) - (package-initialize) - ,#+END_SRC -#+END_SRC - -This code block will initialize =package.el=. Now we need to replace use-package -as it works with package.el - -*** Making use-package work with package.el - -Now, replace the second code-block in the section with the following -commands. - -#+BEGIN_SRC org :tangle no - ,#+BEGIN_SRC emacs-lisp - (unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - - (require 'use-package) - ,#+END_SRC -#+END_SRC - -There is also the final step, which is the most important one. Replacing the use-package =:straight= -calls with =:ensure=. Keep in mind that doing so will also replace the line below as well. In your shell, -run the following command. - -#+BEGIN_SRC sh :tangle no -sed -i 's/\:straight /\:ensure /g' init.org -#+END_SRC