modern_lisp-machine/emacs.d/init.el

265 lines
7.0 KiB
EmacsLisp
Raw Normal View History

2024-01-22 05:09:04 +00:00
;; -*- mode: emacs-lisp; buffer-read-only: t; -*-
2024-06-01 05:00:40 +00:00
(custom-set-variables '(wakatime-api-key "waka_60723ebe-de7f-4671-9a0e-6dd1d5087cc7"))
(global-wakatime-mode)
(electric-indent-mode 1)
(set-face-attribute 'default nil :height 110)
;;(rg-define-toggle "-r" "I" t)
(global-set-key (kbd "M-c") 'my-custom-map)
(define-prefix-command 'my-custom-map)
(require 'ox-hugo)
(rg-define-search rg-guix
"Search in the guix source code."
:dir "/mnt/Data/github-stuff/guix_source_code/guix"
;; :flags '("-r" )
:files "*.{scm}")
(set-face-attribute 'default nil
:family "Wumpus Mono Pro"
:height 95 )
(global-set-key (kbd "C-c g") 'rg-guix)
;; cpp template
(defun insert-cpp-template ()
"Insert a template for a C++ source code file."
(interactive)
(insert "\
// Copyright (C) 2023
#include <fast_io.h>
using namespace std;
using namespace fast_io::io;
int main() {
return 0;
}
"))
;; Define a key binding to trigger insertion of C++ template
(global-set-key (kbd "C-c t") 'insert-cpp-template)
;;-------------------------------
(defun indent-whole-buffer ()
"Indent the entire buffer."
(interactive)
(save-excursion
(mark-whole-buffer)
(indent-region (region-beginning) (region-end))))
(global-set-key (kbd "C-c i") 'indent-whole-buffer)
(setq geiser-mode-auto-p nil)
(add-to-list 'load-path "~/.emacs.d/org-mode-async/org-mode/")
2024-01-22 05:00:54 +00:00
(add-hook 'scheme-mode-hook 'guix-devel-mode)
(dirvish-override-dired-mode)
;; Example: Setting cursor-type to 'box
(setq cursor-type 'box)
2024-01-22 05:37:35 +00:00
2024-02-03 04:13:43 +00:00
(global-set-key (kbd "C-z") 'undo)
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
(global-set-key (kbd "C-c z") 'org-roam-node-insert)
2024-01-22 05:00:54 +00:00
(set-frame-parameter nil 'alpha-background 100)
(add-to-list 'default-frame-alist '(alpha-background . 100))
2024-06-01 05:00:40 +00:00
(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)))))
2024-01-22 05:00:54 +00:00
(toggle-transparency)
2024-06-01 05:00:40 +00:00
(load-theme 'modus-vivendi)
(global-set-key (kbd "M-c i") 'toggle-transparency)
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
(toggle-transparency)
(load-file "~/.emacs.d/extensions/emacs-everywhere.el")
(global-set-key (kbd "M-c M-d") 'rg-guix)
2024-02-03 04:13:43 +00:00
;;---------------------
(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)
2024-06-01 05:00:40 +00:00
2024-02-03 04:13:43 +00:00
;;-------------------------
2024-06-01 05:00:40 +00:00
(load-file "~/.emacs.d/novel/nov.el")
2024-02-03 04:13:43 +00:00
(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")
2024-01-22 05:00:54 +00:00
(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)
2024-06-01 05:00:40 +00:00
(load-file "~/.emacs.d/blog/blog.el")
(global-set-key (kbd "M-c C-n") 'org-roam-capture)
(global-set-key (kbd "C-c q") 'org-roam-node-insert)
(global-set-key (kbd "M-c C-x") 'org-capture)
(global-set-key (kbd "M-c C-k") 'xeft)
2024-01-22 05:06:48 +00:00
2024-02-03 04:13:43 +00:00
(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))
2024-01-22 05:00:54 +00:00
;; 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)
;; 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))
2024-06-01 05:00:40 +00:00
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
;;(load-theme 'meimuna :no-confirm)
(load-theme 'modus-operandi :no-confirm)
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
(setq whitespace-style '(face tabs trailing))
(set-face-attribute 'whitespace-tab nil :background "background-color-from-theme" :foreground 'unspecified :inherit 'default)
(set-face-attribute 'whitespace-trailing nil :background "background-color-from-theme" :foreground 'unspecified :inherit 'default)
2024-01-22 05:00:54 +00:00
;; Set font to Iosevka Comfy with aliasing
(set-face-attribute 'default nil
2024-06-01 05:00:40 +00:00
:family "Wumpus Mono Pro"
:height 95 )
;; Set the font for Kanji and Kana characters
(let ((fontspec (font-spec :family "Calex Code JP" :size 16)))
(set-fontset-font "fontset-default" '(#x4e00 . #x9fff) fontspec) ; Kanji range
(set-fontset-font "fontset-default" '(#x3040 . #x30ff) fontspec)) ; Hiragana and Katakana range
(defun my-enable-nov-and-olivetti ()
(interactive)
(nov-mode)
(olivetti-mode))
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
;; Add a hook to enable nov-mode and olivetti-mode when opening EPUB files
(add-hook 'nov-mode-hook 'olivetti-mode)
2024-01-22 05:00:54 +00:00
2024-06-01 05:00:40 +00:00
;; Associate EPUB files with nov-mode and olivetti-mode
(add-to-list 'auto-mode-alist '("\\.epub\\'" . my-enable-nov-and-olivetti))
2024-01-22 05:00:54 +00:00
(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" )