.emacs.d/elisp/init-const.el

113 lines
3.0 KiB
EmacsLisp

;;; init-const.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-const.el
;; Description: Initialize Constants
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Mar 18 14:20:54 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: Mon Dec 9 20:49:39 2019 (-0500)
;; By: Mingde (Matthew) Zeng
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d constants
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes constants
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; UserInfo
(setq user-full-name "Mikaël Capelle")
(setq user-mail-address "capelle.mikael@gmail.com")
;; -UserInfo
;; Consts
(defconst *sys/gui*
(display-graphic-p)
"Are we running on a GUI Emacs?")
(defconst *sys/win32*
(eq system-type 'windows-nt)
"Are we running on a WinTel system?")
(defconst *sys/linux*
(eq system-type 'gnu/linux)
"Are we running on a GNU/Linux system?")
(defconst *sys/mac*
(eq system-type 'darwin)
"Are we running on a Mac system?")
(defconst *sys/root*
(string-equal "root" (getenv "USER"))
"Are you a ROOT user?")
(defconst *rg*
(executable-find "rg")
"Do we have ripgrep?")
(defconst *python*
(executable-find "python")
"Do we have python?")
(defconst *python3*
(executable-find "python3")
"Do we have python3?")
(defconst *tr*
(executable-find "tr")
"Do we have tr?")
(defconst *mvn*
(executable-find "mvn")
"Do we have Maven?")
(defconst *clangd*
(or (executable-find "clangd") ;; usually
(executable-find "/usr/local/opt/llvm/bin/clangd")) ;; macOS
"Do we have clangd?")
(defconst *gcc*
(executable-find "gcc")
"Do we have gcc?")
(defconst *git*
(executable-find "git")
"Do we have git?")
(defconst *pdflatex*
(executable-find "pdflatex")
"Do we have pdflatex?")
(defconst *eaf-env*
(and *sys/linux* *sys/gui* *python3*
(executable-find "pip")
(not (equal (shell-command-to-string "pip freeze | grep '^PyQt\\|PyQtWebEngine'") "")))
"Check basic requirements for EAF to run.")
;; -Consts
(provide 'init-const)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-const.el ends here