summaryrefslogtreecommitdiff
path: root/jakob.org
diff options
context:
space:
mode:
Diffstat (limited to 'jakob.org')
-rw-r--r--jakob.org503
1 files changed, 442 insertions, 61 deletions
diff --git a/jakob.org b/jakob.org
index 71d2da8..a4ccf73 100644
--- a/jakob.org
+++ b/jakob.org
@@ -67,6 +67,29 @@ massacre is not made of my =init.el=.
(load custom-file))
#+END_SRC
+** Hooks
+
+Favor composed characters as opposed to Unicode's "WITH CARON" equivalents,
+because they look awful in Terminus.
+
+#+BEGIN_SRC elisp
+(add-to-list 'before-save-hook
+ (let ((replacements '(((char-to-string 462) . "ǎ")
+ ((char-to-string 466) . "ǒ")
+ ((char-to-string 464) . "ǐ")
+ ((char-to-string 8217) . "'")
+ ((char-to-string 8220) . "\"")
+ ((char-to-string 8221) . "\"")))
+ actions)
+ (dolist (replacement replacements)
+ (let* ((from (car replacement))
+ (to (cdr replacement))
+ (expr `(replace-string ,from ,to nil 0 (buffer-size))))
+ (push expr actions)))
+ `(lambda () (save-excursion
+ ,@actions))))
+#+END_SRC
+
** Packages
For package archives, I currently use [[http://melpa.org/][MELPA]] and [[https://orgmode.org/elpa.html][Org's elpa]], the latter of which
@@ -398,7 +421,10 @@ they look like."
`(org-block ((,class (:foreground ,white-1 :background ,black-4))))
`(org-verbatim ((,class (:foreground ,blue-1 :background ,black-4))))
`(org-link ((,class (:inherit link))))
- `(org-warning ((,class (:foreground ,white-0 :background ,red-4)))))
+ `(org-warning ((,class (:foreground ,white-0 :background ,red-4))))
+
+ ;; erc
+ `(erc-input-face ((,class (:foreground ,white-1)))))
(custom-theme-set-variables
'chayote
@@ -485,15 +511,83 @@ escaped twice -- once for =battery-format=, and once for =mode-line-format=.
text))))
#+END_SRC
+* ido
+
+Originally, I was going to try out ivy and see if it was any snappier than ido,
+but it turns out that a properly-configured vanilla ido is faster than I'm used
+to. It also plays nicely with EXWM/ERC.
+
+#+BEGIN_SRC elisp
+(use-package ido
+ :after exwm-config
+ :ensure t
+ :config
+ (ido-mode 1)
+#+END_SRC
+
+Fix =ido-buffer-window-other-frame= to play nicely with EXWM.
+
+#+BEGIN_SRC elisp
+ (exwm-config-ido)
+#+END_SRC
+
+Cap the number of candidates to make it even snappier, and for the same reason,
+don't use the annoying built-in ffap functionality.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq ido-max-prospects 10)
+ (setq ido-use-filename-at-point nil)
+#+END_SRC
+
+Don't waste time searching for files in recently used directories.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq ido-auto-merge-work-directories-length -1)
+#+END_SRC
+
+This is a preference of hygene. Stores the ido state in the same directory as
+auto-save state and Emacs's backup files.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq ido-save-directory-list-file "~/.cache/emacs/ido.last"))
+#+END_SRC
+
+* Dired
+
+Hide the targets of symbolic links in dired listings. This is just a visual
+preference of mine.
+
+#+BEGIN_SRC elisp
+(use-package dired
+ :ensure nil
+ :init
+ (setq-default dired-listing-switches "-alL"))
+#+END_SRC
+
+* Imenu
+
+Set up keybindings for =imenu=.
+
+#+BEGIN_SRC elisp
+(use-package imenu
+ :bind ("C-c i" . imenu))
+#+END_SRC
+
* EXWM
Yes, I use Emacs as my window manager. You should try it out some time!
#+BEGIN_SRC elisp
+(use-package exwm-config
+ :after exwm
+ :ensure nil)
+
(use-package exwm
:ensure t
:config
- (require 'exwm-config)
(exwm-enable)
#+END_SRC
@@ -590,51 +684,17 @@ pinentry's job.
(setq epa-pinentry-mode 'loopback))
#+END_SRC
-* ido
-
-Originally, I was going to try out ivy and see if it was any snappier than ido,
-but it turns out that a properly-configured vanilla ido is faster than I'm used
-to. It also plays nicely with EXWM/ERC.
-
-#+BEGIN_SRC elisp
-(use-package ido
- :ensure t
- :config
- (ido-mode 1)
-#+END_SRC
-
-Fix =ido-buffer-window-other-frame= to play nicely with EXWM.
-
-#+BEGIN_SRC elisp
- (exwm-config-ido)
-#+END_SRC
-
-Cap the number of candidates to make it even snappier, and for the same reason,
-don't use the annoying built-in ffap functionality.
-
-#+BEGIN_SRC elisp
- :init
- (setq ido-max-prospects 10)
- (setq ido-use-filename-at-point nil)
-#+END_SRC
-
-This is a preference of hygene. Stores the ido state in the same directory as
-auto-save state and Emacs's backup files.
-
-#+BEGIN_SRC elisp
- (setq ido-save-directory-list-file "~/.cache/emacs/ido.last"))
-#+END_SRC
-
* Org
-Some general hygene -- place generated images in the same directory as backup
-files.
+Some general hygene -- place generated images and other information in the same
+directory as backup files.
#+BEGIN_SRC elisp
(use-package org
:init
- (setq org-latex-preview-ltxpng-directory "~/.cache/emacs/ltximg/")
- (setq org-preview-latex-image-directory "~/.cache/emacs/ltximg/")
+ (setq-default org-id-locations-file "~/.cache/emacs/org-id-locations")
+ (setq-default org-latex-preview-ltxpng-directory "~/.cache/emacs/ltximg/")
+ (setq-default org-preview-latex-image-directory "~/.cache/emacs/ltximg/")
#+END_SRC
Only load the =org-contrib= modules that I actually use.
@@ -646,8 +706,9 @@ Only load the =org-contrib= modules that I actually use.
Some general configurations for quality-of-life and appearance.
#+BEGIN_SRC elisp
- (setq org-return-follows-link 't)
- (setq org-startup-folded 'nil)
+ (setq org-return-follows-link t)
+ (setq org-startup-with-inline-images t)
+ (setq org-startup-folded nil)
(setq org-tags-column 100)
#+END_SRC
@@ -661,15 +722,16 @@ Fix =org-src= blocks such that <tab> indents according to the mode's indentation
rules, and so that there is no implicit indentation of the source code ([[https://stackoverflow.com/questions/15773354/indent-code-in-org-babel-src-blocks][1]], [[https://emacs.stackexchange.com/questions/9472/org-mode-source-block-doesnt-respect-parent-buffer-indentation][2]]).
#+BEGIN_SRC elisp
-(setq org-src-tab-acts-natively t)
-(setq org-edit-src-content-indentation 0)
+ (setq org-src-tab-acts-natively t)
+ (setq org-edit-src-content-indentation 0)
#+END_SRC
Scale up embedded LaTeX so that I can actually read it.
#+BEGIN_SRC elisp
- (setq org-format-latex-options
- (plist-put org-format-latex-options :scale 1.5))
+ :config
+ (setq org-format-latex-options
+ (plist-put org-format-latex-options :scale 1.5)))
#+END_SRC
** Workflow
@@ -765,16 +827,12 @@ items right on the first try. It's unhelpful and really just annoying.
(setq org-drill-forgetting-index 100)
#+END_SRC
-* Dired
-
-Hide the targets of symbolic links in dired listings. This is just a visual
-preference of mine.
+* Yasnippet
#+BEGIN_SRC elisp
-(use-package dired
- :ensure nil
- :init
- (setq-default dired-listing-switches "-alL"))
+(use-package yasnippet
+ :config
+ (yas-global-mode))
#+END_SRC
* TODO Gnus
@@ -928,7 +986,292 @@ available [[http://jakob.space/links/][on my website]] with links to the sites i
("https://yingtongli.me/blog/feed.xml" blog)
("https://text.causal.agency/feed.atom" blog)
("https://programmingisterrible.com/rss" blog)
- ("https://dehora.net/journal?format=RSS" blog)))
+ ("https://dehora.net/journal?format=RSS" blog)
+ ("http://bradhodge.ca/blog/?feed=rss2" blog)
+ ("https://sdf-cn.org/feed/" blog)
+ ("https://shadowrz.github.io/feed.xml" blog)
+ ("https://blog.hcl.moe/feed" blog)
+ ("https://blog.yoitsu.moe/feeds/all.atom.xml" blog)
+ ("https://leosongwei.github.io/rss.xml" blog)
+ ("https://jfm.carcosa.net/blog/index.xml" blog)
+ ("http://thestone.zone/feed.xml" blog)
+ ("http://www.matrix67.com/blog/feed" blog)
+ ("https://ben.tild3.org/blog/feed.rss" blog)
+ ("https://lucasmeijer.com/posts/index.xml" blog)))
+#+END_SRC
+
+* ERC
+
+Set up some convenience functions for connecting to and authenticating with my
+IRC bouncer.
+
+#+BEGIN_SRC elisp
+(defun read-bouncer-password ()
+ "Get the password from my bouncer from authinfo"
+ (let ((auth (auth-source-search :host "jakob.space" :user "jakob" :port 26969)))
+ (unless auth
+ (error "No auth entry for bouncer."))
+ (let ((secretf (plist-get (car auth) :secret)))
+ (unless secretf
+ (error "No secret for bouncer's auth entry."))
+ (funcall secretf))))
+
+(defun connect-bouncer (server)
+ "Connect to `SERVER' on the bouncer and rename the buffer"
+ (let ((password (format "%s/%s:%s" "jakob" server (read-bouncer-password))))
+ (erc-tls :server "jakob.space" :port 26969 :password password)
+ (erc-with-buffer ((get-buffer "jakob.space:26969")
+ (rename-buffer server)))))
+#+END_SRC
+
+Define an interactive function for automatically connecting to a local Bitlbee
+instance and all of the networks I have my bouncer connected to.
+
+#+BEGIN_SRC elisp
+(defvar irc-autoconnect-networks '("bitlbee" "freenode" "tildetown" "tildechat")
+ "List of networks to automatically connect to when 'irc' is invoked.")
+
+(defun irc ()
+ "Automatically connect to IRC networks."
+ (interactive)
+ (dolist (network irc-autoconnect-networks)
+ (if (string= network "bitlbee")
+ (bitlbee-start)
+ (connect-bouncer network))))
+
+(defun irc-quit ()
+ "Disconnects from and kills all buffers associated with ERC."
+ (interactive)
+ (let ((server-buffers (remove-if-not #'erc-server-buffer-p (erc-buffer-list))))
+ (dolist (buffer server-buffers)
+ (erc-with-buffer (buffer)
+ (erc-quit-server (funcall erc-quit-reason nil)))))
+ (bitlbee-stop))
+#+END_SRC
+
+Define some interactive functions for manipulating =erc-track-exclude=.
+
+#+BEGIN_SRC elisp
+(defvar irc-important-channels '("&bitlbee" "#tildetown" "#lobsters")
+ "Channels that I don't want shutting up.")
+
+(defun list-irc-channels ()
+ "Returns a list of the names of the ERC channel buffers"
+ (map 'list #'buffer-name (remove-if #'erc-server-buffer-p (erc-buffer-list))))
+
+(defun silence-channels ()
+ "Add all channels to `ERC-TRACK-EXCLUDE' if they are not a
+member of `IRC-IMPORTANT-CHANNELS'."
+ (interactive)
+ (setq --old-track-exclude erc-track-exclude)
+ (let ((channels (list-irc-channels)))
+ (when (boundp 'irc-important-channels)
+ (dolist (channel channels)
+ (if (and (not (find channel irc-important-channels :test #'string=))
+ (not (find channel erc-track-exclude :test #'string=)))
+ (push channel erc-track-exclude)))))
+ (setq erc-modified-channels-alist nil)
+ (erc-modified-channels-display)
+ (minibuffer-message "Silence!"))
+
+(defun unsilence-channels ()
+ "Reset the state of `ERC-TRACK-EXCLUDE'."
+ (interactive)
+ (setq erc-track-exclude
+ (remove-if-not #'(lambda (channel)
+ (find channel --old-track-exclude))
+ erc-track-exclude))
+ (minibuffer-message "Okay, you may speak again."))
+
+(defun list-ignored-channels ()
+ "Prints the currently ignored channels to the minibuffer."
+ (interactive)
+ (if erc-track-exclude
+ (minibuffer-message (format "Currently ignoring: %s"
+ (reduce #'(lambda (a b) (concatenate 'string a ", " b)) erc-track-exclude)))
+ (minibuffer-message "Not ignoring any channels")))
+
+(defun ignore-channel ()
+ "Use 'ido-completing-read to ask the user for a channel to ignore."
+ (interactive)
+ (let* ((current-mode (with-current-buffer (current-buffer) major-mode))
+ (current-channel (if (eq current-mode 'erc-mode) (buffer-name (current-buffer))))
+ (channels (if current-channel
+ (cons current-channel
+ (remove-if #'(lambda (chan) (string= chan current-channel)) (list-irc-channels)))
+ (list-irc-channels)))
+ (channels (remove-if #'(lambda (channel) (find channel erc-track-exclude)) channels))
+ (buffer (ido-completing-read "Channel: " channels)))
+ (push buffer erc-track-exclude)
+ (erc-modified-channels-display)))
+
+(defun unignore-channel ()
+ "Use 'ido-completing-read to ask the user for a channel to ignore."
+ (interactive)
+ (let* ((current-mode (with-current-buffer (current-buffer) major-mode))
+ (current-channel (if (eq current-mode 'erc-mode) (buffer-name (current-buffer))))
+ (channels (if current-channel
+ (cons current-channel
+ (remove-if #'(lambda (chan) (string= chan current-channel)) (list-irc-channels)))
+ (list-irc-channels)))
+ (channels (remove-if-not #'(lambda (channel) (find channel erc-track-exclude)) channels))
+ (buffer (ido-completing-read "Channel: " channels)))
+ (setq erc-track-exclude
+ (remove-if #'(lambda (channel)
+ (string= channel buffer))
+ erc-track-exclude))))
+#+END_SRC
+
+Only load the modules I actually use. This list deviates from the default by
+including =keep-place= and =truncate=, but omitting =autojoin=.
+
+#+BEGIN_SRC elisp
+(use-package erc
+ :config
+ (setq erc-modules '(button completion fill
+ irccontrols keep-place list
+ match menu move-to-prompt
+ netsplit networks noncommands
+ readonly ring stamp
+ track truncate))
+ (erc-update-modules)
+#+END_SRC
+
+Configure some personal details.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-nick '("jakob" "tsarfox")
+ erc-user-full-name "Jakob <http://jakob.space>"
+ erc-quit-reason (lambda (reason)
+ (or reason (concat "Program received signal "
+ "SIGSEGV, Segmentation fault."))))
+#+END_SRC
+
+Have the prompt display my current nick.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-prompt (lambda () (format "%s>" (erc-current-nick))))
+#+END_SRC
+
+Center everything nicely in the buffer.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-fill-function 'erc-fill-static
+ erc-fill-column 100
+ erc-fill-static-center 22)
+#+END_SRC
+
+Enable interpretation of MIRC and control sequences so I can appreciate the
+occasional figlet spam.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-interpret-controls-p t
+ erc-interpret-mirc-color t)
+#+END_SRC
+
+Enable timestamps, and show them to the left of the messages.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-hide-timestamps nil
+ erc-insert-timestamp-function 'erc-insert-timestamp-left)
+#+END_SRC
+
+Although =log= is omitted from =erc-modules=, I still explicitly disable
+logging. If I want to save a conversation, I'll just save the buffer.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-enable-logging nil
+ erc-save-buffer-on-part nil)
+#+END_SRC
+
+=autowaway= is also omitted from =erc-modules=, but I'm explicitly disabling it.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-auto-set-away nil
+ erc-auto-discard-away nil)
+#+END_SRC
+
+Kill buffers when I disconnect.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-kill-buffer-on-part t
+ erc-kill-queries-on-quit t
+ erc-kill-server-buffer-on-quit t)
+#+END_SRC
+
+Don't get in my way by popping new windows when someone queries me, and don't
+assault me with windows when I connect to my bouncer.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-auto-query 'bury
+ erc-join-buffer 'bury)
+#+END_SRC
+
+People think I'm insane because I am frowning all the time
+All day long, I think of things, but nothing seems to satisfy
+Think I'll lose my mind if I don't find something to pacify
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-paranoid t)
+#+END_SRC
+
+Don't bother me with stuff I don't care about.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-track-exclude-server-buffer t
+ erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
+ "324" "329" "332" "333" "353" "477"))
+#+END_SRC
+
+Configure ignoring of people not contributing to the conversation.
+
+#+BEGIN_SRC elisp
+ :init
+ (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT")
+ erc-lurker-threshold-time 3600)
+#+END_SRC
+
+Enable channel tracking.
+
+#+BEGIN_SRC elisp
+ :config
+ (erc-track-minor-mode 1)
+ (erc-track-mode 1)
+#+END_SRC
+
+Let =erc-fill= handle filling.
+
+#+BEGIN_SRC elisp
+ :hook
+ (erc-mode . (lambda () (auto-fill-mode 0))))
+#+END_SRC
+
+Ensure a package for colorizing nicks.
+
+#+BEGIN_SRC elisp
+(use-package erc-hl-nicks
+ :after erc
+ :config
+ (erc-hl-nicks-enable))
+#+END_SRC
+
+Ensure a package for starting an instance of Bitlbee.
+
+#+BEGIN_SRC elisp
+(use-package bitlbee
+ :init
+ (setq bitlbee-user-directory "~/.config/bitlbee/"))
#+END_SRC
* Pretty Symbols
@@ -936,10 +1279,7 @@ available [[http://jakob.space/links/][on my website]] with links to the sites i
Enable =prettify-symbols= globally.
#+BEGIN_SRC elisp
-(use-package pretty-symbols
- :ensure nil
- :config
- (global-prettify-symbols-mode t))
+(global-prettify-symbols-mode t)
#+END_SRC
This is snippet was taken verbatim from [[https://emacs.stackexchange.com/questions/17283/is-it-possible-to-get-prettified-symbols-in-org-mode-source-blocks][Emacs StackExchange]] to enable
@@ -947,7 +1287,6 @@ This is snippet was taken verbatim from [[https://emacs.stackexchange.com/questi
implement this as advice.
#+BEGIN_SRC elisp
-;; TODO: Can this be implemented as Elisp advice?
(defun org-src-font-lock-fontify-block (lang start end)
"Fontify code block.
This function is called by emacs automatic fontification, as long
@@ -998,3 +1337,45 @@ I don't really care about persisting minibuffer history between sessions.
:config
(savehist-mode -1))
#+END_SRC
+
+* SLIME
+
+#+BEGIN_SRC elisp
+(use-package slime
+ :config
+ (setq inferior-lisp-program "/usr/bin/sbcl")
+ (setq slime-contribs '(slime-fancy)))
+#+END_SRC
+* Tramp
+
+General hygene.
+
+#+BEGIN_SRC elisp
+(use-package tramp
+ :init
+ (setq-default tramp-persistency-file-name "~/.cache/emacs/tramp"))
+#+END_SRC
+
+* XScheme
+
+Configuration for using the [[https://wiki.call-cc.org/emacs#builtin-scheme-support][best Scheme implementation]].
+
+#+BEGIN_SRC elisp
+(use-package xscheme
+ :init
+ (setq scheme-program-name "csi -:c"))
+#+END_SRC
+
+* pdf-tools
+
+=doc-view= is unbearable for reading PDF's of any considerable size and
+=pdf-tools= brings a number of significant improvements, so I can justify not
+using the built-in solution. Even though I can run MuPDF in an EXWM buffer, the
+integration in terms of searching and viewing attachments that comes with
+=pdf-tools= makes for a much more pleasant experience.
+
+#+BEGIN_SRC elisp
+(use-package pdf-tools
+ :config
+ (pdf-loader-install))
+#+END_SRC

© 2015 - 2026 Jakob L. Kreuze