dotfiles

A steaming hot pile of sh...ell scripts and configuration files.
git clone https://kaka.farm/~git/dotfiles
Log | Files | Refs

init.el (13667B)


      1 ;;; -*- lexical-binding: t; -*-
      2 
      3 (setq gc-cons-threshold (* 1024 1024 1024))
      4 
      5 (setq read-process-output-max (string-to-number
      6                                (with-temp-buffer
      7                                  (insert-file-contents "/proc/sys/fs/pipe-max-size")
      8                                  (buffer-string))))
      9 
     10 (require 'server)
     11 (unless (server-running-p)
     12   (server-start))
     13 
     14 (require 'benchmark-init)
     15 
     16 (add-to-list 'load-path (concat user-emacs-directory
     17                                 "local-packages/emacs-kakafarm/"))
     18 
     19 (load (locate-user-emacs-file "local-stuff.el"))
     20 
     21 (setq package-archives '())
     22 (require 'use-package)
     23 
     24 (autoload 'skribilo-mode "skribilo.el" "Skribilo mode." t)
     25 
     26 (use-package browse-url
     27   :demand t
     28   :custom
     29   (browse-url-browser-function 'eww-browse-url)
     30   (browse-url-new-window-flag t)
     31   )
     32 
     33 (use-package casual-calc
     34   :ensure nil
     35   :bind (:map calc-mode-map ("C-o" . casual-calc-tmenu)))
     36 
     37 (use-package casual-dired
     38   :ensure nil
     39   :bind (:map dired-mode-map ("C-o" . casual-dired-tmenu)))
     40 
     41 (use-package casual-info
     42   :ensure nil
     43   :bind (:map Info-mode-map ("C-o" . casual-info-tmenu)))
     44 
     45 '(use-package company
     46    :defer t
     47    :init
     48    (add-hook 'after-init-hook 'global-company-mode))
     49 
     50 (use-package compilation
     51   :demand t
     52   :requires (ansi-color)
     53   )
     54 
     55 ;; FIXME: Why can't I use it in the (use-package compilation :hook or :init)?
     56 (add-hook 'compilation-filter-hook #'kakafarm/colorize-compilation)
     57 
     58 
     59 (use-package corfu
     60   :defer t
     61   :config
     62   (global-corfu-mode)
     63   :custom
     64   (corfu-auto t))
     65 
     66 (use-package cus-edit
     67   :config
     68   ;; Use another file for the ``customize'' customisations.
     69   (setq custom-file (locate-user-emacs-file "custom-variables.el"))
     70   (load custom-file 'noerror 'nomessage))
     71 
     72 (use-package detubifier
     73   :defer t
     74   )
     75 
     76 (use-package dictionary
     77   :defer t
     78   :custom
     79   (dictionary-server "localhost"))
     80 
     81 (use-package elfeed
     82   :defer t
     83   :config
     84   ;; XXX: Not sure if I want it to be a `kakafarm/elfeed-feeds'
     85   ;; variable that is then set to `elfeed-feeds' in the `:custom'
     86   ;; section, or loaded inside the `elfeed-feeds.el' file using the
     87   ;; `customize-set-value' function.
     88   (load (locate-user-emacs-file "elfeed-feeds.el"))
     89   (customize-set-value 'elfeed-curl-program-name
     90                        (expand-file-name "~/.guix-profile/bin/curl"))
     91   :custom
     92   ;; (elfeed-curl-max-connections 10)
     93   (elfeed-search-filter "@1-week-ago +unread")
     94   (elfeed-curl-program-name (expand-file-name "~/.guix-profile/bin/curl"))
     95   )
     96 
     97 '(use-package elfeed-goodies
     98    :config
     99    (elfeed-goodies/setup))
    100 
    101 (use-package emacs
    102   :ensure nil
    103   :bind
    104   (
    105    :map global-map
    106    ("C-c p" . kakafarm/percent-read)
    107    ("C-c C-s" . (lambda (beg end)
    108                   (interactive (list (region-beginning) (region-end)))
    109 
    110                   (sort-lines '()
    111                               beg
    112                               end)))
    113 
    114    ;; (";" . #'kakafarm/easy-underscore)
    115    )
    116   :config
    117   (set-register ?i `(file . ,(locate-user-emacs-file "init.el")))
    118   '(ido-mode t)
    119   ;; (tab-bar-mode)
    120   :custom
    121   (inhibit-startup-screen t)
    122   )
    123 
    124 (use-package ement
    125   :custom
    126   (ement-auto-sync nil)
    127   (ement-save-sessions t)
    128   )
    129 
    130 (use-package erc
    131   :defer t
    132   :custom
    133   (erc-server "irc.libera.chat")
    134   (erc-nick "kakafarm")
    135   (erc-track-shorten-start 8)
    136   (erc-kill-buffer-on-part t)
    137   (erc-auto-query 'bury)
    138   (erc-autojoin-channels-alist '((libera-kakafarm "#systemcrafters")))
    139   :bind
    140   (("C-c i r c" . (lambda ()
    141                     (interactive)
    142                     (erc-tls :id 'libera-kakafarm))))
    143   ;; :config
    144   ;; (erc-tls :id 'libera-kakafarm)
    145   )
    146 
    147 (use-package ffap
    148   :defer t
    149   :bind
    150   (
    151    ("C-c f a p"   . ffap-menu)
    152    ("C-c f f a p" . kakafarm/ffap-browse-urls)
    153    ))
    154 
    155 (use-package fontset
    156   :defer t
    157   :config
    158   (set-fontset-font t 'hebrew "Noto Sans Hebrew"))
    159 
    160 (use-package geiser
    161   :defer t
    162   :after (scheme-mode)
    163   :config
    164   '((define-key 'geiser-mode-map)
    165     (setq geiser-active-implementations '(guile))
    166     (global-unset-key "C-c C-a")
    167     (unbind-key "C-c C-e" geiser-mode-map)
    168     (unbind-key "C-c C-a" geiser-mode-map))
    169   :custom
    170   (geiser-default-implementation 'guile)
    171   (geiser-mode-auto-p nil)
    172   (geiser-repl-per-project-p t)
    173   )
    174 
    175 (use-package greader
    176   :defer t
    177   :commands (greader-mode)
    178   :config
    179   (add-hook 'greader-mode-hook
    180             'kakafarm/sentence-end-double-nilify-for-read-only-buffers)
    181   :hook (
    182          Custom-mode
    183          Info-mode
    184          Man-mode
    185          elfeed-show
    186          elfeed-show-mode
    187          elpher
    188          eww-after-render
    189          fundamental-mode
    190          help-mode
    191          helpful-mode
    192          lisp-mode
    193          nov-mode
    194          text-mode
    195          w3m-mode
    196          ))
    197 
    198 (use-package helm
    199   :defer t
    200   :bind
    201   (
    202    :map global-map
    203    ("M-x" . helm-M-x)
    204    )
    205   )
    206 
    207 (use-package helpful
    208   :defer t
    209   :bind
    210   (
    211    ("C-h f" . helpful-function)
    212    ("C-h k" . helpful-key)
    213    ("C-h m" . helpful-mode)
    214    ("C-h v" . helpful-variable)
    215    )
    216   )
    217 
    218 (use-package icomplete
    219   :defer t
    220   :config
    221   ;; Display completions continuously in minibuffer.
    222   (icomplete-mode 1))
    223 
    224 (use-package info
    225   :defer t
    226   :custom
    227   (Info-additional-directory-list '("~/infopath/")))
    228 
    229 (use-package kakafarm
    230   :demand t
    231   :bind
    232   (
    233    :map global-map
    234    ("C-c C-w" . kakafarm/multi-vterm-weechat)
    235    ("C-c w"   . kakafarm/multi-vterm-weechat)
    236    )
    237   )
    238 
    239 (use-package magit
    240   :custom
    241   (magit-diff-refine-hunk t)
    242   (magit-diff-refine-ignore-whitespace nil)
    243   )
    244 
    245 (use-package magit-todos
    246   :defer t
    247   :after magit
    248   :config
    249   (magit-todos-mode 1)
    250   :custom
    251   (magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'")
    252   )
    253 
    254 (use-package mastodon
    255   :defer t
    256   :init
    257   ;; (setq mastodon-active-user "kakafarm"
    258   ;;       mastodon-instance-url "https://emacs.ch/")
    259   (setq mastodon-active-user "kakafarm"
    260         mastodon-instance-url "https://shitposter.world/")
    261   )
    262 
    263 (use-package menu-bar
    264   :custom
    265   (menu-bar-mode nil)
    266   )
    267 
    268 '(use-package mode-line
    269    :custom
    270    (mode-line-percent-position '(6 "%q"))
    271    )
    272 
    273 (use-package modus-themes
    274   :defer t
    275   :init
    276   (setq modus-themes-mode-line '(borderless
    277                                  accented
    278                                  ;; 3d
    279                                  padded
    280                                  ;; moody
    281                                  )
    282         modus-themes-region '(;;accented
    283                               bg-only
    284                               ;;no-extend
    285                               )
    286         modus-themes-paren-match '(bold
    287                                    intense)
    288         ;;modus-themes-syntax '(alt-syntax)
    289         modus-themes-scale-headings t
    290         modus-themes-org-blocks 'tinted-background)
    291   (load-theme 'modus-vivendi)
    292   ;;(load-theme 'wheatgrass)
    293   )
    294 
    295 (use-package mule
    296   :defer t
    297   :config
    298 ;;; https://emacs.stackexchange.com/questions/34322/set-default-coding-system-utf-8
    299   (set-language-environment "utf-8"))
    300 
    301 (use-package multi-vterm
    302   ;; :demand t
    303   :bind
    304   (
    305    :map global-map
    306    ("C-c <RET> <RET>" . multi-vterm)
    307    ("C-c m m"         . multi-vterm)
    308    :map vterm-mode-map
    309    ("C-q" . vterm-send-next-key)
    310    )
    311   :commands
    312   (
    313    multi-vterm
    314    multi-vterm-buffer-exist-p
    315    )
    316   )
    317 
    318 '(use-package nano-tts
    319    :defer t
    320    :hook (eww-after-render nov-mode Info-mode)
    321    :custom
    322    (nano-tts-words-per-minute 225)
    323    )
    324 
    325 (use-package nov
    326   :defer t
    327   :mode ((rx ".epub" string-end) . nov-mode))
    328 
    329 '(use-package opml-to-elfeed-feeds
    330    :custom
    331    (opml-to-elfeed-feeds-elfeed-feeds nil t)
    332    )
    333 
    334 (use-package orderless
    335   :defer t
    336   :custom
    337   (completion-styles
    338    '(orderless
    339      basic))
    340   (completion-category-overrides
    341    '((file (styles
    342             basic
    343             partial-completion)))))
    344 
    345 (use-package org
    346   :defer t
    347   :config
    348   (org-babel-do-load-languages
    349    'org-babel-load-languages
    350    '((scheme     . t)
    351      (emacs-lisp . t)))
    352   :custom
    353   (org-agenda-files (list (expand-file-name "~/mine/org/")
    354                           (expand-file-name "~/Documents/notes/")))
    355   (org-default-notes-file (expand-file-name "~/mine/org/org.org"))
    356   (org-directory (expand-file-name "~/mine/org/"))
    357   (org-export-use-babel nil)
    358   (org-html-postamble t)
    359   (org-html-postamble-format '(("en" "<p class=\"author\">Author: %a</p>\12<p class=\"date\">Date: %d</p>\12<p class=\"creator\">%c</p>\12<p class=\"validation\">%v</p>")))
    360   (org-structure-template-alist '(
    361                                   ("a" . "export ascii")
    362                                   ("c" . "center")
    363                                   ("C" . "comment")
    364                                   ("e" . "example")
    365                                   ("E" . "export")
    366                                   ("h" . "export html")
    367                                   ("l" . "export latex")
    368                                   ("q" . "quote")
    369                                   ("s" . "src")
    370                                   ("v" . "verse")
    371                                   ("g" . "src scheme :session moo :results output :tangle eopl3.scm")
    372                                   ("z" . "src scheme")
    373                                   ))
    374   )
    375 
    376 (use-package org-roam
    377   :defer t
    378   :bind (("C-c n l" . org-roam-buffer-toggle)
    379          ("C-c n f" . org-roam-node-find)
    380          ("C-c n i" . org-roam-node-insert))
    381   :config
    382   ;;(org-roam-db-autosync-enable)
    383   ;;(org-roam-db-autosync-mode)
    384   :custom
    385   (org-roam-directory "~/mine/roam/")
    386   (org-roam-graph-viewer '(lambda (x) nil))
    387   )
    388 
    389 (use-package paredit
    390   :defer t
    391   :hook (emacs-lisp-mode
    392          lisp-mode
    393          scheme-mode))
    394 
    395 (use-package paren
    396   :defer t
    397   :config
    398   (show-paren-mode))
    399 
    400 ;; XXX: Disabled.
    401 '(use-package parinfer
    402    :defer t
    403    :hook (emacs-lisp-mode
    404           lisp-mode
    405           scheme-mode))
    406 
    407 (use-package rainbow-delimiters
    408   :defer t
    409   :config
    410   (rainbow-delimiters-mode))
    411 
    412 (use-package recentf
    413   :defer t
    414   :config
    415   (recentf-mode 1)
    416   :bind (("C-S-t" . recentf-open-files)
    417          ("C-c t" . recentf-open-files)
    418          ("C-c l" . dictionary-lookup-definition))
    419   :custom
    420   (recentf-max-menu-items 100)
    421   (recentf-max-saved-items 100)
    422   )
    423 
    424 (use-package scheme-mode
    425   :defer t
    426   :config
    427   ;; TODO: Did it even work?!
    428   (add-hook 'scheme-mode-hook 'hs-minor-mode)
    429   (progn ;; For SRFI-253:
    430    (put 'define-checked 'scheme-indent-function 1)
    431    (put 'lambda-checked 'scheme-indent-function 1))
    432   :mode (rx "." (| "scm" "sxml" "skb") string-end)
    433   ;; :bind (:map scheme-mode-map
    434   ;;             ("C-c C-e" . arei-mode-map)
    435   ;;             ("C-c C-a" . arei))
    436   )
    437 
    438 (use-package shr
    439   :custom
    440   (shr-width 75)
    441   (shr-use-fonts nil)
    442   (shr-use-colors nil)
    443   (shr-indentation 2)
    444   )
    445 
    446 (use-package simple
    447   :defer
    448   :init
    449   (advice-add 'kill-ring-save
    450               :before
    451               'kakafarm/pulse-current-region)
    452   :config
    453   (column-number-mode)
    454   ;; Don't want tabs in any of my source files.
    455   (setq-default indent-tabs-mode
    456                 nil)
    457   '(advice-add 'scratch-buffer
    458                :after
    459                (lambda () "Switch to text-mode."
    460                  (text-mode)))
    461   :custom
    462   (global-visual-line-mode t)
    463   )
    464 
    465 (use-package undo-tree
    466   :defer t
    467   :config
    468   (global-undo-tree-mode 1)
    469   (setq undo-tree-auto-save-history nil)
    470   :bind
    471   ("C-x u" . undo-tree-visualize))
    472 
    473 (use-package vterm
    474   :custom
    475   (vterm-environment '("LC_ALL=en_IL.utf8"))
    476   )
    477 
    478 '(use-package whitespace-cleanup
    479    :custom
    480    (global-whitespace-cleanup-mode t)
    481    )
    482 
    483 (use-package window
    484   :defer t
    485   :config
    486   '(advice-add 'recenter-top-bottom
    487                :around
    488                'kakafarm/recenter-top-bottom))
    489 
    490 (progn
    491 ;;; Emacs From Scratch
    492 ;;; https://systemcrafters.net/emacs-from-scratch/
    493 ;;; https://www.youtube.com/playlist?list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ
    494 
    495   (setq visible-cursor t
    496         visible-bell t)
    497 
    498 ;;; The Basics of Emacs Configuration
    499 ;;; https://systemcrafters.net/emacs-from-scratch/basics-of-emacs-configuration/
    500 ;;; https://www.youtube.com/watch?v=OaF-N-FuGtc
    501 
    502   (tool-bar-mode -1)
    503   (scroll-bar-mode -1)
    504   (menu-bar-mode -1)
    505   ;; (global-display-line-numbers-mode 1)
    506   (hl-line-mode 1)
    507   (blink-cursor-mode 1)
    508 
    509 ;;; https://systemcrafters.net/emacs-from-scratch/the-best-default-settings/
    510 ;;; https://www.youtube.com/watch?v=51eSeqcaikM
    511   ;;(recentf-mode 1)
    512   (setq history-length 25)
    513   (savehist-mode 1)
    514   (save-place-mode 1))
    515 
    516 (progn
    517 ;;; Load org-roam stuff.
    518 
    519   (defvar kakafarm/org-roam-my-publish-time 0
    520     ;; TODO: Write docstring.
    521     "TODO"
    522     )
    523 
    524   (setq org-publish-project-alist
    525         `(("roam"
    526            :base-directory "~/mine/roam/publish/"
    527            :auto-sitemap t
    528            :sitemap-function kakafarm/org-roam-sitemap
    529            :sitemap-title "Roam Notes"
    530            :publishing-function kakafarm/org-roam-publication-wrapper
    531            :publishing-directory "~/mine/roam-export"
    532            :section-number nil
    533            :table-of-contents nil
    534            :include ,(directory-files "~/mine/roam/publish/" t ".*.org$")
    535            :html-head "<link rel=\"stylesheet\" href=\"/index.css\" type=\"text/css\">")))
    536 
    537   (setq org-roam-graph-link-builder
    538         'kakafarm/org-roam-custom-link-builder)
    539 
    540   (add-hook 'org-roam-graph-generation-hook
    541             (lambda (dot svg)
    542               (if (< (- (cadr (current-time))
    543                         kakafarm/org-roam-project-publish-time)
    544                      5)
    545                   (progn
    546                     (copy-file svg
    547                                "~/mine/roam-export/sitemap.svg"
    548                                't)
    549                     (setq kakafarm/org-roam-project-publish-time
    550                           0))))))
    551 
    552 (setq gc-cons-threshold (* 200 1024 1024))
    553 (put 'narrow-to-region 'disabled nil)
    554 (put 'upcase-region 'disabled nil)
    555 (put 'narrow-to-page 'disabled nil)
    556 (put 'scroll-left 'disabled nil)