Files
emacs/settings/pre-settings.el

68 lines
2.7 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;;; 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
))
;; 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)))
;; omit warnings like: /opt/emacs-conf/lisp/org/oc-basic.el: Warning: buffer-substring is an obsolete generalized variable.
(setq byte-compile-warnings nil)
(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"))
(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