;;; pre-settings.el --- Summary -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (mapc (lambda (item) (add-to-list 'load-path item)) (list (concat config-dir "settings") ;; path where settings files are kept (concat config-dir "lisp") ;; personal elisp lib dir, for manually installed packages (concat config-dir "lisp/adaptive-wrap") ;; https://elpa.gnu.org/packages/adaptive-wrap.html (concat config-dir "lisp/dash") (concat config-dir "lisp/with-editor") (concat config-dir "lisp/hydra") ;; required by treemacs org-ref (concat config-dir "lisp/async") ;; https://melpa.org/#/async required by ob-async (concat config-dir "lisp/persist") ;; https://elpa.gnu.org/packages/persist.html required by org-drill (concat config-dir "lisp/use-package") ;; https://melpa.org/#/use-package )) (setq gc-cons-threshold (* 50 1000 1000)) ;; Make startup faster by reducing the frequency of garbage collection. The default is 800 kilobytes. Measured in bytes. Will be decreased again at the end. ;; count startup time (add-hook 'emacs-startup-hook ;; Use a hook so the message doesn't get clobbered by other messages. (lambda () (message "Emacs ready in %s with %d garbage collections." (format "%.2f seconds" (float-time (time-subtract after-init-time before-init-time))) gcs-done))) (require 'use-package) ;; requires bind-key (setq use-package-verbose t) (setq use-package-compute-statistics t) (use-package delight) ;; used for use-package :delight, see delight-delighted-modes ;; ;; functions ;; (defun my-font-installed-p (font-name) "Check if font with FONT-NAME is available." (when (find-font (font-spec :name "all-the-icons")) t)) ;; ;; variables ;; (defvar running-on-windows (memq system-type '(windows-nt cygwin32 cygwin)) "Non-nil if and only if we're running on Windows. Both Win32 and Cygwin count.") ;; https://stackoverflow.com/questions/60922620/shell-script-to-check-if-running-in-windows-when-using-wsl (defvar running-on-windows-wsl (string-equal (replace-regexp-in-string "[ \n]+$" "" (shell-command-to-string "uname -a | sed -n 's/.*\\( *Microsoft *\\).*/\\1/ip'")) "Microsoft")) (setq user-emacs-directory "~/.config/emacs/") ;; for cache etc. (defconst user-cache-directory (file-name-as-directory (concat user-emacs-directory ".cache")) "My Emacs storage area for persistent files.") ;; create the `user-cache-directory' if not exists (make-directory user-cache-directory t) (defvar my-dbusp (and (boundp 'dbus-compiled-version) ;; t on WSL Debian machine (if (require 'dbus) (dbus-ping :session "org.freedesktop.Notifications"))) ;; is not enough "Check if DBus is available.") (use-package cus-edit :config (setq custom-file (concat user-emacs-directory "custom.el")) (setq custom-buffer-done-kill t) (load custom-file t t)) (provide 'pre-settings) ;;; pre-settings.el ends here