modern_lisp-machine/emacs.d/init.el

168 lines
4.4 KiB
EmacsLisp

;; -*- mode: emacs-lisp; buffer-read-only: t; -*-
(add-hook 'scheme-mode-hook 'guix-devel-mode)
(dirvish-override-dired-mode)
;; Example: Setting cursor-type to 'box
(setq cursor-type 'box)
(global-set-key (kbd "C-z") 'undo)
(set-frame-parameter nil 'alpha-background 100)
(add-to-list 'default-frame-alist '(alpha-background . 100))
(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)))))
(toggle-transparency)
(load-theme 'modus-operandi)
(global-set-key (kbd "C-c t") 'toggle-transparency)
;;---------------------
(load-file "~/.emacs.d/keys/xah-fly-keys.el")
(require 'xah-fly-keys)
;; specify a layout
(xah-fly-keys-set-layout "qwerty")
(xah-fly-keys 1)
;;-------------------------
(defun enable-olivetti ()
"Enable `olivetti-mode' for Org mode files."
(when (and buffer-file-name
(string-match "\\.org\\'" buffer-file-name))
(olivetti-mode 1)))
(add-hook 'org-mode-hook 'enable-olivetti)
(load-file "~/.emacs.d/org-roam-templates/main.el")
(load-file "~/.emacs.d/extensions/alert/alert.el")
;; needs alert
(load-file "~/.emacs.d/extensions/pomidor/pomidor.el")
(add-to-list 'load-path "~/.emacs.d/extensions/xeft") ;; fix a bug that doesn't let it find the xapian module
(load-file "~/.emacs.d/extensions/xeft/xeft.el")
(setq xeft-title-function #'file-name-nondirectory)
;; Follow symlinks.
(setq xeft-recursive 'follow-symlinks)(defvar-local xeft--displayed-by-xeft-p nil)
(defun xeft--eager-preview()
(when-let* ((button (button-at (point)))
(path (button-get button 'path)))
;; Kill previously displayed buffer.
(when (window-live-p xeft--preview-window)
(with-selected-window xeft--preview-window
(when xeft--displayed-by-xeft-p
(kill-buffer))))
;; Show preview of current selection.
(xeft--preview-file path)))
(add-hook 'xeft-find-file-hook
(lambda () (setq xeft--displayed-by-xeft-p t)))
(advice-add 'xeft-next :after #'xeft--eager-preview)
(advice-add 'xeft-previous :after #'xeft--eager-preview)
(global-set-key (kbd "C-c C-n") 'org-roam-capture)
(global-set-key (kbd "C-c C-k") 'xeft)
(defun enable-rainbow-delimiters-mode ()
"Enable rainbow-delimiters-mode."
(rainbow-delimiters-mode 1))
(add-hook 'prog-mode-hook 'enable-rainbow-delimiters-mode)
;; Associate file extensions with major modes
(add-to-list 'auto-mode-alist '("\\.scm\\'" . scheme-mode))
(add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.el\\'" . emacs-lisp-mode))
;; Disable menu bar, tool bar, and scroll bar
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Disable splash screen and startup message
(setq inhibit-splash-screen t
inhibit-startup-message t)
;; Set default font and size
(set-face-attribute 'default nil :family "Iosevka Comfy" :height 100)
;; Show line numbers
(global-display-line-numbers-mode)
;; Highlight current line
(global-hl-line-mode t)
;; Clean mode-line
(setq-default mode-line-format
'("%e"
mode-line-front-space
mode-line-mule-info
mode-line-client
mode-line-modified
mode-line-remote
mode-line-frame-identification
mode-line-buffer-identification
" "
mode-line-position
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
mode-line-end-spaces))
;; Set a clean minibuffer prompt
(setq-default minibuffer-prompt-properties
'(read-only t intangible t cursor-intangible t face minibuffer-prompt))
;; Set font to Iosevka Comfy with aliasing
(set-face-attribute 'default nil
:family "Iosevka Comfy"
:height 100
:antialias 'subpixel)
(add-to-list
'org-capture-templates
`("wN" "Web link" entry (file+headline ,(car org-agenda-files) "Links to read later")
"* %?%a \nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"Fri\"))\n"
:immediate-finish t :empty-lines 2))
(load-file "~/.emacs.d/emacs-nyxt.el" )