dotfiles/.config/emacs/lisp/init-funcs.el
2023-05-18 21:32:08 +09:00

36 lines
1.1 KiB
EmacsLisp

;;; init-funcs.el -*- lexical-binding: t -*-
(require 'cl-lib)
(require 'init-const)
(defun font-installed-p (font-name)
(find-font (font-spec :name font-name)))
(defun too-long-file-p ()
"Check whether the file is too long."
(if (fboundp 'buffer-line-statistics)
(> (car (buffer-line-statistics)) 10000)
(> (buffer-size) 100000)))
(defun icons-displayable-p ()
"Return non-nil if icons are displayable."
(or (featurep 'nerd-icons)
(require 'nerd-icons nil t)))
;;(or (featurep 'all-the-icons)
;; (require 'all-the-icons nil t)))
(defun toggle-transparency ()
(interactive)
(let ((alpha (frame-parameter nil 'alpha)))
(set-frame-parameter
nil 'alpha
(if (eql (cond ((numberp alpha) alpha)
((numberp (cdr alpha)) (cdr alpha))
;; Also handle undocumented (<active> <inactive>) form.
((numberp (cadr alpha)) (cadr alpha)))
100)
'(85 . 50) '(100 . 100)))))
(defun my/transparency-round (val)
"Round VAL to the nearest tenth of an integer."
(/ (round (* 10 val)) 10.0))
(provide 'init-funcs)
;;; init-funcs.el ends here