aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Wilkie <duncannwilkie@gmail.com>2023-06-13 09:13:33 -0500
committerDuncan Wilkie <duncannwilkie@gmail.com>2023-06-13 09:13:33 -0500
commit89fd6124d5dbfab70b0e7e7d9123dd4412343461 (patch)
treee2d3fa9841fa142212b1e26065db4fc305767d17
parent14b655fb65e6858018f56da8dba4c322afb12080 (diff)
Changed to generalized dotfiles repo; got config.org somewhat stable
-rw-r--r--.xinitrc30
-rw-r--r--.zprofile4
-rw-r--r--.zshrc47
-rw-r--r--2023-06-11-214759_1919x1080_scrot.pngbin523062 -> 0 bytes
-rw-r--r--2023-06-11-214856_1021x767_scrot.pngbin231567 -> 0 bytes
-rw-r--r--Geometric_Langlands_S_Duality(1)1024_1.pngbin1078511 -> 0 bytes
-rw-r--r--README.org19
-rw-r--r--config.org403
-rw-r--r--init.el885
-rw-r--r--pam_usb.conf97
-rw-r--r--system-auth2
11 files changed, 394 insertions, 1093 deletions
diff --git a/.xinitrc b/.xinitrc
new file mode 100644
index 0000000..569841b
--- /dev/null
+++ b/.xinitrc
@@ -0,0 +1,30 @@
+setxkbmap us -option ctrl:swapcaps
+
+#/home/dnw/.fehbg &
+#bash /home/dnw/status.sh &
+pulseaudio --start
+
+# EXWM start
+# Disable access control for the current user.
+xhost +SI:localuser:$USER
+
+# Make Java applications aware this is a non-reparenting window manager.
+export _JAVA_AWT_WM_NONREPARENTING=1
+
+# Set default cursor.
+xsetroot -cursor_name left_ptr
+
+# Set keyboard repeat rate.
+xset r rate 200 60
+
+# Uncomment the following block to use the exwm-xim module.
+export XMODIFIERS=@im=exwm-xim
+export GTK_IM_MODULE=xim
+export QT_IM_MODULE=xim
+export CLUTTER_IM_MODULE=xim
+
+# required for GTK3 scrolling
+export GDK_CORE_DEVICE_EVENTS=1
+# Finally start Emacs
+
+exec dbus-run-session -- emacsclient -c -a ""
diff --git a/.zprofile b/.zprofile
new file mode 100644
index 0000000..47eba2e
--- /dev/null
+++ b/.zprofile
@@ -0,0 +1,4 @@
+# Honor system-wide environment variables
+source /etc/profile
+
+[[ -t 0 && $(tty) == /dev/tty2 && $- =~ "l" ]] && source ~/.zshrc && exec startx
diff --git a/.zshrc b/.zshrc
new file mode 100644
index 0000000..efccaff
--- /dev/null
+++ b/.zshrc
@@ -0,0 +1,47 @@
+[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return # prevent TRAMP issues
+
+autoload -U compinit bashcompinit
+compinit
+bashcompinit
+alias ls='ls --color=auto'
+alias ll='ls -al'
+alias ..='cd ..'
+alias ...='cd ../../'
+alias .4='cd ../../..'
+alias grep='grep --color=auto'
+alias mkdir='mkdir -pv'
+export EDITOR='emacsclient -a "" '
+export VISUAL='emacsclient -a ""'
+export PAGER=/bin/less
+
+function preexec() {
+ timer=$(date +%s%3N)
+}
+
+function precmd() {
+ if [ $timer ]; then
+ local now=$(date +%s%3N)
+ local d_ms=$(($now-$timer))
+ local d_s=$((d_ms / 1000))
+ local ms=$((d_ms % 1000))
+ local s=$((d_s % 60))
+ local m=$(((d_s / 60) % 60))
+ local h=$((d_s / 3600))
+ if ((h > 0)); then elapsed=${h}h${m}m
+ elif ((m > 0)); then elapsed=${m}m${s}s
+ elif ((s >= 10)); then elapsed=${s}.$((ms / 100))s
+ elif ((s > 0)); then elapsed=${s}.$((ms / 10))s
+ else elapsed='' #elapsed=${ms}ms
+ fi
+
+ export RPROMPT="%F{240}${elapsed} %f"
+ unset timer
+ fi
+}
+
+PROMPT='%F{blue}%2~%f%(?..%F{88} %?%f) %F{magenta}%Bᛋ%b%f '
+
+# export PHITSPATH=/home/dnw/phits326A/phits
+# export PATH=/home/dnw/phits326A/phits/bin:${PATH}
+# export PATH=/home/dnw/phits326A/phits/dchain-sp/bin:${PATH}
+export PATH=/home/dnw/Code/bin:${PATH}
diff --git a/2023-06-11-214759_1919x1080_scrot.png b/2023-06-11-214759_1919x1080_scrot.png
deleted file mode 100644
index 5c61b95..0000000
--- a/2023-06-11-214759_1919x1080_scrot.png
+++ /dev/null
Binary files differ
diff --git a/2023-06-11-214856_1021x767_scrot.png b/2023-06-11-214856_1021x767_scrot.png
deleted file mode 100644
index 14ee757..0000000
--- a/2023-06-11-214856_1021x767_scrot.png
+++ /dev/null
Binary files differ
diff --git a/Geometric_Langlands_S_Duality(1)1024_1.png b/Geometric_Langlands_S_Duality(1)1024_1.png
deleted file mode 100644
index 5938239..0000000
--- a/Geometric_Langlands_S_Duality(1)1024_1.png
+++ /dev/null
Binary files differ
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..5f7ced1
--- /dev/null
+++ b/README.org
@@ -0,0 +1,19 @@
+* Some Emacs-Focused Dotfiles
+
+These are most of my dotfiles for Parabola/Arch on my Librebooted T60, at the current moment. Some highlights:
+
+- 2.3kline, literate, external-link-documented org-mode config for Emacs, with as much philosophy as I could stomach.
+- Automatic =startx= upon login from tty.
+- =dwm=-like, =xrandr=-friendly EXWM config.
+- Libreboot as combined firmware/bootloader, with a bootloader password, full-disk encryption, and a keyfile---secure against physical access, but only one password (the HDD's LUKS key) necessary to boot normally.
+- =pam_usb= and =xsecurelock= (bug discovered) for seamless, multi-factor authentication
+- Airgapped GPG master key, encrypting a =~/.password-store= integrated with Emacs via =password-store.el= and the built-in =auth-sources= library.
+- Pretty-but-minimal =zsh= config.
+
+
+Some anti-highlights:
+
+- Minimal email/bbdb configuration
+- Minimal org-mode/agenda/calendar/diary configuration
+- Some untested config: a few modes, eglot.
+- Missing config: ledger/finance, non-Arch automatic system package installation.
diff --git a/config.org b/config.org
index 153474f..b82fb05 100644
--- a/config.org
+++ b/config.org
@@ -1,33 +1,17 @@
#+Title DNW's GNU Emacs Configuration
#+PROPERTY: header-args :tangle ./init.el
-
Top-level TODOs:
- - Describe how I use things, and what the alternatives are and why I dislike them, more than what things do. They can read the code.
- - Read through the Emacs source tree/info pages for all the features I'm missing
- - Make the dashboard load on startup and shrink the image.
- - Org-agenda and calendar/diary
- - Better org mode in general
- - Read info page for Dired.
- - Clean up prose on "Why Emacs"
- - DocView.
- - calc
- - BBDB
- - Hydra looks ridiculously powerful
- - Mail
- - Eshell
- - Learn how to use compiling and debugging
- - Make notifications work
- - Generalize system package installations to non-Arch package managers
- - Allout/outline-mode
- - Faceup
- - Image-dired
- - Info-xref
- - elide-head
- - expand.el
- - filesets
- - find-cmd
- - follow-mode
- - forms
+- Org-agenda and calendar/diary
+- Better org mode in general --- org-insert-link-global
+- Clean up prose on "Why Emacs"
+- BBDB
+- Mail
+- Debug/PR Eshell visual commands over TRAMP
+- Learn how to use compiling and debugging
+- Generalize system package installations to non-Arch package managers
+- Test eglot, consult-eglot, etc.
+- More extensive display-buffer-alist integration with edwina.
+- Fix bank stuff and get a ledger setup working.
* Why Emacs?
@@ -51,28 +35,30 @@ I simply cannot relate.
Let this be my act of defiance.
Let this by my refusal to fit in.
Let this by my writ of misanthropy
-To a wreckless world of men
-Who have perfected
-Nothing.
+To a thankless world of men
+Who have perfected nothing.
+Save the art of accusation.
...
--- /Scornful of The Motives And Virtue of Others/, Shai Hulud, 2003
#+end_verse
-Emacs and vi have long histories, each back to 1976. As editors based on them in some way have seen extensive use through all of the evolution of text and its structure (not even to mention the evolution of computers!) in the intervening 47 years, they over all newer editors can evidence the claim that their systems are capable. But what is the material grounds for this capability? I hope to convince you that they are actually in this respect /dual/---two sides of the same coin. And that, of that coin, Emacs is the side far prettier.
+Emacs and vi have long histories, each back to 1976. As editors based on them in some way have seen extensive use through all of the evolution of text and its structure (not to even mention the evolution of computers!) in the intervening 47 years, they over all newer editors can evidence the claim that their systems are capable. But what are the material grounds for this capability? In both cases, the strategy is extensibility, but the tactics could not be further apart.
+
+The vi perspective (in line with the UNIX perspective) starts from the assertion that everything on a computer can be fundamentally identified with text. Text in the filesystem is the substance of programs and that on which programs operate; it is what they produce and consume, and that by composing individual programs that perform simple text manipulations one may arive at powerful systems from simple parts. Programs are configured through filesystem text, either with a declarative config file or by modifying and recompilng their source. Programs are accessed through (not necessarily filesystem) text, by typing their name into a shell (which can only take text input, and can only output other text and side-effects). Even hardware devices are accessed through filesystem text, by reading and writing under the =/proc= and =/dev= trees. The text editor's task is merely to present the contents of the static fraction of this text for human consumption and modification, using in no small part the extant systems for text manipulation to this end. The user's enhancements to the system then contribute jointly to the operation of the system and his prowess in the editor---vi ever-growing in functionality /precisely/ on account of its minimality and, therefore, independence of the text-manipulation tools with which it shares a system.
-The vi perspective (in line with the UNIX perspective) is that text in the filesystem is the substance of programs and that on which programs operate; it is what they produce and consume, and that by composing individual programs that perform simple text manipulations one may arive at powerful systems from simple parts. Programs are configured through filesystem text, either with a declarative config file or by modifying and recompilng their source. Programs are accessed through filesystem text, by typing their name into a shell (which can only take text input, and can only output other text and side-effects). Even hardware devices are accessed through filesystem text, by reading and writing under the =/proc= and =/dev= trees. This is a worthy perspective, and certainly an elegant one. There's no question shell-fu is an ancient, effective art. This paradigm's near half-century survival seems to be because the editor itself does relatively little: it's the responsibility of the tools around the editor to extend the functionality of the editor itself.
+By contrast, it seems the Emacs perspective is that text is merely the substance of which programs and the data they operate on can be /composed/, but is not what they /are/. That text is merely a description of procedures to be performed. Therefore, we need not invoke those procedures through particular text incantations in a shell (though we may), nor must all procedures interface through the intermediary of a text terminal or terminal emulator (though, again, they may). The text editor exists more generally to describe and control computer behavior, to intercess between the user and the system---which, yes, often takes the form of reading, writing, and executing text, but which also may be keystrokes bound to functionality, pictures and animations presented to the user, or interactive graphical displays. vi people have recognized this to an extent, mercilessly abusing terminal control codes to get colors and interactive animations in their shells, polluting their textual paradise with programs graphical in all but the most distorted sense (ever tried to /write/ a TUI from scratch?). Emacs by contrast has no such philosophical restrictions, so it may be principled about drawing, using code and protocols actually /designed/ for the purpose from the ground-up.
-By contrast, I think the Emacs perspective is that text is merely the substance of which programs and the data they operate on can be /composed/, but is not what they /are/. Therefore, we need not control our computers through particular text incantations in a shell (though we may), nor must all programs interface through the intermediary of a text terminal or terminal emulator (though, again, they may). The text editor exists more generally to describe and control computer behavior, which, yes, often takes the form of reading, writing, and executing text, but which also can take the form of simple keystrokes bound to functionality, pictures and animations presented to the user, or interactive graphical displays. vi people have recognized this to an extent, mercilessly abusing terminal control codes to get colors and interactive animations in the tty, polluting their textual paradise with programs graphical in all but the most distorted sense. Emacs, by contrast, has no such philosophical restrictions, so it may be principled about drawing, via code and protocols actually /designed/ for the purpose, from the ground up. Emacs, rather than a text editor, should be regarded as a replacement of the /shell/, the vi man's door to his system.
+Emacs is configured in Lisp. The language family represents a fixed point in the relationship between programs' identity and programs' composition. Homoiconicity, there being no structural distinction between a Lisp's representation of the data it operates on and the code doing the operation, enables ordinary Lisp code to reason about other Lisp code with the same primitives used for reasoning about anything else---no weird templating, interpolation, parsing, or quoting. Just =macroexpand=. It's a dead-simple language, with about 5 pieces of fundamental syntax (lists, procedure calls, quotes, quasiquotes, and namespace distinguishment). Other dialects can be implemented with about 10 primitives (see the [[https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book.html][wizard book]]). It's extremely expressive---most modern CAS (for a fact: Maple, Wolfram/Mathematica, and SageMATH) drew on theoretical advances made by the MACSYMA system, written at MIT in Maclisp for the PDP-6 starting in 1968. Sage is actually said to have some of that original mainframe Lisp code, albeit ported to CommonLisp, surviving in its core routines. Configuration in a general-purpose language like this enables the editor's functionality to change as its users' preferences, requirements, hardware, and operating systems do. The actual, runtime state of configuration variables can be inspected and changed on the fly. The entire system can be modified, replaced, extended, abused, hacked, introspected, exported, and any other passive-voice verbs you can think of, at runtime, to hearts' content. People have implemented about as complicated and diverse functionality as anyone can imagine in Emacs Lisp, from [[elisp:(describe-package 'eieio)][object systems]] to [[elisp:(describe-package 'cats)][libraries of categorical programming abstractions]] to [[elisp:(describe-package 'elforth)][Forth emulation modes]].
-Emacs is configured in Lisp. The language family represents a fixed point in the relationship between programs' identity and programs' composition. Homoiconicity, there being no structural distinction between a Lisp's representation of the data it operates on and the code doing the operation, enables ordinary Lisp code to reason about other Lisp code with the same primitives used for reasoning about anything else---no weird templating, interpolation, parsing, or quoting. Just =macroexpand=. It's a dead-simple language, with about 5 pieces of syntax (lists, procedure calls, quotes, quasiquotes, and namespace distinguishment). Other versions can be implemented with about 10 primitives (see the [[https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book.html][wizard book]]). It's extremely expressive---most modern CAS (for a fact: Maple, Wolfram/Mathematica, and SageMATH) drew on theoretical advances made by the MACSYMA system, written at MIT in Maclisp for the PDP-6 starting in 1968. Sage is actually said to have some of the original 1968 Lisp code, albeit ported to CommonLisp, surviving in its core routines. Configuration in a general-purpose language like this enables the editor's functionality to change as its users' preferences, requirements, hardware, and operating systems do. The actual, runtime state of configuration variables can be inspected and changed on the fly. The entire system can be modified, replaced, extended, abused, hacked, introspected, exported, and any other passive-voice verbs you can think of. People have implemented just about as complicated and diverse functionality as anyone can imagine in Emacs Lisp, from [[elisp:(describe-package 'eieio)][object systems]] to [[elisp:(describe-package 'cats)][libraries of categorical abstractions]] to [[elisp:(describe-package 'elforth)][Forth emulation modes]].
+The vi-style editors are hardly a monolith, but on account of their heritage they err on the side of the static UNIX Conf file for extending user behavior. The original was literally this; vim has vimscript (🤣); neovim, Lua (respectable, but far from mature). Nothing like Emacs' ecosystem, where code from the times of the dinosaurs is still found in the repositories, maintained, used, and extended.
-From a user perspective, the fact that all keystrokes in Emacs are user-configurably bound to Lisp functions (or Lisp wrappers of C functions) is a large part of what enables its power. One may attach any and all of this extensive functionality to any key combination in any way, at runtime, in any way you desire. And so it has been since Stallman's FOSS port to GNU in 1984. Without this, I doubt I'd be writing this today. This contrasts again with the structure of vi: the improvements to Emacs are internal, not external. Programs written in Emacs Lisp, distributed and installed just as other programs, are used as substitutes for command-line alternatives, written in bash or C. To be clear, no generality or speed need be lost: Emacs can interact with the C ABI and command-line programs just as vi-based editors can. Instead, that generality and speed is made to balance against ease of development and use, a balance most seem to have struck against developing code externally first. Which, probably, would mean that more code would have been developed for vi, had its users the same option (neovim's move to Lua configuration confirms this further).
+From a user perspective, the fact that all keystrokes in Emacs are user-configurably bound to Lisp functions (or Lisp wrappers of C functions) is paramount. One may attach any and all of this extensive functionality to any key combination in any way, at runtime, in any way you desire. And so it has been since Stallman's FOSS port to GNU in 1984. Programs written in Emacs Lisp, distributed and installed just as other programs, are used as substitutes for command-line alternatives, written in bash or C. To be clear, no generality or speed need be lost: Emacs can interact with the C ABI and command-line programs just as vi-based editors can. Instead, that generality and speed is made to balance against ease of development and use, a balance most seem to have struck against developing code externally first. Which, probably, would mean that more extension would have been developed for vi, had its users the same option (look no further than neovim's adoption of Lua).
-Emacs is additionally self-documenting. In the Common Lisp tradition, every package, module, variable, function, and macro can be adorned with a docstring. These docstrings can be used to dynamically produce documentation pages for variables and keybinds, as you forget them in real-time. Emacs' use of prefix keys (e.g. =C-x=, after which the keystroke =b= will mean the Lisp function =switch-to-buffer= rather than insertion of a characters) enables packages that, through runtime querying of the current keymap, will tell you all the available next-step bindings and their functions in a key sequence if you wait too long. If you forget what a key does, or want to use a key combination in a script, =C-h k= will let you type it in and will present the documentation page of the function to which the key combination is bound. Similarly, under =C-h= are many other facilities to bring up documentation pages, which, after some configuration with an external package, will present the command, its arguments, its docstring, any manual/info entries about it, links to the documentation of other functions in close relation to it, any key bindings in any mode map that are defined to it, it's definition (whether C or Emacs Lisp), other source references to it (C or Emacs Lisp), trace calls of it, and more. I wrote my first Emacs major mode in a weekend, knowing zero Emacs Lisp beyond what I had copied verbatim from David Wilson's /Emacs from Scratch/ videos, and was distributing it among my research group the following Monday. It's difficult to overstate its power.
+Emacs is additionally self-documenting. In the Common Lisp tradition, every package, module, variable, function, and macro can be adorned with a docstring. These docstrings can be used to dynamically produce documentation pages for variables and keybinds, as you forget them in real-time. Emacs' use of prefix keys (e.g. =C-x=, after which the keystroke =b= will mean the Lisp function =switch-to-buffer= rather than insertion of a =b= character) enables packages that, by runtime-querying the current keymap, will tell you all the available next-step bindings and their functions in a key sequence if you wait too long. If you forget what a key does, or want its function to use in a script, =C-h k= will let you type it in and will present the documentation page of the function to which the key combination is bound. Similarly, under =C-h= are many other facilities to bring up documentation pages, which, after some configuration, will present the command, its arguments, its docstring, any manual/info entries about it, links to the documentation of other functions in close relation to it, any relevant key bindings and their mode map, its source definition (whether C or Emacs Lisp), other calls to it from the source (C or Emacs Lisp), options to trace calls of it, and more. I wrote my first Emacs major mode in a weekend, knowing zero Emacs Lisp beyond what I had copied verbatim from David Wilson's /Emacs from Scratch/ videos, and was distributing it among my research group the following Monday. It's difficult to overstate its power.
-Finally, Emacs is comparably performant to the vi ecosystem. Implementing most of the editor's functionality as modules in a scripting language means that most of Emacs' deep functionality is simply /not present/ unless explicitly loaded, either by an explicit require or as a dependency of another module or function invoked by the user. Currently, =(emacs-uptime)= returns =2 days, 9 hours, 50 minutes, 6 seconds=. Most of this time has been spent heavily loading packages to test, evaluating at some level all 6000 that're either built-in, on ELPA, or on MELPA to craft this config. Yet a simple =free -h= from the terminal reveals usage of only 602MiB, even under X, with =eww=, several info manuals, and a several-thousand-line, rich-text org document all open, among other things. That's less than the startup, idle RAM usage of some entire desktop environments, and when you consider that Emacs /is/ my desktop environment...this old, Librebooted T60 has struggled more to run certain /package managers/ than the heaviest of tasks daily Emacs editing throws at it.
+Finally, Emacs is comparably performant to the vi ecosystem. Implementing most of the editor's functionality as modules in a scripting language means that most of Emacs' deep functionality is simply /not present/ unless explicitly loaded, either by an explicit require or as a dependency of another module or function invoked by the user. Currently, =(emacs-uptime)= returns =2 days, 9 hours, 50 minutes, 6 seconds=. Most of this time has been spent heavily loading packages to test, evaluating at some level all 6000 that're either built-in, on ELPA, or on MELPA to craft this config. Yet a simple =free -h= from the terminal reveals usage of only 602MiB, even under X, with =eww=, several info manuals, and a several-thousand-line, rich-text org document all open, among other things. That's less than the startup, idle RAM usage of some entire desktop environments, and when you consider that Emacs /is/ my desktop environment...this old, Librebooted T60 has struggled more to run certain /package managers/ than the heaviest of tasks Emacs editing throws at it.
Emacs is, as the GNU project puts it, "/the/ extensible, customizable, self-documenting, real-time display editor." The vi ecosystem is but a pale imitation on each of those three dimensions, and so the Emacs way seems clearly the fastest towards a more principled, deeper, and enjoyable mode of human-computer interaction.
@@ -84,7 +70,7 @@ Place this org file under =~/.emacs.d/=. Once Emacs is up-and-running with this
This is intended to be read in tandem with other sources of documentation; particularly, the manual and built-in help facilities mentioned above. =C-h r= at any time should return to the Emacs manual, and when in doubt, spam =C-g= a few times before rerunning. To see exactly what something in the configuration snippets is doing, press =C-h o= with the point near the thing in question and it should be the first completion candidate (otherwise just type it in like a plebian 😎).
-If any functionality seems useless or undesirable, add =:tangle no= to the header line (after =emacs-lisp=) in the relevant source code block. To add your own functionality, create a code block by typing =<el= and pressing =TAB=; typing =C-c '= with the point on the code block should open an Emacs Lisp mode buffer that you can edit with nice completion and indentation, whose changes will be written back into the source block when told.
+If any functionality seems useless or undesirable, add =:tangle no= to the header line (after =emacs-lisp=) in the relevant source code block. To add your own functionality, create a code block by typing =<el= and pressing =TAB=; typing =C-c '= with the point in the code block should open the contents in an Emacs Lisp buffer that you can edit with nice completion and indentation, whose changes will be written back into the source block when instructed.
* Configuration Philosophy
@@ -96,23 +82,23 @@ There are a few principles this configuration follows.
- User interfaces should be mostly invisible until called-upon---the user can rely on explicit documentation and help features to learn what's available when.
- Minimize keystrokes, prevent injury.
- Mice are literally spawn of Satan: keyboard-driven workflows are preferred at all costs (hence why this is an Emacs configuration). The time taken moving keyboard-to-mouse adds up.
-- Modal editing requires keeping track of which mode you're in, and doesn't seem to meaningfully reduce either keystrokes or dependence upon modifier keys, and as such is needless complexity. The keystroke =A= should always insert the character "A", unless specifically instruced otherwise via prefixing. In a sense, these prefixes are a type of "modal editing"---and accordingly, by exploiting them in depth, the key combinations are more semantic/mnemonic and far more numerous (by default, there are 10000+ key combinations).
+- Modal editing requires keeping track of which mode you're in, and doesn't seem to meaningfully reduce either keystrokes or dependence upon held modifier keys, and as such is needless complexity. The keystroke =A= should always insert the character "A", unless specifically instruced otherwise via prefixing. In a sense, these prefixes are a type of "modal editing"---and accordingly, by exploiting them in depth, the key combinations are more semantic/mnemonic and far more numerous (by default, there are 10000+ key combinations).
- In-Emacs user-interfaces are preferred to external programs, in the interest of maximizing configurability, integration, and extensibility (with the same caveat as the second bullet, /mutadis mutandis/).
- Colors, symbols, and embedded pictures enable more compact representation and faster communication of information than text alone---and this process is aided by using tools designed from the ground-up to represent this kind of information (hence GUI Emacs).
-- Avoid the "customize" interface, because actual use of it clutters up the init file/process. Changes to variables should be performed first temporarily through =M-:= and then permanently via =setq= in this org file, and tangled out to the actual =init.el=.
+- Avoid the "customize" interface, because actual use of it clutters up the init file/process. Changes to variables should be performed first temporarily through =M-:= and then permanently via =setq= in this org file, tangled out to the actual =init.el= on save.
- Starting with more feature-complete packages, while one might not need all of their functionality immediately, prevents needing to rewrite an existing config for what would be a single =setq= otherwise. Especially true if the package in question is already built-in---there's little downside.
There are also some rules according to which this text is composed.
- Group configuration elements by their highest-level end-user purpose.
- Describe first the /why/ of the config snippet. Then describe the /what/ with comments in the actual snippet, and follow the snippet with some /how/ (useful keybindings, extra necessary system configuration etc).
-- Link to first-party repositories or in-Emacs documentation as much as possible.
-- Describe useful, built-in Emacs tools that might need no configuration, so the reader knows what's out there.
-- For similar reasons, describe the other packages not included in the configuration, but are worthy of evaluation, detailing the reasoning for what is chosen based on the list above.
+- Link to package documentation, info pages, and first-party repositories as much as possible.
+- Describe useful, built-in Emacs tools that might need no configuration so the reader knows what's out there.
+- For similar reasons, try to describe the other packages not included in the configuration, but are worthy of evaluation, detailing the reasoning for what is chosen based on the list above.
* Startup Performance
-The configuration will load faster if we let the interpreter's RAM footprint blow up on startup.
+The configuration will load faster if we let the interpreter's RAM footprint blow up on startup. To debug a bad startup time, or slow functions in general, see the [[info:elisp#Profiling][profiler]].
#+begin_src emacs-lisp
@@ -133,7 +119,8 @@ The configuration will load faster if we let the interpreter's RAM footprint blo
* Package Management
-The default Emacs system, from 24 to 28, has only the =require= interface, which is imperative and somewhat difficult to optimize load-time with. The =use-package= macro provides a more ergonomic, declarative way to control loading and configuration of packages, and will be in Emacs 29 (a few weeks away at time of writing). Additionally, installs are only available from the official GNU ELPA archive by default. Most third-party packages are hosted on the MELPA. Currently, some alternative package managers/loaders/configurers are: =straight=, =quelpa-use-package=, =elpaca=, =el-get=, =elpaso=, =cask=, =leaf=. I will not claim to be familiar with any of these, but the selection criteria few sections above ought to apply to package managers.
+The default Emacs system, from 24 to 28, has only the [[elisp:(helpful-function 'require)][require]] interface, which is imperative and somewhat difficult to optimize load-time with. The [[elisp:(describe-package 'use-package)][use-package]] macro provides a more ergonomic, declarative way to control loading and configuration of packages, and will be in Emacs 29 (a few weeks away at time of writing). Additionally, installs are only available from the official GNU ELPA archive by default. Most third-party packages are hosted on the MELPA, so that is configured.. Currently, some alternative package managers/loaders/configurers are:
+[[elisp:(describe-package 'straight)][straight]], [[elisp:(describe-package 'quelpa-use-package)][quelpa-use-package]], [[elisp:(describe-package 'elpaca)][elpaca]], [[elisp:(describe-package 'el-get)][el-get]], [[elisp:(describe-package 'elpaso)][elpaso]], [[elisp:(describe-package 'cask)][cask]], and [[elisp:(describe-package 'leaf)][leaf]]. I will not claim to be familiar with any of these, but the selection criteria few sections above ought to apply to package managers.
#+begin_src emacs-lisp
@@ -162,9 +149,12 @@ The default Emacs system, from 24 to 28, has only the =require= interface, which
#+end_src
* Desktop Environment
+
+The highest level of information management and display.
+
** Buffer Management
-[[elisp:(describe-package 'bufler)][Bufler]] provides a replacement for the built-in Ibuffer that's both prettier and has sane defaults. [[elisp:(describe-package 'edwina)][Edwina]] provides dwm-like window management.
+[[elisp:(describe-package 'bufler)][Bufler]] provides a replacement for the built-in [[elisp:(describe-package 'ibuffer)][ibuffer]] that's both prettier and has sane defaults; it's very useful for reclaiming space from large, unused, buried buffers. [[elisp:(describe-package 'edwina)][Edwina]] provides dwm-like window management. There exist many tab-bar-style interfaces for buffer management, but these seem to end up being little more than distracting---twixt-buffer navigation information ought not intrpude on buffer space, but present itself when called.
#+begin_src emacs-lisp
@@ -173,7 +163,11 @@ The default Emacs system, from 24 to 28, has only the =require= interface, which
(use-package edwina
:config
- (setq display-buffer-base-action '(display-buffer-below-selected))
+ (setq display-buffer-base-action '(display-buffer-below-selected)) ;; Always create new window for buffer,
+ (setq display-buffer-alist ;; except in these cases, where it's far too annoying.
+ '(("\\*Help\\*" display-buffer-same-window)
+ ("\\*helpful " display-buffer-same-window)
+ ("\\*Backtrace\\*" display-buffer-at-bottom)))
(edwina-setup-dwm-keys 'super)
(edwina-mode t))
@@ -181,20 +175,19 @@ The default Emacs system, from 24 to 28, has only the =require= interface, which
** Notifications
-[[elisp:(describe-package 'ednc)][Ednc]] implements a freedesktop-conformant notification server in Elisp. Perfect for EXWM.
+[[elisp:(describe-package 'ednc)][Ednc]] implements a decent UI for [[elisp:(describe-package 'notifications)][notifications]], an Elisp implementation of the [[https://freedesktop.org][freedesktop.org]] desktop notification spec. Perfect for EXWM.
#+begin_src emacs-lisp
(defun dnw/stack-notifications (&optional hide)
"Stringify only the most recent notification from each application."
- (mapconcat (lambda (notification)
- (let ((app-name (ednc-notification-app-name notification)))
- (unless (member app-name hide)
- (push app-name hide)
- (ednc-format-notification notification))))
- (ednc-notifications) ""))
-
- ;; TODO: debug along with emacsclient dbus stuff.
+ (mapconcat (lambda (notification)
+ (let ((app-name (ednc-notification-app-name notification)))
+ (unless (member app-name hide)
+ (push app-name hide)
+ (ednc-format-notification notification))))
+ (ednc-notifications) ""))
+
(use-package ednc
:after exwm
:hook (ednc-notification-presentation-functions . (lambda (&rest _) (force-mode-line-update t)))
@@ -206,7 +199,7 @@ The default Emacs system, from 24 to 28, has only the =require= interface, which
** EXWM
-[[elisp:(describe-package 'exwm)][EXWM]] allows me to spawn X applications as Emacs buffers. This is great, because it allows me to use a single buffer-management scheme for windows also, extends Emacs' wonderful input modes for mathematics and CJK to all applications (fcitx is a nightmare by comparison), and remap Emacs-style keybindings to CUA equivalents.
+[[elisp:(describe-package 'exwm)][EXWM]] allows me to spawn X applications as Emacs buffers. This is great, because it allows me to use a single buffer-management scheme for windows also, extends Emacs' wonderful input modes for mathematics and CJK to all applications (fcitx is a nightmare by comparison), and remap Emacs-style keybindings to CUA equivalents. [[elisp:(describe-package 'exwm-edit)][Exwm-edit]] allows for Emacs-buffer entry of text into X applications---think editing Markdown-formatted forum posts in a Markdown-mode buffer.
#+begin_src emacs-lisp
@@ -321,6 +314,7 @@ The =.xinitrc= that I use to actually start Emacs is (see [[*Editing Server][Edi
# required for GTK3 scrolling
export GDK_CORE_DEVICE_EVENTS=1
# Finally start Emacs
+
exec dbus-run-session -- emacsclient -c -a ""
#+end_src
@@ -453,7 +447,7 @@ The [[elisp:(describe-package 'dashboard)][dashboard]] package from Spacemacs, b
#+begin_src emacs-lisp
- ;; Make a 1337 h@ckerman5 splash screen
+ ;; Make a 1337 h@ckerman5 splash screen. TODO: debug the buffer not displaying when starting the server.
(use-package dashboard
:config
(dashboard-setup-startup-hook)
@@ -461,7 +455,7 @@ The [[elisp:(describe-package 'dashboard)][dashboard]] package from Spacemacs, b
(setq dashboard-banner-logo-title "Pauca Sed Matura.")
(setq dashboard-center-content t)
(setq dashboard-image-banner-max-width 600)
- (setq dashboard-startup-banner "~/Emacs-Config/crystals8.PNG")
+ (setq dashboard-startup-banner "~/Emacs-Config/crystals8.png")
(setq dashboard-display-icons-p t)
(setq dashboard-icon-type 'nerd-icons))
@@ -473,23 +467,23 @@ Exploit Iosevka's ligature support, with the [[elisp:(describe-package 'ligature
#+begin_src emacs-lisp
- ;; Replace e.g. lambda -> λ in Emacs Lisp mode,
- ;; or \alpha -> α in TeX-mode
- (global-prettify-symbols-mode t)
+ ;; Replace e.g. lambda -> λ in Emacs Lisp mode,
+ ;; or \alpha -> α in TeX-mode
+ (global-prettify-symbols-mode t)
- ;; Enables fonts' ligature support---Iosevka has some good ones.
- (use-package ligature
- :if (display-graphic-p)
- :config
- (global-ligature-mode t)
- (ligature-set-ligatures
- '(prog-mode org-mode)
- '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-"
- "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>="
- "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__"
- "<~~" "</" "</>" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!="
- "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>"
- "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "<!--" "<!---")))
+ ;; Enables fonts' ligature support---Iosevka has some good ones.
+ (use-package ligature
+ :if (display-graphic-p)
+ :config
+ (global-ligature-mode t)
+ (ligature-set-ligatures
+ '(prog-mode org-mode)
+ '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-"
+ "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>="
+ "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__"
+ "<~~" "</" "</>" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!="
+ "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>"
+ "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "<!--" "<!---")))
#+end_src
@@ -501,18 +495,7 @@ There are lots of ways to search, jump, move through, highlight, rearrange, disp
** Basic Movement and Alteration
-Not too much configuration here. The defaults are very sane, and hard to unlearn.
-
-However, expanding a file by typing newlines manually can get annoying.
-
-#+begin_src emacs-lisp
-
- ;; C-n expands the file.
- (setq next-line-add-newlines t)
-
-#+end_src
-
-As noted above, see the [[elisp:(call-interactively #'help-with-tutorial)][tutorial]] (accessible via =C-h t=) for the basics. The commands are documented pretty extensively in the manual:
+Not too much configuration here. The defaults are very sane, and hard to unlearn. As noted above, see the [[elisp:(call-interactively #'help-with-tutorial)][tutorial]] (accessible via =C-h t=) for the basics. The commands are documented pretty extensively in the manual:
- [[info:emacs#Moving Point][Moving the Point]]
- [[info:emacs#Scrolling][Scrolling]]
@@ -592,14 +575,15 @@ See the documentation linked above for the set of basic keys (which align with t
** Macros
-Onebr of the most helpful features of Emacs is its extremely deep [[info:emacs#Keyboard Macros][keyboard macro]] system. In particular, the fact these macros extend to all Emacs interfaces, e.g. =C-s=, =M-x=, and =M-:=, enables them to perform almost any repetitive task on files. Look to record one when doing any editing that feels boring; most likely there's something lurking! Save any particularly general ones for later. Note the macro queries with recursive-edit levels and counts; you can integrate calc commands into macro execution too. The [[elisp:(describe-package 'elmacro)][elmacro]] package converts a macro to an Elisp function---something only possible due to Emacs' everything-is-a-Lisp-function model---which can then be extracted into the config, bound to keys, native-compiled for extreme speed, and so on.
+One of the most helpful features of Emacs is its extremely deep [[info:emacs#Keyboard Macros][keyboard macro]] system. In particular, the fact these macros extend to all Emacs interfaces, e.g. =C-s=, =M-x=, and =M-:=, enables them to perform almost any repetitive task on files. Look to record one when doing any editing that feels boring; most likely there's something lurking! Save any particularly general ones for later. Note the macro queries with recursive-edits and counters; you can integrate calc commands into macro execution too. Notice the commands under =C-x C-k= allowing one to name, bind, extract as Lisp, and insert as Lisp keyboard macros. This one was useful in the preparation of this document; executing the form will recreate this macro.
-#+begin_src emacs-lisp
+#+begin_src emacs-lisp :tangle no
+
+ (fset 'dnw/org-link-to-package
+ (kmacro-lambda-form
+ [?\C-c ?\C-l ?e ?l ?i ?s ?p ?: ?\( ?d ?e ?s ?c ?r ?i ?b ?e ?- ?p ?a ?c ?k ?a ?g ?e ? ?\'
+ ?\C-` ?\C-u ?\C-x ?q ?\M-` ?\C- ?\C-e ?\M-w ?\) return ?\C-y return] 0 "%d"))
- ;; Produces an Elisp function for a macro, so you can bind it from init.el.
- (use-package elmacro
- :config (elmacro-mode)
- :commands (elmacro-mode elmacro-show-last-macro))
#+end_src
@@ -655,7 +639,7 @@ Counting and doing =C-f 57= isn't fun. Long-term, I'd like to develop eye-tracki
("M-g g" . avy-goto-line)
("M-g M-g" . avy-goto-line))
- ;; Smartly navigate to past locations.
+ ;; Smartly navigate to past locations. NOTE: on package probation; it might be less than useful.
(use-package dogears
:config (dogears-mode)
:bind (("M-g d" . dogears-go)
@@ -674,25 +658,25 @@ While looking at a place you want to jump to, press =C-'= , enter two characters
** Whitespace Behavior
-Save space, and make things look nice. The [[elisp:(describe-package 'ws-butler)][ws-butler]] package will trim trailing whitespace on saves, which is essential for the smooth operation of navigation like =C-e=.
+Save space, and make things look nice (on everyone's machine). The [[elisp:(describe-package 'ws-butler)][ws-butler]] package will trim trailing whitespace on saves, which is essential for the smooth operation of navigation like =C-e=.
#+begin_src emacs-lisp
- ;; Spaces over tabs
- (setq tab-always-indent 'complete)
- (setq align-to-tab-stop nil)
+ ;; Spaces over tabs
+ (setq tab-always-indent 'complete)
+ (setq align-to-tab-stop nil)
- ;; Require files to end in newlines
- (setq require-final-newline t)
+ ;; Require files to end in newlines
+ (setq require-final-newline t)
- ;; Enforce a line-length limit.
- (setq fill-column 140) ;; Chosen to fit nicely at my font-size on 4:3.
- (auto-fill-mode t)
+ ;; Enforce a line-length limit.
+ (setq fill-column 140) ;; Chosen to fit nicely at my font-size on 4:3.
+ (auto-fill-mode t)
- ;; Trim trailing line whitespace on save.
- (use-package ws-butler
- :hook ((text-mode . ws-butler-mode)
- (prog-mode . ws-butler-mode)))
+ ;; Trim trailing line whitespace on save.
+ (use-package ws-butler
+ :hook ((text-mode . ws-butler-mode)
+ (prog-mode . ws-butler-mode)))
#+end_src
@@ -700,7 +684,7 @@ Notice =M-x whitespace-mode= for inspecting exactly what's going on with whitesp
** Better English
-[[elisp:(describe-package 'ispell)][Ispell]] is the built-in package for interfacing with dictionaries. There is a [[elisp:(describe-package 'grammarly)][grammarly]] package on MELPA, but I'm squeamish about sending all my text to a nonfree network service for semantic analysis. And the FOSS, local package =languagetool= (at least, in conjunction with [[elisp:(describe-package 'langtool)][langtool]] for Emacs) is slow as can be and very unhelpful. It couldn't find a problem with "The quick fox brown jumps over the dog, lazy." [[elisp:(describe-package 'define-word)][Define-word]] interfaces with external dictionaries to get definitions, not just spelling corrections. [[elisp:(describe-package 'le-thesaurus)][Le-thesaurus]] uses the [[https:thesaurus.com][thesaurus.com]] API to provide synonyms for the word at point. See [[elisp:(describe-package 'mw-thesaurus)][mw-thesaurus]], [[elisp:(describe-package 'synonymous)][synonomous]], [[elisp:(describe-package 'synosaurus)][synosaurus]], for other less-complete, less-well-maintained, or requiring-API-key thesaurus packages. See [[elisp:(describe-package 'smog)][smog]] and [[elisp:(describe-package 'proselint)][proselint]] for integrated style analysis.
+[[elisp:(describe-package 'ispell)][Ispell]] is the built-in package for interfacing with dictionaries. There is a [[elisp:(describe-package 'grammarly)][grammarly]] package on MELPA, but I'm squeamish about sending all my text to a nonfree network service for semantic analysis. And the FOSS, local package =languagetool= (at least, in conjunction with [[elisp:(describe-package 'langtool)][langtool]] for Emacs) is slow as can be and very unhelpful. It couldn't find a problem with "The quick fox brown jumps over the dog, lazy." [[elisp:(describe-package 'define-word)][Define-word]] interfaces with external dictionaries to get definitions, not just spelling corrections. [[elisp:(describe-package 'le-thesaurus)][Le-thesaurus]] uses the [[https:thesaurus.com][thesaurus.com]] API to provide synonyms for the word at point. See [[elisp:(describe-package 'mw-thesaurus)][mw-thesaurus]], [[elisp:(describe-package 'synonymous)][synonomous]], [[elisp:(describe-package 'synosaurus)][synosaurus]], for other less-complete, less-well-maintained, or requiring-API-key thesaurus packages. See [[elisp:(describe-package 'smog)][smog]] and [[elisp:(describe-package 'proselint)][proselint]] for more complete style analysis.
#+begin_src emacs-lisp
@@ -725,7 +709,7 @@ Use =M-$= to spell-check a word. Use =M-x ispell= to spell-check the whole buffe
** Rendering LaTeX Inline
-By default, there's an org command I bind globally to =C-c C-x C-l= that renders LaTeX snippets. There's a [[elisp:(describe-package 'math-preview)][math-preview]] package using MathJax, which may be faster. The package [[elisp:(describe-package 'texfrag)][texfrag]] hooks into AUCTeX's preview functionality, and has the advantage that putting the point over inside the rendered snippet expands it to the source and permits editing. Additionally, the preamble used may be modified, and the TeX buffer used to generate the snippet modified by-hand for one-off things.
+By default, there's an org command I bind globally to =C-c C-x C-l= that renders LaTeX snippets. There's a [[elisp:(describe-package 'math-preview)][math-preview]] package using MathJax, which may be faster. The package [[elisp:(describe-package 'texfrag)][texfrag]] hooks into AUCTeX's preview functionality, and has the advantage that putting the point over inside the rendered snippet expands it to the source and permits editing. Additionally, the preamble used may be modified, and the TeX buffer used to generate the snippet changed by-hand for one-off things.
#+begin_src emacs-lisp
@@ -742,12 +726,16 @@ Puts graphical-only underscores between triple-digit groups of large numbers, e.
#+begin_src emacs-lisp
- (use-package readable-numbers
- :hook ((text-mode . readable-numbers-mode)
- (prog-mode . readable-numbers-mode)))
+ (use-package readable-numbers
+ :hook ((text-mode . readable-numbers-mode)
+ (prog-mode . readable-numbers-mode)))
#+end_src
+** Outlining
+
+While it's hard to see a use for it, Emacs provides [[info:emacs#Outline Mode][Outline Mode]] (and a glow-up [[elisp:(describe-package 'allout)][allout]]) for essentially emulating org-mode in arbitrary text-mode buffers.
+
** Translation
[[elisp:(describe-package 'go-translate)][Go-translate]] can de-obfuscate non-English human languages.
@@ -772,7 +760,7 @@ Puts graphical-only underscores between triple-digit groups of large numbers, e.
#+begin_src emacs-lisp
- ;; TODO: demonstrate this.
+ ;; TODO: demonstration purposes.
(use-package hl-todo
:config (global-hl-todo-mode)
:bind (("C-c t p" . hl-todo-previous)
@@ -782,11 +770,15 @@ Puts graphical-only underscores between triple-digit groups of large numbers, e.
#+end_src
-The commands bound above do exactly what they say on the box for navigating between TODO statements.
+The commands bound above do exactly what they say on the box for navigating between highlighted elements.
** Confusable Characters
-TODO: possibly configure =textsec= in Emacs 29.
+TODO: configure =textsec= in Emacs 29.
+
+** Ugly, Repetitive Headers
+
+The built-in [[elisp:(describe-package 'elide-head)][elide-head]] can be used to surpress fixed, relatively useless content at the top of files.
* Completion and Templating
@@ -796,7 +788,7 @@ The =vertico= stack instead alters the built-in =completing-read= for minibuffer
** Vertico
-The starting place of it all only modifies the minibuffer UI, by presenting a [[elisp:(describe-package 'vertico)][VERTical list of COmpletions]] in the minibuffer. [[elisp:(describe-package 'nerd-icons-completion)][Nerd-icons-completion]] uses the nerd icons font installed wiith the DOOM themes for complection candidate icons.
+The starting place of it all only modifies the minibuffer UI, by presenting a [[elisp:(describe-package 'vertico)][VERTical list of COmpletions]] in the minibuffer. [[elisp:(describe-package 'nerd-icons-completion)][Nerd-icons-completion]] uses the nerd icons font installed wiith the DOOM themes for complection candidate icons.
#+begin_src emacs-lisp
@@ -825,7 +817,7 @@ The starting place of it all only modifies the minibuffer UI, by presenting a [[
*** Kind Icon
-Adds type-based icon annotations in the left margin of the Corfu buffer, so you can tell if the candidate is a function etc.
+[[elisp:(describe-package 'kind-icon)][Kind-icon]] adds type-based icon annotations in the left margin of the Corfu buffer, so you can tell if the candidate is a function etc.
#+begin_src emacs-lisp
@@ -856,7 +848,8 @@ The prompt (e.g. what you type into =M-x=) is divided into space-separated compo
** Consult
-A lot of the default navigation commands are pretty clumsy. [[elisp:(describe-package 'consult)][Consult]] provides a lot of alternative UIs to commands, such as search and history that shows the context around the match. [[elisp:(describe-package 'consult-eglot)][Consult-eglot]] and [[elisp:(describe-package 'flyspell)][Consult-flyspell]] provide the same for their respective functionalities. TODO: integrate these last two packages, bind their commants etc.
+A lot of the default navigation commands are pretty clumsy. [[elisp:(describe-package 'consult)][Consult]] provides a lot of alternative UIs to commands, such as search and history that shows the context around the match.
+[[elisp:(describe-package 'consult-eglot)][Consult-eglot]] provides the same for eglot symbol search.
#+begin_src emacs-lisp
@@ -872,11 +865,9 @@ A lot of the default navigation commands are pretty clumsy. [[elisp:(describe-pa
:custom (completion-in-region-function #'consult-completion-in-region))
(use-package consult-eglot
+ :commands consult-eglot-symbols
:after eglot)
- (use-package consult-flyspell
- :after flyspell)
-
#+end_src
** Marginalia
@@ -898,7 +889,7 @@ A lot of the default navigation commands are pretty clumsy. [[elisp:(describe-pa
#+begin_src emacs-lisp
- ;; From the recommended config.
+ ;; From the recommended config. TODO: figure out how to prevent it from shoving whole paragraphs into the minibuffer.
(use-package embark
:bind
(("C-." . embark-act)
@@ -924,7 +915,7 @@ A lot of the default navigation commands are pretty clumsy. [[elisp:(describe-pa
When typing a long something repetitively, Emacs’ built-in [[info:emacs#Abbrevs][Abbrevs]] can help.
-Sometimes, you want completion, but you don't have anything providing the completion. =dabbrev= helps provide that by looking through the words in the buffer for things you've already typed to use as candidates.[[elisp:(describe-package 'tempel)][Tempel]] extends =org-tempo= style template expansion to other modes.
+Sometimes, you want completion, but you don't have anything providing the completion. =dabbrev= helps provide that by looking through the words in the buffer for things you've already typed to u se as candidates.[[elisp:(describe-package 'tempel)][Tempel]] extends [[elisp:(describe-package 'tempo)][tempo]] style template expansion to other modes, and with better integration with modern Emacs features, e.g. completion. See also the built-in [[elisp:(describe-package 'expand)][expand]] for interactively expanded abbreviations.
#+begin_src emacs-lisp
@@ -936,13 +927,13 @@ Sometimes, you want completion, but you don't have anything providing the comple
:bind (("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand)))
- ;; TODO: setup tempel
+ ;; TODO: setup some tempel templates
(use-package tempel
;; Require trigger prefix before template name when completing.
:custom
(tempel-trigger-prefix "<")
- :init
- ;; Setup completion at point
+ :init
+ ;; Setup completion at point
(defun tempel-setup-capf ()
;; Add the Tempel Capf to `completion-at-point-functions'.
;; `tempel-expand' only triggers on exact matches. Alternatively use
@@ -952,15 +943,15 @@ Sometimes, you want completion, but you don't have anything providing the comple
;; `tempel-expand' *before* the main programming mode Capf, such
;; that it will be tried first.
(setq-local completion-at-point-functions
- (cons #'tempel-expand
- completion-at-point-functions)))
+ (cons #'tempel-expand
+ completion-at-point-functions)))
(add-hook 'prog-mode-hook 'tempel-setup-capf)
(add-hook 'text-mode-hook 'tempel-setup-capf))
#+end_src
-Note the ways to customize what =dabbrev= considers a word, and distinct.
+Note the ways to customize what =dabbrev= considers a word, and distinct words.
** Auto-Insert
@@ -971,22 +962,22 @@ The built-in [[elisp:(describe-package 'autoinsert)][autoinsert]] package makes
;; Let the user enter a due date (very buggy).
(defun dnw/prompt-date ()
(let ((date (read-string "Due date: "))
- (now (split-string (format-time-string "%e %B %Y" (current-time)))))
- (cond ((equal date "")
- (concat now))
- ((equal (substring date 0 1) "+")
- (concat (number-to-string (+ (string-to-number (car now))
- (string-to-number (substring date 1))))
- " "
- (cadr now)
- " "
- (caddr now)))
- ((= (length date) 2)
- (concat date
- " "
- (cadr now)
- " "
- (caddr now))))))
+ (now (split-string (format-time-string "%e %B %Y" (current-time)))))
+ (cond ((equal date "")
+ (concat now))
+ ((equal (substring date 0 1) "+")
+ (concat (number-to-string (+ (string-to-number (car now))
+ (string-to-number (substring date 1))))
+ " "
+ (cadr now)
+ " "
+ (caddr now)))
+ ((= (length date) 2)
+ (concat date
+ " "
+ (cadr now)
+ " "
+ (caddr now))))))
;; Some assorted preambles.
(setq dnw/autoinsert-latex-presets
@@ -1101,7 +1092,7 @@ Emacs has to interact with the rest of the system at some point, unfortunately.
** Files
-Emacs editing facilities technically manipulate only buffers. It's via [[info:emacs#Files][file handling commands]], which populate buffers with file contents and /vice versa/, that Emacs actually edits text in a normal sense.
+Emacs editing facilities technically manipulate only buffers. It's via [[info:emacs#Files][file handling commands]], which populate buffers with file contents and /vice versa/, that Emacs actually edits text in a normal sense. The [[elisp:(describe-package 'vlf)][vlf]] package enables editing of abnormally large files.
#+begin_src emacs-lisp
@@ -1122,30 +1113,30 @@ Interesting features people often gloss over: [[info:emacs#Filesets][Filesets]],
** Dired
-[[info:emacs#Dired][Dired]] is Emacs' file management system. If there's ever need for opening files in external programs, [[elisp:(describe-package 'dired-open)][dired-open]] will help with that. [[elisp:(describe-package 'dired-single)][Dired-single]] prevents Dired from creating buffers for each directory it visits; [[elisp:(describe-package 'nerd-icons-dired)][nerd-icons-dired]] uses the same nerd-fonts needed for DOOM modeline to display file type icons; and
-[[elisp:(describe-package 'diredfl)][diredfl]] colorizes the buffer more richly.
+[[info:emacs#Dired][Dired]] is Emacs' file management system. If there's ever need for opening files in external programs, [[elisp:(describe-package 'dired-open)][dired-open]] will help with that. [[elisp:(describe-package 'dired-single)][Dired-single]] prevents Dired from creating buffers for each directory it visits; [[elisp:(describe-package 'nerd-icons-dired)][nerd-icons-dired]] uses the same nerd-fonts needed for DOOM modeline to display file type icons; and [[elisp:(describe-package 'diredfl)][diredfl]] colorizes the buffer more richly.
+The built-in [[elisp:(describe-package 'image-dired)][image-dired]] provides excellent support for tagging, querying, and viewing thumbnails of images; similarly, [[elisp:(describe-package 'wdired)][wdired]] allows for usual buffer editing commands' use for modifying filenames.
#+begin_src emacs-lisp
- ;; Mostly configuring C-x C-j to open dired at the pwd.
- (use-package dired
- :ensure nil
- :commands (dired dired-jump)
- :bind (("C-x C-j" . dired-jump))
- :custom ((dired-listing-switches "-ahgo --group-directories-first")))
+ ;; Mostly configuring C-x C-j to open dired at the pwd.
+ (use-package dired
+ :ensure nil
+ :commands (dired dired-jump)
+ :bind (("C-x C-j" . dired-jump))
+ :custom ((dired-listing-switches "-ahgo --group-directories-first")))
- ;; Prevents dired from dirtying the buffer list with directories.
- (use-package dired-single
- :after dired)
+ ;; Prevents dired from dirtying the buffer list with directories.
+ (use-package dired-single
+ :after dired)
- ;; Use the nerd-fonts installed with the DOOM UI elements for file icons.
- (use-package nerd-icons-dired
- :after dired)
+ ;; Use the nerd-fonts installed with the DOOM UI elements for file icons.
+ (use-package nerd-icons-dired
+ :after dired)
- ;; Nice colors.
- (use-package diredfl
- :after dired
- :config (diredfl-global-mode))
+ ;; Nice colors.
+ (use-package diredfl
+ :after dired
+ :config (diredfl-global-mode))
#+end_src
@@ -1157,7 +1148,7 @@ Invoke it with =M-x dired= or the =C-x C-j= bound above. Use =C-h m= as always t
** Vterm
-[[elisp:(describe-package 'vterm)][vterm]] is a full-featured terminal. Emacs has built-in eshell, shell, and (ansi-)term, ordered roughly in order of the number of programs' output they break. I like eshell for Emacs integration, so I use that as a rule. However, it does break a lot; luckily, it provides a facility for using another terminal (external to Emacs or otherwise) to run certain commands known to break it. =vterm=, unlike any of the built-ins, handles everything, even including ncurses programs. It has no Windows compatibility, but then again the only thing that shines there is eshell, so the config is covered for such misfortune.
+[[elisp:(describe-package 'vterm)][vterm]] is a full-featured terminal. Emacs has built-in eshell, shell, and (ansi-)term, ordered roughly in order of the number of programs' output they break. I like eshell for its Emacs integration, so I use that as a rule. However, it does break a lot; luckily, it provides a facility for using another terminal (external to Emacs or otherwise) to run certain commands known to break it. =vterm=, unlike any of the built-ins, handles everything, even including ncurses programs. It has no Windows compatibility, but then again the only thing that shines there is eshell, so the config is covered for such misfortune.
#+begin_src emacs-lisp
@@ -1185,32 +1176,34 @@ There is a shell config snippet needed to make the integration work well:
** Eshell
-[[elisp:(describe-pacakge 'eshell)][Eshell]] is a shell writen entirely in Emacs Lisp, which supports execution of Elisp forms on the command line and integration thereof into shell workflows. The integration with the rest of Emacs is second-to-none.[[elisp:(describe-package 'eshell-vterm)][Eshell-vterm]] enables the functionality described above: using =vterm= to execute commands too visual for =eshell=. The assortment of packages [[elisp:(describe-package 'eshell-bookmark)][eshell-bookmark]], [[elisp:(describe-package 'eshell-prompt-extras)][eshell-prompt-extras]], [[elisp:(describe-package 'eshell-syntax-highlighting)][eshell-syntax-highlighting]], and [[elisp:(describe-package 'eshell-toggle)][eshell-toggle]] do basically what their names imply, and improve the experience in various ways.
+[[elisp:(describe-pacakge 'eshell)][Eshell]] is a shell writen entirely in Emacs Lisp, which supports execution of Elisp forms on the command line and integration thereof into shell workflows. The integration with the rest of Emacs is second-to-none.[[elisp:(describe-package 'eshell-vterm)][Eshell-vterm]] enables the functionality described above: using =vterm= to execute commands too visual for =eshell=. The package [[elisp:(describe-package 'eshell-syntax-highlighting)][eshell-syntax-highlighting]] provides rich Elisp and shell/binary fontification.
#+begin_src emacs-lisp
+ (require 'eshell) ;; Not a package, so use-package niceness doesn't work...
+
;; Use last two components of the pwd, excepting the home directory, as the pre-prompt text.
;; Pretty flaky.
(setq dnw/user-account "dnw")
(defun dnw/prompt-prefix ()
(let ((guess (apply
- 'concat
- (-map
- (lambda (x)
- (if (string= x dnw/user-account)
- "~/"
- (concat x "/")))
- (seq-subseq
- ;; extra ""'s are to prevent slicing errors
- (cons "" (cons "" (split-string (eshell/pwd) "/")))
- -2)))))
+ 'concat
+ (-map
+ (lambda (x)
+ (if (string= x dnw/user-account)
+ "~/"
+ (concat x "/")))
+ (seq-subseq
+ ;; extra ""'s are to prevent slicing errors
+ (cons "" (cons "" (split-string (eshell/pwd) "/")))
+ -2)))))
(if (string= guess "home/~/")
- "~"
- (string-remove-suffix "/" guess))))
+ "~"
+ (string-remove-suffix "/" guess))))
;; Change the way the buffer is scrolled on output.
(remove-hook 'eshell-output-filter-functions
- 'eshell-postoutput-scroll-to-bottom)
+ 'eshell-postoutput-scroll-to-bottom)
;; Customize the interface---motd, prompt, etc
(defun dnw/prompt ()
@@ -1224,16 +1217,23 @@ There is a shell config snippet needed to make the integration work well:
(setq eshell-prompt-regexp "^[^ᛋ\n]* ᛋ ")
(setq eshell-highlight-prompt nil
- eshell-prompt-function #'dnw/prompt)
+ eshell-prompt-function #'dnw/prompt)
;; Set motd message.
(setq eshell-banner-message "Formal methods are merely sufficiently good documentation. 🗿\n\n")
;; Patch to use vterm rather than term for visual commands.
- (use-package eshell-vterm)
+ (use-package eshell-vterm
+ :after eshell
+ :config (eshell-vterm-mode))
+
+ (require 'em-tramp) ;; So passwords don't end up in the buffer in plaintext.
+ (require 'em-term) ;; So the setting below works out.
+
+ ;; TODO: currently, visual commands called over TRAMP don't work;
+ ;; this is apparently a known upstream bug.
;; Additional commants for which to use vterm.
- ;; TODO: doesn't appear to work, even with eshell/sudo
(add-to-list 'eshell-visual-commands "pacman")
;; Use the better-integrated elisp command versions over the binaries'---be careful, they might be slow.
@@ -1241,22 +1241,9 @@ There is a shell config snippet needed to make the integration work well:
(setq eshell-prefer-lisp-functions t)
(setq eshell-prefer-lisp-variables t)
- ;; So passwords don't end up in the buffer in plaintext.
- ;; TODO: currently doesn't appear to work at all.
- (require 'em-tramp)
-
-
- ;; TODO: configure the below awesomeness.
- (use-package eshell-bookmark
- :after eshell)
-
- (use-package eshell-prompt-extras
- :after eshell)
-
(use-package eshell-syntax-highlighting
:hook (eshell-mode . eshell-syntax-highlighting-mode))
- (use-package eshell-toggle)
#+end_src
** Building Programs
@@ -1376,7 +1363,7 @@ Emacs can do all the nasty password and authentication management for us.
** UNIX Pass
The command-line [[elisp:(woman "pass")][pass]] program interacts neatly with GnuPG and the clipboard to enable storage and access of secrets in an elegant, minimal manner.
-[[elisp:(describe-package 'password-store)][Password-store]] provides Emacs tools for interacting with it. See [[elisp:(describe-package 'password-store-otp)][password-store-otp]] for extensions.
+[[elisp:(describe-package 'password-store)][Password-store]] provides Emacs tools for interacting with it. See [[elisp:(describe-package 'password-store-otp)][password-store-otp]] for fun extensions.
#+begin_src emacs-lisp
@@ -1436,6 +1423,10 @@ Built-in to Emacs, [[info:epa#Top][epa]] enables all the usual GnuPG interaction
The built-in [[info:emacs#Calendar/Diary][Calendar/Diary]] is nice, but doesn't integrate as completely as org-mode's tools. See [[elisp:(describe-package 'excorporate)][excorporate]] and [[elisp:(describe-package 'gmail2bbdb)][gmail2bbdb]] for tools that aid the transition away from proprietary alternatives.
+** Data Entry
+
+This didn't /quite/ fit cleanly anywhere else, but it sort of counts as time management: the built-in [[elisp:(describe-package 'forms)][forms]] can be used to create interactive data-entry systems.
+
* Help
Knowing things is better than not knowing things. And the WWW is a bit of a footgun in that respect.
@@ -1505,7 +1496,7 @@ Things related to git, cvs, /et. al/. There are some built-in features under =C-
** Git
-[[elisp:(describe-package 'magit)][Magit]] is the only tool that makes =git= bearable most of the time. [[elisp:(describe-package 'dired-git-info][Dired-git-info]] displays source control information and commit messages alongside folders and files in Dired, and [[elisp:(describe-package 'browse-at-remote)][browse-at-remote]]
+[[elisp:(describe-package 'magit)][Magit]] is the only tool that makes =git= bearable most of the time. [[elisp:(describe-package 'dired-git-info)][Dired-git-info]] displays source control information and commit messages alongside folders and files in Dired, and [[elisp:(describe-package 'browse-at-remote)][browse-at-remote]] opens the current file at the remote repository in the browser.
#+begin_src emacs-lisp
@@ -1530,11 +1521,11 @@ Things related to git, cvs, /et. al/. There are some built-in features under =C-
* Org Mode
-Org is a markup language, like Markdown or HTML, for which =org-mode= is an extensive set of tooling. It is so extensive that said description drastically undersells its awesomeness; it's unclear whether to file it under "Computation Environments," "Documentation Modes," or "Time Management"
+[[info:org#Top][Org]] is a markup language, like Markdown or HTML, for which =org-mode= is an extensive set of tooling. It is so extensive that said description drastically undersells its awesomeness; it's unclear whether to file it under "Computation Environments," "Documentation Modes," or "Time Management"
** Beautification
-Even though Org is pretty readable as-is, we can get basically WYSIWYG levels with a little effort. [[elisp:(describe-package 'visual-fill-column)][Visual-fill-column]] adds margins to the buffer that resize based on the windows; [[elisp:(describe-package 'org-bullets)][org-bullets]] changes repeated stars in headings to fancy Unicode characters; [[elisp:(describe-package 'org-appear)][org-appear]] makes hidden emphasis markers appear again when the point is adjacent to or between them (so you don't lose track of them); and [[elisp:(describe-package 'org-link-beautify)][org-link-beautify]] puts iconified link type indicators on every link.
+Even though Org is pretty readable as-is, we can get basically WYSIWYG levels with a little effort. [[elisp:(describe-package 'visual-fill-column)][Visual-fill-column]] adds margins to the buffer that resize based on the windows; [[elisp:(describe-package 'org-appear)][org-appear]] makes hidden emphasis markers appear again when the point is adjacent to or between them (so you don't lose track of them); and [[elisp:(describe-package 'org-link-beautify)][org-link-beautify]] puts iconified link type indicators on every link.
#+begin_src emacs-lisp
@@ -1550,6 +1541,8 @@ Even though Org is pretty readable as-is, we can get basically WYSIWYG levels wi
:bind
("C-c C-x C-l" . org-latex-preview) ;; This is an awesome function that works outside of org-mode.
("C-c l" . org-store-link)
+ ("C-c a" . org-agenda)
+ ("C-c c" . org-capture)
:config
(setq org-ellipsis " ▼")
(setq org-latex-create-formula-image-program 'imagemagick)
@@ -1557,7 +1550,7 @@ Even though Org is pretty readable as-is, we can get basically WYSIWYG levels wi
;; Prevent text from getting uncomfortably wide on widescreen monitors.
(defun dnw/org-mode-visual-fill ()
- (setq visual-fill-column-width 170
+ (setq visual-fill-column-width 140
visual-fill-column-center-text t)
(visual-fill-column-mode 1))
@@ -1776,7 +1769,7 @@ A mode I wrote/am writing for interacting with JAEA's PHITS.
** Calc
-The built-in [[https://www.gnu.org/software/emacs/manual/html_mono/calc.html][Calc]] is hands-down the best calculator I've ever used that wasn't built to be a CAS from the ground-up. See especially the embedded LaTeX mode. The package [[elisp:(describe-package 'literate-calc-mode)][literate-calc-mode]] enables using it to evaluate computations embedded in normal buffers.
+The built-in [[https://www.gnu.org/software/emacs/manual/html_mono/calc.html][Calc]] is hands-down the best calculator I've ever used that wasn't built to be a CAS from the ground-up. As examples: it has inbuilt, default support for [[https://en.wikipedia.org/wiki/Mobius_function][Möbius functions]], computing Taylor series, and doing IO on LaTeX-formatted algebraic expressions. The package [[elisp:(describe-package 'literate-calc-mode)][literate-calc-mode]] enables using it to evaluate computations embedded in normal buffers.
#+begin_src emacs-lisp
@@ -1969,7 +1962,7 @@ Play around with [[elisp:(describe-package 'artist)][artist]]. It's mind-bogglin
** Gnuplot
-[[elisp:(describe-package 'gnuplot)][Gnuplot]] is great for producing extremely high-quality vector plots. I like to use the TikZ terminal, which outputs LaTeX drawing code---and so uses all of the stylistic options I have set in my document.
+[[elisp:(describe-package 'gnuplot)][Gnuplot]] is great for producing extremely high-quality vector plots. I like to use the TikZ terminal, which outputs LaTeX drawing code---and so uses all of the stylistic options I have set in my document. See also the org-mode integration.
#+begin_src emacs-lisp
@@ -1994,10 +1987,6 @@ Can't remember atomic numbers? Enter [[elisp:(describe-package 'chemtable)][chem
See also the [[info:emacs#Amusements][built-in]] fun stuff.
-** Jammer
-
-TODO
-
** Go
😵 [[elisp:(describe-package 'gnugo)][gnugo]]
@@ -2073,7 +2062,7 @@ Alphapapa's Matrix client, [[elisp:(describe-package 'ement)][ement]]. Very usef
** Address Book
-TODO: [[elisp:(describe-package 'bbdb)][bbdb]]
+See: [[elisp:(describe-package 'bbdb)][bbdb]]
** Mastodon
diff --git a/init.el b/init.el
deleted file mode 100644
index 836d5bd..0000000
--- a/init.el
+++ /dev/null
@@ -1,885 +0,0 @@
-(setq gc-cons-threshold (* 50 1000 1000))
-
-(defun dnw/display-startup-time ()
- (message "Emacs loaded in %s with %d garbage collections."
- (format "%2f seconds"
- (float-time
- (time-subtract after-init-time before-init-time)))
- gcs-done))
-
-(add-hook 'emacs-startup-hook #'dnw/display-startup-time)
-
-;;(server-start)
-
-(global-set-key (kbd "C->") 'indent-rigidly-right-to-tab-stop)
-(global-set-key (kbd "C-<") 'indent-rigidly-left-to-tab-stop)
-
-(setq tab-always-indent 'complete)
-(setq align-to-tab-stop nil)
-
-;; default-frame-alist works with --daemon
-
-(add-to-list 'default-frame-alist
- '(font . "Iosevka-10"))
-
-(defun dnw/unicode-fonts ()
- (setf use-default-font-for-symbols nil)
- (set-fontset-font t 'unicode "Noto Emoji" nil 'append)
- (set-fontset-font t 'emoji "Noto Color Emoji"))
-
-(if (daemonp)
- (add-hook 'server-after-make-frame-hook #'dnw/unicode-fonts)
- (dnw/unicode-fonts))
-
-(setq inhibit-startup-message t)
-
-(menu-bar-mode -1)
-(tool-bar-mode -1)
-(scroll-bar-mode -1)
-(tooltip-mode -1)
-(set-fringe-mode 10)
-
-(column-number-mode)
-(global-display-line-numbers-mode t)
-
-;; Disable in e.g. shell
-(dolist (mode '(org-mode-hook
- term-mode-hook
- eshell-mode-hook
- Info-mode-hook
- ement-room-mode-hook
- elfeed-show-mode-hook
- pdf-mode-hook))
- (add-hook mode (lambda () (display-line-numbers-mode 0))))
-
-(set-frame-parameter (selected-frame) 'alpha '(100 100))
-
-(add-to-list 'default-frame-alist '(alpha 100 100))
-
-(require 'package)
-(setq package-archives '(("melpa" . "https://melpa.org/packages/")
- ("elpa" . "https://elpa.gnu.org/packages/")))
-
-(package-initialize)
-(unless package-archive-contents
- (package-refresh-contents))
-
-(eval-when-compile
- (require 'use-package))
-
-(setq use-package-always-ensure t)
-
-(add-to-list 'load-path "/home/dnw/Code/PyPHITS/phits-mode")
-(require 'phits-mode)
-
-(add-to-list 'auto-mode-alist '("\\.inp\\'" . phits-mode))
-(add-to-list 'auto-mode-alist '("\\.out\\'" . phits-mode))
-
-(use-package exec-path-from-shell
-
- :init
- (setq exec-path-from-shell-variables '("PATH" "MANPATH" "GUIX_PROFILE" "PHITSPATH"))
- (when (memq window-system '(mac ns x))
- (exec-path-from-shell-initialize)))
-
-(use-package no-littering)
-
-(setq auto-save-file-name-transforms
- `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
-
-(use-package vertico
- :init (vertico-mode)
- :custom (vertico-cycle t))
-
-(use-package corfu
- :custom (corfu-cycle t)
- :init (global-corfu-mode))
-
-;; (use-package kind-icon
-;; :ensure t
-;; :after corfu
-;; :custom
-;; (kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly
-;; :config
-;; (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
-
-;; Doesn't work :(
-
-(use-package orderless
- :init
- (setq completion-styles '(orderless)
- completion-category-defaults nil
- completion-category-overrides '((file (styles . (partial-completion))))))
-
-(use-package consult
- :bind (("C-s" . consult-line)
- ("C-r" . consult-history))
- :custom (completion-in-region-function #'consult-completion-in-region))
-
-(use-package marginalia
- :after vertico
- :custom
- (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
- :init (marginalia-mode))
-
-(use-package dabbrev
- :bind (("M-/" . dabbrev-completion)
- ("C-M-/" . dabbrev-expand)))
-
-(defun dnw/prompt-date ()
- (let ((date (read-string "Due date: "))
- (now (split-string (format-time-string "%e %B %Y" (current-time)))))
- (cond ((equal date "")
- (concat now))
- ((equal (substring date 0 1) "+")
- (concat (number-to-string (+ (string-to-number (car now))
- (string-to-number (substring date 1))))
- " "
- (cadr now)
- " "
- (caddr now)))
- ((= (length date) 2)
- (concat date
- " "
- (cadr now)
- " "
- (caddr now))))))
-
-(setq dnw/autoinsert-latex-presets
- '(("Physics" . (nil "\\documentclass{article}\n\n"
-
- "\\usepackage[letterpaper]{geometry}\n"
- "\\usepackage{tgpagella}\n"
- "\\usepackage{amsmath}\n"
- "\\usepackage{amssymb}\n"
- "\\usepackage{amsthm}\n"
- "\\usepackage{tikz}\n"
- "\\usepackage{minted}\n"
- "\\usepackage{physics}\n"
- "\\usepackage{siunitx}\n\n"
-
- "\\sisetup{detect-all}\n"
- "\\newtheorem{plm}{Problem}\n"
- "\\renewcommand*{\\proofname}{Solution}\n\n"
-
-
- "\\title{" (read-string "Title: ") "}\n"
- "\\author{Duncan Wilkie}\n"
- "\\date{" (dnw/prompt-date) "}\n\n"
-
- "\\begin{document}\n\n"
-
- "\\maketitle\n\n"
-
- -
-
- "\n\n\\end{document}"))
- ("Math" . (nil "\\documentclass{article}\n\n"
-
- "\\usepackage[letterpaper]{geometry}\n"
- "\\usepackage{tgpagella}\n"
- "\\usepackage{amsmath}\n"
- "\\usepackage{amssymb}\n"
- "\\usepackage{amsthm}\n"
- "\\usepackage{tikz}\n"
- "\\usepackage{minted}\n"
- "\\usepackage{physics}\n"
- "\\usepackage{siunitx}\n\n"
-
- "\\sisetup{detect-all}\n"
- "\\newtheorem{plm}{Problem}\n\n"
-
-
- "\\title{" (read-string "Title: ") "}\n"
- "\\author{Duncan Wilkie}\n"
- "\\date{" (dnw/prompt-date) "}\n\n"
-
- "\\begin{document}\n\n"
-
- "\\maketitle\n\n"
-
- -
-
- "\n\n\\end{document}"))
- ("Default" . ("options, RET: " "\\documentclass[" str & 93 | -1 123
- (read-string "class: ")
- "}\n"
- ("package, %s: " "\\usepackage["
- (read-string "options, RET: ")
- & 93 | -1 123 str "}\n")
- _ "\n\\begin{document}\n"
- _ "\n\\end{document}"))))
-
-(use-package autoinsert
- :hook (find-file . auto-insert)
- :init
- (setq auto-insert t)
- (setq auto-insert-query nil)
- (auto-insert-mode t)
- :config
- (assoc-delete-all 'latex-mode auto-insert-alist)
- (define-auto-insert 'latex-mode
- (lambda ()
- (let* ((presets (mapcar (lambda (pair) (car pair))
- dnw/autoinsert-latex-presets))
- (choice (completing-read "Preset:" presets)))
- (skeleton-insert (assoc choice dnw/autoinsert-latex-presets))))))
-
-(use-package helpful
- :commands (helpful-callable helpful-variable helpful-command helpful-key)
- :custom
- (counsel-describe-function-function #'helpful-callable)
- (counsel-describe-variable-function #'helpful-variable)
- :bind
- ([remap describe-function] . helpful-function)
- ([remap describe-command] . helpful-command)
- ([remap describe-variable] . helpful-variable)
- ([remap describe-key] . helpful-key))
-
-(use-package doom-modeline
- :ensure t
- :init (doom-modeline-mode 1))
-
-(use-package diminish)
-
-(use-package all-the-icons) ;; requires M-x all-the-icons-install-fonts on first load
-
-(use-package doom-themes
- :init (load-theme 'doom-tomorrow-night t))
-
-(use-package rainbow-delimiters
- :hook ((prog-mode . rainbow-delimiters-mode)
- (LaTeX-mode . rainbow-delimiters-mode)))
-
-(use-package smartparens
- :hook ((prog-mode . smartparens-mode)
- (LaTeX-mode . smartparens-mode)
- (org-mode . smartparens-mode))
- :config
- (require 'smartparens-latex))
-
-(use-package paren
- :config
- (set-face-attribute 'show-paren-match-expression nil :background "#363e4a")
- (show-paren-mode 1))
-
-(setq require-final-newline t)
-
-(use-package ws-butler
- :hook ((text-mode . ws-butler-mode)
- (prog-mode . ws-butler-mode)))
-
-(use-package which-key
- :defer 0
- :diminish which-key-mode
- :config
- (which-key-mode)
- (setq which-key-idle-delay 1))
-
-(defun dnw/org-mode-setup ()
- (org-indent-mode)
- (variable-pitch-mode 1)
- (visual-line-mode 1))
-
-(use-package org
- :commands (org-capture org-agenda)
- :hook (org-mode . dnw/org-mode-setup)
- :bind ("C-c C-x C-l" . org-latex-preview)
- :config
- (setq org-ellipsis " ▼")
- (setq org-latex-create-formula-image-program 'imagemagick))
-
-(use-package org-bullets
- :after org
- :hook (org-mode . org-bullets-mode))
-
-(with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.2)
- (org-level-2 . 1.1)
- (org-level-3 . 1.05)
- (org-level-4 . 1.0)
- (org-level-5 . 1.0)
- (org-level-6 . 1.0)
- (org-level-7 . 1.0)
- (org-level-8 . 1.0)))
- (set-face-attribute (car face) nil :font "Liberation Sans" :weight 'regular :height (cdr face)))
-
- (set-face-attribute 'fixed-pitch nil :font "Iosevka" :weight 'regular :height 1.0)
- (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
- (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
- (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
- (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
-
-(setq org-hide-emphasis-markers t)
-
-(use-package org-appear
- :hook (org-mode . org-appear-mode))
-
-(font-lock-add-keywords 'org-mode
- '(("^ *\\([-]\\) "
- (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
-
-(defun dnw/org-mode-visual-fill ()
- (setq visual-fill-column-width 170
- visual-fill-column-center-text t)
- (visual-fill-column-mode 1))
-
-(use-package visual-fill-column
- :hook (org-mode . dnw/org-mode-visual-fill))
-
-(with-eval-after-load 'org
- (org-babel-do-load-languages
- 'org-babel-load-languages
- '((emacs-lisp . t)
- (python . t)
- (fortran . t)
- (gnuplot t)
- (R . t)
- (sqlite . t)
- (haskell . t)
- (lua . t)
- (shell . t)
- (C . t)))
-
- (setq org-confirm-babel-evaluate nil)
-
- (require 'org-tempo)
-
- (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
- (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
- (add-to-list 'org-structure-template-alist '("py" . "src python3"))
- (add-to-list 'org-structure-template-alist '("ft" . "src fortran"))
- (add-to-list 'org-structure-template-alist '("gp" . "src gnuplot"))
- (add-to-list 'org-structure-template-alist '("sql" . "src sqlite"))
- (add-to-list 'org-structure-template-alist '("r" . "src R"))
- (add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
- (add-to-list 'org-structure-template-alist '("lu" . "src lua"))
- (add-to-list 'org-structure-template-alist '("sys" . "src C")))
-
-(defun dnw/org-babel-tangle-config ()
- (when (string-equal (buffer-file-name)
- (expand-file-name "~/.emacs.d/config.org"))
-
- (let ((org-confirm-babel-evaluate nil))
- (org-babel-tangle))))
-
-(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'dnw/org-babel-tangle-config)))
-
-(use-package org-roam
- :ensure t
- :init
- (setq org-roam-v2-ack t)
- :custom
- (org-roam-directory "/home/dnw/Roam")
- (org-roam-completion-everywhere t)
- (org-roam-db-node-include-function
- (defun dnw/org-roam-include ()
- (not (member "drill" (org-get-tags)))))
- (org-roam-capture-templates
- '(("d" "default" plain
- "%?"
- :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
- :unnarowed t)
- ("i" "idea" plain
- "* Motivation\n\n%?\n\n* Similar Work\n\n* Feasibility\n\n* Implementation"
- :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Idea")
- :unnarrowed t)
- ("p" "project" plain
- "* Description\n\n%?\n\n** Collaborators\n\n** Stack\n\n* Tasks"
- :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Project")
- :unnarrowed t)
- ("a" "article" plain
- "* Summary\n\n%?\n\n* Context"
- :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Article")
- :unnarrowed t)
- ("m" "musing" plain
- "* %?"
- :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Musing")
- :unnarrowed t)))
- :bind (("C-c n l" . org-roam-buffer-toggle)
- ("C-c n f" . org-roam-node-find)
- ("C-c n i" . org-roam-node-insert)
- :map org-mode-map
- ("C-M-i" . completion-at-point))
- :config
- (org-roam-db-autosync-mode))
-
-(use-package org-drill)
-
-(use-package org-present)
-
-(use-package dired
- :ensure nil
- :commands (dired dired-jump)
- :bind (("C-x C-j" . dired-jump))
- :custom ((dired-listing-switches "-ahgo --group-directories-first")))
-
-(use-package dired-single
- :after dired)
-
-(use-package all-the-icons-dired
- :hook (dired-mode . all-the-icons-dired-mode))
-
-(use-package lsp-mode
- :commands (lsp lsp-deferred)
- :hook
- ((c-mode) . lsp)
- ((LaTeX-mode) . lsp)
- (lsp-completion-mode . dnw/lsp-completion)
- :init
- (setq lsp-keymap-prefix "C-c l")
- (defun dnw/lsp-completion ()
- (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
- '(orderless)))
- :config
- (lsp-enable-which-key-integration t)
- :custom
- (lsp-completion-provider :none))
-
-(use-package lsp-ui
- :hook (lsp-mode . lsp-ui-mode)
- :custom
- (setq lsp-ui-doc-position 'bottom))
-
-
-(use-package flycheck
- :defer t
- :hook (lsp-mode . flycheck-mode))
-
-;; (use-package company
-;; :after lsp-mode
-;; :hook (prog-mode . company-mode)
-;; :bind
-;; (:map company-active-map
-;; ("<tab>" . company-complete-selection))
-;; (:map lsp-mode-map
-;; ("<tab>" . company-indent-or-complete-common))
-;; :custom
-;; (company-minimum-prefix-length 1)
-;; (company-idle-delay 0.0))
-
-;; (eval-after-load 'company
-;; '(add-to-list
-;; 'company-backends '(company-irony-c-headers
-;; company-irony
-;; company-rtags)))
-
-
-;; (use-package company-box
-;; :hook (company-mode . company-box-mode))
-
-;; (use-package projectile
-;; :diminish projectile-mode
-;; :config (projectile-mode)
-;; :custom ((projectile-completion-system 'ivy))
-;; :bind-keymap
-;; ("C-c p" . projectile-command-map)
-;; :init
-;; (when (file-directory-p "~")
-;; (setq projectile-project-search-path '("~")))
-;; (setq projectile-switch-project-action #'projectile-dired))
-
-;; (use-package counsel-projectile
-;; :config (counsel-projectile-mode))
-
-(use-package magit
- :commands (magit-status magit-get-current-branch)
- :custom
- (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
-
-;; (use-package yasnippet
-;; :hook ((prog-mode LaTeX-mode) . yas-minor-mode)
-;; :config
-;; (yas-reload-all))
-
-;; (use-package yasnippet-snippets)
-
-(use-package tex
- :ensure auctex
- :config
- (setq TeX-auto-save t)
- (setq TeX-parse-self t)
- (setq-default TeX-master t)
- (setq LaTeX-command "latex -shell-escape")
- (add-hook 'LaTeX-mode-hook 'visual-line-mode)
- (add-hook 'LaTeX-mode-hook 'flyspell-mode)
- (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
- (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
- (setq reftex-plug-into-AUCTeX t)
- (setq TeX-view-program-selection '((output-pdf "Zathura")))
- (setq TeX-electric-sub-and-superscript t))
-
-;; Done from Guix
-;; (pdf-loader-install)
-;; (use-package pdf-tools
-;; :init
-;; (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
-;; (pdf-loader-install))
-
-(use-package term
- :commands term
- :config
- (setq explicit-shell-file-name "zsh"))
-
-(use-package eterm-256color
- :hook (term-mode . eterm-256color-mode))
-
-(defun dnw/prompt-prefix ()
- (let ((guess (apply
- 'concat
- (-map
- (lambda (x)
- (if (string= x "dnw")
- "~/"
- (concat x "/")))
- (seq-subseq
- ;; extra ""'s are to prevent slicing errors
- (cons "" (cons "" (split-string (eshell/pwd) "/")))
- -2)))))
- (if (string= guess "home/~/")
- "~"
- (string-remove-suffix "/" guess))))
-
-(remove-hook 'eshell-output-filter-functions
- 'eshell-postoutput-scroll-to-bottom)
-
-(defun dnw/prompt ()
- (concat
- (propertize
- (dnw/prompt-prefix)
- 'font-lock-face '(:foreground "#4068A3"))
- (propertize " ᛋ" 'font-lock-face '(:foreground "#CB77F9"))
- (propertize " " 'font-lock-face "default")))
-
-(setq eshell-prompt-regexp "^[^ᛋ\n]* ᛋ ")
-
-(setq eshell-highlight-prompt nil
- eshell-prompt-function #'dnw/prompt)
-
-(setq eshell-banner-message "We will reinvent the wheel. They used triangles. 🗿\n\n")
-
-;; (add-to-list eshell-visual-subcommands '("guix" "search"))
-;; (add-to-list eshell-visual-subcommands '("guix" "install"))
-;; (add-to-list eshell-visual-subcommands '("guix" "remove"))
-
-(setq eshell-destroy-buffer-when-process-dies t)
-
-(setq eshell-prefer-lisp-functions t)
-(setq eshell-prefer-lisp-variables t)
-
-;; (use-package notmuch
-;; :config
-;; (setq mail-user-agent 'message-user-agent)
-;; (setq user-mail-address "antigravityd@gmail.com"
-;; user-full-name "Duncan Wilkie")
-;; (setq smtpmail-smtp-server "smtp.gmail.com"
-;; message-mail-send-function 'message-smtpmail-send-it)
-;; (setq smtpmail-debug-info t)
-;; (setq message-default-mail-headers "Cc: \nBcc: \n")
-;; (setq message-auto-save-directory "~/.mail/drafts")
-;; (setq message-kill-buffer-on-exit t)
-;; (setq message-directory "~/.mail/sent")
-;; (setq message-signature "-Duncan Wilkie"))
-
-;; (require 'mu4e)
-
-;; (setq mail-user-agent 'mu4e-user-agent)
-;; (setq mu4e-get-mail-command "mbsync -a")
-
-;; (setq user-full-name "Duncan Wilkie")
-;; (setq mu4e-compose-signature "-Duncan Wilkie")
-
-;; (setq message-kill-buffer-on-exit t)
-
-;; (require 'smtpmail)
-
-;; (setq message-send-mail-function 'smtpmail-send-it)
-
-;; ;;; Call the oauth2ms program to fetch the authentication token
-;; (defun fetch-access-token ()
-;; (with-temp-buffer
-;; (call-process "oauth2ms" nil t nil "--encode-xoauth2")
-;; (buffer-string)))
-
-;; ;;; Add new authentication method for xoauth2
-;; (cl-defmethod smtpmail-try-auth-method
-;; (process (_mech (eql xoauth2)) user password)
-;; (let* ((access-token (fetch-access-token)))
-;; (smtpmail-command-or-throw
-;; process
-;; (concat "AUTH XOAUTH2 " access-token)
-;; 235)))
-
-;; ;;; Register the method
-;; (with-eval-after-load 'smtpmail
-;; (add-to-list 'smtpmail-auth-supported 'xoauth2))
-
-;; (setq message-send-mail-function 'smtpmail-send-it
-;; smtpmail-default-smtp-server "smtp.example.com"
-;; smtpmail-smtp-server "smtp.example.com"
-;; smtpmail-stream-type 'starttls
-;; smtpmail-smtp-service 587)
-
-;; (setq mu4e-contexts
-;; `(,(make-mu4e-context
-;; :name "Personal Gmail"
-;; :enter-func (lambda () (mu4e-message "Switching to Personal Gmail..."))
-;; :match-func (lambda (msg)
-;; (when msg
-;; (string-match-p "/gmail-personal" (mu4e-message-field msg :maildir))))
-;; :vars '((user-mail-address . "antigravityd@gmail.com") ;; set up example Gmail config from manual
-;; (mu4e-drafts-folder . "/gmail-personal/[Gmail].Drafts")
-;; (mu4e-sent-folder . "/gmail-personal/[Gmail].Sent Mail")
-;; (mu4e-trash-folder . "/gmail-personal/[Gmail].Trash")
-;; (mu4e-sent-messages-behavior . delete)
-;; (assoc 'mu4e-maildir-shortcuts '((:maildir "/gmail-personal/Inbox" :key ?i)
-;; (:maildir "/gmail-personal/[Gmail].Sent Mail" :key ?s)
-;; (:maildir "/gmail-personal/[Gmail].Trash" :key ?t)
-;; (:maildir "/gmail-personal/[Gmail].All Mail" :key ?a)))
-;; (starttls-use-gnutls . t)
-;; (assoc smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
-;; (assoc smtpmail-auth-credentials '(("smtp.gmail.com" 587 "antigravityd@gmail.com" nil)))
-;; (smtpmail-smtp-server . "smtp.gmail.com")
-;; (smtpmail-smtp-service . 587)))
-;; ,(make-mu4e-context
-;; :name "LSU"
-;; :enter-func (lambda () (mu4e-message "Switching to LSU email..."))
-;; :match-func (lambda (msg)
-;; (when msg
-;; (string-match-p "/lsu" (mu4e-message-field msg :maildir))))
-;; :vars '((user-mail-address . "dwilk14@lsu.edu")
-;; (smtpmail-smtp-server . "smtp-mail.outlook.com")
-;; (smtpmail-stream-type . starttls)
-;; (smtpmail-smtp-service . 587)))))
- ;; `(make-mu4e-context
- ;; :name "Professional Gmail"
- ;; :enter-func (lambda () (mu4e-message "Switching to Professional Gmail..."))
- ;; :match-func (lambda (msg)
- ;; (when msg
- ;; (string= (mu4e-message-field msg :maildir) "/gmail-professional")))
- ;; :vars '((user-mail-address . "duncannwilkie@gmail.com")
- ;; (user-full-name . "Duncan Wilkie")
- ;; (mu4e-compose-signature . "-Duncan Wilkie")))
- ;; `(make-mu4e-context
- ;; :name "Lab"
- ;; :enter-func (lambda () (mu4e-message "Switching to Lab email..."))
- ;; :match-func (lambda (msg)
- ;; (when msg
- ;; (string= (mu4e-message-field msg :maildir) "/lab")))
- ;; :vars '((user-mail-address . "duncan@spartanphysics.com")
- ;; (user-full-name . "Duncan Wilkie")
- ;; (mu4e-compose-signature . "-Duncan Wilkie")))
-
-(setq user-mail-address "antigravityd@gmail.com"
- user-full-name "Duncan Wilkie")
-
-(setq gnus-select-method '(nnimap "gmail"
- (nnimap-address "imap.gmail.com")
- (nnimap-server-port "imaps")
- (nnimap-stream ssl)))
-(setq smtpmail-smtp-server "smtp.gmail.com"
- smtpmail-smtp-service 587
- gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
-
-(setq
- erc-nick "FlaminWalrus"
- erc-user-full-name "Duncan W")
-
-(global-set-key (kbd "C-c e")
- (lambda ()
- (interactive)
- (erc-tls :server "irc.libera.chat"
- :port "6697")))
-
-;; (package-install 'quelpa-use-package)
-;; (require 'quelpa-use-package)
-
-;; (use-package plz
-;; :quelpa (plz :fetcher github :repo "alphapapa/plz.el"))
-
-;; (use-package plz
-;; :quelpa (plz :fetcher github :repo "alphapapa/plz.el"))
-
-;; (use-package ement
-;; :quelpa (ement :fetcher github :repo "alphapapa/ement.el"))
-
-(defun dnw/elfeed-show-mode-visual-fill ()
- (setq visual-fill-column-width 130
- visual-fill-column-center-text t)
- (visual-fill-column-mode 1))
-
-(defun dnw/render-latex ()
- (let ((current-prefix-arg '(2)))
- (switch-to-buffer "*elfeed-entry*")
- (call-interactively 'org-latex-preview)))
-
-(use-package elfeed
- :hook ((elfeed-show-mode . dnw/elfeed-show-mode-visual-fill))
- :config
- (setq elfeed-db-directory (expand-file-name "elfeed" user-emacs-directory)
- elfeed-show-entry-switch 'display-buffer)
- (setq elfeed-feeds
- '("http://feeds.aps.org/rss/allsuggestions.xml" ;; Physics
- "http://feeds.aps.org/rss/recent/rmp.xml"
-
- "https://lexi-lambda.github.io/feeds/all.rss.xml" ;; CS
- "https://blog.functorial.com/feed.rss"
-
- "https://www.ams.org/rss/jams.rss"
- "https://jaireetschahal.substack.com/feed" ;; Math
- "https://golem.ph.utexas.edu/category/atom10.xml"
- "https://homotopytypetheory.org/feed/"
-
- "https://notrelated.xyz/rss" ;; Misc
- ))
- :bind
- ("C-x w" . elfeed ))
-
-
-;; doesn't function. It'd be really nice to configure this from this orgfile
-;; (use-package elfeed-org
-;; :config
-;; (setq elfeed-show-entry-switch 'display-buffer)
-;; (setq rmh-elfeed-org-files (list "/home/dnw/.emacs.d/feeds.org")))
-
-;;(use-package bison-mode)
-(add-to-list 'auto-mode-alist '("\\.g4\\'" . c-mode))
-
-(use-package haskell-mode
- :bind ("C-c C-h" . hoogle)) ;; figure out how to defer loading until .hs is opened?
-
-;; TRAMP can't find necessary binaries on Guix machines without this after Emacs 28
-(add-to-list 'tramp-remote-path "/run/current-system/profile/bin")
-
-(setq Info-use-header-line nil)
-
-(setq markdown-command "pandoc")
-
-(use-package emms
- :config
- (emms-all)
- (add-to-list 'emms-player-list 'emms-player-mpd)
- :bind
- ("<XF86AudioPlay>" . emms-start)
- ("<XF86AudioPause>" . emms-pause)
- ("<XF86AudioNext>" . emms-next)
- ("<XF86AudioNext>" . emms-previous))
-
-(add-hook 'xhtml-mode-hook (lambda () (call-interactively 'shr-render-buffer)))
-
-(use-package gnuplot)
-
-(require 'exwm-xim)
-(require 'exwm-randr)
-(require 'exwm-systemtray)
-
-(defun dnw/exwm-config ()
- "My configuration of EXWM, adapted from the example."
- ;; Set the initial workspace number.
- (unless (get 'exwm-workspace-number 'saved-value)
- (setq exwm-workspace-number 4))
- ;; Make class name the buffer name
- (add-hook 'exwm-update-class-hook
- (lambda ()
- (exwm-workspace-rename-buffer exwm-class-name)))
- (setq exwm-randr-workspace-output-plist '(1 "VGA1" 2 "VGA1" 3 "VGA1"))
- (add-hook 'exwm-randr-screen-change-hook
- (lambda ()
- (start-process-shell-command
- "xrandr" nil "xrandr --output VGA1 --left-of LVDS1 --auto")))
-
- ;; Global keybindings.
- (unless (get 'exwm-input-global-keys 'saved-value)
- (setq exwm-input-global-keys
- `(
- ;; 's-r': Reset (to line-mode).
- ([?\s-r] . exwm-reset)
- ;; 's-w': Switch workspace.
- ([?\s-w] . exwm-workspace-switch)
- ;; 's-p': Launch application.
- ([?\s-p] . (lambda (command)
- (interactive (list (read-shell-command "$ ")))
- (start-process-shell-command command nil command)))
- ;; 's-P': retrieve a password from password store
- ([?\s-P] . password-store-copy)
- ;; 's-N': Switch to certain workspace.
- ,@(mapcar (lambda (i)
- `(,(kbd (format "s-%d" i)) .
- (lambda ()
- (interactive)
- (exwm-workspace-switch-create ,i))))
- (number-sequence 0 9)))))
- ;; Line-editing shortcuts
- (unless (get 'exwm-input-simulation-keys 'saved-value)
- (setq exwm-input-simulation-keys
- '(([?\C-b] . [left])
- ([?\C-f] . [right])
- ([?\C-p] . [up])
- ([?\C-n] . [down])
- ([?\C-a] . [home])
- ([?\C-e] . [end])
- ([?\M-v] . [prior])
- ([?\C-v] . [next])
- ([?\C-s] . [C-f])
- ([?\C-d] . [delete])
- ([?\C-g] . [ESC])
- ([?\M-b] . [C-left])
- ([?\M-f] . [C-right])
- ([?\C-k] . [S-end delete])
- ([?\C-w] . [C-x])
- ([?\M-w] . [C-c])
- ([?\C-y] . [C-v])
- ([?\C-/] . [C-z])
- ([?\C-x ?h] . [C-a]))))
- ;; Enable EXWM
- (exwm-enable)
- (exwm-xim-enable)
- (exwm-randr-enable)
- (exwm-systemtray-enable)
- (push ?\C-\\ exwm-input-prefix-keys))
-
-(use-package exwm
- :config (dnw/exwm-config))
-
-(use-package password-store
- :config (pinentry-start))
-
-(use-package exwm-edit)
-
-(use-package eww
- :config
- (setq browse-url-browser-function 'eww-browse-url)
- (setq eww-search-prefix "https://librex.devol.it/search.php?q=")
- (setq dnw/eww-auto-readable-blacklist '("https://librex.devol.it"))
-
- (defun dnw/eww-auto-readable ()
- (if (seq-some (lambda (bl) (string-prefix-p bl (eww-current-url)))
- dnw/eww-auto-readable-blacklist)
- nil
- (eww-readable)))
-
- (defun dnw/eww-unreadable ()
- (interactive)
- (let ((hook eww-after-render-hook))
- (setq eww-after-render-hook nil)
- (eww-reload t)
- (setq eww-after-render-hook hook))))
-
- ;; (add-hook 'eww-after-render-hook #'dnw/eww-auto-readable)
- ;; :hook (eww-after-render-hook . dnw/eww-auto-readable) this, for some reason, doesn't work
- ;; :bind ("U" . dnw/eww-unreadable)
-
-(use-package lean-mode)
-
-(use-package company-lean)
-
-(use-package racket-mode)
-
-(use-package geiser
- :config (require 'geiser-guile))
-
-(with-eval-after-load 'quail (defun quail-completion ()))
-
-(setq gc-cons-threshold (* 2 1000 1000))
diff --git a/pam_usb.conf b/pam_usb.conf
new file mode 100644
index 0000000..0ad4f67
--- /dev/null
+++ b/pam_usb.conf
@@ -0,0 +1,97 @@
+<?xml version="1.0" ?><!--
+pam_usb.conf: Configuration file for pam_usb.
+
+See https://github.com/mcdope/pam_usb/wiki/Configuration
+--><configuration>
+ <!-- Default options -->
+ <defaults>
+ <!-- Example:
+ <option name="debug">true</option>
+ <option name="deny_remote">true</option>
+ -->
+ <!-- <option name="quiet">true</option> -->
+ </defaults>
+
+ <!-- Device settings -->
+ <devices>
+ <!-- Example:
+ Note: You should use pamusb-conf to add devices automatically.
+ <device id="MyDevice">
+ <vendor>SanDisk Corp.</vendor>
+ <model>Cruzer Titanium</model>
+ <serial>SNDKXXXXXXXXXXXXXXXX</serial>
+ <volume_uuid>6F6B-42FC</volume_uuid>
+ <option name="probe_timeout">10</option>
+ </device>
+ -->
+<device id="secrets-userauth">
+ <vendor>SanDisk</vendor>
+ <model>Ultra USB 3.0</model>
+ <serial>0101d8fb9229fee00501eaa0ec26e7148f771e8fda8c1fa162378e9cbd975560dc4c00000000000000000000282bf233009120009155810741a77293</serial>
+ <volume_uuid>4b11a4e4-140f-4d98-92a4-28219fc7eb63</volume_uuid>
+</device></devices>
+
+
+ <!-- User settings -->
+ <users>
+ <!-- Note: Use pamusb-conf to add a user, then you can tweak
+ manually the configuration here if needed.
+ -->
+
+ <!-- Example:
+ Authenticate user scox using "MyDevice", and configure pamusb-agent
+ to automatically start/stop gnome-screensaver on key insertion and
+ removal:
+ <user id="scox">
+ <device>MyDevice</device>
+ <option name="quiet">true</option>
+ <agent event="lock">
+ <cmd>gnome-screensaver-command -\-lock</cmd>
+ <env>DISPLAY=:1</env>
+ <env>DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus</env>
+ <env>XAUTHORITY=/run/user/1000/gdm/Xauthority</env>
+ </agent>
+ <agent event="unlock">
+ <cmd>gnome-screensaver-command -\-deactivate</cmd>
+ <env>DISPLAY=:1</env>
+ <env>DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus</env>
+ <env>XAUTHORITY=/run/user/1000/gdm/Xauthority</env>
+ </Agent>
+ </user>
+
+ Configure user root to authenticate using MyDevice, but update one
+ time pads at every login (default is 1 hour):
+ <user id="root">
+ <device>MyDevice</device>
+ <option name="pad_expiration">0</option>
+ </user>
+ -->
+ <user id="dnw">
+ <device>secrets-userauth</device>
+ <agent event="lock">
+ <env>XSECURELOCK_AUTHPROTO=authproto_pam</env>
+ <env>XSECURELOCK_PAM_SERVICE=system-auth</env>
+ <env>XSECURELOCK_PASSWORD_PROMPT=time_hex</env>
+ <env>DISPLAY=:0.0</env> <!-- Possibly flaky. -->
+ <env>XAUTHORITY=/home/dnw/.Xauthority</env>
+ <cmd>xsecurelock</cmd>
+ </agent>
+</user></users>
+
+ <!-- Services settings (e.g. gdm, su, sudo...) -->
+ <services>
+ <!-- Example: Speed up hotplugging by disabling one time pads -->
+ <!--
+ <service id="pamusb-agent">
+ <option name="one_time_pad">false</option>
+ </service>
+ -->
+
+ <!-- Disable output for 'su' (needed for gksu) -->
+ <!--
+ <service id="su">
+ <option name="quiet">true</option>
+ </service>
+ -->
+ </services>
+</configuration>
diff --git a/system-auth b/system-auth
index 81f5aed..70a188e 100644
--- a/system-auth
+++ b/system-auth
@@ -1,6 +1,6 @@
#%PAM-1.0
-auth required pam_faillock.so preauth
+auth requisite pam_faillock.so preauth
# Optionally use requisite above if you do not want to prompt for the password
# on locked accounts.
-auth [success=2 default=ignore] pam_systemd_home.so