diff options
| -rw-r--r-- | jakob.org | 855 |
1 files changed, 371 insertions, 484 deletions
@@ -6,13 +6,14 @@ all of the relevant Org source blocks into a temporary buffer and proceeds to invoke =eval-buffer=. The main implication of this is that there won't be a =jakob.el= in the Emacs configuration directory. -Also worth noting is that there is no specific namespace (i.e. =jakob-=, =jakob/=, -or =my-=) for functions defined in this file. +Also worth noting is that there is no namespace (i.e. =jakob/= or =my-=) for +functions defined in this file. I'm happy to use a consistent namespacing for +packages I plan to publish on Melpa, but I don't see the point in a +configuration file. * Bootstrapping -There are a few packages I use that require early initialization, which is done -under this heading. +A few of the packages I use require early initialization. ** Package Management @@ -33,8 +34,8 @@ I use [[https://github.com/raxod502/straight.el][straight.el]] insetad of =packa (load bootstrap-file nil 'nomessage)) #+END_SRC -=straight.el= does have a known issue with installing Org, however, and requires a -workaround early on. The details are outlined [[https://github.com/raxod502/straight.el#installing-org-with-straightel][here]] +=straight.el= does have a known issue with installing Org, and requires a +workaround for it early on. The details are outlined [[https://github.com/raxod502/straight.el#installing-org-with-straightel][here]] #+BEGIN_SRC elisp (require 'subr-x) @@ -69,40 +70,66 @@ Inserted by installing org-mode or when a release is made." (provide 'org-version) #+END_SRC -For installation and configuration of packages, I use the [[https://github.com/jwiegley/use-package][use-package]] macro. +As for the actual installation and configuration of packages, I use [[https://github.com/jwiegley/use-package][use-package]]. #+BEGIN_SRC elisp (straight-use-package 'use-package) (setq straight-use-package-by-default t) #+END_SRC -=bind-key= is required early on to support =use-package='s =:bind= declarations. +=bind-key= is required early on for =use-package='s =:bind= declarations. #+BEGIN_SRC elisp (use-package bind-key :defer t) #+END_SRC +** Dependency Management + +=use-package= provies a number of features such as =:after= to defer the loading of +packages and their configurations until some other package has been loaded, but +I've wrestled witth this functionality for weeks now and realized that it's not +well-suited for configuring packages in a way that depends on symbols from +another package. As an alternative, I've chosen to use the =with-eval-after-load= +machinery provided by Vanilla Emacs, albeit wrapped in a slightly more ergnomic +macro that allows for dependence on multiple packages rather than just one. + +#+BEGIN_SRC elisp +(defmacro when-all-loaded (files &rest form) + "Nests FORM in several `with-eval-after-load' for each of FILES. +FILES can be either a symbol, representing dependence on a single +package, or a list of symbols, representing dependence on more +than one package." + (let ((form `(progn ,@form)) + (files (if (symbolp files) (list files) files))) + (dolist (file files) + (setq form `(with-eval-after-load (quote ,file) ,form))) + form)) + +(put 'when-all-loaded 'lisp-indent-function 1) +#+END_SRC + ** Libraries A handful of the Elisp snippets in this file depend on third-party libraries which aren't loaded by default. #+BEGIN_SRC elisp -(require 'cl) +(require 'cl-lib) +(require 'cl-extra) #+END_SRC ** Configuration -Create some bindings for quickly getting to this configuration file. +Bind some keys for working with this configuration file. #+BEGIN_SRC elisp (defun config-goto () - "Find the literate config file." + "Switch to a buffer visiting the literate config file." (interactive) (find-file "~/.emacs.d/jakob.org")) (defun config-reload () - "Re-evaluate the literate config file." + "Evaluate the literate config file." (interactive) (eval-document "~/.emacs.d/jakob.org")) @@ -112,13 +139,13 @@ Create some bindings for quickly getting to this configuration file. * Vanilla Emacs -Any configuration that addresses the core of Emacs rather than a built-in or -third-party package goes here. +Any configuration addressing the core of Emacs rather than a third-party +package. ** Startup -Having Emacs open to =*scratch*= feels as if it's inviting me to punch out some -Lisp forms and evaluate them. I like to pretend that my computers are Lisp +Having Emacs open to =*scratch*= feels as though it's inviting me to punch out +some Lisp forms and evaluate them. I like to pretend that my computers are Lisp machines. #+BEGIN_SRC elisp @@ -151,16 +178,15 @@ listing the files it's currently taking care of. (setq auto-save-list-file-prefix "~/.cache/emacs/auto-save-list/.saves-") #+END_SRC -Disables the creation of locking symlinks in the current directory. This is a -very opinionated choice, and might not be a good idea for the average user. +Disable the creation of locking symlinks in the current directory. This is a +very opinionated choice, and probably isn't a good idea for most. #+BEGIN_SRC elisp (setq create-lockfiles nil) #+END_SRC -Although I personally prefer writing elisp to =custom.el=, a few packages -(specifically =package.el=) do make use of it. This snippet ensures that a -massacre is not made of my =init.el=. +I don't use =custom.el= to set variables, but a few of the packages I use do. This +snippet ensures that a massacre is not made of my =init.el=. #+BEGIN_SRC elisp (setq custom-file "~/.emacs.d/custom.el") @@ -195,18 +221,12 @@ Automatically revert buffers and dired listings when something on disk changes. auto-revert-verbose nil)) #+END_SRC -I got sick of seeing "Command attempted to use minibuffer while in minibuffer". +"Command attempted to use minibuffer while in minibuffer" gets old fast. #+BEGIN_SRC elisp (setq enable-recursive-minibuffers t) #+END_SRC -Use soft wrapping instead of "scrolling" when overflowing the width of a frame. - -#+BEGIN_SRC elisp -(global-visual-line-mode t) -#+END_SRC - Actually select help windows when I pop them so that I can kill them with <q>. #+BEGIN_SRC elisp @@ -219,15 +239,15 @@ Most *NIX tools work best when files are terminated with a newline. (setq require-final-newline t) #+END_SRC -Sentences should be separated by a single space, so treat two sentences as two +Sentences should be separated by a single space. Treat two sentences as such when filling. #+BEGIN_SRC elisp (setq sentence-end-double-space nil) #+END_SRC -I like using the tab key, but prefer spaces to tabstops, and the width I prefer -to use is 4 characters. +I use the tab key, but I generally prefer space characters to tabstops and like +a four-character width for indentation. #+BEGIN_SRC elisp (setq-default indent-tabs-mode nil @@ -254,12 +274,14 @@ Enable the default-disabled functions that I use. (put 'upcase-region 'disabled nil) #+END_SRC +Enable useful visual queues. + #+BEGIN_SRC elisp (show-paren-mode t) (column-number-mode t) #+END_SRC -Unbind =C-z= and =C-x C-z= so I'm not accidentally calling =suspend-frame=. +Unbind <C-z> and <C-x C-z> so that I'm not accidentally calling =suspend-frame=. #+BEGIN_SRC elisp (global-unset-key (kbd "C-z")) @@ -267,6 +289,7 @@ Unbind =C-z= and =C-x C-z= so I'm not accidentally calling =suspend-frame=. #+END_SRC * Quality-of-Life + ** Ivy As [[https://icosahedron.website/@zge/101330910258980695][suggested by a friend]], I tried out Ivy as a replacement for ido. It was love @@ -278,33 +301,15 @@ Configure how the =completing-read= is displayed. #+BEGIN_SRC elisp (use-package ivy :init - (setq ivy-height 5) - (setq ivy-count-format "") + (setq ivy-height 5 + ivy-count-format "") #+END_SRC Enable Ivy globally. #+BEGIN_SRC elisp :config - (ivy-mode 1) -#+END_SRC - -Transformer to highlight channels in the =completing-read= of -=irc-switch-buffer= that have had activity recently. - -#+BEGIN_SRC elisp - :config - (defun irc-switch-buffer-transformer (str) - "Transform channels with activity with `ivy-virtual' face." - (let ((modified (map 'list - (lambda (channel) - (buffer-name (first channel))) - erc-modified-channels-alist))) - (if (member str modified) - (propertize str 'face 'ivy-virtual) - str))) - (ivy-set-display-transformer 'irc-switch-buffer - 'irc-switch-buffer-transformer)) + (ivy-mode 1)) #+END_SRC Use Counsel as a frontend to a couple of interactive commands. @@ -338,6 +343,8 @@ Load all snippets when =yas-minor-mode= is enabled. ** avy +Set up keybindings for =avy=. + #+BEGIN_SRC elisp (use-package avy :bind @@ -355,6 +362,9 @@ Set up keybindings for =imenu=. ** pass +Here's a snippet for interactively pulling a password from [[passwordstore.org][password-store]], so +I'm not spawning a terminal every time I need to invoke my password manager. + #+BEGIN_SRC elisp (defvar password-store-directory "~/.password-store" "Directory containing passwords managed by `pass'.") @@ -364,7 +374,7 @@ Set up keybindings for =imenu=. (let ((prefix-length (1+ (length (expand-file-name password-store-directory)))) (suffix-length (length ".gpg"))) (map 'list - #'(lambda (path) (subseq path prefix-length (- suffix-length))) + #'(lambda (path) (cl-subseq path prefix-length (- suffix-length))) (directory-files-recursively password-store-directory ".gpg$")))) (defun pass () @@ -395,6 +405,12 @@ just scroll by one line. (setq scroll-conservatively most-positive-fixnum) #+END_SRC +Use soft wrapping instead of "scrolling" when overflowing the width of a frame. + +#+BEGIN_SRC elisp +(global-visual-line-mode t) +#+END_SRC + The menu bar can be accessed with =M-`= if I really need it, so I don't see the point in having it take up the space at the top. The rest of these rarely see use from me, and I'd prefer to disable them and have access to the extra screen @@ -599,8 +615,8 @@ they look like." ** Modeline -This is the vanilla modeline without the handful of components that I consider -unimportant. +This is essentially the vanilla modeline, just without the handful of components +I consider unimportant. #+BEGIN_SRC elisp (setq-default mode-line-format @@ -732,22 +748,24 @@ as `org-src-fontify-natively' is non-nil." ** dim [[https://www.emacswiki.org/emacs/DelightedModes][Delight]] doesn't work for me, and [[https://github.com/myrjola/diminish.el][diminish]] is sadly lacking in the feature -department, so I'm choosing to clean up my modeline with dim. =use-package= -doesn't have an equivalent of =:diminish= or =:delight=, so the declarations occur -here. +department, so I've chosen to clean up my modeline with dim. =use-package= doesn't +have an equivalent of =:diminish= or =:delight=, so declarations occur here. #+BEGIN_SRC elisp (use-package dim :config (dim-minor-name 'visual-line-mode "") - (dim-minor-name 'ivy-mode "") + + (eval-after-load 'ivy + '(dim-minor-name 'ivy-mode "")) + (eval-after-load 'projectile '(dim-minor-name 'projectile-mode ""))) #+END_SRC * Window Management -Yes, I use Emacs as my window manager. You should try it out some time! +Yes, I use Emacs as my window manager. You should, too! #+BEGIN_SRC elisp (use-package exwm-config @@ -770,10 +788,8 @@ to use my X windows across workspaces. #+END_SRC "Global key bindings" in EXWM work essentially anywhere, including buffers that -are currently in char mode. The bindings below should be fairly straightforward. -I've taken this as an opportunity to incorporate windmove to my workflow, now -that I have the super key at my disposal. The choice of keys for that was -inspired by the WASD movement typical of first-person shooter games. +are currently in char mode. I've taken this as an opportunity to incorporate +windmove to my workflow, now that I have the super key at my disposal. #+BEGIN_SRC elisp :init @@ -833,9 +849,9 @@ Ah, yes. Simulation keys, the real reason I decided to install EXWM. ([?\C-s] . [?\C-f]))) #+END_SRC -The tab switching functionality of Saka Key is pretty limited, so I'm using -simulation keys for tab switching. Simulation keys is also disabled for kitty -because it gets in the way of readline. +The tab management functionality of Firefox's Saka Key extension is limited, so +I'm using simulation keys instead. I've also disabled simulation keys for kitty +because it doesn't play nicely with readline. #+BEGIN_SRC elisp :hook @@ -873,7 +889,7 @@ to pop a new buffer for editing. (server-start)) #+END_SRC -EXWM has issues popping any sort of pinentry window, so we'll just let Emacs do +EXWM has issues popping any sort of pinentry window, so I just let Emacs do pinentry's job. #+BEGIN_SRC elisp @@ -887,6 +903,8 @@ pinentry's job. ** ag +Set up keybindings for calling =ag=. + #+BEGIN_SRC elisp (use-package ag :bind @@ -914,9 +932,7 @@ Preference of hygene. See [[Filesystem]]. :straight nil :init (setq-default tramp-persistency-file-name "~/.cache/emacs/tramp")) -#+END_SRC -#+BEGIN_SRC elisp (use-package nsm :straight nil :init @@ -927,18 +943,15 @@ Preference of hygene. See [[Filesystem]]. ** Org -Preference of hygene. See [[Filesystem]]. Org is also forcefully loaded because -there are a number of things declared via =:config= that I want run as soon as -Emacs starts. +Preference of hygene. See [[Filesystem]]. #+BEGIN_SRC elisp (use-package org :straight org-plus-contrib - :demand t :init - (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/") + (setq-default org-id-locations-file "~/.cache/emacs/org-id-locations" + org-latex-preview-ltxpng-directory "~/.cache/emacs/ltximg/" + org-preview-latex-image-directory "~/.cache/emacs/ltximg/") #+END_SRC Only load the =org-contrib= modules that I actually use. @@ -948,42 +961,44 @@ Only load the =org-contrib= modules that I actually use. (setq org-modules '(org-drill)) #+END_SRC -Some general configurations for quality-of-life and appearance. +General appearance and quality-of-life settings. #+BEGIN_SRC elisp :init - (setq org-return-follows-link t) - (setq org-startup-folded nil) - (setq org-startup-with-inline-images t) - (setq org-hide-emphasis-markers t) - (setq org-tags-column 100) + (setq org-return-follows-link t + org-startup-folded nil + org-startup-with-inline-images t + org-hide-emphasis-markers t + org-tags-column 100) #+END_SRC -Don't indent text following a headline. +Keep everything in column zero, instead of indenting according to the depth of +the preceding headline. #+BEGIN_SRC elisp :init (setq org-adapt-indentation nil) #+END_SRC -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]]). +Have <tab> indent according to the indentation rules of the corresponding mode +in an =org-src= block, and start indentation on column 0. Taken from [[https://stackoverflow.com/questions/15773354/indent-code-in-org-babel-src-blocks][this post]] and +[[https://emacs.stackexchange.com/questions/9472/org-mode-source-block-doesnt-respect-parent-buffer-indentation][this post]] on StackExchange. #+BEGIN_SRC elisp :init - (setq org-src-tab-acts-natively t) - (setq org-edit-src-content-indentation 0) + (setq org-src-tab-acts-natively t + org-edit-src-content-indentation 0) #+END_SRC -Just reuse the current window when I punch in =C-c '=, rather than mess up my -window configuration. +Reuse the current window when I punch in =C-c '=, rather than mess up my window +configuration. #+BEGIN_SRC elisp :init (setq org-src-window-setup 'current-window) #+END_SRC -Scale up embedded LaTeX so that I can actually read it. +Scale up embedded LaTeX. The default size is unreadable. #+BEGIN_SRC elisp :config @@ -998,9 +1013,8 @@ Enable [[Yasnippet]]. (org-mode . yas-minor-mode-on) #+END_SRC -Replace my [[Imenu]] binding with =org-goto=, as it allows me to select headings with -subheadings. Keybindings for working with my Org workflow from anywhere are also -here, since =use-package= doesn't like split =:bind= declarations. +Replace my [[Imenu]] binding with =org-goto=, as it allows me to select parent +headings. #+BEGIN_SRC elisp :init @@ -1008,44 +1022,32 @@ here, since =use-package= doesn't like split =:bind= declarations. (setq org-outline-path-complete-in-steps nil) :bind - (("C-c a" . (lambda () (interactive) (org-agenda nil "d"))) - ("C-c c" . (lambda () (interactive) (org-capture nil "c"))) - ("C-c t" . (lambda () (interactive) (org-capture nil "t"))) - :map org-mode-map - ("C-c s" . org-goto) - ("C-c C-q" . counsel-org-tag)) + (:map org-mode-map + ("C-c s" . org-goto)) #+END_SRC -*** Workflow - -Automatically open a buffer named =*Mind Dump*= to, well, save all of my -thoughts. They're dated and saved in a directory so I can =ag= them. This is the -closest thing I will ever have to an implementation of =ag= for my thoughts. +Global keybindings for my Org workflow. #+BEGIN_SRC elisp - :init - (defvar mind-dump-directory "~/Notes/Mind Dumps" - "Where to store dated 'mind dump' files.") + :bind + (("C-c a" . (lambda () (interactive) (org-agenda nil "d"))) + ("C-c c" . (lambda () (interactive) (org-capture nil "c"))) + ("C-c t" . (lambda () (interactive) (org-capture nil "t")))) +#+END_SRC - (defun mind-dump-filename () - "Returns the path of today's 'mind dump' file." - (concatenate 'string - (file-name-as-directory mind-dump-directory) - (format-time-string "%Y-%m-%d") - ".org")) +Use Counsel's functionality for adding tags. - :config - (let* ((buffer (find-file-noselect (mind-dump-filename)))) - (set-buffer buffer) - (rename-buffer "*Mind Dump*")) +#+BEGIN_SRC elisp + :bind + (:map org-mode-map + ("C-c C-q" . counsel-org-tag)) #+END_SRC *** Personal Wiki -I maintain somewhat of a "personal wiki" using Org and I like to link between -pages. This is just a convenience link type, rooted at the base of my notes -folder so that I can easily refer to other pages from subdirectories of -=notes-directory=. +I maintain a personal wiki using Org and I like to link between pages. This is +just a convenience link type, rooted at the base of my notes folder so that I +can easily refer to other pages from subdirectories of =notes-directory=. #+BEGIN_SRC elisp :config @@ -1074,7 +1076,7 @@ Code for interactively navigating the personal wiki. (defun notes-file-is-page (filename) "Returns whether or not FILENAME names a page rather than a category." - (string= (subseq filename (- (length filename) 4)) ".org")) + (string= (cl-subseq filename (- (length filename) 4)) ".org")) (defun notes-file-should-ignore (filename) "Returns whether or not a file in `notes-directory' should be ignored. @@ -1088,10 +1090,10 @@ Code for interactively navigating the personal wiki. (let* ((path (if category (concat notes-directory "/" category) notes-directory)) - (contents (remove-if #'notes-file-should-ignore + (contents (cl-remove-if #'notes-file-should-ignore (directory-files path))) - (pages (remove-if-not #'notes-file-is-page contents)) - (categories (remove-if #'notes-file-is-page contents)) + (pages (cl-remove-if-not #'notes-file-is-page contents)) + (categories (cl-remove-if #'notes-file-is-page contents)) (categories (if category (map 'list #'(lambda (subcategory) (concat category "/" subcategory)) @@ -1109,7 +1111,9 @@ Code for interactively navigating the personal wiki. does not include files that satisfy the `notes-file-should-ignore' predicate." (map 'list - #'(lambda (path) (list (if (notes-file-is-page path) (subseq path 0 -4) path) + #'(lambda (path) (list (if (notes-file-is-page path) + (cl-subseq path 0 -4) + path) (concat notes-directory "/" path) (notes-file-is-page path))) (notes-hierarchy-paths))) @@ -1118,34 +1122,36 @@ Code for interactively navigating the personal wiki. "Interactively find a page in `notes-directory'." (interactive) (let* ((hierarchy (notes-hierarchy)) - (hierarchy (remove-if-not #'third hierarchy)) + (hierarchy (cl-remove-if-not #'third hierarchy)) (name (ivy-read "Find file: " (map 'list #'first hierarchy))) - (item (find-if #'(lambda (item) (string= name (first item))) hierarchy))) + (item (cl-find-if #'(lambda (item) (string= name (first item))) hierarchy))) (if item (find-file (second item)) (let ((path (concat notes-directory "/" name ".org"))) (find-file path))))) +#+END_SRC +Set up a key binding for quickly querying the wiki. + +#+BEGIN_SRC elisp :bind ("C-c w" . notes-page-goto) #+END_SRC *** Capture -Low-friction of adding things to the day's "mind dump" and my GTD inbox. +Low-friction means of adding things to my GTD inbox. #+BEGIN_SRC elisp :config (setq org-capture-templates - `(("c" "Thought" plain (file ,(mind-dump-filename)) - "%?\n") - ("t" "TODO" entry (file "~/Notes/GTD/Inbox.org") + `(("t" "TODO" entry (file "~/Notes/GTD/Inbox.org") "* TODO %?\n"))) #+END_SRC *** Agenda -Rather convoluted agenda setup to show me: +A rather convoluted agenda setup to show me: - The tasks I've marked as needing to be done today. - The inbox items I need to process. - My daily habits (implemented as recurring Org TODO's). @@ -1177,7 +1183,7 @@ Rather convoluted agenda setup to show me: (subtree-is-not-inbox '(lambda () (let ((subtree-end (save-excursion (org-end-of-subtree t)))) - (if (not (search "Inbox.org" (buffer-name))) + (if (not (cl-search "Inbox.org" (buffer-name))) subtree-end nil))))) @@ -1203,10 +1209,11 @@ Rather convoluted agenda setup to show me: *** Drill -Scan the directory of the current buffer's file for other items -- this is so -that I can spread my cards across multiple files and still be tested on all of -them when I run =org-drill=. Combining topic during review sessions is -recommended by Michael Nielsen in his article, [[http://augmentingcognition.com/ltm.html]["Augmenting Long-term Memory"]]. +Scan the directory of the current buffer's file for other items, rather than +just the current buffer. This is so that I can spread my cards across multiple +files and still be tested on all of them when I run =org-drill=. The idea of +combining topic during review sessions is suggested in Michael Nielsen article, +[[http://augmentingcognition.com/ltm.html]["Augmenting Long-term Memory"]]. #+BEGIN_SRC elisp :init @@ -1214,22 +1221,31 @@ recommended by Michael Nielsen in his article, [[http://augmentingcognition.com/ #+END_SRC Shut up the nagging "are you studying enough!?" message if I don't get enough -items right on the first try. It's unhelpful and really just annoying. +items right. It's unhelpful and discourages me from being completely honest with +the SRS algorithm. #+BEGIN_SRC elisp :init (setq org-drill-forgetting-index 100)) #+END_SRC -# Workaround +**** Workaround + +As described [[https://bitbucket.org/eeeickythump/org-drill/issues/62/org-drill-doesnt-work-with-org-mode-92][here]], the upstream version of org-drill doesn't work with the +latest version of Org. Until this is fixed, I'm using someone else's patched +version of =org-drill=. #+BEGIN_SRC elisp -(straight-use-package '(org-drill :type git :host github :repo "hakanserce/org-drill")) +(straight-use-package + '(org-drill :type git :host github :repo "hakanserce/org-drill")) +(require 'cl) (require 'org-drill) #+END_SRC *** Blog +Use =ox-hugo= for exporting my blog posts. + #+BEGIN_SRC elisp (use-package ox-hugo) #+END_SRC @@ -1262,8 +1278,77 @@ integration in terms of searching and viewing attachments that comes with * IRC +Functions for connecting to and authenticating with my IRC bouncer. + +#+BEGIN_SRC elisp +(defun read-bouncer-password () + "Pull the password for 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 + +Functions for connecting to and authenticating with an instance of Bitlbee. + +#+BEGIN_SRC elisp +(defun bitlbee-connect () + "Start bitlbee as an inferior process and connect to it." + (bitlbee-start) + (erc :server "localhost" :port 6667) + (erc-with-buffer ((get-buffer "localhost:6667") + (rename-buffer "bitlbee")))) + +(defun bitlbee-identify () + "If we're on the bitlbee server, send the identify command to the + &bitlbee channel." + (when (and (string= "localhost" erc-session-server) + (string= "&bitlbee" (buffer-name))) + (erc-message "PRIVMSG" (format "%s identify %s" + (erc-default-target) + (read-bouncer-password))))) +#+END_SRC + +Interactive function for setting everything up, which involves starting an +inferior Bitlbee process, connecting to it, and then connecting to all of the +networks my bouncer is connected to. + +#+BEGIN_SRC elisp +(defvar irc-autoconnect-networks '("bitlbee" "crtnet" "freenode" + "tildetown" "tildechat") + "List of networks to automatically connect to when 'irc' is invoked.") + +(defun irc () + "Connect to Bitlbee and every network in `irc-autoconnect-networks'." + (interactive) + (dolist (network irc-autoconnect-networks) + (if (string= network "bitlbee") + (bitlbee-connect) + (connect-bouncer network)))) + +(defun irc-quit () + "Disconnects from and kills all buffers associated with ERC, +and ends the Bitlbee process." + (interactive) + (bitlbee-stop) + (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)))))) +#+END_SRC + Only load the modules I actually use. This list deviates from the default by -including =truncate=, but omitting =autojoin=. +including =truncate= and =keep-place=, but omitting =autojoin=. #+BEGIN_SRC elisp (use-package erc @@ -1278,7 +1363,7 @@ including =truncate=, but omitting =autojoin=. (erc-update-modules) #+END_SRC -Configure some personal details. +Configure personal details. #+BEGIN_SRC elisp :init @@ -1289,14 +1374,14 @@ Configure some personal details. "SIGSEGV, Segmentation fault.")))) #+END_SRC -Have the prompt display my current nick. +Display the current nick in the prompt. #+BEGIN_SRC elisp :init (setq erc-prompt (lambda () (format "%s>" (erc-current-nick)))) #+END_SRC -Center everything nicely in the buffer. +Center everything. #+BEGIN_SRC elisp :init @@ -1305,8 +1390,8 @@ Center everything nicely in the buffer. erc-fill-static-center 22) #+END_SRC -Enable interpretation of MIRC and control sequences so I can appreciate the -occasional figlet spam. +Enable MIRC and control sequences so I can partake in figlet spam, objectively +the best part of the IRC experience. #+BEGIN_SRC elisp :init @@ -1322,8 +1407,8 @@ Enable timestamps, and show them to the left of the messages. 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. +Although =log= is omitted from =erc-modules=, I still explicitly disable logging. I +can just save the buffer if I want to save a conversation. #+BEGIN_SRC elisp :init @@ -1331,7 +1416,7 @@ logging. If I want to save a conversation, I'll just save the buffer. erc-save-buffer-on-part nil) #+END_SRC -=autowaway= is also omitted from =erc-modules=, but I'm explicitly disabling it. +Similarly, =autowaway= is omitted from =erc-modules=, but I'm disabling it anyway. #+BEGIN_SRC elisp :init @@ -1357,30 +1442,29 @@ assault me with windows when I connect to my bouncer. 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 +Show CTCP requests. Not for any reason in particular, I just like seeing when +people ping me. #+BEGIN_SRC elisp :init (setq erc-paranoid t) #+END_SRC -Don't bother me with stuff I don't care about. +Hide JOIN/PART/QUIT messages from idlers. #+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")) + (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT") + erc-lurker-threshold-time 3600) #+END_SRC -Configure ignoring of people not contributing to the conversation. +Enable =erc-track= to ignore the less interesting message types. #+BEGIN_SRC elisp :init - (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT") - erc-lurker-threshold-time 3600) + (setq erc-track-exclude-server-buffer t + erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" + "324" "329" "332" "333" "353" "477")) #+END_SRC Enable channel tracking. @@ -1391,8 +1475,8 @@ Enable channel tracking. (erc-track-mode 1) #+END_SRC -Move to the prompt when I begin typing, since I've configured the buffer text -preceding it to be read-only. +Move to the prompt as soon as I begin typing. I've configured the buffer text +preceding it to be read-only, anyway. #+BEGIN_SRC elisp :config @@ -1406,52 +1490,14 @@ Let =erc-fill= handle filling. (erc-mode . (lambda () (auto-fill-mode 0))) #+END_SRC -Hook for automatically identifying with [[IRC][Bitlbee]]. +Enable a hook for automatically identifying with Bitlbee. #+BEGIN_SRC elisp :hook (erc-join . bitlbee-identify) #+END_SRC -Sadly =:bind= is limited when it comes to defining keystrokes with prefixes, so -I've done it manually here. These are the more frequently used of the functions -in [[IRC]]. - -#+BEGIN_SRC elisp - :config - (defvar irc-map (make-sparse-keymap) - "Prefix keymap for bindings related to IRC.") - (bind-key "C-c i" irc-map) - (dolist (chord '("C-c i b" - "C-c i c" - "C-c i f" - "C-c i i" - "C-c i s" - "C-c i q" - "C-c i u")) - (bind-key chord irc-map)) - - (bind-key "C-c i b" #'irc-switch-buffer) - (bind-key "C-c i c" (lambda () - (interactive) - (clear-irc-buffer) - (message "Backlog cleared."))) - (bind-key "C-c i f" #'clear-erc-track-list) - (bind-key "C-c i i" #'ignore-channel) - (bind-key "C-c i s" #'irc) - (bind-key "C-c i q" #'irc-quit) - (bind-key "C-c i u" #'unignore-channel) -#+END_SRC - -Binds that aren't part of a prefix map are fine, though. - -#+BEGIN_SRC elisp -:bind (:map erc-mode-map - ("C-c C-f" . irc-cycle-forward) - ("C-c C-b" . irc-cycle-backward))) -#+END_SRC - -Ensure a package for colorizing nicks. +Configure =erc-hl-nicks= to show names using pretty colors. #+BEGIN_SRC elisp (use-package erc-hl-nicks @@ -1460,7 +1506,7 @@ Ensure a package for colorizing nicks. (erc-hl-nicks-enable)) #+END_SRC -Ensure a package for starting an instance of Bitlbee. +Configure the =bitlbee= package for starting an inferior Bitlbee process. #+BEGIN_SRC elisp (use-package bitlbee @@ -1492,6 +1538,8 @@ Configure Elfeed to sync with the instance of Tiny Tiny RSS I use. ** Speed Typing +Preference of hygene. See [[Filesystem]]. + #+BEGIN_SRC elisp (use-package speed-type :init @@ -1502,8 +1550,8 @@ Configure Elfeed to sync with the instance of Tiny Tiny RSS I use. ** dumb-jump -Replace =xref= keybindings instead of using the default ones, since I'm nearly -always using =dumb-jump= instead of a proper tag indexer. +Replace =xref= keybindings instead of using the default ones, since these will get +overwritten if I'm using a proper tag indexer anyway. #+BEGIN_SRC elisp (use-package dumb-jump @@ -1518,16 +1566,17 @@ always using =dumb-jump= instead of a proper tag indexer. ** company -Start suggesting completions ASAP. +Start suggesting completions as soon as possible. #+BEGIN_SRC elisp (use-package company :config - (setq company-idle-delay 0) - (setq company-minimum-prefix-length 3) + (setq company-idle-delay 0 + company-minimum-prefix-length 3) #+END_SRC -Use standard movement keys instead of those used for minibuffer next/previous. +Use standard movement keys for selecting entries from the completion popup +instead of those used for minibuffer next/previous. #+BEGIN_SRC elisp :bind @@ -1540,6 +1589,8 @@ Use standard movement keys instead of those used for minibuffer next/previous. ** compile +Bind a key to calling =compile=. + #+BEGIN_SRC elisp (use-package compile :straight nil @@ -1548,16 +1599,17 @@ Use standard movement keys instead of those used for minibuffer next/previous. ("<f12>" . compile) #+END_SRC -The compilation command can be set by invoking =compile= with a prefix argument, -so I don't see a need in popping a prompt every time. [[https://www.emacswiki.org/emacs/CompileCommand][(1)]]. +Taken from [[https://www.emacswiki.org/emacs/CompileCommand][EmacsWiki]]. The compilation command can be changed by invoking =compile= +with a prefix argument, so I don't see the advantage of popping a prompt every +time. #+BEGIN_SRC elisp :init (setq compilation-read-command nil) #+END_SRC -Hide the compilation buffer upon successful compilation, because I typically -don't care about the output unless there were errors. +Hide the compilation buffer upon successful compilation. I typically don't care +about the output unless there were errors. #+BEGIN_SRC elisp :config @@ -1575,6 +1627,8 @@ don't care about the output unless there were errors. ** Magit +Set up key bindings for getting to the Magit status buffer. + #+BEGIN_SRC elisp (use-package magit :bind ("C-c g" . magit-status)) @@ -1582,18 +1636,33 @@ don't care about the output unless there were errors. ** Projectile +Preference of hygene. See [[Filesystem]]. + #+BEGIN_SRC elisp (use-package projectile :demand t + :init + (setq projectile-known-projects-file "~/.cache/emacs/projectile-bookmarks.eld" + projectile-track-known-projects-automatically nil) +#+END_SRC + +Use [[Ivy]] for Projectile commands instead of =ido=. +#+BEGIN_SRC elisp :init (setq projectile-completion-system 'ivy) - (setq projectile-known-projects-file "~/.cache/emacs/projectile-bookmarks.eld") - (setq projectile-track-known-projects-automatically nil) +#+END_SRC + +Set up key bindings for Projectile. +#+BEGIN_SRC elisp :bind ("C-c p" . projectile-command-map) +#+END_SRC + +Enable Projectile globally. +#+BEGIN_SRC elisp :config (projectile-mode +1)) #+END_SRC @@ -1602,45 +1671,64 @@ don't care about the output unless there were errors. ** Language Server Protocol -The reason I'm using =lsp-mode= in the first place is to integrate with the -packages I've set up in [[Programming Tools]], so use that instead of the provided -machinery. +The only reason I'm using =lsp-ui= is for integration with [[Flycheck]]. The features +like lenses don't interest me. #+BEGIN_SRC elisp -(use-package lsp-mode +(use-package lsp-ui :init - (setq lsp-prefer-flymake nil) - (setq lsp-enable-xref t) - (setq lsp-session-file "~/.cache/emacs/.lsp-session-v1") - (setq lsp-auto-guess-root t) + (setq lsp-ui-sideline-enable nil + lsp-ui-peek-enable nil + lsp-ui-doc-enable nil)) +#+END_SRC - :bind - (:map lsp-mode-map - ("M-." . lsp-find-definition) - ("M-," . pop-tag-mark))) +Disable =lsp-mode='s default machinery. The reason I'm using the package in the +first place is for its ability to integrate with everything I've set up in +[[Programming Tools]]. +#+BEGIN_SRC elisp (use-package company-lsp - :requires company :commands company-lsp :init (setq company-lsp-cache-candidates 'auto)) -#+END_SRC +(use-package lsp-mode + :init + (setq lsp-prefer-flymake nil + lsp-enable-xref t) +#+END_SRC -The only reason I'm using =lsp-ui= is for integration with [[Flycheck]]. The features -like lenses don't interest me. +Preference of hygene. See [[Filesystem]]. #+BEGIN_SRC elisp -(use-package lsp-ui :init - (setq lsp-ui-sideline-enable nil) - (setq lsp-ui-peek-enable nil) - (setq lsp-ui-doc-enable nil)) + (setq lsp-session-file "~/.cache/emacs/.lsp-session-v1" + lsp-auto-guess-root t) +#+END_SRC + +Replace =xref= keybindings instead of using the default ones. + +#+BEGIN_SRC elisp + :bind + (:map lsp-mode-map + ("M-." . lsp-find-definition) + ("M-," . pop-tag-mark))) #+END_SRC ** Rust +Enable flycheck. + +#+BEGIN_SRC elisp +(use-package flycheck-rust + :after rust-mode + + :hook + (flycheck-mode . flycheck-rust-setup) + (rust-mode . flycheck-mode)) +#+END_SRC + Enable [[company]], ElDoc, and racer. #+BEGIN_SRC elisp @@ -1665,17 +1753,6 @@ Run =rustfmt= automatically. (setq rust-format-on-save t)) #+END_SRC -Enable flycheck. - -#+BEGIN_SRC elisp -(use-package flycheck-rust - :after rust-mode - - :hook - (flycheck-mode . flycheck-rust-setup) - (rust-mode . flycheck-mode)) -#+END_SRC - ** C Generally, I adhere to the [[https://www.kernel.org/doc/html/v4.10/process/coding-style.html][Linux kernel coding style]]. @@ -1684,10 +1761,12 @@ Generally, I adhere to the [[https://www.kernel.org/doc/html/v4.10/process/codin (use-package cc-mode :straight nil :hook - (c-mode . (lambda () (c-set-style "linux"))) + (c-mode . (lambda () + (setq indent-tabs-mode t) + (c-set-style "linux"))) #+END_SRC -Enable [[company]], [[Flycheck]], and ElDoc, provided by =irony-mode=. +Enable [[company]], [[Flycheck]], and ElDoc, all provided by =irony-mode=. #+BEGIN_SRC elisp :hook @@ -1703,6 +1782,7 @@ Enable [[company]], [[Flycheck]], and ElDoc, provided by =irony-mode=. (use-package company-irony :config (add-to-list 'company-backend 'company-irony) + :hook (irony-mode . company-irony)) @@ -1717,7 +1797,7 @@ Enable [[company]], [[Flycheck]], and ElDoc, provided by =irony-mode=. ** Emacs Lisp -Enable [[company]]. +Enable [[company]] for both =lisp-interaction-mode= and =emacs-lisp-mode=. #+BEGIN_SRC elisp (use-package elisp-mode @@ -1727,7 +1807,7 @@ Enable [[company]]. (emacs-lisp-mode . company-mode) #+END_SRC -Don't omit information when lists nest too deep. +Avoid omitting information when displaying deeply-nested lists. #+BEGIN_SRC elisp :init @@ -1735,7 +1815,7 @@ Don't omit information when lists nest too deep. #+END_SRC Helpful is a wonderful improvement upon the vanilla =describe-.*= functions, -showing source code, keybindings, symbol properties, and more. +capable of showing source code, keybindings, symbol properties, etc.n #+BEGIN_SRC elisp (use-package helpful @@ -1750,25 +1830,39 @@ showing source code, keybindings, symbol properties, and more. SLIME is my preferred REPL for working with Common Lisp. +Set up SLIME to use sbcl. + #+BEGIN_SRC elisp (use-package slime :config - (setq inferior-lisp-program "/usr/bin/sbcl") - (setq slime-contribs '(slime-fancy))) + (setq inferior-lisp-program "/usr/bin/sbcl" + slime-contribs '(slime-fancy))) #+END_SRC ** Scheme +Geiser is my preferred REPL for working with Common Lisp. + +Set up Geiser to use CHICKEN. + #+BEGIN_SRC elisp (use-package geiser :init (setq geiser-active-implementations '(chicken)) - (setq geiser-repl-history-filename "~/.cache/emacs/geiser_history") - (setenv "CHICKEN_DOC_REPOSITORY" "/home/jakob/.local/share/chicken/doc/")) + (setenv "CHICKEN_DOC_REPOSITORY" "/home/jakob/.local/share/chicken/doc/") +#+END_SRC + +Preference of hygene. See [[Filesystem]]. + +#+BEGIN_SRC elisp + :init + (setq geiser-repl-history-filename "~/.cache/emacs/geiser_history")) #+END_SRC ** Python +Set up [[company]]. + #+BEGIN_SRC elisp (use-package company-jedi :hook @@ -1783,7 +1877,7 @@ SLIME is my preferred REPL for working with Common Lisp. ** Javascript -Use a [[Language Server Protocol]] daemon. +Set up =js-mode= to interact with a [[Language Server Protocol]] daemon. #+BEGIN_SRC elisp (use-package js @@ -1798,240 +1892,33 @@ Use a [[Language Server Protocol]] daemon. :server-id 'js-ts-stdio)) #+END_SRC +I have yet to find a style guide I agree with, but one thing common to most of +them that I _do_ agree with is that Javascript is far more readable with an +indentation width of 2. + #+BEGIN_SRC elisp :init (setq-default js-indent-level 2)) #+END_SRC -* Custom Functionality - -This section is for any nontrivial Elisp functions written by me. - -** Utilities - -A wrapper for =completing-read= that passes in an argument for DEF. - -#+BEGIN_SRC elisp -(defun completing-read-with-default (prompt collection default) - "Invoke `completing-read' with DEFAULT as the DEF argument." - (completing-read prompt collection nil nil nil nil default)) -#+END_SRC - -** IRC +* Post-Initialization -Convenience functions for connecting to and authenticating with my IRC bouncer. +Automatically open a buffer named =*Mind Dump*= for quickly jotting down thoughts. +They're dated and saved in a directory, so I can =ag= them. This is the closest +I'll ever get to being able to grep my brain. #+BEGIN_SRC elisp -(defun read-bouncer-password () - "Get the password for 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)))) +(defvar mind-dump-directory "~/Notes/Mind Dumps" + "Directory to store dated 'mind dump' files in.") -(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 +(defun mind-dump-filename () + "Path for today's 'mind dump' file." + (concatenate 'string + (file-name-as-directory mind-dump-directory) + (format-time-string "%Y-%m-%d") + ".org")) -Convenience functions for connecting to and authenticating with an instance of -Bitlbee. - -#+BEGIN_SRC elisp -(defun bitlbee-connect () - "Start bitlbee as an inferior process and connect to it." - (bitlbee-start) - (erc :server "localhost" :port 6667) - (erc-with-buffer ((get-buffer "localhost:6667") - (rename-buffer "bitlbee")))) - -(defun bitlbee-identify () - "If we're on the bitlbee server, send the identify command to the - &bitlbee channel." - (when (and (string= "localhost" erc-session-server) - (string= "&bitlbee" (buffer-name))) - (erc-message "PRIVMSG" (format "%s identify %s" - (erc-default-target) - (read-bouncer-password))))) -#+END_SRC - -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" "crtnet" "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-connect) - (connect-bouncer network)))) - -(defun irc-quit () - "Disconnects from and kills all buffers associated with ERC, -and ends the Bitlbee process." - (interactive) - (bitlbee-stop) - (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)))))) -#+END_SRC - -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)) - -(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))) - -(defun ignore-channel () - "Use `completing-read' to ask the user for a channel to ignore." - (interactive) - (let* ((candidates (remove-if #'(lambda (channel) - (find channel erc-track-exclude)) - (list-irc-channels))) - (default (if (and (eq major-mode 'erc-mode) - (not (member (buffer-name) erc-track-exclude))) - (buffer-name))) - (channel (if default - (completing-read-with-default "Channel:" candidates default) - (completing-read "Channel: " candidates)))) - (push channel erc-track-exclude) - (erc-modified-channels-display))) - -(defun unignore-channel () - "Use `completing-read' to ask the user for a channel to remove -from the list of ignored channels." - (interactive) - (let* ((candidates erc-track-exclude) - (default (if (and (eq major-mode 'erc-mode) - (member (buffer-name) erc-track-exclude)) - (buffer-name))) - (channel (if default - (completing-read-with-default "Channel:" candidates default) - (completing-read "Channel: " candidates)))) - (setq erc-track-exclude - (remove-if #'(lambda (channel) - (string= channel buffer)) - erc-track-exclude)))) -#+END_SRC - -Interactive function for switching to a channel's buffer. - -#+BEGIN_SRC elisp -(defun irc-switch-buffer () - "Use `completing-read' to ask for a channel buffer to visit." - (interactive) - (let* ((candidates (list-irc-channels)) - (default (if erc-modified-channels-alist - (buffer-name (first (first erc-modified-channels-alist))))) - (channel (if default - (completing-read-with-default "Channel: " candidates default) - (completing-read "Channel: " candidates)))) - (switch-to-buffer channel))) -#+END_SRC - -Improvements upon manually switching channel buffers. Channels can now be cycled -through interactively. - -#+BEGIN_SRC elisp -(defun bitlbee-control-buffer-p (buffer-or-name) - "Returns whether or not BUFFER-OR-NAME is connected to the -current inferior bitlbee process." - (let ((name (if (bufferp buffer-or-name) - (buffer-name buffer-or-name) - buffer-or-name))) - (and (char-equal (elt name 0) (string-to-char "&")) - (equal (erc-with-buffer ((get-buffer buffer-or-name)) - (erc-server-buffer)) - (get-buffer "bitlbee"))))) - -(defun irc-cycle-buffer-list (starting-buffer) - "Returns the forward order in which to cycle channel buffers, -which as of the current implementation is alphabetical. Control -buffers belonging to bitlbee are omitted." - (let* ((buffers (sort (map 'list - #'(lambda (channel) - (get-buffer channel)) - (list-irc-channels)) - #'(lambda (channel1 channel2) - (string< (subseq (buffer-name channel1) 1) - (subseq (buffer-name channel2) 1))))) - (split-index (position (get-buffer starting-buffer) buffers))) - (remove-if #'(lambda (buffer) (or (equal buffer (get-buffer starting-buffer)) - (bitlbee-control-buffer-p buffer))) - (if split-index - (concatenate 'list - (subseq buffers split-index) - (subseq buffers 0 split-index)) - buffers)))) - -(defun irc-cycle-forward () - "Visits the next channel buffer as dictated by -`irc-cycle-buffer-list'." - (interactive) - (switch-to-buffer (first (irc-cycle-buffer-list (current-buffer))))) - -(defun irc-cycle-backward () - "Visits the previous channel buffer as dictated by -`irc-cycle-buffer-list'." - (interactive) - (switch-to-buffer (car (last (irc-cycle-buffer-list (current-buffer)))))) -#+END_SRC - -Interactive function for marking a channel's backlog as read in ZNC. - -#+BEGIN_SRC elisp -(defun clear-irc-buffer () - "Query ZNC to clear the backlog for the current buffer." - (interactive) - (let ((channel-to-clear (buffer-name)) - (buffer (erc-query "*status" (erc-server-buffer)))) - (erc-with-buffer (buffer) - (erc-send-message (format "clearbuffer %s" channel-to-clear))))) -#+END_SRC - -Interactive function for clearing out the list of active channels in the mode -line. - -#+BEGIN_SRC elisp -(defun clear-erc-track-list () - (interactive) - (setq erc-modified-channels-alist nil) - (erc-modified-channels-display)) +(let* ((buffer (find-file-noselect (mind-dump-filename)))) + (set-buffer buffer) + (rename-buffer "*Mind Dump*")) #+END_SRC |