mirror of https://github.com/Chizi123/.emacs.d.git

Joel Grunbaum
2024-02-14 56a5d88324a3d10b8ba52d673f58fc43b01b1b89
Move to straight for packages, with easy reversion to package.el
2 files added
3 files modified
129 ■■■■■ changed files
.gitignore 4 ●●● patch | view | raw | blame | history
config.org 40 ●●●●● patch | view | raw | blame | history
early-init.el 4 ●●●● patch | view | raw | blame | history
init.el 40 ●●●●● patch | view | raw | blame | history
package-manager.el 41 ●●●●● patch | view | raw | blame | history
.gitignore
@@ -1,5 +1,7 @@
/*
!config.org
!init.el
!early-init.el
!package-manager.el
!.gitignore
!snippets
!snippets
config.org
@@ -405,6 +405,14 @@
  (global-set-key (kbd "C-c e i") 'init-visit)
#+END_SRC
*** Go to early-init.el
#+BEGIN_SRC emacs-lisp
  (defun early-init-visit ()
    (interactive)
    (find-file "~/.emacs.d/early-init.el"))
  (global-set-key (kbd "C-c e e") 'early-init-visit)
#+END_SRC
*** Reload configuration
#+BEGIN_SRC emacs-lisp
  (defun config-reload ()
@@ -1087,6 +1095,7 @@
#+BEGIN_SRC emacs-lisp
  (use-package tex
    :ensure auctex
    :straight auctex
    :config
    (setq TeX-auto-save t
          TeX-parse-self t
@@ -1242,17 +1251,18 @@
*** MATLAB
Mode for editing MATLAB m-files.
#+BEGIN_SRC emacs-lisp
    (use-package matlab
      :ensure matlab-mode
      :config
      (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
      (add-to-list
       'auto-mode-alist
       '("\\.m$" . matlab-mode))
      (setq matlab-indent-function t)
      (setq matlab-shell-command "matlab")
      (matlab-cedet-setup)
      (add-to-list 'company-backends 'company-matlab-shell))
  (use-package matlab
    :ensure matlab-mode
    :straight matlab-mode
    :config
    (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
    (add-to-list
     'auto-mode-alist
     '("\\.m$" . matlab-mode))
    (setq matlab-indent-function t)
    (setq matlab-shell-command "matlab")
    (matlab-cedet-setup)
    (add-to-list 'company-backends 'company-matlab-shell))
#+END_SRC
*** COMMENT MIPS
@@ -1322,13 +1332,6 @@
    (add-to-list 'lsp-enabled-clients 'jedi))
#+END_SRC
* Org mode
** Up to date org
Pull the latest org mode from the repository, rather than the org which comes with emacs.
#+BEGIN_SRC emacs-lisp
  (use-package org
    :pin gnu)
#+END_SRC
** Small tweaks
Small quality of life changes to org-mode.
#+BEGIN_SRC emacs-lisp
@@ -1425,6 +1428,7 @@
#+BEGIN_SRC emacs-lisp
  (use-package emms-setup
    :ensure emms
    :straight emms
    :init
    (add-to-list 'load-path "~/elisp/emms/")
    :config
early-init.el
New file
@@ -0,0 +1,4 @@
;; Disable package at startup in case of other package managers being used
(setq package-enable-at-startup nil)
(makunbound 'package-archives)
(setq-default package-manager 'package)
init.el
@@ -2,37 +2,27 @@
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)
;; Repos
(require 'package)
(setq package-archives '(("gnu"   . "https://elpa.gnu.org/packages/")
                         ("nongnu"  . "https://elpa.nongnu.org/nongnu/")
                         ("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(setq package-install-upgrade-built-in t)
(eval-when-compile
  (require 'use-package))
(require 'use-package-ensure)
(setq use-package-always-ensure t)
;; Load package manager
(setq package-manager 'straight)
(load "~/.emacs.d/package-manager.el" `noerror)
;; auto-package-update
(use-package auto-package-update
  :ensure t
  :config
  (setq auto-package-update-delete-old-versions t)
  (setq auto-package-update-hide-results t)
  (setq auto-package-update-interval 7)
  (setq auto-package-update-at-time "03:00")
  (auto-package-update-maybe))
(when (eq package-manager 'package)
  (use-package auto-package-update
    :ensure t
    :config
    (setq auto-package-update-delete-old-versions t)
    (setq auto-package-update-hide-results t)
    (setq auto-package-update-interval 7)
    (setq auto-package-update-at-time "03:00")
    (auto-package-update-maybe)))
;; diminish
(use-package diminish)
;; org-mode
(use-package org)
;; redirect to org config file
(when (file-readable-p "~/.emacs.d/config.org")
  (org-babel-load-file "~/.emacs.d/config.org"))
package-manager.el
New file
@@ -0,0 +1,41 @@
;;; Package manager selection
;; Can chose the package manager from the default package.el or straight.el
;; There may be problems with some of them in corporate environments
;; Repos
(cond ((eq package-manager 'package)
       (require 'package)
       (when (not (boundp 'package-archives))
         (setq package-archives '(("gnu"   . "https://elpa.gnu.org/packages/")
                                  ("nongnu"  . "https://elpa.nongnu.org/nongnu/")
                                  ("melpa" . "https://melpa.org/packages/"))))
       (package-initialize)
       ;; use-package
       (unless (package-installed-p 'use-package)
         (package-refresh-contents)
         (package-install 'use-package))
       (setq package-install-upgrade-built-in t)
       (eval-when-compile
         (require 'use-package))
       (require 'use-package-ensure)
       (setq use-package-always-ensure t))
      ((eq package-manager 'straight)
       (defvar bootstrap-version)
       (let ((bootstrap-file
              (expand-file-name
               "straight/repos/straight.el/bootstrap.el"
               (or (bound-and-true-p straight-base-dir)
                  user-emacs-directory)))
             (bootstrap-version 7))
         (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)))