mirror of https://github.com/Chizi123/.emacs.d.git

Joel Grunbaum
2020-02-24 be9cffb0ef508a4f8d91e66e4dec97180151289a
config.org
@@ -1,7 +1,7 @@
#+TITLE: My Emacs configuration
#  LocalWords:  poppler mingw emacs eq nt gnuplot setenv mapconcat el cond minibuffer pdf color Smartparens smartparens yas aindent whitespace eldoc ielm ibuffer hippie pscp pos Spaceline spaceline powerline spacemacs seperator dir Yasnippet yasnippet flycheck magit fullscreen CEDET askifnotset semanticdb EDE ede gdb srefactor analyzer eval cdb autosetup ghostscript math unicode reftex bibtex TeXcount texcount str latin rkt PlantUML plantuml autoload alist matlab verilog ds vh src fontify natively fortran dvipng plist xcolor
#  LocalWords:  poppler mingw emacs eq nt gnuplot setenv mapconcat el cond minibuffer pdf color Smartparens smartparens yas aindent whitespace eldoc ielm ibuffer hippie pscp pos Spaceline spaceline powerline spacemacs seperator dir Yasnippet yasnippet flycheck magit fullscreen CEDET askifnotset semanticdb EDE ede gdb srefactor analyzer eval cdb autosetup ghostscript math unicode reftex bibtex TeXcount texcount str latin rkt PlantUML plantuml autoload alist matlab verilog ds vh src fontify natively fortran dvipng plist xcolor EXWM Zenburn setq zenburn defun dolist init config DejaVu ispell aspell flyspell kbd recentf sexp ov bg listp defadvice progn prog keyfreq autosave dabbrev hl gc linum linux utf RET ARG arg configs backends contribs AucTex tex auctex LaTeX url htmlize
* Windows dependencies
* COMMENT Windows dependencies
Dependencies needed for Aspell, poppler PDF-tools, compilers and ghost-script provided by mingw64
#+BEGIN_SRC emacs-lisp
  (when (eq system-type 'windows-nt)
@@ -17,25 +17,39 @@
#+BEGIN_SRC emacs-lisp
  (setq emacs-theme 'zenburn)
  (defun disable-all-themes ()
    (dolist (i custom-enabled-themes)
      (disable-theme i)))
  (cond ((eq emacs-theme 'zenburn)
         (use-package zenburn-theme
           :ensure t
           :init
           (disable-all-themes)
           :config
           (load-theme 'zenburn t)))
        ((eq emacs-theme 'doom-one)
         (use-package doom-themes
           :ensure t
           :init
           (disable-all-themes)
           :config
           (setq doom-themes-enable-bolt t
                 doom-themes-enable-italic t)
           (load-theme 'doom-one t)
           (doom-themes-visual-bell-config)
           (doom-themes-org-config))))
           (doom-themes-org-config)))
        ((eq emacs-theme 'none)
         (disable-all-themes)))
#+END_SRC
** Default font
#+BEGIN_SRC emacs-lisp
  (set-frame-font "DejaVu Sans Mono" nil t)
#+BEGIN_SRC emacs-lisp
  ;; (set-frame-font "DejaVu Sans Mono" nil t)
  (set-frame-font "Dank Mono-11" nil t)
  ;; (set-frame-font "Source Code Pro-10" nil t)
  (set-face-italic 'font-lock-comment-face t)
  (set-face-italic 'font-lock-keyword-face t)
#+END_SRC
** Remove menu bar, toolbar, but keep scroll bar
@@ -92,10 +106,18 @@
** PDF-tools
#+BEGIN_SRC emacs-lisp
(use-package pdf-tools
  :ensure t
  :config
  (pdf-tools-install))
  (use-package pdf-tools
   :ensure t
   :config
   (pdf-tools-install 1))
#+END_SRC
** COMMENT Writegood-mode
Supposedly should provide insight to writing quality
#+BEGIN_SRC emacs-lisp
  (use-package writegood-mode
    :ensure t
    :hook (text-mode . writegood-mode))
#+END_SRC
* Helm and Projectile
@@ -153,10 +175,133 @@
*** Enable communication with helm
#+BEGIN_SRC emacs-lisp
(use-package helm-projectile
  :ensure t
  :config
  (helm-projectile-on))
  (use-package helm-projectile
    :ensure t
    :config
    (helm-projectile-on))
#+END_SRC
** COMMENT ggtags
#+BEGIN_SRC emacs-lisp
    (use-package ggtags
      :ensure t
      :bind (("C-c g s" . ggtags-find-other-symbol)
           ("C-c g h" . ggtags-view-tag-history)
           ("C-c g r" . ggtags-find-reference)
           ("C-c g f" . ggtags-find-file)
           ("C-c g c" . ggtags-create-tags)
           ("C-c g u" . ggtags-update-tags))
      :config
      (add-hook 'c-mode-common-hook
              (lambda ()
                (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
                  (ggtags-mode 1))))
      )
    (setq
     helm-gtags-ignore-case t
     helm-gtags-auto-update t
     helm-gtags-use-input-at-cursor t
     helm-gtags-pulse-at-cursor t
     helm-gtags-prefix-key "\C-c g"
     helm-gtags-suggested-key-mapping t
     )
    (use-package helm-gtags
      :ensure t
      :config
      (add-hook 'dired-mode-hook 'helm-gtags-mode)
      (add-hook 'eshell-mode-hook 'helm-gtags-mode)
      (add-hook 'c-mode-hook 'helm-gtags-mode)
      (add-hook 'c++-mode-hook 'helm-gtags-mode)
      (add-hook 'asm-mode-hook 'helm-gtags-mode)
      (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
      (define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select)
      (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
      (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
      (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
      (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history))
#+END_SRC
** COMMENT Ctags
#+BEGIN_SRC emacs-lisp
  (defvar ctags-command "ctags -e -R --languages=vhdl")
  (defun ctags ()
    (call-process-shell-command ctags-command nil "*Ctags*"))
  (defun ctags-find-tags-file ()
    "Recursively searches each parent directory for a file named
                TAGS and returns the path to that file or nil if a tags file is
                not found or if the buffer is not visiting a file."
    (progn
      (defun find-tags-file-r (path)
        "Find the tags file from current to the parent directories."
        (let* ((parent-directory (file-name-directory (directory-file-name path)))
               (tags-file-name (concat (file-name-as-directory path) "TAGS")))
          (cond
           ((file-exists-p tags-file-name) (throw 'found tags-file-name))
           ((string= "/TAGS" tags-file-name) nil)
           (t (find-tags-file-r parent-directory)))))
      (if (buffer-file-name)
          (catch 'found
            (find-tags-file-r (file-name-directory buffer-file-name)))
        nil)))
  (defun ctags-set-tags-file ()
    "Uses `ctags-find-tags-file' to find a TAGS file. If found,
                set 'tags-file-name' with its path or set as nil."
    (setq-default tags-file-name (ctags-find-tags-file)))
  (defun ctags-create-tags-table ()
    (interactive)
    (let* ((current-directory default-directory)
           (top-directory (read-directory-name
                           "Top of source tree: " default-directory))
           (file-name (concat (file-name-as-directory top-directory) "TAGS")))
      (cd top-directory)
      (if (not (= 0 (ctags)))
          (message "Error creating %s!" file-name)
        (setq-default tags-file-name file-name)
        (message "Table %s created and configured." tags-file-name))
      (cd current-directory)))
  (defun ctags-update-tags-table ()
    (interactive)
    (let ((current-directory default-directory))
      (if (not tags-file-name)
          (message "Tags table not configured.")
        (cd (file-name-directory tags-file-name))
        (if (not (= 0 (ctags)))
            (message "Error updating %s!" tags-file-name)
          (message "Table %s updated." tags-file-name))
        (cd current-directory))))
  (defun ctags-create-or-update-tags-table ()
    "Create or update a tags table with `ctags-command'."
    (interactive)
    (if (not (ctags-set-tags-file))
        (ctags-create-tags-table)
      (ctags-update-tags-table)))
  (defun ctags-search ()
    "A wrapper for `tags-search' that provide a default input."
    (interactive)
    (let* ((symbol-at-point (symbol-at-point))
           (default (symbol-name symbol-at-point))
           (input (read-from-minibuffer
                   (if (symbol-at-point)
                       (concat "Tags search (default " default "): ")
                     "Tags search (regexp): "))))
      (if (and (symbol-at-point) (string= input ""))
          (tags-search default)
        (if (string= input "")
            (message "You must provide a regexp.")
          (tags-search input)))))
#+END_SRC
* Small tweaks
@@ -201,7 +346,8 @@
    (which-key-mode))
#+END_SRC
** Go to this file
** Config shortcuts
*** Go to this file
#+BEGIN_SRC emacs-lisp
(defun config-visit ()
  (interactive)
@@ -209,7 +355,7 @@
(global-set-key (kbd "C-c e d") 'config-visit)
#+END_SRC
** Go to init.el
*** Go to init.el
#+BEGIN_SRC emacs-lisp
  (defun init-visit ()
    (interactive)
@@ -217,7 +363,7 @@
  (global-set-key (kbd "C-c e i") 'init-visit)
#+END_SRC
** Reload configuration
*** Reload configuration
#+BEGIN_SRC emacs-lisp
(defun config-reload ()
  "Reloads ~/.emacs.d/config.org at run time"
@@ -379,18 +525,21 @@
** Coding style
#+BEGIN_SRC emacs-lisp
(setq c-default-style "linux")
  (setq c-default-style '((java-mode . "java")
                         (awk-mode . "awk")
                         (other . "k&r")))
#+END_SRC
** Coding system
#+BEGIN_SRC emacs-lisp
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
(setq-default indent-tabs-mode t)
(delete-selection-mode)
(global-set-key (kbd "RET") 'newline-and-indent)
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (set-language-environment "UTF-8")
  (prefer-coding-system 'utf-8)
  (setq-default indent-tabs-mode t
            tab-width 4)
  (delete-selection-mode)
  (global-set-key (kbd "RET") 'newline-and-indent)
#+END_SRC
** Move to beginning of line ignoring whitespace
@@ -452,15 +601,16 @@
** Spaceline
A little easier to read than the default emacs mode line
#+BEGIN_SRC emacs-lisp
  (use-package spaceline
    :ensure t
    :config
    (require 'spaceline-config)
    (setq spaceline-buffer-encoding-abbrev-p t)
    (setq spaceline-line-column-p t)
    (setq spaceline-line-p t)
    (setq powerline-default-separator (quote arrow))
    (spaceline-spacemacs-theme))
    (use-package spaceline
      :ensure t
      :config
      (require 'spaceline-config)
      (setq spaceline-buffer-encoding-abbrev-p t)
      (setq spaceline-line-column-p t)
      (setq spaceline-line-p t)
      (setq powerline-default-separator (quote arrow))
      (spaceline-spacemacs-theme)
      (spaceline-helm-mode))
#+END_SRC
** No separator
@@ -471,14 +621,14 @@
* Programming tweaks
** Yasnippet
#+BEGIN_SRC emacs-lisp
    (use-package yasnippet
      :ensure t
      :diminish yas-minor-mode
      :config
      (use-package yasnippet-snippets
   :ensure t)
      (yas-reload-all)
      (yas-global-mode 1))
  (use-package yasnippet
    :ensure t
    :diminish yas-minor-mode
    :config
    (use-package yasnippet-snippets
      :ensure t)
    (yas-reload-all)
    (yas-global-mode 1))
#+END_SRC
** flycheck
@@ -489,7 +639,7 @@
    :config
    (global-flycheck-mode))
#+END_SRC
*** flycheck-pos-tip
*** flycheck-pos-tipe
#+BEGIN_SRC emacs-lisp
(use-package flycheck-pos-tip
  :ensure t
@@ -680,7 +830,7 @@
    (slime-setup '(slime-fancy slime-company)))
#+END_SRC
*** x86
*** COMMENT x86
**** x86-lookup
#+BEGIN_SRC emacs-lisp
(use-package x86-lookup
@@ -693,13 +843,14 @@
*** Latex
**** AucTex
#+BEGIN_SRC emacs-lisp
(use-package tex
  :ensure auctex
  :config
  (setq TeX-auto-save t)
  (setq TeX-parse-self t)
  (setq doc-view-ghostscript-program "c:/msys64/mingw64/bin/gswin32c.exe")
  (setq preview-gs-command "c:/msys64/mingw64/bin/gs.exe"))
  (use-package tex
    :ensure auctex
    :config
    (setq TeX-auto-save t)
    (setq TeX-parse-self t)
    (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
          TeX-source-correlate-start-server t)
    (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
#+END_SRC
**** Company
@@ -728,52 +879,53 @@
    (add-to-list 'company-backends 'company-bibtex))
#+END_SRC
**** Preview pane
#+BEGIN_SRC emacs-lisp
(use-package latex-preview-pane
  :ensure t
  :config
  (latex-preview-pane-enable))
#+END_SRC
**** TeXcount
     Word counts in latex
     #+BEGIN_SRC emacs-lisp
       (when (eq system-type 'windows-nt)
         (add-to-list 'exec-path "c:/Users/joelg/TeXcount_3_1_1")
         (setenv "PATH" (mapconcat #'identity exec-path path-separator)))
      (defun get-texcount-latest()
       (if (not(file-directory-p "~/.texcount"))
          (make-directory "~/.texcount"))
       (url-copy-file "https://app.uio.no/ifi/texcount/download.php?file=texcount_3_1_1.zip" "~/.texcount/texcount.zip" 1)
       (shell-command "unzip -o ~/.texcount/texcount.zip -d ~/.texcount")
       (add-to-list 'exec-path "~/.texcount/texcount.pl"))
       (defun texcount ()
         (interactive)
         (let*
             ( (this-file (buffer-file-name))
               (enc-str (symbol-name buffer-file-coding-system))
               (enc-opt
                (cond
                 ((string-match "utf-8" enc-str) "-utf8")
                 ((string-match "latin" enc-str) "-latin1")
                 ("-encoding=guess")
                 ) )
               (word-count
                (with-output-to-string
                  (with-current-buffer standard-output
                    (call-process "texcount" nil t nil "-0" enc-opt this-file)
                    ) ) ) )
           (message word-count)
           ) )
       (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-c c") 'texcount)))
       (add-hook 'latex-mode-hook (lambda () (define-key latex-mode-map (kbd "C-c c") 'texcount)))
      (if (not(file-exists-p "~/.texcount/texcount.pl"))
         (get-texcount-latest))
      (defun texcount ()
       (interactive)
       (let*
          ( (this-file (buffer-file-name))
            (enc-str (symbol-name buffer-file-coding-system))
            (enc-opt
            (cond
             ((string-match "utf-8" enc-str) "-utf8")
             ((string-match "latin" enc-str) "-latin1")
             ("-encoding=guess")
             ) )
            (word-count
            (with-output-to-string
              (with-current-buffer standard-output
               (call-process "texcount" nil t nil "-0" enc-opt this-file)
               ) ) ) )
         (message word-count)
         ) )
      (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-c c") 'texcount)))
      (add-hook 'latex-mode-hook (lambda () (define-key latex-mode-map (kbd "C-c c") 'texcount)))
     #+END_SRC
*** PlantUML
#+BEGIN_SRC emacs-lisp
(use-package plantuml-mode
  :ensure t
  :init
  (setq plantuml-jar-path "c:/ProgramData/chocolatey/lib/plantuml/tools/plantuml.jar"))
  (use-package plantuml-mode
    :ensure t
    :init
    (cond ((eq system-type 'windows-nt)
           (setq plantuml-jar-path "c:/ProgramData/chocolatey/lib/plantuml/tools/plantuml.jar"))
          ((eq system-type 'gnu/linux)
           (setq plantuml-jar-path "/usr/share/java/plantuml/plantuml.jar"))))
#+END_SRC
*** Racket
*** COMMENT Racket
**** Major mode
#+BEGIN_SRC emacs-lisp
  (when (eq system-type 'windows-nt)
@@ -791,13 +943,95 @@
#+END_SRC
*** Verilog
**** Get latest version
Pull the latest version from the web
#+BEGIN_SRC emacs-lisp
  (defun get-verilog-latest()
    (if (not(file-directory-p "~/.emacs.d/elpa/verilog-mode"))
        (make-directory "~/.emacs.d/elpa/verilog-mode"))
    (if (file-exists-p "~/.emacs.d/elpa/verilog-mode/verilog-mode.el")
        (delete-file "~/.emacs.d/elpa/verilog-mode/verilog-mode.el"))
    (url-copy-file "https://www.veripool.org/ftp/verilog-mode.el" "~/.emacs.d/elpa/verilog-mode/verilog-mode.el" 1))
#+END_SRC
**** Integrate into emacs
Add updated version and integrate it with Emacs.
#+BEGIN_SRC emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/elpa/verilog-mode-20190324/verilog-mode.el")
  (require 'verilog-mode)
    (defun verilog-read-file-as-string (file)
      "Read FILE contents."
      (when (file-exists-p file)
        (with-temp-buffer
          (insert-file-contents file)
          (buffer-string))))
  (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
  (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode))
    (defun verilog-write-string-to-file (file string)
      "Substitute FILE contents with STRING."
      (with-temp-buffer
        (insert string)
        (when (file-writable-p file)
          (write-region (point-min)
                        (point-max)
                        file))))
    (defun verilog-today-day ()
      (time-to-days (current-time)))
    (defun should-update-verilog-p ()
      "Return non-nil when an update is due."
      (and
       (or
        (not (file-exists-p "~/.emacs.d/.last-verilog-update-day"))
        (if (>= (/ (- (verilog-today-day) (verilog-read-last-update-day)) 7) 1)
            t
          nil))))
    (defun verilog-read-last-update-day ()
      "Read last update day."
      (string-to-number
       (verilog-read-file-as-string "~/.emacs.d/.last-verilog-update-day")))
    (defun verilog-write-current-day ()
      "Store current day."
      (verilog-write-string-to-file
       "~/.emacs.d/.last-verilog-update-day"
       (int-to-string (verilog-today-day))))
    (use-package verilog-mode
      :init
      (when (should-update-verilog-p)
          (get-verilog-latest)
          (verilog-write-current-day))
      (add-to-list 'load-path "~/.emacs.d/elpa/verilog-mode/verilog-mode.el")
      :config
      (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
      (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode)))
#+END_SRC
*** MATLAB
Mode for editing MATLAB m-files.
Have to manually install matlab-mode
#+BEGIN_SRC emacs-lisp
  (autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
  (add-to-list
   'auto-mode-alist
   '("\\.m$" . matlab-mode))
  (setq matlab-indent-function t)
  (setq matlab-shell-command "matlab")
  (matlab-cedet-setup)
#+END_SRC
*** MIPS
#+BEGIN_SRC emacs-lisp
  (use-package mips-mode
    :ensure t
    :mode "\\.mips$")
#+END_SRC
*** IPython notebooks
Allow emacs to view and use IPython notebooks
#+BEGIN_SRC emacs-lisp
  (use-package ein
    :ensure t)
#+END_SRC
* Org mode
@@ -823,15 +1057,15 @@
** Line wrapping
#+BEGIN_SRC emacs-lisp
  (add-hook 'org-mode-hook
         '(lambda ()
       (visual-line-mode 1)))
            '(lambda ()
               (visual-line-mode 1)))
#+END_SRC
** org-bullets
#+BEGIN_SRC emacs-lisp
(use-package org-bullets
  :ensure t
  :config
  (use-package org-bullets
    :ensure t
    :config
    (add-hook 'org-mode-hook (lambda () (org-bullets-mode))))
#+END_SRC
@@ -839,16 +1073,22 @@
*** Languages
Add C to org babel supported languages
#+BEGIN_SRC emacs-lisp
  (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t)
                                                           (C . t)
                                                           (python . t)
                                                           (latex . t)
                                                           (scheme . t)
                                                           (gnuplot . t)
                                                           (matlab . t)
                                                           (plantuml . t)
                                                           (fortran . t)
                                                           (java . t)))
    (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t)
                                                             (C . t)
                                                             (python . t)
                                                             (latex . t)
                                                             (scheme . t)
                                                             (gnuplot . t)
                                                             (matlab . t)
                                                             (plantuml . t)
                                                             (fortran . t)
                                                             (java . t)
                                                             (plantuml . t)))
#+END_SRC
**** Plantuml path
#+BEGIN_SRC emacs-lisp
  (setq org-plantuml-jar-path plantuml-jar-path)
#+END_SRC
** Latex preview fragments match colour
@@ -859,4 +1099,114 @@
    (plist-put dvipng--plist :image-converter '("dvipng -D %D -T tight -o %O %f")))
#+END_SRC
* EMMS
Emacs media manager.
#+BEGIN_SRC emacs-lisp
  (use-package emms-setup
    :ensure emms
    :init
    (add-to-list 'load-path "~/elisp/emms/")
    :config
    (emms-all)
    (emms-default-players)
    (setq emms-source-file-directory "~/Music/"))
#+END_SRC
* Org Blog
** Org static blog config
Boiler plate template code for site.
#+BEGIN_SRC emacs-lisp
  (use-package org-static-blog
    :ensure t
    :config
    (setq org-static-blog-publish-title "Joel's Site")
    (setq org-static-blog-publish-url "https://blog.joelg.cf/")
    (setq org-static-blog-publish-directory "/backup/home/joel/Downloads/Chizi123.github.io/")
    (setq org-static-blog-posts-directory "/backup/home/joel/Downloads/Chizi123.github.io/posts/")
    (setq org-static-blog-drafts-directory "/backup/home/joel/Downloads/Chizi123.github.io/drafts/")
    (setq org-static-blog-enable-tags t)
    (setq org-export-with-toc nil)
    (setq org-export-with-section-numbers nil)
    ;; This header is inserted into the <head> section of every page:
    ;;   (you will need to create the style sheet at
    ;;    ~/projects/blog/static/style.css
    ;;    and the favicon at
    ;;    ~/projects/blog/static/favicon.ico)
    (setq org-static-blog-page-header
    "<meta name=\"author\" content=\"Joel Grunbaum\">
    <meta name=\"referrer\" content=\"no-referrer\">
    <link href= \"static/style.css\" rel=\"stylesheet\" type=\"text/css\" />
    <link rel=\"icon\" href=\"static/favicon.png\">
    <script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-147303155-2\"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-147303155-2');
    </script>
    ")
    ;; This preamble is inserted at the beginning of the <body> of every page:
    ;;   This particular HTML creates a <div> with a simple linked headline
    (setq org-static-blog-page-preamble
    "<div class=\"header\">
      <a href=\"https://blog.joelg.cf\">Joel's Site - Personal site and constant work in progress</a>
      <div class=\"sitelinks\">
        <a href=\"https://blog.joelg.cf/about-me.html\">About Me</a> |
        <a href=\"https://github.com/Chizi123\">Github</a> |
        <a href=\"https://facebook.com/joel.grun.5\">Facebook</a>
      </div>
    </div>")
    ;; This postamble is inserted at the end of the <body> of every page:
    ;;   This particular HTML creates a <div> with a link to the archive page
    ;;   and a licensing stub.
    (setq org-static-blog-page-postamble
    "<div id=\"archive\">
      <a href=\"https://blog.joelg.cf/archive.html\">Other posts</a>
    </div>
    <br>
    <div id=\"commento\"></div>
    <script src=\"https://cdn.commento.io/js/commento.js\"></script>")
    ;; <center><button id=\"disqus_button\" onclick=\"load_disqus()\">Load Disqus Comments</button></center>
    ;; <div id=\"disqus_thread\"></div>
    ;; <script type=\"text/javascript\">
    ;;   function load_disqus() {
    ;;       var dsq = document.createElement('script');
    ;;       dsq.type = 'text/javascript';
    ;;       dsq.async = true;
    ;;       dsq.src = 'https://joelg-cf.disqus.com/embed.js';
    ;;       (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    ;;       document.getElementById('disqus_button').style.visibility = 'hidden';
    ;;   };
    ;; </script>")
    ;; generate blog files and create sitemap for files
    (defun blog-publish()
      (interactive)
      (org-static-blog-publish)
      (setq n 0)
      (setq site "https://blog.joelg.cf/")
      (setq posts (directory-files org-static-blog-publish-directory))
      (generate-new-buffer "sitemap.xml.gen")
      (with-current-buffer "sitemap.xml.gen" (insert "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"))
      (while (< n (length (directory-files org-static-blog-publish-directory)))
        (setq curr (nth n posts))
        (if (string-match "\\(html\\)" curr)
            (if (string-match "index.html" curr)
                (with-current-buffer "sitemap.xml.gen" (insert (concat "\t<url>\n\t\t<loc>" site "</loc>\n\t</url>\n")))
              (with-current-buffer "sitemap.xml.gen" (insert (concat "\t<url>\n\t\t<loc>" site curr "</loc>\n\t</url>\n")))))
        (setq n (1+ n)))
      (with-current-buffer "sitemap.xml.gen" (insert "</urlset>"))
      (with-current-buffer "sitemap.xml.gen" (write-region (point-min) (point-max) (concat org-static-blog-publish-directory "sitemap.xml")) t)
      (kill-buffer "sitemap.xml.gen"))
  )
#+END_SRC
** Emacs-htmlize
Allow org features to be exported to HTML for site
#+BEGIN_SRC emacs-lisp
  (use-package htmlize
    :ensure t)
#+END_SRC