Clean up the publishing aspect of my config files

And fix a few bugs while I am at it.
This commit is contained in:
Howard Abrams 2023-12-21 20:26:51 -08:00
parent 164664f8fe
commit 7111c62db9
7 changed files with 55 additions and 43 deletions

View file

@ -8,9 +8,9 @@ Ive crafted my Emacs configuration, I cheekily call /hamacs/, in a literate p
The advantage to rolling yer own is I tend to /use/ what I add, leading to less bloat. In reality, this is more fun.
Using [[https://howardism.org/Technical/Emacs/literate-devops.html][literate programming]] for my Emacs configuration gives me an easy way to /share/ my code. So yes, feel free to steal whatever you find interesting, as sharing makes our community great. Notice that functions and features I have written begin with =ha-=, but everything else is either /stock Emacs/ or a /package/ I download using [[https://github.com/raxod502/straight.el][straight]] (see [[file:bootstrap.org][bootstrap]] for how for details) and configured with [[https://github.com/jwiegley/use-package][use-package]] (see either [[https://ianyepan.github.io/posts/setting-up-use-package/][this introduction]] or [[https://www.emacswiki.org/emacs/UsePackage][this wiki page]] for those details)… meaning most blocks of code should work on its own.
Using [[https://howardism.org/Technical/Emacs/literate-devops.html][literate programming]] for my Emacs configuration gives me an easy way to /share/ my code. Feel free to steal whatever you find interesting, as sharing makes our community great. Notice that functions and features I have written begin with =ha-=, but everything else is either /stock Emacs/ or a /package/ I download using [[https://github.com/raxod502/straight.el][straight]] (see [[file:bootstrap.org][bootstrap]] for the details) and configure with [[https://github.com/jwiegley/use-package][use-package]] (see either [[https://ianyepan.github.io/posts/setting-up-use-package/][this introduction]] or [[https://www.emacswiki.org/emacs/UsePackage][this wiki page]] for those details)… meaning most blocks of code should work on its own.
My configuration is broken into /chapters/ around particular subjects, applications or programming languages. This allows me to /selectively load/ individual chapters. For instance, currently, Im not doing much with Ruby, so I just remove it from the end of my [[file:bootstrap.org][bootstrap]]. I also going load my [[file:ha-display.org][UI configuration]] if I am using the Terminal (doesnt happen much, actually). So jump to the chapters of interest.
Ive separated my configuration into /chapters/ around particular subjects, applications and programming languages. This feature allows you, dear reader, to jump our to items of interest, but allows me to /selectively load/ individual chapters. For instance, if Im not doing much with Ruby at work, I can remove that chapter from the list in my [[file:bootstrap.org::*Load the Rest][bootstrap]]. I also dont load my [[file:ha-display.org][UI configuration]] when I am using the Terminal (doesnt happen much, actually).
Hit me up with questions on Mastodon: [[https://emacs.ch/@howard][@howard@emacs.ch]].
@ -22,7 +22,9 @@ And then, run:
#+BEGIN_SRC sh
./initialize
#+END_SRC
To create [[file:~/.emacs.d/init.el][~/.emacs.d/init.el]] which starts the process loading the files.
To create [[file:~/.emacs.d/init.el][~/.emacs.d/init.el]] which starts the process loading the files. Heres how my Emacs looks when it starts:
[[file:screenshots/dashboard-small.png]]
** Core Configuration
- [[file:bootstrap.org][Bootstrap]] :: configures =straight= and loads basic libraries the rest of the code depends on. It then loads the following files in order.
- [[file:ha-config.org][Configuration]] :: contains /most/ of my configuration, setting up my sequence key menus, evil, etc.
@ -48,7 +50,7 @@ If you know me, I appreciate the light-weight nature of Eshell (see [[https://em
- [[file:ha-remoting.org][Remote Access]] :: my interface to systems using SSH and Vterm.
** Programming Configuration
While Im a language polyglot, I usually focus on one or two languages at a time, and my configuration may acquire a /wee bit of cruft/. That said, Im attempting to convert over to LSP (with varying degrees of success).
While Im a language polyglot, I often focus on one or two languages at a time, but continue to keep my configuration for those languages around. Im attempting to convert over to LSP (with varying degrees of success).
- [[file:ha-programming.org][General Programming]] :: configuration for /all/ programming languages, or at least, the simple ones.
- [[file:ha-programming-elisp.org][Emacs Lisp]] :: additions to Emacs Lisp programming.
@ -67,7 +69,7 @@ The [[file:elisp/][elisp]] directory contains non-literate code.
Other functions and files come from essays written on [[http://www.howardism.org][my blog]]. To help with this synchronization, I created a [[file:support/final-initialize.el][support/final-initialize.el]] file, but that shouldnt be too interesting to others.
You may ask yourself, Howard, why are you still using Github. The only reason is that Org files automatically get rendered as HTML with the code block correctly syntax highlighted. This may change. 🤓
🤓
#+DESCRIPTION: An index.html for describing my hamacs project
@ -75,6 +77,6 @@ You may ask yourself, Howard, why are you still using Github. The only reason is
#+PROPERTY: header-args:emacs-lisp :tangle no
#+PROPERTY: header-args :results none :eval no-export :comments no
#+OPTIONS: num:nil toc:t todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+INFOJS_OPT: view:nil toc:t ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js

View file

@ -31,6 +31,7 @@ I'm installing everything using the [[https://github.com/raxod502/straight.el#ge
See the details in [[https://dev.to/jkreeftmeijer/emacs-package-management-with-straight-el-and-use-package-3oc8][this essay]].
* Initial Settings
** OS Path and Native Compilation
Helper functions to allow code for specific operating systems:
#+begin_src emacs-lisp
@ -105,7 +106,7 @@ Since =brew link gpg= doesnt always work, this helper function may find the e
(executable "/usr/bin/pgp")))
:config (epa-file-enable))
#+end_src
** Basic Libraries
* Basic Libraries
The following packages come with Emacs, but seems like they still need loading:
#+begin_src emacs-lisp
(use-package cl-lib
@ -169,7 +170,7 @@ Much of my more complicated code comes from my website essays and other projects
#+end_src
Hopefully, this will tie me over while I transition.
** Emacs Server Control
* Emacs Server Control
I actually run two instances of Emacs on some systems, where one instance has all my work-related projects, perspectives, and packages installed (like LSP), and my personal instance has other packages running (like IRC and Mail). I need a function that can make that distinction, and based on that, it will set =server-start= appropriately, so that =emacsclient= can call into the correct one.
#+begin_src emacs-lisp
(defun ha-emacs-for-work? ()

View file

@ -314,9 +314,9 @@ Why use [[https://gitlab.com/ideasman42/emacs-undo-fu][undo-fu]] instead of the
(global-set-key (kbd "s-S-z") 'undo-fu-only-redo))
#+end_src
** On the Subject of Being Evil
Im currently using the [[https://github.com/emacs-evil/evil][Extensible VI Layer]] for Emacs, aka /evil/. This configuration happens in [[file:ha-evil.org][ha-evil.org]], but because much of my configuration requires access to =ha-leader=, =general=, and other features, we need to include it here:
Im currently using the [[https://github.com/emacs-evil/evil][Extensible VI Layer]] for Emacs, aka /evil/. This configuration happens in [[file:ha-eviljjjj.org][ha-evil.org]], but because much of my configuration requires access to =ha-leader=, =general=, and other features, we need to include it here:
#+begin_src emacs-lisp
(ha-hamacs-load "ha-evil")
(ha-hamacs-load "ha-evil.org")
#+end_src
** Additional Global Packages
The following defines my use of the Emacs completion system. Ive decided my /rules/ will be:
@ -417,7 +417,7 @@ Since auto insertion requires entering data for particular fields, and for that
(auto-insert-query nil)
(yas-indent-line nil))
(yas/minor-mode 1)
(when (fboundp evil-insert-state)
(when (fboundp 'evil-insert-state)
(evil-insert-state))
(yas-expand-snippet (buffer-string) (point-min) (point-max))))
#+end_src

View file

@ -134,7 +134,7 @@ The [[https://github.com/emacs-dashboard/emacs-dashboard][emacs-dashboard]] proj
(string-replace "\n" "" smaller-version)))
(setq dashboard-banner-logo-title
(format "Emacs %s %s"
(format "Emacs %s %s"
(if (and (fboundp 'native-comp-available-p)
(native-comp-available-p))
"with Native Compilation" "")

View file

@ -1405,6 +1405,6 @@ Let's =provide= a name so we can =require= this file:
#+PROPERTY: header-args:emacs-lisp :tangle yes
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: num:nil toc:t todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js

View file

@ -49,7 +49,7 @@ Since I have two specific websites, I create two variables for those destination
#+end_src
** You Dont Know Jack
Im not afraid of HTML, however, I like the idea of doing my HTML work in a Lisp-like way using the [[https://github.com/tonyaldon/jack][jack-html project]]:
Im not afraid of HTML, but I like the idea of doing my HTML work in a Lisp-like way using the [[https://github.com/tonyaldon/jack][jack-html project]]:
#+begin_src emacs-lisp
(use-package jack)
#+end_src
@ -65,11 +65,11 @@ Returns the string:
I separate my /website/ into distinct projects separately built:
- =blog-content= :: The bulk of rendering my =website= org files into HTML
- =blog-static= :: All of the assets, like images are easily copied in place
- =blog-static= :: Copies all assets, like images, in place
- =blog-rss= :: Regenerate the feeder files
- =org-notes= :: Optionally render a non-web site collection of notes.
** The Website
Years of having two domain names can be confusing, but I have to keep them going now. So =howardabrams.com= is essentially a single static page (oh, and email).
Years of having two domain names can be confusing, but I have to keep them going now. My =howardabrams.com= is essentially a single static page (oh, and email).
#+begin_src emacs-lisp
(add-to-list 'org-publish-project-alist
`("website"
@ -77,7 +77,7 @@ Years of having two domain names can be confusing, but I have to keep them going
:publishing-directory ,ha-publishing-howardabrams))
#+end_src
** The Blog
My main blog made up a huge collection of org files:
My main blog made up a collection of org files:
#+begin_src emacs-lisp
(add-to-list 'org-publish-project-alist
`("blog-content"
@ -177,7 +177,7 @@ I take notes on a variety of technical subjects, and since I can share these not
:publishing-directory ,(concat org-mode-publishing-directory "notes/")
:recursive t
:publishing-function org-html-publish-to-html
:headline-levels 4 ; Just the default for this project.
:headline-levels 4
:auto-preamble t
:auto-sitemap t ; Generate sitemap.org automagically...
:makeindex t
@ -212,27 +212,35 @@ As above, we can separate the publishing of the images and other static files:
:publishing-function org-publish-attachment))
#+end_src
** Literate Emacs Configuration
Ive been committing my literate-style Emacs configuration for a few years now, and Ive assumed that Github would be sufficient for rendering it. However, I feel that I could publish this to my own web site.
Ive been committing my literate-style Emacs configuration for years now, and Github has rendered it well, but I felt I could publish this to my own web site as a /cleaner version/.
#+begin_src emacs-lisp
(add-to-list 'org-publish-project-alist
`("hamacs"
:base-directory "~/other/hamacs"
:base-extension "org"
:publishing-directory ,(concat org-mode-publishing-directory "hamacs/")
:recursive t
:publishing-function org-html-publish-to-html
:headline-levels 4 ; Just the default for this project.
:auto-preamble t
:auto-sitemap nil
:makeindex nil
:section-numbers nil
:style ,(jack-html
'(:link (@ :rel "stylesheet" :type "text/css"
:href "../css/styles.css")))
:table-of-contents nil
:with-author nil
:with-creator nil
:with-tags nil))
`("hamacs"
:base-directory "~/other/hamacs"
:publishing-directory ,(concat org-mode-publishing-directory "hamacs/")
:publishing-function org-html-publish-to-html
:recursive t
:auto-preamble nil
:auto-sitemap nil
:makeindex nil
:section-numbers nil
:html-head-include-default-style nil
:html-head ,(jack-html
'(:link (@ :rel "stylesheet" :type "text/css"
:href "../css/styles.css")))
:html-head-extra nil
:table-of-contents t
:with-author nil
:with-creator nil
:with-tags nil))
(add-to-list 'org-publish-project-alist
`("hamacs-static"
:base-directory "~/other/hamacs"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory ,(concat org-mode-publishing-directory "hamacs")
:recursive t
:publishing-function org-publish-attachment))
#+end_src
* Including Sections
In the project definitions, I reference a =pre-= and =postamble= that allow me to inject some standard HTML file headers and footers:
@ -255,7 +263,7 @@ In the project definitions, I reference a =pre-= and =postamble= that allow me t
Another helper function for the content of website is to make sure to update =index.org=, so that the RSS gets generated.
#+begin_src emacs-lisp
(defun org-mode-blog-prepare (&optional options)
"`index.org' should always be exported so touch the file before publishing."
"Change modification of `index.org' before publishing."
(let* ((base-directory (plist-get options :base-directory))
(buffer (find-file-noselect (expand-file-name "index.org" base-directory) t)))
(with-current-buffer buffer
@ -280,13 +288,14 @@ Using =rsync= to keep published files in sync with my website:
((equal project "blog-content") "howardism")
((equal project "blog-static") "howardism")
((equal project "blog-rss") "howardism")
((equal project "org-notes") "howardabrams/technical")
((equal project "org-notes-static") "howardabrams/technical")
((equal project "hamacs") "howardabrams/hamacs"))))
(message "rsync -az %s %s:%s" src host dest)))
((equal project "tech-notes") "howardabrams/technical")
((equal project "tech-notes-static") "howardabrams/technical")
((equal project "hamacs") "howardabrams/hamacs")
((equal project "hamacs-static") "howardabrams/hamacs"))))
(async-shell-command (format "rsync -az %s %s:%s" src host dest))))
#+end_src
* Keybindings
Make it easy to publish all or just some of my website:
Make it easy to publish all projects or single project:
#+begin_src emacs-lisp
(with-eval-after-load 'ha-org
(ha-leader :keymaps 'org-mode-map

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB