53 lines
1.8 KiB
EmacsLisp
53 lines
1.8 KiB
EmacsLisp
;;; pre-settings.el --- Summary -*- lexical-binding: t -*-
|
||
;;; Commentary:
|
||
;;; Code:
|
||
;; count startup time
|
||
(defun display-startup-time ()
|
||
"Display the startup time and number of garbage collections."
|
||
(message "Emacs init loaded in %.2f seconds (Full emacs-startup: %.2fs) with %d garbage collections."
|
||
(float-time (time-subtract after-init-time before-init-time))
|
||
(time-to-seconds (time-since before-init-time))
|
||
gcs-done))
|
||
(add-hook 'emacs-startup-hook #'display-startup-time 100)
|
||
|
||
;; omit warnings like: /opt/emacs-conf/lisp/org/oc-basic.el: Warning: ‘buffer-substring’ is an obsolete generalized variable.
|
||
(setq byte-compile-warnings nil)
|
||
|
||
(use-package delight
|
||
:defer t) ;; used for use-package :delight, see delight-delighted-modes, defer b/c of awesome-tray
|
||
|
||
;;
|
||
;; 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-buffer-done-kill t)
|
||
(load custom-file t t))
|
||
|
||
(provide 'pre-settings)
|
||
;;; pre-settings.el ends here
|