You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.8 KiB

;;; init.el --- The Emacs init file
;;
;;; Commentary:
;; This is the main configuration file for Emacs.
;; In this file:
;; - Set the bootstratp for straight.el
;; - Load use-package
;; - Load no-littering
;; - Set user-init-directory to ~/.cache/emacs
;; - Install the latest release of org
;; - Load the file ~/.emacs.d/myconfig.org
;;
;;; Code:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set up straight package manager
;;
;; set new location for straight.el
(setq straight-base-dir (expand-file-name "~/.cache/emacs/var"))
;;
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" straight-base-dir))
(bootstrap-version 6))
(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))
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Install and configure use-package
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keep emacs clean!
;; Use no-littering to automatically set common paths to the new user-emacs-directory
(use-package no-littering
:init
;; set paths for no-littering etc and var directories
;; instead of this paths, you could use
;; (setq user-emacs-directory (expand-file-name "~/.cache/emacs"))
(setq no-littering-etc-directory (expand-file-name "~/.cache/emacs/etc")
no-littering-var-directory (expand-file-name "~/.cache/emacs/var")
)
:config
;; set sensible defaults for backups
(no-littering-theme-backups)
;; set paths for url-history-file and custom-file
(setq url-history-file (no-littering-expand-etc-file-name "url/history")
custom-file (no-littering-expand-etc-file-name "custom.el"))
)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Install org-mode
(straight-use-package 'org)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load myconfig file.
(let ((config-el (expand-file-name "myconfig.el" user-emacs-directory))
(config-org (expand-file-name "myconfig.org" user-emacs-directory)))
(if (and (file-exists-p config-el)
(file-exists-p config-org)
(time-less-p (file-attribute-modification-time (file-attributes config-org))
(file-attribute-modification-time (file-attributes config-el))))
(load-file config-el)
(if (file-exists-p config-org)
(org-babel-load-file config-org)
(error "No file `%s' found!! No configuration loaded!!" config-org))))
;;
;;
(provide 'init)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init.el ends here