Restructure website, start writing
This commit is contained in:
parent
8216f2dc83
commit
3c06769ea9
5 changed files with 3673 additions and 68 deletions
77
emacs/package-based-configuration.org
Normal file
77
emacs/package-based-configuration.org
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
#+TITLE: Package-based Configuration
|
||||||
|
#+SUBTITLE: Let's get crazy!
|
||||||
|
#+OPTIONS: num:nil
|
||||||
|
#+STARTUP: showall
|
||||||
|
#+HTML_LINK_UP: ..
|
||||||
|
#+HTML_LINK_HOME: ..
|
||||||
|
|
||||||
|
I've been using a configuration based on using =package.el= to manage loading, installing, and configuring packages.
|
||||||
|
|
||||||
|
* Motivation
|
||||||
|
|
||||||
|
I've been configuring Emacs since around 2008. My configuration has grown quite a bit since I first started. I've been working in multiple languages, I've used multiple completion methods, and I've tried multiple ways of keeping my configuration in check.
|
||||||
|
|
||||||
|
For a long time I was using a git repository that contained all of my configuration. I tried my best to set everything up with autoloads and everything, and it worked well once everything was installed, but installing it on a new machine was a bit of a pain.
|
||||||
|
|
||||||
|
#+begin_src dot :exports results :file git-config-workflow.svg
|
||||||
|
digraph {
|
||||||
|
graph [bgcolor="#111114"]
|
||||||
|
node [color="#bfbfbf", fontcolor="#bfbfbf", fontname="sans-serif"]
|
||||||
|
edge [color="#bfbfbf", fontcolor="#bfbfbf", fontname="sans-serif"]
|
||||||
|
label="Installing my configuration on a new machine"
|
||||||
|
fontcolor="#bfbfbf"
|
||||||
|
fontname="sans-serif"
|
||||||
|
|
||||||
|
node[shape="box", style="rounded"]
|
||||||
|
"git clone";
|
||||||
|
work;
|
||||||
|
node[shape="parallelogram", style=""]
|
||||||
|
make; "install package"; "run Emacs";
|
||||||
|
node[shape="diamond", style=""]
|
||||||
|
compiletime[label="missing\ncompile-time\npackage?"];
|
||||||
|
runtime[label="missing\nrun-time\npackage?"];
|
||||||
|
|
||||||
|
"git clone" -> make -> compiletime;
|
||||||
|
"install package" -> make;
|
||||||
|
compiletime -> "install package"[label="yes"];
|
||||||
|
compiletime -> "run Emacs"[label="no"];
|
||||||
|
"run Emacs" -> runtime;
|
||||||
|
runtime -> "install package"[label="yes"];
|
||||||
|
runtime -> "work"[label="no"];
|
||||||
|
"work" -> runtime
|
||||||
|
|
||||||
|
{rank=same; make "install package"}
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
(Apologies if this is a terrible excuse for a flowchart, I don't usually make any) I would clone my git repository, run make to byte-compile my configurations. During byte-compilation it would complain about being unable to load a certain package. Then I'd start Emacs without my configuration and install the package, run make again until and repeat until make finished without errors. Then I'd start Emacs and it would complain about being unable to load other packages. I'd install this package, restart Emacs, and repeat /this/ process until Emacs stopped complaining. That didn't necessarily mean that everything was fine, I might run into other packages that were missing later on.
|
||||||
|
|
||||||
|
This was frustrating. I wanted something more flexible and easier to install.
|
||||||
|
|
||||||
|
* A New Configuration
|
||||||
|
|
||||||
|
I had this crazy thought one day that I could use =package.el= to manage my configuration /and/ do fun things like run all kinds of tests on my configuration to make sure that everything still works as I expect it to. Even just for my configuration this has helped me prevent having to spend time during work to fix certain issues.
|
||||||
|
|
||||||
|
My new installation method consists of evaluating a little bit of code:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(add-to-list 'package-archives '("oni" . "https://ryuslash.org/elpa/"))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Once this is done I install =oni-package= so that all the repositories that I use get added, and then I can just install each configuration as I want it. If I'm writing Python on this machine, I can install =oni-python=. This will install Yasnippet, Company, Flycheck, Lsp, etc.
|
||||||
|
|
||||||
|
It does this just through regular package dependencies. In the =oni-python= package definition I have just any old =Package-Requires= line:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
;; Package-Requires: (oni-yasnippet oni-company oni-fci oni-flycheck oni-hydra oni-lsp rainbow-delimiters reformatter traad)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
The =oni-= prefixed packages are my configuration for those particular modes. Because Company and friends are big enough projects that they'll have their own configuration that I want to include whenever I use that package.
|
||||||
|
|
||||||
|
* Autoloading magic
|
||||||
|
|
||||||
|
In order to allow me to just download the package and have my configuration work, I abuse the autoloading mechanism. The autoload cookie will add whatever form you put after it into the package autoloads file. There are certain forms (like =defun=) that add a special form to the autoloads file which is just enough to get things set up if it's called, but most forms are just copied over.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
;;;###autoload(with-eval-after-load 'python (require 'oni-python))
|
||||||
|
#+end_src
|
18
index.org
Normal file
18
index.org
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#+TITLE: ryuslash
|
||||||
|
#+SUBTITLE: Vae Victis, dood!
|
||||||
|
#+OPTIONS: toc:nil num:nil
|
||||||
|
#+STARTUP: showall
|
||||||
|
|
||||||
|
This is the website of Tom Willemse. I'm a software developer.
|
||||||
|
|
||||||
|
* Gardening
|
||||||
|
|
||||||
|
After reading [[https://joelhooks.com/digital-garden][this post]] I'm fascinated by the idea of seeing my website as a digital garden. As opposed to a newspaper where people come and find out all the latest news about what I've been up to. I have no interest in providing a news service.
|
||||||
|
|
||||||
|
I really want to just write, even if it isn't useful for anyone.
|
||||||
|
|
||||||
|
* Emacs
|
||||||
|
|
||||||
|
The first topic I pay any attention to of course has to be 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.
|
||||||
|
|
||||||
|
- [[file:emacs/package-based-configuration.org][Package-based configuration]]
|
95
publish.el
95
publish.el
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'ox-publish)
|
|
||||||
(require 'ox-rss)
|
|
||||||
(require 'subr-x)
|
|
||||||
(require 'dockerfile-mode)
|
(require 'dockerfile-mode)
|
||||||
|
(require 'ob-dot)
|
||||||
|
(require 'ox-publish)
|
||||||
(require 'rainbow-delimiters)
|
(require 'rainbow-delimiters)
|
||||||
|
(require 'subr-x)
|
||||||
|
|
||||||
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
||||||
|
|
||||||
|
@ -43,88 +43,47 @@
|
||||||
time
|
time
|
||||||
(if (= time 1) "" "s")))
|
(if (= time 1) "" "s")))
|
||||||
|
|
||||||
(defun publish-org-sitemap (title list)
|
|
||||||
"Create a site map file. TITLE is used as the title, LIST is turned into a subtree."
|
|
||||||
(concat "#+TITLE: " title "\n"
|
|
||||||
"#+OPTIONS: toc:nil num:nil\n\n"
|
|
||||||
;; (message "Lets see here: %S" list)
|
|
||||||
(org-list-to-subtree list)))
|
|
||||||
|
|
||||||
(defun publish-org-sitemap-format-entry (entry style project)
|
|
||||||
"Format ENTRY as a healine.
|
|
||||||
STYLE is ignored and PROJECT is passed on directly to related functions."
|
|
||||||
(unless (directory-name-p entry)
|
|
||||||
(format "%s\n :PROPERTIES:\n :ID: %s\n :RSS_PERMALINK: %s\n :PUBDATE: %s\n :END:\n %s\n Published on: %s\n\n [[file:%s][Read More]] (%s)"
|
|
||||||
(org-publish-find-title entry project)
|
|
||||||
entry
|
|
||||||
(concat (string-remove-suffix ".org" entry) ".html")
|
|
||||||
(format-time-string
|
|
||||||
(cdr org-time-stamp-formats)
|
|
||||||
(org-publish-find-date entry project))
|
|
||||||
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents (concat (plist-get (cdr project) :base-directory) "/" entry))
|
|
||||||
(goto-char (point-min))
|
|
||||||
(let ((current-element (org-element-at-point)))
|
|
||||||
(while (not (equal (org-element-type current-element) 'paragraph))
|
|
||||||
(org-forward-element)
|
|
||||||
(setq current-element (org-element-at-point)))
|
|
||||||
(buffer-substring-no-properties
|
|
||||||
(plist-get (cadr current-element) :contents-begin)
|
|
||||||
(plist-get (cadr current-element) :contents-end))))
|
|
||||||
(format-time-string
|
|
||||||
(cdr org-time-stamp-formats)
|
|
||||||
(org-publish-find-date entry project))
|
|
||||||
entry
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents (concat (plist-get (cdr project) :base-directory) "/" entry))
|
|
||||||
(publish-format-reading-time
|
|
||||||
(publish-calculate-reading-time (current-buffer)))))))
|
|
||||||
|
|
||||||
(setq org-rss-use-entry-url-as-guid t)
|
|
||||||
|
|
||||||
(setq org-export-exclude-tags '("noexport" "draft"))
|
(setq org-export-exclude-tags '("noexport" "draft"))
|
||||||
|
|
||||||
|
(setq org-confirm-babel-evaluate nil)
|
||||||
|
|
||||||
|
(setq org-html-head-include-default-style t)
|
||||||
|
|
||||||
(setq org-html-htmlize-output-type 'css)
|
(setq org-html-htmlize-output-type 'css)
|
||||||
|
|
||||||
(setq org-publish-timestamp-directory
|
(setq org-publish-timestamp-directory
|
||||||
(concat default-directory "/.org-timestamps/"))
|
(concat default-directory "/.org-timestamps/"))
|
||||||
|
|
||||||
(setq org-publish-project-alist
|
(setq org-publish-project-alist
|
||||||
'(("posts"
|
'(("index"
|
||||||
:base-directory "posts/"
|
:base-directory "."
|
||||||
:base-extension "org"
|
:base-extension "org"
|
||||||
:publishing-directory "public/"
|
:publishing-directory "public/"
|
||||||
:recursive t
|
:recursive t
|
||||||
|
:exclude "^posts/"
|
||||||
:publishing-function org-html-publish-to-html
|
:publishing-function org-html-publish-to-html
|
||||||
:html-head "<link rel=\"stylesheet\" href=\"assets/css/main.css\" type=\"text/css\"/>"
|
:html-head "<link rel=\"stylesheet\" href=\"/assets/css/main.css\" type=\"text/css\"/>")
|
||||||
|
("posts"
|
||||||
|
:base-directory "posts/"
|
||||||
|
:base-extension "org"
|
||||||
|
:publishing-directory "public/posts/"
|
||||||
|
:recursive t
|
||||||
|
:publishing-function org-html-publish-to-html
|
||||||
|
:html-head "<link rel=\"stylesheet\" href=\"/assets/css/main.css\" type=\"text/css\"/>"
|
||||||
:html-preamble (lambda (project)
|
:html-preamble (lambda (project)
|
||||||
(let ((buffer (find-file-noselect (buffer-file-name))))
|
(let ((buffer (find-file-noselect (buffer-file-name))))
|
||||||
(unless (string= "ryuslash.org"
|
(unless (string= "ryuslash.org"
|
||||||
(car (org-publish-find-property (buffer-file-name) :title project)))
|
(car (org-publish-find-property (buffer-file-name) :title project)))
|
||||||
(publish-format-reading-time
|
(publish-format-reading-time
|
||||||
(publish-calculate-reading-time buffer)))))
|
(publish-calculate-reading-time buffer))))))
|
||||||
:auto-sitemap t
|
("assets"
|
||||||
:sitemap-filename "index.org"
|
:base-directory "."
|
||||||
:sitemap-title "ryuslash.org"
|
:recursive t
|
||||||
:sitemap-format-entry publish-org-sitemap-format-entry
|
:exclude "^public/"
|
||||||
:sitemap-style list
|
:base-extension "svg"
|
||||||
:sitemap-function publish-org-sitemap
|
:publishing-function org-publish-attachment
|
||||||
:sitemap-sort-files anti-chronologically)
|
:publishing-directory "public/")
|
||||||
("rss"
|
("all" :components ("index" "posts" "assets"))))
|
||||||
:base-directory "posts/"
|
|
||||||
:base-extension "org"
|
|
||||||
:html-link-home "https://ryuslash.org/"
|
|
||||||
:rss-link-home "https://ryuslash.org/"
|
|
||||||
:html-link-use-abs-url t
|
|
||||||
:rss-extension "xml"
|
|
||||||
:publishing-directory "public"
|
|
||||||
:publishing-function (org-rss-publish-to-rss)
|
|
||||||
:section-number nil
|
|
||||||
:exclude ".*"
|
|
||||||
:include ("index.org")
|
|
||||||
:table-of-contents nil)
|
|
||||||
("all" :components ("posts" "rss"))))
|
|
||||||
|
|
||||||
(provide 'publish)
|
(provide 'publish)
|
||||||
;;; publish.el ends here
|
;;; publish.el ends here
|
||||||
|
|
|
@ -13,6 +13,19 @@ a {
|
||||||
color: @link-color;
|
color: @link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre.src {
|
||||||
|
@import (less) "yoshi.css";
|
||||||
|
|
||||||
|
position: static;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: @background-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.org-src-container { position: relative; }
|
||||||
|
.org-svg { width: unset; }
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
3538
src/less/yoshi.css
Normal file
3538
src/less/yoshi.css
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue