1
0
Fork 0
emacs-config/oni-gui.el
Tom Willemse 2be22d72d9 Replace Comic Neue with DejaVu Sans
It doesn’t seem like Emacs can load Comic Neue at all, I also tried Open Sans.
DejaVu seems to work fine.
2021-03-16 23:31:18 -07:00

125 lines
4.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.

;;; oni-gui.el --- GUI settings for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2021.0316.232945
;; Package-Requires: (oni-ui oni-hydra yoshi-theme diminish mode-icons)
;; 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 this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; These are my GUI settings.
;;; Code:
(require 'hydra)
(add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15"))
(add-to-list 'default-frame-alist '(internal-border-width . 15))
(set-face-attribute 'fixed-pitch nil :font "Fantasque Sans Mono-15")
(set-face-attribute 'variable-pitch nil :font "DejaVu Sans-15")
(defconst oni-gui-isearch-icon ?)
(defconst oni-gui-arev-icon ?)
(defun oni-gui-setup-fontsets (frame)
"Setup fontsets for FRAME.
If FRAME is nil, theyre set for the current frame."
(let ((font-awesome "Font Awesome 5 Free Solid-12"))
(set-fontset-font t oni-gui-isearch-icon font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t oni-gui-arev-icon font-awesome frame))
(let ((font-awesome "Font Awesome 5 Free Regular-12"))
(set-fontset-font t ? font-awesome frame)
(set-fontset-font t ? font-awesome frame))
(let ((dejavu-sans-mono "DejaVu Sans Mono-12"))
(set-fontset-font t ?◉ dejavu-sans-mono frame)
(set-fontset-font t ?○ dejavu-sans-mono frame)
(set-fontset-font t ?✸ dejavu-sans-mono frame)
(set-fontset-font t ?✿ dejavu-sans-mono frame)
(set-fontset-font t ?✓ dejavu-sans-mono frame)))
;; Thanks to the article at
;; https://andreyorst.gitlab.io/posts/2020-07-21-programming-ligatures-in-emacs/
(defun oni-gui-setup-ligatures (&optional _)
"Define ligatures supported by Fantasque Sans Mono."
(let ((ligatures
`((?= . ,(regexp-opt '("==" "===" "=/=" "=>" "==>" "=>>" "=<<")))
(?! . ,(regexp-opt '("!=" "!==")))
(?< . ,(regexp-opt '("<-<" "<<-" "<--" "<-" "<->" "<=<" "<<=" "<=="
"<=>" "<~>" "<~~" "<~" "<<<" "<<" "<=" "<>"
"<|||" "<||" "<|" "<|>" "<!--")))
(?- . ,(regexp-opt '("->" "-->" "->>" "-<" "-<<")))
(?> . ,(regexp-opt '(">->" ">=>" ">>=" ">>-" ">-" ">=" ">>" ">>>")))
(?~ . ,(regexp-opt '("~~" "~>" "~~>")))
(?| . ,(regexp-opt '("|>" "||>" "|||>"))))))
(dolist (char-regexp ligatures)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring])))))
(with-eval-after-load 'isearch
(diminish 'isearch-mode (string ?\s oni-gui-isearch-icon)))
(with-eval-after-load 'autorevert
(diminish 'auto-revert-mode (string ?\s oni-gui-arev-icon)))
(defhydra oni-gui-hydra (:color teal :hint nil)
"
^Buffer^ ^Packages^ ^Sort^
^^^^^^-----------------------------------
_br_: Revert _pl_: List _sl_: Sort
_bi_: Auto Insert ^^ ^^
"
("br" (revert-buffer nil t))
("bi" auto-insert)
("pl" list-packages)
("sl" sort-lines))
(setq-default cursor-type '(bar . 2))
(setq-default cursor-in-non-selected-windows 'box)
(setq frame-resize-pixelwise t)
(scroll-bar-mode -1)
(mode-icons-mode)
(if (daemonp)
(progn
(add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets)
(add-hook 'after-make-frame-functions #'oni-gui-setup-ligatures))
(oni-gui-setup-fontsets nil)
(oni-gui-setup-ligatures))
(global-unset-key (kbd "C-z"))
(global-set-key (kbd "C-c c") 'oni-gui-hydra/body)
(load-theme 'yoshi :no-confirm)
;;;###autoload(require 'oni-gui)
(provide 'oni-gui)
;;; oni-gui.el ends here