From a7ca56f5fa9ba7a760d4c21ecf68b66ec2b2db80 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 16 Nov 2022 22:41:49 -0800 Subject: [PATCH] Add a start of my literate programming configuration --- config/index.org | 79 ++++++++++++++++++++++++++++++++++++++++ guix.org | 2 + index.org | 4 ++ literate-programming.org | 15 ++++++++ 4 files changed, 100 insertions(+) create mode 100644 config/index.org create mode 100644 guix.org create mode 100644 literate-programming.org diff --git a/config/index.org b/config/index.org new file mode 100644 index 0000000..aa1493b --- /dev/null +++ b/config/index.org @@ -0,0 +1,79 @@ +#+title: Oni Machine Interface +#+subtitle: My Literate Machine Configuration +#+options: num:nil + +This is my latest attempt at a literate configuration. + +#+begin_note +This is in the very early stages of an attempt to do this. And usually I get frustrated and give up quite early on. I'll try and get small bits and pieces in here one at a time. +#+end_note + + +# * TODO Write a config.scm that tangles this file and loads the result + +# * TODO Make all of this tangle into an actual file + +* Environment + +This is a random assortment of environment variables that I like to have defined for various reasons. + +The =LESS= environment variable specifies the default command-line arguments to pass in to =less= whenever it is run. I've gotten quite used to these: + +#+ATTR_HTML: :class short-dl +- =F= :: Causes =less= to exit right away when there is less than one screen of text to display. +- =X= :: Prevents the screen from being cleared away when =less= exits (it does more, but this is why I use it) +- =R= :: Displays ANSI color escape sequences to be rendered as normal, instead of as readable characters. In other words it lets =less= display colored text instead of displaying escape sequences. +- =S= :: Truncates long lines instead of wrapping them. Makes it easier for me to read. +- =i= :: This causes any searches using =/= to become case-insensitive so that the search term “done” will match “done”, “Done”, “DONE”, and any other combination of upper- and lowercase letters. + +#+begin_src scheme :noweb-ref environment-variables + ("LESS" . "FXRSi") +#+end_src + +I use the =MY_GUIX_CONFIGURED= just as an indication that [[file:../guix.org][Guix]] home actually configured my user profile. It's not actually necessary for anything. + +#+begin_src scheme :noweb-ref environment-variables + ("MY_GUIX_CONFIGURED" . "1") +#+end_src + +This opts out of sending any telemetry to Microsoft whenever I play around with any .Net things. + +#+begin_src scheme :noweb-ref environment-variables + ("DOTNET_CLI_TELEMETRY_OPTOUT" . "1") +#+end_src + +Turn on dark-mode for Calibre. I prefer dark mode everywhere. + +#+begin_src scheme :noweb-ref environment-variables + ("CALIBRE_USE_DARK_PALETTE" . "1") +#+end_src + +Because I use [[file:../guix.org][Guix]] on top of another distribution, this variable needs to be set in order for locales to work properly for both package installed through Guix and ones installed by the host distribution. + +#+begin_src scheme :noweb-ref environment-variables + ("GUIX_LOCPATH" . "$HOME/.guix-home/profile/lib/locale") +#+end_src + +Again because I use Guix on top of another distribution this variable ensures that the things I have stored away in my usual data directory get included, not just the ones Guix defines. + +#+begin_src scheme :noweb-ref environment-variables + ("XDG_DATA_DIRS" + . "${XDG_DATA_DIRS}${XDG_DATA_DIRS:+:}/usr/local/share:/usr/share") +#+end_src + +I was working with =git= recently, splitting some utilities out into their own repository from a bigger repository using =filter-branch=. Apparently =filter-branch= has been deprecated because it's easy to make mistakes and there's better alternatives now. But =filter-branch= is what I know and my needs are simple, so I disable that warning. + +#+begin_src scheme :noweb-ref environment-variables + ("FILTER_BRANCH_SQUELCH_WARNING" . "1") +#+end_src + +Putting it all together to define the service for my home configuration. + +#+begin_src scheme :noweb yes + (define oni-environment-servicee + (simple-service + 'home-environment-service + home-environment-variables-service-type + '( + <>))) +#+end_src diff --git a/guix.org b/guix.org new file mode 100644 index 0000000..ffdfd97 --- /dev/null +++ b/guix.org @@ -0,0 +1,2 @@ +#+title: Guix +#+subtitle: The Emacs of Distros diff --git a/index.org b/index.org index 1a69747..6504def 100644 --- a/index.org +++ b/index.org @@ -21,6 +21,10 @@ I really want to just write, even if it isn't useful for anyone. I have a [[http The first topic I pay any attention to of course has to be [[file:emacs.org][Emacs]]. I write all the content for this site in Emacs, I try to work as much as I can in Emacs, and I have a couple of small contributions to Emacs. My blog features a [[https://blog.ryuslash.org/tags/emacs][tag]] about it, specifically with its own [[https://blog.ryuslash.org/feed/atom?with=emacs][feed]] you can subscribe to, in case that’s the only thing you’re interested in. +* My literate configuration + +Every so often I get really drawn to remaking my entire configuration into a [[file:literate-programming.org][Literate Programming]] style. See my [[file:config/index.org][latest attempt]]. + * Topics - [[file:projects.org][Projects]] diff --git a/literate-programming.org b/literate-programming.org new file mode 100644 index 0000000..da7c598 --- /dev/null +++ b/literate-programming.org @@ -0,0 +1,15 @@ +#+title: Literate Programming + +In literate programming the goal is to write your program as you would write a book. Or to see it another way, you write the documentation first, and then the implementation in it. Or another way, you make your documentation executable. It lets us focus on the /why/ of the code before the what. + +The idea is that + +Here is a video that talks about what literate programming is: + +#+begin_export html + +#+end_export + +Some example projects that do this: + +- The books “Implementing Elliptic Curve Cryptography” and “Lisp in Small Pieces” are supposed to have been written as literate programs.