diff --git a/init.el b/init.el index 33f2c1c..f923944 100644 --- a/init.el +++ b/init.el @@ -5,7 +5,6 @@ ;;; Code: ;; set up local directory -;(add-to-list 'load-path "~/.emacs.d/lisp/") (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) (setq-default flycheck-emacs-lisp-load-path 'inherit) @@ -62,7 +61,8 @@ (when (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (blink-cursor-mode 0) -;; disable annoying ring-bell when backspace key is pressed in certain situations +;; disable annoying ring-bell when backspace key +;; is pressed in certain situations (setq ring-bell-function 'ignore) ;; use utf-8 @@ -70,8 +70,43 @@ (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) -(defvar use-pragmata) -(setq use-pragmata (not (equal (system-name) "cleanse"))) +;; prioritized list of fonts to try +(defvar my/fonts + '("PragmataPro Mono Liga" + "PragmataPro Mono" + "PragmataPro Liga" + "PragmataPro" + "Iosevka" + "JetBrains Mono" + "Fira Code")) + +;; default size to use when loading fonts +(defvar my/font-size 16) + +;; see if a given font exists +(defun my/has-font (font) + (member font (font-family-list))) + +;; load the first font found (if any) +(defun my/load-first-font (fonts) + (let ((font (seq-find #'my/has-font fonts))) + (when font + (let* ((size (number-to-string my/font-size)) + (name (concat font " " size))) + (set-frame-font name nil t))))) + +;; set transparency percentage +(defun my/set-transparency (n) + "Set transparency." + (set-frame-parameter (selected-frame) 'alpha (list n n)) + (add-to-list 'default-frame-alist (list 'alpha n n))) + +;; change transparency interactively +(defun set-transparency () + "Set transparency interactively." + (interactive) + (let ((n (read-string "Transparency (50-100): " "90"))) + (my/set-transparency (string-to-number n)))) ;; UI settings when not in a terminal (when (display-graphic-p) @@ -79,16 +114,16 @@ mac-command-key-is-meta t mac-command-modifier 'meta mac-option-modifier nil + x-super-keysym 'meta x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) - (if use-pragmata - (set-frame-font "PragmataPro Liga 24" nil t) - (set-frame-font "Iosevka 24" nil t)) + (my/load-first-font my/fonts) + (my/set-transparency 90) (set-foreground-color "#c7c7c7") (set-background-color "#000000")) ;; set up font ligatures (use-package pragmatapro-lig - :if (and window-system use-pragmata) + :if (and window-system (my/has-font "PragmataPro")) :straight (pragmatapro-lig :type git :host github :repo "lumiknit/emacs-pragmatapro-ligatures") @@ -389,8 +424,8 @@ (setq git-gutter:handled-backends '(git hg svn)) (global-set-key (kbd "C-x n") 'git-gutter:next-hunk)) -;; git-timemachine -(use-package git-timemachine) +;; ;; git-timemachine +;; (use-package git-timemachine) ;; json (use-package json-mode)