commit 868817f90029a438ea385e3984cf72ce7c9163ce parent 31a2bf7461b9e0891628d2a624875fa4a1da8086 Author: Vincent Demeester <vincent@sbr.pm> Date: Sun, 29 Mar 2020 18:40:30 +0200 emacs: move from tmp to tools π― Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
257 files changed, 3316 insertions(+), 3328 deletions(-)
diff --git a/tmp/emacs-config/README.org b/tmp/emacs-config/README.org @@ -1 +0,0 @@ -index.org- \ No newline at end of file diff --git a/tmp/emacs-config/data/17/a3ed73-aaca-4a18-8ed1-3efe7bac855a/2020-02-29-14-41-59.png b/tmp/emacs-config/data/17/a3ed73-aaca-4a18-8ed1-3efe7bac855a/2020-02-29-14-41-59.png @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f96bb89ef7260c82a6283061a8e467125b94eb4ecb7320526e27c1525163b87e -size 63416 diff --git a/tmp/emacs-config/data/1f/74bbae-c4a1-4723-977e-e48900fcd1c7/2020-02-29-13-46-08.png b/tmp/emacs-config/data/1f/74bbae-c4a1-4723-977e-e48900fcd1c7/2020-02-29-13-46-08.png @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f85767c14dd416690fd03ef84d921f4fd929a657475e4f54a89b872cb2efcabd -size 97137 diff --git a/tmp/emacs-config/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-57-41.png b/tmp/emacs-config/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-57-41.png @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b4e362cf1c5ed2b36c31d01cf604426d04c6b32bdee894e4171537994a81bb83 -size 187193 diff --git a/tmp/emacs-config/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-59-22.png b/tmp/emacs-config/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-59-22.png @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c002b6c041d7350bbe1e9a919b3ef2451f030739de70fb04f17d8c758ed48d80 -size 191294 diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/default b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/default @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: default -# key: default -# -- -default() -> Self { - ${0:Self::new()} -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/fmt b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/fmt @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: fmt -# key: fmt -# -- -fmt(&self, f: &mut Formatter) -> Result<(), Error> { - $0 -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/impl b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/impl @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: impl -# key: impl -# -- -impl$3 ${1:Trait} for ${2:Type}$3 { - $0 -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/implClone b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/implClone @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: implClone -# key: Clone -# -- -impl$2 Clone for ${1:Type}$2 { - fn clone(&self) -> Self { - $0 - } -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/implDefault b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/implDefault @@ -1,9 +0,0 @@ -# -*- mode: snippet -*- -# name: implDefault -# key: Default -# -- -impl$2 Default for ${1:Type}$2 { - fn default() -> Self { - ${0:Self::new()} - } -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/is_empty b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/is_empty @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: is_empty -# key: is_empty -# -- -is_empty(&self) -> bool { - ${0:self.len() == 0} -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/len b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/len @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: len -# key: len -# -- -len(&self) -> usize { - $0 -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/new b/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/new @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: new -# key: new -# -- -new() -> Self { - $0 -}- \ No newline at end of file diff --git a/tmp/emacs-config/etc/yasnippet/snippets/text-mode/ggit b/tmp/emacs-config/etc/yasnippet/snippets/text-mode/ggit @@ -1 +0,0 @@ -https://github.com/vdemeester/$0 diff --git a/tmp/emacs-config/host/README.org b/tmp/emacs-config/host/README.org @@ -1 +0,0 @@ -Put stuff here that are local to a specific machine, those are private, aka not shared via this git repository. diff --git a/tmp/emacs-config/host/naruhodo.el b/tmp/emacs-config/host/naruhodo.el @@ -1 +0,0 @@ -../../sync/emacs/naruhodo.el- \ No newline at end of file diff --git a/tmp/emacs-config/host/wakasu.el b/tmp/emacs-config/host/wakasu.el @@ -1 +0,0 @@ -../../sync/emacs/wakasu.el- \ No newline at end of file diff --git a/tmp/emacs-config/index.org b/tmp/emacs-config/index.org @@ -1,40 +0,0 @@ -#+TITLE: vdemeester's .emacs.d -#+AUTHOR: Vincent Demeester -#+EMAIL: vincent@sbr.pm -#+EXPORT_EXCLUDE_TAGS: noexport -#+CREATOR: Emacs 27.0.90 (Org mode 9.3) -#+LANGUAGE: en -#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./notes.css"/> -#+OPTIONS: html-style:nil - -#+BEGIN_QUOTE -My emacs setup is tested to work only with emacs 26.1 and newer versions. If you are on -older versions, I would recommend that you upgrade to the [[https://www.gnu.org/software/emacs/download.html][latest available stable version]]. -#+END_QUOTE - -*Warning: this repository is being /transformed/ a bit: slowly migrating to literate programming ([[./emacs.org][emacs.org]]) and most likely moving into [[https://github.com/vdemeester/home][=home=]] at some point* - -* Few notes - -- This works best in =NixOS=, coupled with my [[https://github.com/vdemeester/home][=home=]] repository (especially with my - [[https://github.com/vdemeester/home/blob/master/modules/profiles/emacs.nix][emacs.nix]] file). -- Almost all setup files have setup done as per my personal tastes and needs. -- If you want to change the default theme, font size, etc, you would want to edit - =setup-files/setup-style.el= - -* Key points - -- Use of my minor mode =vde-mode= to enable my custom key-bindings. Doing so allows me to - force override my bindings in all major and minor modes. If I ever need to try out the - default emacs bindings, I can simply disable =vde-mode= by doing =M-x vde-mode=. /It - is enabled globally by default./ -- Use of =use-package= in load all packages for faster load times. -- Use of =bind-keys= allows me to review my custom bindings in a single buffer by doing - =M-x describe-personal-keybindings=. -- Certain packages will be loaded only if you have the associated applications installed. - -* Feedback - -Use at your own risk, but I am definitely looking forward to suggestions, corrections. - -Thanks! diff --git a/tmp/emacs-config/init.el b/tmp/emacs-config/init.el @@ -1,195 +0,0 @@ -;;; init.el --- -*- lexical-binding: t -*- -;; +CheckVer -(let ((minver 26)) - (unless (>= emacs-major-version minver) - (error "Your Emacs is too old -- this configuration requires v%s or higher" minver))) - -(defconst emacs-start-time (current-time)) - -;; load early-init.el before Emacs 27.0 -(unless (>= emacs-major-version 27) - (message "Early init: Emacs Version < 27.0") - (load (expand-file-name "early-init.el" user-emacs-directory))) -;; -CheckVer - -;; Inhibit -(setq inhibit-default-init t) ; Disable the site default settings - -(setq inhibit-startup-message t - inhibit-startup-screen t) -;; -Inhibit - -;; Confirm -(setq confirm-kill-emacs #'y-or-n-p) -;; -Confirm - -;; DefaultMode -(setq initial-major-mode 'fundamental-mode - initial-scratch-message nil) -;; -DefaultMode - -;; Unicode -(prefer-coding-system 'utf-8) -(set-default-coding-systems 'utf-8) -(set-language-environment 'utf-8) -(set-selection-coding-system 'utf-8) -(set-terminal-coding-system 'utf-8) -;; -Unicode - -;;; UsePackageSetup -(require 'package) - -(setq package-archives - '(("melpa" . "http://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("gnu" . "https://elpa.gnu.org/packages/"))) - -(setq package-archive-priorities - '(("melpa" . 3) - ("org" . 2) - ("gnu" . 1))) - -(require 'tls) - -;; From https://github.com/hlissner/doom-emacs/blob/5dacbb7cb1c6ac246a9ccd15e6c4290def67757c/core/core-packages.el#L102 -(setq gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this - tls-checktrust gnutls-verify-error - tls-program (list "gnutls-cli --x509cafile %t -p %p %h" - ;; compatibility fallbacks - "gnutls-cli -p %p %h" - "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")) - -;; Initialise the packages, avoiding a re-initialisation. -(unless (bound-and-true-p package--initialized) - (setq package-enable-at-startup nil) - (package-initialize)) - -(setq load-prefer-newer t) ; Always load newer compiled files -(setq ad-redefinition-action 'accept) ; Silence advice redefinition warnings - -;; Init `delight' -(unless (package-installed-p 'delight) - (package-refresh-contents) - (package-install 'delight)) - -;; Configure `use-package' prior to loading it. -(eval-and-compile - (setq use-package-always-ensure nil) - (setq use-package-always-defer nil) - (setq use-package-always-demand nil) - (setq use-package-expand-minimally nil) - (setq use-package-enable-imenu-support t)) - -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - -(eval-when-compile - (require 'use-package)) -;; -UsePackageSetup - -;; CustomFile -(defconst vde/custom-file (locate-user-emacs-file "custom.el") - "File used to store settings from Customization UI.") - -(use-package cus-edit - :config - (setq - custom-file vde/custom-file - custom-buffer-done-kill nil ; Kill when existing - custom-buffer-verbose-help nil ; Remove redundant help text - custom-unlispify-tag-names nil ; Show me the real variable name - custom-unlispify-menu-entries nil) - (unless (file-exists-p custom-file) - (write-region "" nil custom-file)) - - (load vde/custom-file 'no-error 'no-message)) -;; -CustomFile - -;; NoBuiltinOrg -(require 'cl-seq) -(setq load-path - (cl-remove-if - (lambda (x) - (string-match-p "org$" x)) - load-path)) -;; -NoBuiltinOrg - -;; PinEntry -(use-package pinentry - :config - (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version)) - (pinentry-start)) -;; -PinEntry - -;; LoadCfgFunc -(defun vde/el-load-dir (dir) - "Load el files from the given folder" - (let ((files (directory-files dir nil "\.el$"))) - (while files - (load-file (concat dir (pop files)))))) - -(defun vde/short-hostname () - "Return hostname in short (aka wakasu.local -> wakasu)" - (string-match "[0-9A-Za-z-]+" system-name) - (substring system-name (match-beginning 0) (match-end 0))) -;; -LoadCfgFunc - -;; CfgConstant -(defconst *sys/gui* - (display-graphic-p) - "Are we running on a GUI Emacs ?") -(defconst *sys/linux* - (eq system-type 'gnu/linux) - "Are we running on a GNU/Linux system?") -(defconst *sys/mac* - (eq system-type 'darwin) - "Are we running on a Mac system?") -(defconst *sys/root* - (string-equal "root" (getenv "USER")) - "Are you a ROOT user?") -(defconst *nix* - (executable-find "nix") - "Do we have nix? (aka are we running in NixOS or a system using nixpkgs)") -(defconst *rg* - (executable-find "rg") - "Do we have ripgrep?") -(defconst *gcc* - (executable-find "gcc") - "Do we have gcc?") -(defconst *git* - (executable-find "git") - "Do we have git?") - -(defvar *sys/full* - (member (vde/short-hostname) '("wakasu" "naruhodo")) ; "naruhodo" <- put naruhodo back in - "Is it a full system ?") -(defvar *sys/light* - (not *sys/full*) - "Is it a light system ?") -;; -CfgConstant - -;; CfgLoad -(add-to-list 'load-path (concat user-emacs-directory "lisp/")) -(require 'init-func) -(vde/el-load-dir (concat user-emacs-directory "/config/")) -;; -CfgLoad - -;; CfgHostLoad -(if (file-exists-p (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el"))) - (load-file (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el")))) -;; -CfgHostLoad - -;; LastInit -(let ((elapsed (float-time (time-subtract (current-time) - emacs-start-time)))) - (message "Loading %s...done (%.3fs)" load-file-name elapsed)) - -(add-hook 'after-init-hook - `(lambda () - (let ((elapsed - (float-time - (time-subtract (current-time) emacs-start-time)))) - (message "Loading %s...done (%.3fs) [after-init]" - ,load-file-name elapsed))) t) -;; -LastInit diff --git a/tmp/emacs-config/lisp/gotest-ui.el b/tmp/emacs-config/lisp/gotest-ui.el @@ -1,625 +0,0 @@ -;;; gotest-ui.el --- Major mode for running go test -json - -;; Copyright 2018 Andreas Fuchs -;; Authors: Andreas Fuchs <asf@boinkor.net> - -;; URL: https://github.com/antifuchs/gotest-ui-mode -;; Created: Feb 18, 2018 -;; Keywords: languages go -;; Version: 0.1.0 -;; Package-Requires: ((emacs "25") (s "1.12.0") (gotest "0.14.0")) - -;; This file is not a part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3.0, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: - -;; Provides support for running go tests with a nice user interface -;; that allows folding away output, highlighting failing tests. - -;;; Code: - -(eval-when-compile - (require 'cl)) - -(require 'subr-x) -(require 'ewoc) -(require 'json) -(require 'compile) - -(defgroup gotest-ui nil - "The go test runner." - :group 'tools) - -(defface gotest-ui-pass-face '((t :foreground "green")) - "Face for displaying the status of a passing test." - :group 'gotest-ui) - -(defface gotest-ui-skip-face '((t :foreground "grey")) - "Face for displaying the status of a skipped test." - :group 'gotest-ui) - -(defface gotest-ui-fail-face '((t :foreground "pink" :weight bold)) - "Face for displaying the status of a failed test." - :group 'gotest-ui) - -(defface gotest-ui-link-face '((t :foreground "white" :weight bold)) - "Face for displaying links to go source files." - :group 'gotest-ui) - -(defcustom gotest-ui-expand-test-statuses '(fail) - "Statuses to expand test cases for. -Whenever a test enters this state, it is automatically expanded." - :group 'gotest-ui) - -(defcustom gotest-ui-test-binary '("go") - "Command list used to invoke the `go' binary." - :group 'gotest-ui) - -(defcustom gotest-ui-test-args '("test" "-json") - "Argument list used to run tests with JSON output." - :group 'gotest-ui) - -(defcustom gotest-ui-additional-test-args '() - "Additional args to pass to `go test'." - :group 'gotest-ui) - -;;;; Data model: - -(defstruct (gotest-ui-section :named - (:constructor gotest-ui-section-create) - (:type vector) - (:predicate gotest-ui-section-p)) - title tests node) - -;;; `gotest-ui-thing' is a thing that can be under test: a -;;; package, or a single test. - -(defstruct gotest-ui-thing - (name) - (node) - (expanded-p) - (status) - (buffer) ; the buffer containing this test's output - (elapsed) ; a floating-point amount of seconds - ) - -;;; `gotest-ui-test' is a single test. It contains a status and -;;; output. -(defstruct (gotest-ui-test (:include gotest-ui-thing) - (:constructor gotest-ui--make-test-1)) - (package) - (reason)) - -(defun gotest-ui-test->= (test1 test2) - "Returns true if TEST1's name sorts greater than TEST2's." - (let ((pkg1 (gotest-ui-test-package test1)) - (pkg2 (gotest-ui-test-package test2)) - (name1 (or (gotest-ui-thing-name test1) "")) - (name2 (or (gotest-ui-thing-name test2) ""))) - (if (string= pkg1 pkg2) - (string> name1 name2) - (string> pkg1 pkg2)))) - -(defstruct (gotest-ui-status (:constructor gotest-ui--make-status-1)) - (state) - (cmdline) - (dir) - (output) - (node)) - -(cl-defun gotest-ui--make-status (ewoc cmdline dir) - (let ((status (gotest-ui--make-status-1 :state 'run :cmdline (s-join " " cmdline) :dir dir))) - (let ((node (ewoc-enter-first ewoc status))) - (setf (gotest-ui-status-node status) node)) - status)) - -(cl-defun gotest-ui--make-test (ewoc &rest args &key status package name &allow-other-keys) - (apply #'gotest-ui--make-test-1 :status (or status "run") args)) - -;;; Data manipulation routines: - -(cl-defun gotest-ui-ensure-test (ewoc package-name base-name &key (status 'run)) - (let* ((test-name (format "%s.%s" package-name base-name)) - (test (gethash test-name gotest-ui--tests))) - (if test - test - (setf (gethash test-name gotest-ui--tests) - (gotest-ui--make-test ewoc :name base-name :package package-name :status status))))) - -(defun gotest-ui-update-status (new-state) - (setf (gotest-ui-status-state gotest-ui--status) new-state) - (ewoc-invalidate gotest-ui--ewoc (gotest-ui-status-node gotest-ui--status))) - -(defun gotest-ui-update-status-output (new-output) - (setf (gotest-ui-status-output gotest-ui--status) new-output) - (ewoc-invalidate gotest-ui--ewoc (gotest-ui-status-node gotest-ui--status))) - -(defun gotest-ui-ensure-output-buffer (thing) - (unless (gotest-ui-thing-buffer thing) - (with-current-buffer - (setf (gotest-ui-thing-buffer thing) - (generate-new-buffer (format " *%s" (gotest-ui-thing-name thing)))) - (setq-local gotest-ui-parse-marker (point-min-marker)) - (setq-local gotest-ui-insertion-marker (point-min-marker)) - (set-marker-insertion-type gotest-ui-insertion-marker t))) - (gotest-ui-thing-buffer thing)) - -(defun gotest-ui-mouse-open-file (event) - "In gotest-ui mode, open the file/line reference in another window." - (interactive "e") - (let ((window (posn-window (event-end event))) - (pos (posn-point (event-end event))) - file line) - (if (not (windowp window)) - (error "No file chosen")) - (with-current-buffer (window-buffer window) - (goto-char pos) - (setq file (gotest-ui-get-file-for-visit)) - (setq line (gotest-ui-get-line-for-visit))) - (unless (file-exists-p file) - (error "Could not open %s:%d" file line)) - (with-current-buffer (find-file-other-window file) - (goto-char (point-min)) - (forward-line (1- line))))) - -(defun gotest-ui-get-file-for-visit () - (get-text-property (point) 'gotest-ui-file)) - -(defun gotest-ui-get-line-for-visit () - (string-to-number (get-text-property (point) 'gotest-ui-line))) - -(defun gotest-ui-file-from-gopath (package file-basename) - (if (or (file-name-absolute-p file-basename) - (string-match-p "/" file-basename)) - file-basename - (let ((gopath (or (getenv "GOPATH") - (expand-file-name "~/go")))) - (expand-file-name (concat gopath "/src/" package "/" file-basename))))) - -(defvar gotest-ui-click-map - (let ((map (make-sparse-keymap))) - (define-key map [mouse-2] 'gotest-ui-mouse-open-file) - map)) - -(defun gotest-ui-ensure-parsed (thing) - (save-excursion - (goto-char gotest-ui-parse-marker) - (while (re-search-forward "\\([^ \t]+\\.go\\):\\([0-9]+\\)" gotest-ui-insertion-marker t) - (let* ((file-basename (match-string 1)) - (file (gotest-ui-file-from-gopath (gotest-ui-test-package thing) file-basename))) - (set-text-properties (match-beginning 0) (match-end 0) - `(face gotest-ui-link-face - gotest-ui-file ,file - gotest-ui-line ,(match-string 2) - keymap ,gotest-ui-click-map - follow-link t - )))) - (set-marker gotest-ui-parse-marker gotest-ui-insertion-marker))) - -(defun gotest-ui-update-thing-output (thing output) - (with-current-buffer (gotest-ui-ensure-output-buffer thing) - (goto-char gotest-ui-insertion-marker) - (let ((overwrites (split-string output "\r"))) - (insert (car overwrites)) - (dolist (segment (cdr overwrites)) - (let ((delete-to (point))) - (forward-line 0) - (delete-region (point) delete-to)) - (insert segment))) - (set-marker gotest-ui-insertion-marker (point)) - (gotest-ui-ensure-parsed thing))) - -;; TODO: clean up buffers on kill - -;;;; Mode definition - -(defvar gotest-ui-mode-map - (let ((m (make-sparse-keymap))) - (suppress-keymap m) - ;; key bindings go here - (define-key m (kbd "TAB") 'gotest-ui-toggle-expanded) - (define-key m (kbd "g") 'gotest-ui-rerun) - m)) - -(define-derived-mode gotest-ui-mode special-mode "go test UI" - "Major mode for running go test with JSON output." - (setq truncate-lines t) - (setq buffer-read-only t) - (setq-local line-move-visual t) - (setq show-trailing-whitespace nil) - (setq list-buffers-directory default-directory) - (make-local-variable 'text-property-default-nonsticky) - (push (cons 'keymap t) text-property-default-nonsticky)) - - -(defun gotest-ui--clear-buffer (buffer) - (let ((dir default-directory)) - (with-current-buffer buffer - (when (buffer-live-p gotest-ui--process-buffer) - (kill-buffer gotest-ui--process-buffer)) - (kill-all-local-variables) - (let ((buffer-read-only nil)) - (erase-buffer)) - (buffer-disable-undo) - (setq-local default-directory dir)))) - -(defun gotest-ui--setup-buffer (buffer name cmdline dir) - (setq-local default-directory dir) - (setq gotest-ui--cmdline cmdline - gotest-ui--dir dir) - (let ((ewoc (ewoc-create 'gotest-ui--pp-test nil nil t)) - (tests (make-hash-table :test #'equal))) - (setq gotest-ui--tests tests) - (setq gotest-ui--ewoc ewoc) - ;; Drop in the first few ewoc nodes: - (setq gotest-ui--status (gotest-ui--make-status ewoc cmdline dir)) - (gotest-ui-add-section gotest-ui--ewoc 'fail "Failed Tests:") - (gotest-ui-add-section gotest-ui--ewoc 'run "Currently Running:") - (gotest-ui-add-section gotest-ui--ewoc 'skip "Skipped:") - (gotest-ui-add-section gotest-ui--ewoc 'pass "Passed Tests:")) - ;; Set up the other buffers: - (setq gotest-ui--stderr-process-buffer (generate-new-buffer (format " *%s (stderr)" name))) - (with-current-buffer gotest-ui--stderr-process-buffer - (setq gotest-ui--ui-buffer buffer)) - (setq gotest-ui--process-buffer (generate-new-buffer (format " *%s" name))) - (with-current-buffer gotest-ui--process-buffer - (setq gotest-ui--ui-buffer buffer))) - -(defun gotest-ui-add-section (ewoc state name) - (let ((section (gotest-ui-section-create :title name :tests (list nil)))) - (setf (gotest-ui-section-node section) - (ewoc-enter-last ewoc section)) - (push (cons state section) gotest-ui--section-alist))) - -(defun gotest-ui-sort-test-into-section (test previous-state) - (let (invalidate-nodes) - (when-let ((previous-section* (and previous-state - (assoc previous-state gotest-ui--section-alist)))) - (let ((previous-section (cdr previous-section*))) - (setf (gotest-ui-section-tests previous-section) - (delete test (gotest-ui-section-tests previous-section))) - (when (null (cdr (gotest-ui-section-tests previous-section))) - (push (gotest-ui-section-node previous-section) invalidate-nodes)))) - ;; Drop the node from the buffer: - (when-let (node (gotest-ui-thing-node test)) - (let ((buffer-read-only nil)) - (ewoc-delete gotest-ui--ewoc node)) - (setf (gotest-ui-thing-node test) nil)) - - ;; Put it in the next secion: - (when-let ((section* (assoc (gotest-ui-thing-status test) - gotest-ui--section-alist))) - (let* ((section (cdr section*)) - (insertion-cons (gotest-ui-section-tests section))) - (while (and (cdr insertion-cons) - (gotest-ui-test->= test (cadr insertion-cons))) - (setq insertion-cons (cdr insertion-cons))) - (rplacd insertion-cons (cons test (cdr insertion-cons))) - (let ((insertion-node (if (car insertion-cons) - (gotest-ui-thing-node (car insertion-cons)) - (gotest-ui-section-node section)))) - (setf (gotest-ui-thing-node test) - (ewoc-enter-after gotest-ui--ewoc insertion-node test))) - (when (null (cddr (gotest-ui-section-tests section))) - (push (gotest-ui-section-node section) invalidate-nodes)))) - (unless (null invalidate-nodes) - (apply 'ewoc-invalidate gotest-ui--ewoc invalidate-nodes)) - (gotest-ui-thing-node test))) - -;;;; Commands: - -(defun gotest-ui-toggle-expanded () - "Toggle expandedness of a test/package node" - (interactive) - (let* ((node (ewoc-locate gotest-ui--ewoc (point))) - (data (ewoc-data node))) - (when (and data (gotest-ui-thing-p data)) - (setf (gotest-ui-thing-expanded-p data) - (not (gotest-ui-thing-expanded-p data))) - (ewoc-invalidate gotest-ui--ewoc node)))) - -(defun gotest-ui-rerun () - (interactive) - (gotest-ui gotest-ui--cmdline :dir gotest-ui--dir)) - -;;;; Displaying the data: - -(defvar-local gotest-ui--tests nil) -(defvar-local gotest-ui--section-alist nil) -(defvar-local gotest-ui--ewoc nil) -(defvar-local gotest-ui--status nil) -(defvar-local gotest-ui--process-buffer nil) -(defvar-local gotest-ui--stderr-process-buffer nil) -(defvar-local gotest-ui--ui-buffer nil) -(defvar-local gotest-ui--process nil) -(defvar-local gotest-ui--stderr-process nil) -(defvar-local gotest-ui--cmdline nil) -(defvar-local gotest-ui--dir nil) - -(cl-defun gotest-ui (cmdline &key dir) - (let* ((dir (or dir default-directory)) - (name (format "*go test: %s in %s" (s-join " " cmdline) dir)) - (buffer (get-buffer-create name))) - (unless (eql buffer (current-buffer)) - (display-buffer buffer)) - (with-current-buffer buffer - (let ((default-directory dir)) - (gotest-ui--clear-buffer buffer) - (gotest-ui-mode) - (gotest-ui--setup-buffer buffer name cmdline dir)) - (setq gotest-ui--stderr-process - (make-pipe-process :name (s-concat name "(stderr)") - :buffer gotest-ui--stderr-process-buffer - :sentinel #'gotest-ui--stderr-process-sentinel - :filter #'gotest-ui-read-stderr)) - (setq gotest-ui--process - (make-process :name name - :buffer gotest-ui--process-buffer - :sentinel #'gotest-ui--process-sentinel - :filter #'gotest-ui-read-stdout - :stderr gotest-ui--stderr-process - :command cmdline))))) - -(defun gotest-ui-pp-status (status) - (propertize (format "%s" status) - 'face - (case status - (fail 'gotest-ui-fail-face) - (skip 'gotest-ui-skip-face) - (pass 'gotest-ui-pass-face) - (otherwise 'default)))) - -(defun gotest-ui--pp-test-output (test) - (with-current-buffer (gotest-ui-ensure-output-buffer test) - (propertize (buffer-substring (point-min) (point-max)) - 'line-prefix "\t"))) - -(defun gotest-ui--pp-test (test) - (cond - ((gotest-ui-section-p test) - (unless (null (cdr (gotest-ui-section-tests test))) - (insert "\n" (gotest-ui-section-title test) "\n"))) - ((gotest-ui-status-p test) - (insert (gotest-ui-pp-status (gotest-ui-status-state test))) - (insert (format " %s in %s\n\n" - (gotest-ui-status-cmdline test) - (gotest-ui-status-dir test))) - (unless (zerop (length (gotest-ui-status-output test))) - (insert (format "\n\n%s" (gotest-ui-status-output test))))) - ((gotest-ui-test-p test) - (let ((status (gotest-ui-thing-status test)) - (package (gotest-ui-test-package test)) - (name (gotest-ui-thing-name test))) - (insert (gotest-ui-pp-status status)) - (insert " ") - (insert (if name - (format "%s.%s" package name) - package)) - (when-let ((elapsed (gotest-ui-thing-elapsed test))) - (insert (format " (%.3fs)" elapsed))) - (when-let ((reason (gotest-ui-test-reason test))) - (insert (format " [%s]" reason)))) - (when (and (gotest-ui-thing-expanded-p test) - (> (length (gotest-ui--pp-test-output test)) 0)) - (insert "\n") - (insert (gotest-ui--pp-test-output test))) - (insert "\n")))) - -;;;; Handling input: - -(defun gotest-ui--process-sentinel (proc event) - (let* ((process-buffer (process-buffer proc)) - (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) - (inhibit-quit t)) - (with-local-quit - (with-current-buffer ui-buffer - (cond - ((string= event "finished\n") - (gotest-ui-update-status 'pass)) - ((s-prefix-p "exited abnormally" event) - (gotest-ui-update-status 'fail)) - (t - (gotest-ui-update-status event))))))) - -(defun gotest-ui--stderr-process-sentinel (proc event) - ;; ignore all events - nil) - -(defun gotest-ui-read-stderr (proc input) - (let* ((process-buffer (process-buffer proc)) - (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) - (inhibit-quit t)) - (with-local-quit - (when (buffer-live-p process-buffer) - (with-current-buffer process-buffer - (gotest-ui-read-compiler-spew proc process-buffer ui-buffer input)))))) - -(defun gotest-ui-read-stdout (proc input) - (let* ((process-buffer (process-buffer proc)) - (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) - (inhibit-quit t)) - (with-local-quit - (when (buffer-live-p process-buffer) - (gotest-ui-read-json process-buffer (process-mark proc) input))))) - -(defun gotest-ui-read-json (process-buffer marker input) - (with-current-buffer process-buffer - (gotest-ui-read-json-1 process-buffer marker gotest-ui--ui-buffer input))) - -(defvar-local gotest-ui--current-failing-test nil) - -(defun gotest-ui-read-failing-package (ui-buffer) - (when (looking-at "^# \\(.*\\)$") - (let* ((package (match-string 1)) - test) - (with-current-buffer ui-buffer - (setq test (gotest-ui-ensure-test gotest-ui--ewoc package nil :status 'fail)) - (gotest-ui-maybe-expand test) - (gotest-ui-sort-test-into-section test nil)) - (forward-line 1) - test))) - -(defun gotest-ui-read-compiler-spew (proc process-buffer ui-buffer input) - (with-current-buffer process-buffer - (save-excursion - (goto-char (point-max)) - (insert input) - (goto-char (process-mark proc)) - (while (and (/= (point-max) (line-end-position)) ; incomplete line - (/= (point-max) (point))) - (cond - (gotest-ui--current-failing-test - (cond - ((looking-at "^# \\(.*\\)$") - (gotest-ui-read-failing-package ui-buffer)) - (t - (let* ((line (buffer-substring (point) (line-end-position))) - (test gotest-ui--current-failing-test)) - (forward-line 1) - (set-marker (process-mark proc) (point)) - (with-current-buffer ui-buffer - (gotest-ui-update-thing-output test (concat line "\n")) - (ewoc-invalidate gotest-ui--ewoc (gotest-ui-thing-node test))))))) - (t - (let ((test (gotest-ui-read-failing-package ui-buffer))) - (setq gotest-ui--current-failing-test test) - (set-marker (process-mark proc) (point)) - (with-current-buffer ui-buffer - (ewoc-invalidate gotest-ui--ewoc (gotest-ui-thing-node test)))))))))) - -(defun gotest-ui-read-json-1 (process-buffer marker ui-buffer input) - (with-current-buffer process-buffer - (save-excursion - ;; insert the chunk of output at the end - (goto-char (point-max)) - (insert input) - - ;; try to read the next object (which is hopefully complete now): - (let ((nodes - (cl-loop - for (node . continue) = (gotest-ui-read-test-event process-buffer marker ui-buffer) - when node collect node into nodes - while continue - finally (return nodes)))) - (when nodes - (with-current-buffer ui-buffer - (apply #'ewoc-invalidate gotest-ui--ewoc - (cl-remove-if-not (lambda (node) (marker-buffer (ewoc-location node))) (cl-remove-duplicates nodes))))))))) - -(defun gotest-ui-read-test-event (process-buffer marker ui-buffer) - (goto-char marker) - (when (= (point) (line-end-position)) - (forward-line 1)) - (case (char-after (point)) - (?\{ - ;; It's JSON: - (condition-case err - (let ((obj (json-read))) - (set-marker marker (point)) - (with-current-buffer ui-buffer - (cons (gotest-ui-update-test-status obj) t))) - (json-error (cons nil nil)) - (wrong-type-argument - (if (and (eql (cadr err) 'characterp) - (eql (caddr err) :json-eof)) - ;; This is peaceful & we can ignore it: - (cons nil nil) - (signal 'wrong-type-argument err))))) - (?\F - ;; It's a compiler error: - (when (looking-at "^FAIL\t\\(.*\\)\s+\\[\\([^]]+\\)\\]\n") - (let* ((package-name (match-string 1)) - (reason (match-string 2)) - test node) - (with-current-buffer ui-buffer - (setq test (gotest-ui-ensure-test gotest-ui--ewoc package-name nil :status 'fail) - node (gotest-ui-thing-node test)) - (setf (gotest-ui-test-reason test) reason) - (gotest-ui-sort-test-into-section test nil) - (gotest-ui-maybe-expand test)) - (forward-line 1) - (set-marker marker (point)) - (cons node t)))) - (otherwise - ;; We're done: - (cons nil nil)))) - -(defun gotest-ui-maybe-expand (test) - (when (memq (gotest-ui-test-status test) gotest-ui-expand-test-statuses) - (setf (gotest-ui-test-expanded-p test) t))) - -(defun gotest-ui-update-test-status (json) - (let-alist json - (let* ((action (intern .Action)) - (test (gotest-ui-ensure-test gotest-ui--ewoc .Package .Test)) - (previous-status (gotest-ui-thing-status test))) - (case action - (run - (gotest-ui-sort-test-into-section test nil)) - (output (gotest-ui-update-thing-output test .Output)) - (pass - (setf (gotest-ui-thing-status test) 'pass - (gotest-ui-thing-elapsed test) .Elapsed) - (gotest-ui-sort-test-into-section test previous-status) - (gotest-ui-maybe-expand test)) - (fail - (setf (gotest-ui-thing-status test) 'fail - (gotest-ui-thing-elapsed test) .Elapsed) - (gotest-ui-sort-test-into-section test previous-status) - (gotest-ui-maybe-expand test)) - (skip - (setf (gotest-ui-thing-status test) 'skip - (gotest-ui-thing-elapsed test) .Elapsed) - (gotest-ui-sort-test-into-section test previous-status) - (gotest-ui-maybe-expand test)) - (otherwise - (setq test nil))) - (when test (gotest-ui-thing-node test))))) - -;;;; Commands for go-mode: - -(defun gotest-ui--command-line (&rest cmdline) - (append gotest-ui-test-binary gotest-ui-test-args gotest-ui-additional-test-args - cmdline)) - -;;;###autoload -(defun gotest-ui-current-test () - "Launch go test with the test that (point) is in." - (interactive) - (cl-destructuring-bind (test-suite test-name) (go-test--get-current-test-info) - (let ((test-flag (if (> (length test-suite) 0) "-m" "-run"))) - (when test-name - (gotest-ui (gotest-ui--command-line test-flag (s-concat test-name "$") ".")))))) - -;;;###autoload -(defun gotest-ui-current-file () - "Launch go test on the current buffer file." - (interactive) - (let* ((data (go-test--get-current-file-testing-data)) - (run-flag (s-concat "-run=" data "$"))) - (gotest-ui (gotest-ui--command-line run-flag ".")))) - -;;;###autoload -(defun gotest-ui-current-project () - "Launch go test on the current buffer's project." - (interactive) - (let ((default-directory (projectile-project-root))) - (gotest-ui (gotest-ui--command-line "./...")))) - -(provide 'gotest-ui) - -;;; gotest-ui.el ends here diff --git a/tmp/emacs-config/lisp/init-func.el b/tmp/emacs-config/lisp/init-func.el @@ -1,53 +0,0 @@ -;;; init-func.el --- -*- lexical-binding: t -*- -;; -;; OrgIncludeAuto -;; https://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html -(defun save-and-update-includes () - "Update the line numbers of #+INCLUDE:s in current buffer. -Only looks at INCLUDEs that have either :range-begin or :range-end. -This function does nothing if not in `org-mode', so you can safely -add it to `before-save-hook'." - (interactive) - (when (derived-mode-p 'org-mode) - (save-excursion - (goto-char (point-min)) - (while (search-forward-regexp - "^\\s-*#\\+INCLUDE: *\"\\([^\"]+\\)\".*:range-\\(begin\\|end\\)" - nil 'noerror) - (let* ((file (expand-file-name (match-string-no-properties 1))) - lines begin end) - (forward-line 0) - (when (looking-at "^.*:range-begin *\"\\([^\"]+\\)\"") - (setq begin (match-string-no-properties 1))) - (when (looking-at "^.*:range-end *\"\\([^\"]+\\)\"") - (setq end (match-string-no-properties 1))) - (setq lines (decide-line-range file begin end)) - (when lines - (if (looking-at ".*:lines *\"\\([-0-9]+\\)\"") - (replace-match lines :fixedcase :literal nil 1) - (goto-char (line-end-position)) - (insert " :lines \"" lines "\"")))))))) - -(add-hook 'before-save-hook #'save-and-update-includes) - -(defun decide-line-range (file begin end) - "Visit FILE and decide which lines to include. -BEGIN and END are regexps which define the line range to use." - (let (l r) - (save-match-data - (with-temp-buffer - (insert-file-contents file) - (goto-char (point-min)) - (if (null begin) - (setq l "") - (search-forward-regexp begin) - (setq l (line-number-at-pos (match-beginning 0)))) - (if (null end) - (setq r "") - (search-forward-regexp end) - (setq r (1+ (line-number-at-pos (match-end 0))))) - (format "%s-%s" (+ l 1) (- r 1)))))) ;; Exclude wrapper -;; -OrgIncludeAuto - -(provide 'init-func) -;;; init-func.el ends here diff --git a/tmp/emacs-config/lisp/ol-github.el b/tmp/emacs-config/lisp/ol-github.el @@ -1,67 +0,0 @@ -;;; ol-github.el --- Links to GitHub -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Vincent Demeester - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: org link github -;; -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3.0, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; This file implements links to GitHub from within Org mode. -;; gh:tektoncd/pipeline : project -;; gh:tektoncd/pipeline#1 : issue or pr #1 - -;;; Code: - -(require 'ol) - -;; Install the link type -(org-link-set-parameters "gh" - :follow #'org-github-follow-link - :export #'org-github-export - :face '(:foreground "DimGrey" :underline t)) - - -(defun org-github-export (link description format) - "Export a github page link from Org files." - (let ((path (org-github-get-url link)) - (desc (or description link))) - (cond - ((eq format 'html) (format "<a hrefl=\"_blank\" href=\"%s\">%s</a>" path desc)) - ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) - ((eq format 'texinfo) (format "@uref{%s,%s}" path desc)) - ((eq format 'ascii) (format "%s (%s)" desc path)) - (t path)))) - -(defun org-github-follow-link (issue) - "Browse github issue/pr specified." - (browse-url (org-github-get-url issue))) - -(defun org-github-get-url (path) - "Translate org-mode link `gh:foo/bar#1' to github url." - (setq expressions (split-string path "#")) - (setq project (nth 0 expressions)) - (setq issue (nth 1 expressions)) - (if issue - (format "https://github.com/%s/issues/%s" project issue) - (format "https://github.com/%s" project))) - -(provide 'ol-github) -;;; ol-github.el ends here diff --git a/tmp/emacs-config/lisp/ol-gitlab.el b/tmp/emacs-config/lisp/ol-gitlab.el @@ -1,78 +0,0 @@ -;;; ol-gitlab.el --- Links to Gitlab -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Vincent Demeester - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: org link gitlab -;; -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3.0, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; This file implements links to Gitlab from within Org mode. -;; gl:vdemeester/emacs-config : project -;; gl:vdemeester/emacs-config#1 : issue #1 -;; gl:vdemeester/emacs-config##1 : merge-request #1 - -;;; Code: - -(require 'ol) - -;; Install the link type -(org-link-set-parameters "gl" - :follow #'org-gitlab-follow-link - :export #'org-gitlab-export - :face '(:foreground "DimGrey" :underline t)) - - -(defun org-gitlab-export (link description format) - "Export a gitlab page link from Org files." - (let ((path (org-gitlab-get-url link)) - (desc (or description link))) - (cond - ((eq format 'html) (format "<a hrefl=\"_blank\" href=\"%s\">%s</a>" path desc)) - ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) - ((eq format 'texinfo) (format "@uref{%s,%s}" path desc)) - ((eq format 'ascii) (format "%s (%s)" desc path)) - (t path)))) - -(defun org-gitlab-follow-link (issue) - "Browse gitlab issue/pr specified." - (browse-url (org-gitlab-get-url issue))) - -(defun org-gitlab-get-url (path) - "Translate org-mode link `gh:foo/bar#1' to gitlab url." - (setq expressions (split-string path "#")) - (setq project (nth 0 expressions)) - (setq issue (nth 1 expressions)) - (setq mr (nth 2 expressions)) - (message (format "issue: %s" issue)) - (message (format "mr: %s" mr)) - (if (not (empty-string-p mr)) - (format "https://gitlab.com/%s/-/merge_requests/%s" project mr) - (if (not (empty-string-p issue)) - (format "https://gitlab.com/%s/-/issues/%s" project issue) - (format "https://gitlab.com/%s" project)))) - -(defun empty-string-p (string) - "Return true if the STRING is empty or nil. Expects string type." - (or (null string) - (zerop (length (string-trim string))))) - -(provide 'ol-gitlab) -;;; ol-gitlab.el ends here diff --git a/tmp/emacs-config/lisp/ol-grep.el b/tmp/emacs-config/lisp/ol-grep.el @@ -1,54 +0,0 @@ -;;; ol-grep.el --- Links to Grep -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Vincent Demeester - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: org link grep -;; -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3.0, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; This file implements links to Grep from within Org mode. -;; grep:orgmode : run grep on current working dir with orgmode expression -;; grep:orgmode:config/ : run grep on config/ dir with orgmode expression - -;;; Code: - -(require 'ol) - -;; Install the link type -(org-link-set-parameters "rg" - :follow #'org-grep-follow-link - :face '(:foreground "DarkRed" :underline t)) - -(defun org-grep-follow-link (issue) - "Run `rgrep' with REGEXP and FOLDER as argument, -like this : [[grep:REGEXP:FOLDER]]." - (setq expressions (split-string regexp ":")) - (setq exp (nth 0 expressions)) - (grep-compute-defaults) - (if (= (length expressions) 1) - (progn - (rgrep exp "*" (expand-file-name "./"))) - (progn - (setq folder (nth 1 expressions)) - (rgrep exp "*" (expand-file-name folder))))) - -(provide 'ol-grep) -;;; ol-grep.el ends here diff --git a/tmp/emacs-config/lisp/ol-ripgrep.el b/tmp/emacs-config/lisp/ol-ripgrep.el @@ -1,53 +0,0 @@ -;;; ol-ripgrep.el --- Links to Ripgrep -*- lexical-binding: t; -*- - -;; Copyright (C) 2020 Vincent Demeester - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: org link ripgrep -;; -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3.0, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; This file implements links to Ripgrep from within Org mode. -;; rg:orgmode : run ripgrep on current working dir with orgmode expression -;; rg:orgmode:config/ : run ripgrep on config/ dir with orgmode expression - -;;; Code: - -(require 'ol) - -;; Install the link type -(org-link-set-parameters "rg" - :follow #'org-ripgrep-follow-link - :face '(:foreground "DarkGreen" :underline t)) - -(defun org-ripgrep-follow-link (issue) - "Run `ripgrep-regexp` with REXEP and FOLDER as argument, -like this : [[pt:REGEXP:FOLDER]]" - (setq expressions (split-string regexp ":")) - (setq exp (nth 0 expressions)) - (if (= (length expressions) 1) - (progn - (ripgrep-regexp exp (expand-file-name "./"))) - (progn - (setq folder (nth 1 expressions)) - (ripgrep-regexp exp (file-name-as-directory (expand-file-name folder)))))) - -(provide 'ol-ripgrep) -;;; ol-ripgrep.el ends here diff --git a/tmp/emacs-config/lisp/shortbrain-light-theme.el b/tmp/emacs-config/lisp/shortbrain-light-theme.el @@ -1,272 +0,0 @@ -;;; shortbrain-light-theme.el --- A calm, light, almost monochrome color theme based on emacs-shortbrain-theme. - -;; Copyright (C) 2020 Vincent Demeester <vincent@sbr.pm> - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: themes -;; URL: https://github.com/vdemeester/emacs-config -;; Version: 2020.03 -;; Package-Requires: ((emacs "24.1")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; To use the shortbrain-light theme, add the following to your Emacs -;; configuration file: -;; -;; (load-theme 'shortbrain-light) -;; -;; Requirements: Emacs 24. - -;;; Code: - - -(deftheme shortbrain-light "A calm, light, almost monochrome color theme") - - -(defconst shortbrain-light-theme-colors - '(;; Basics - (white . "#ffffff") - - ;; Greys - (default-grey . "#0f1619") - (grey . "#0f1619") - (grey-50 . "#fdfdfe") - (grey-100 . "#f5f8fa") - (grey-200 . "#d8dcde") - (grey-300 . "#bcc0c2") - (grey-400 . "#9fa3a6") - (grey-500 . "#9fa3a6") - (grey-600 . "#656b6e") - (grey-700 . "#494f52") - (grey-720 . "#474d50") - (grey-800 . "#2c3236") - (grey-820 . "#1e2428") - (grey-850 . "#1d2226") - (grey-900 . "#0f1619") - - ;; Primaries - (default-primary . "#0be5e5") - (primary . "#0be5e5") - (primary-50 . "#f3fefe") - (primary-100 . "#d4fafa") - (primary-200 . "#91f3f3") - (primary-300 . "#4eecec") - (primary-400 . "#0be5e5") - (primary-500 . "#09cccc") - (primary-600 . "#07b3b3") - (primary-700 . "#059999") - (primary-800 . "#028080") - (primary-900 . "#006666") - - ;; Greens - (default-green . "#0be541") - (green . "#0be441") - (green-50 . "#e7feec") - (green-100 . "#b6fcc7") - (green-200 . "#85f9a2") - (green-300 . "#3cf66b") - (green-400 . "#0be441") - (green-500 . "#0adb3f") - (green-600 . "#09c338") - (green-700 . "#08aa31") - (green-800 . "#07922a") - (green-900 . "#067a23") - - ;; Reds - (default-red. "#f24965") - (red . "#f24965") - (danger . "#f24965") - (red-50 . "#fff0f2") - (red-100 . "#ffd9df") - (red-200 . "#fba9b6") - (red-300 . "#f6798e") - (red-400 . "#f24965") - (red-500 . "#d6455d") - (red-600 . "#ba4054") - (red-700 . "#9e3c4c") - (red-800 . "#823743") - (red-900 . "#66333b") - - ;; Purples - (purple . "#b965e8"))) - - -(defun shortbrain-light-theme-color (name) - "Return the shortbrain-light theme color with the given NAME." - (cdr (assoc name shortbrain-light-theme-colors))) - - -(let ((class '((class color) (min-colors 256))) - (default-fg (shortbrain-light-theme-color 'grey-900)) - (default-bg (shortbrain-light-theme-color 'grey-50)) - (inactive-bg (shortbrain-light-theme-color 'grey-200)) - (minor-fg (shortbrain-light-theme-color 'grey-200)) - (minor-bg (shortbrain-light-theme-color 'grey-50)) - (inactive-fg (shortbrain-light-theme-color 'grey-600)) - (border-fg (shortbrain-light-theme-color 'grey-200)) - (frame-fg (shortbrain-light-theme-color 'grey-500)) - (cursor-fg (shortbrain-light-theme-color 'grey-900)) - (cursor-bg (shortbrain-light-theme-color 'grey-300)) - - ;; Scrollbars - (scrollbar-fg (shortbrain-light-theme-color 'grey-600)) - (scrollbar-bg (shortbrain-light-theme-color 'grey-100)) - - ;; Highlighting - (highlight-fg (shortbrain-light-theme-color 'white)) - (highlight-bg (shortbrain-light-theme-color 'red)) - - ;; Current line - (hl-line-bg (shortbrain-light-theme-color 'grey-100)) - - ;; Search - (search-fg (shortbrain-light-theme-color 'white)) - (search-bg (shortbrain-light-theme-color 'primary-600)) - (search-bg-0 (shortbrain-light-theme-color 'primary-500)) - (search-bg-1 (shortbrain-light-theme-color 'primary-400)) - (search-bg-2 (shortbrain-light-theme-color 'primary-300)) - (search-bg-3 (shortbrain-light-theme-color 'primary-100)) - - ;; Selection - (selection-bg (shortbrain-light-theme-color 'grey-200)) - - ;; Auto-completion - (completion-fg (shortbrain-light-theme-color 'grey-500)) - (completion-bg (shortbrain-light-theme-color 'grey-800)) - (completion-match-fg (shortbrain-light-theme-color 'red-500)) - (completion-mouse-fg (shortbrain-light-theme-color 'white)) - (completion-selection-fg (shortbrain-light-theme-color 'red-500)) - (completion-selection-bg (shortbrain-light-theme-color 'grey-200)) - (completion-annotation-fg (shortbrain-light-theme-color 'red-400)) - - ;; Warnings & errors - (warning-fg (shortbrain-light-theme-color 'white)) - (warning-bg (shortbrain-light-theme-color 'red-600)) - (error-fg (shortbrain-light-theme-color 'white)) - (error-bg (shortbrain-light-theme-color 'red)) - - ;; Org - (org-color-1 (shortbrain-light-theme-color 'green-900)) - (org-color-2 (shortbrain-light-theme-color 'purple)) - (org-color-3 (shortbrain-light-theme-color 'primary-700)) - (org-color-4 (shortbrain-light-theme-color 'primary-500)) - (org-color-5 (shortbrain-light-theme-color 'primary-400)) - (org-meta-fg (shortbrain-light-theme-color 'primary-900)) - - ;; Language syntax highlighting - (variable-fg (shortbrain-light-theme-color 'black)) - (function-fg (shortbrain-light-theme-color 'grey-900)) - (type-fg (shortbrain-light-theme-color 'grey-700)) - (constant-fg (shortbrain-light-theme-color 'grey-600)) - (keyword-fg (shortbrain-light-theme-color 'grey-500)) - (builtin-fg (shortbrain-light-theme-color 'grey-400)) - (string-fg (shortbrain-light-theme-color 'grey-600)) - (doc-fg (shortbrain-light-theme-color 'primary-600)) - (doc-bg (shortbrain-light-theme-color 'grey-50))) - (custom-theme-set-faces - 'shortbrain-light - ;; Regular - `(cursor ((,class (:foreground ,cursor-fg :background ,cursor-bg)))) - `(default ((,class (:foreground ,default-fg :background ,default-bg)))) - `(default-italic ((,class (:italic t)))) - - ;; Emacs UI - `(fringe ((,class (:foreground ,error-fg :background ,default-bg)))) - `(header-line ((,class :background ,default-bg))) - `(linum ((,class (:inherit shadow :background ,default-bg)))) - `(mode-line ((,class (:foreground ,frame-fg :background ,default-bg - :box (:line-width -1 :color ,default-bg))))) - `(mode-line-inactive ((,class (:foreground ,inactive-fg :background ,inactive-bg - :box (:line-width -1 :color ,inactive-bg))))) - `(nlinum-relative-current-face ((,class (:foreground ,frame-fg :background ,default-bg)))) - `(vertical-border ((,class (:foreground ,border-fg :background ,default-bg)))) - - ;; Highlighting - `(highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg)))) - `(hl-line ((,class (:background ,hl-line-bg)))) - - ;; Search - `(isearch ((,class (:foreground ,search-fg :background ,search-bg :weight bold)))) - `(lazy-highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg) :weight normal))) - - ;; Selection - `(region ((,class (:background ,selection-bg)))) - - ;; Erroneous whitespace - `(whitespace-line ((,class (:foreground ,error-fg :background ,error-bg)))) - `(whitespace-space ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) - `(whitespace-tab ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) - - ;; Language syntax highlighting - `(font-lock-builtin-face ((,class (:foreground ,builtin-fg)))) - `(font-lock-comment-face ((,class (:foreground ,doc-fg :background ,doc-bg)))) - `(font-lock-comment-delimiter-face ((,class (:foreground ,minor-fg, :background ,minor-bg)))) - `(font-lock-constant-face ((,class (:foreground ,constant-fg)))) - `(font-lock-doc-face ((,class (:foreground ,doc-fg)))) - `(font-lock-function-name-face ((,class (:foreground ,function-fg)))) - `(font-lock-keyword-face ((,class (:foreground ,keyword-fg)))) - `(font-lock-negation-char-face ((,class (:foreground ,error-fg)))) - `(font-lock-preprocessor-face ((,class (:foreground ,builtin-fg)))) - `(font-lock-string-face ((,class (:foreground ,string-fg)))) - `(font-lock-type-face ((,class (:foreground ,type-fg)))) - `(font-lock-variable-name-face ((,class (:foreground ,variable-fg)))) - `(font-lock-warning-face ((,class (:foreground ,warning-fg :background ,warning-bg)))) - - ;; Org - `(org-level-1 ((,class (:foreground ,org-color-1 :bold t :height 1.2)))) - `(org-level-2 ((,class (:foreground ,org-color-2 :bold t :height 1.1)))) - `(org-level-3 ((,class (:foreground ,org-color-3 :bold t :height 1.0)))) - `(org-level-4 ((,class (:foreground ,org-color-4 :bold t :height 1.0)))) - `(org-level-5 ((,class (:foreground ,org-color-5 :bold t :height 1.0)))) - `(org-level-6 ((,class (:foreground ,org-color-5 :bold t :height 1.0)))) - `(org-document-title ((,class (:bold t :foreground ,org-meta-fg :height 1.4)))) - `(org-meta-line ((,class (:foreground ,org-meta-fg :bold t)))) - - ;; Avy - `(avy-lead-face ((,class (:background ,search-bg-0 :foreground ,search-fg)))) - `(avy-lead-face-0 ((,class (:background ,search-bg-1 :foreground ,search-fg)))) - `(avy-lead-face-1 ((,class (:background ,search-bg-2 :foreground ,search-fg)))) - `(avy-lead-face-2 ((,class (:background ,search-bg-3 :foreground ,search-fg)))) - - ;; Company (auto-completion) - `(company-preview ((,class (:background ,default-bg :foreground ,completion-match-fg)))) - `(company-preview-common ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-preview-search ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-scrollbar-bg ((,class (:background ,scrollbar-bg)))) - `(company-scrollbar-fg ((,class (:background ,scrollbar-fg)))) - `(company-tooltip ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-tooltip-annotation ((,class (:foreground ,completion-annotation-fg)))) - `(company-tooltip-common ((,class (:background nil :foreground ,completion-match-fg)))) - `(company-tooltip-common-selection ((,class (:foreground ,completion-selection-fg - :background ,completion-selection-bg)))) - `(company-tooltip-mouse ((,class (:background ,selection-bg :foreground ,completion-mouse-fg)))) - `(company-tooltip-search ((,class (:foreground ,completion-match-fg)))) - `(company-tooltip-selection ((,class (:background ,selection-bg :foreground nil)))))) - - -;;;###autoload -(when (and (boundp 'custom-theme-load-path) - load-file-name) - ;; add theme folder to `custom-theme-load-path' when installing over MELPA - (add-to-list 'custom-theme-load-path - (file-name-as-directory (file-name-directory load-file-name)))) - - -(provide-theme 'shortbrain-light) -(provide 'shortbrain-light-theme) - - -;;; shortbrain-light-theme.el ends here diff --git a/tmp/emacs-config/lisp/shortbrain-theme.el b/tmp/emacs-config/lisp/shortbrain-theme.el @@ -1,235 +0,0 @@ -;;; shortbrain-theme.el --- A calm, dark, almost monochrome color theme based on emacs-constant-theme - -;; Copyright (C) 2020 Vincent Demeester <vincent@sbr.pm> - -;; Author: Vincent Demeester <vincent@sbr.pm> -;; Keywords: themes -;; URL: https://github.com/vdemeester/emacs-config -;; Version: 2020:03 -;; Package-Requires: ((emacs "24.1")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; To use the shortbrain theme, add the following to your Emacs -;; configuration file: -;; -;; (load-theme 'shortbrain) -;; -;; Requirements: Emacs 24. - -;;; Code: - - -(deftheme shortbrain "A calm, dark, almost monochrome theme") - -(defconst shortbrain-theme-colors - '(;; Basics - (white . "#ffffff") - - ;; Shades of grey - (default-grey . "#0f1619") - (grey . "#0f1619") - (grey-50 . "#fdfdfe") - (grey-100 . "#f5f8fa") - (grey-200 . "#d8dcde") - (grey-300 . "#bcc0c2") - (grey-400 . "#9fa3a6") - (grey-500 . "#9fa3a6") - (grey-600 . "#656b6e") - (grey-700 . "#494f52") - (grey-720 . "#474d50") - (grey-800 . "#2c3236") - (grey-820 . "#1e2428") - (grey-850 . "#1d2226") - (grey-900 . "#0f1619") - - ;; Priary color shades - (default-primary . "#0be5e5") - (primary . "#0be5e5") - (primary-50 . "#f3fefe") - (primary-100 . "#d4fafa") - (primary-200 . "#91f3f3") - (primary-300 . "#4eecec") - (primary-400 . "#0be5e5") - (primary-500 . "#09cccc") - (primary-600 . "#07b3b3") - (primary-700 . "#059999") - (primary-800 . "#028080") - (primary-900 . "#006666") - - ;; Reds - (default-red. "#f24965") - (red . "#f24965") - (danger . "#f24965") - (red-50 . "#fff0f2") - (red-100 . "#ffd9df") - (red-200 . "#fba9b6") - (red-300 . "#f6798e") - (red-400 . "#f24965") - (red-500 . "#d6455d") - (red-600 . "#ba4054") - (red-700 . "#9e3c4c") - (red-800 . "#823743") - (red-900 . "#66333b") - - ;; Purples - (purple . "#b965e8"))) - - -(defun shortbrain-theme-color (name) - "Return the shortbrain theme color with the given NAME." - (cdr (assoc name shortbrain-theme-colors))) - - -(let ((class '((class color) (min-colors 256))) - (default-fg (shortbrain-theme-color 'grey-100)) - (default-bg (shortbrain-theme-color 'grey-900)) - (minor-fg (shortbrain-theme-color 'grey-700)) - (inactive-fg (shortbrain-theme-color 'grey-600)) - (border-fg (shortbrain-theme-color 'grey-850)) - (frame-fg (shortbrain-theme-color 'grey-500)) - (cursor-fg (shortbrain-theme-color 'grey-500)) - (cursor-bg (shortbrain-theme-color 'grey-500)) - - ;; Scrollbars - (scrollbar-fg (shortbrain-theme-color 'grey-800)) - (scrollbar-bg (shortbrain-theme-color 'grey-600)) - - ;; Highlighting - (highlight-fg (shortbrain-theme-color 'white)) - (highlight-bg (shortbrain-theme-color 'red)) - - ;; Current line - (hl-line-bg (shortbrain-theme-color 'grey-810)) - - ;; Search - (search-fg (shortbrain-theme-color 'white)) - (search-bg (shortbrain-theme-color 'primary-700)) - (search-bg-0 (shortbrain-theme-color 'primary-700)) - (search-bg-1 (shortbrain-theme-color 'primary-500)) - (search-bg-2 (shortbrain-theme-color 'primary-300)) - (search-bg-3 (shortbrain-theme-color 'primary-100)) - - ;; Selection - (selection-bg (shortbrain-theme-color 'grey-800)) - - ;; Auto-completion - (completion-fg (shortbrain-theme-color 'primary)) - (completion-bg (shortbrain-theme-color 'grey-820)) - (completion-match-fg (shortbrain-theme-color 'red-500)) - (completion-mouse-fg (shortbrain-theme-color 'white)) - (completion-selection-fg (shortbrain-theme-color 'white)) - (completion-annotation-fg (shortbrain-theme-color 'purple)) - - ;; Warnings & errors - (warning-fg (shortbrain-theme-color 'white)) - (warning-bg (shortbrain-theme-color 'red-600)) - (error-fg (shortbrain-theme-color 'white)) - (error-bg (shortbrain-theme-color 'red)) - - ;; Language syntax highlighting - (variable-fg (shortbrain-theme-color 'white)) - (function-fg (shortbrain-theme-color 'grey-200)) - (type-fg (shortbrain-theme-color 'grey-300)) - (constant-fg (shortbrain-theme-color 'grey-500)) - (keyword-fg (shortbrain-theme-color 'grey-600)) - (builtin-fg (shortbrain-theme-color 'grey-700)) - (string-fg (shortbrain-theme-color 'grey-500)) - (doc-fg (shortbrain-theme-color 'primary-600))) - (custom-theme-set-faces - 'shortbrain - - ;; Regular - `(cursor ((,class (:foreground ,cursor-fg :background ,cursor-bg)))) - `(default ((,class (:foreground ,default-fg :background ,default-bg)))) - `(default-italic ((,class (:italic t)))) - - ;; Emacs UI - `(fringe ((,class (:foreground ,error-fg :background ,default-bg)))) - `(header-line ((,class :background ,default-bg))) - `(linum ((,class (:inherit shadow :background ,default-bg)))) - `(mode-line ((,class (:foreground ,frame-fg :background ,default-bg - :box (:line-width -1 :color ,default-bg))))) - `(mode-line-inactive ((,class (:foreground ,inactive-fg :background ,default-bg - :box (:line-width -1 :color ,default-bg))))) - `(nlinum-relative-current-face ((,class (:foreground ,frame-fg :background ,default-bg)))) - `(vertical-border ((,class (:foreground ,border-fg :background ,default-bg)))) - - ;; Highlighting - `(highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg)))) - `(hl-line ((,class (:background ,hl-line-bg)))) - - ;; Search - `(isearch ((,class (:foreground ,search-fg :background ,search-bg :weight bold)))) - `(lazy-highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg) :weight normal))) - - ;; Selection - `(region ((,class (:background ,selection-bg)))) - - ;; Erroneous whitespace - `(whitespace-line ((,class (:foreground ,error-fg :background ,error-bg)))) - `(whitespace-space ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) - `(whitespace-tab ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) - - ;; Language syntax highlighting - `(font-lock-builtin-face ((,class (:foreground ,builtin-fg)))) - `(font-lock-comment-face ((,class (:foreground ,doc-fg)))) - `(font-lock-comment-delimiter-face ((,class (:foreground ,minor-fg)))) - `(font-lock-constant-face ((,class (:foreground ,constant-fg)))) - `(font-lock-doc-face ((,class (:foreground ,doc-fg)))) - `(font-lock-function-name-face ((,class (:foreground ,function-fg)))) - `(font-lock-keyword-face ((,class (:foreground ,keyword-fg)))) - `(font-lock-negation-char-face ((,class (:foreground ,error-fg)))) - `(font-lock-preprocessor-face ((,class (:foreground ,builtin-fg)))) - `(font-lock-string-face ((,class (:foreground ,string-fg)))) - `(font-lock-type-face ((,class (:foreground ,type-fg)))) - `(font-lock-variable-name-face ((,class (:foreground ,variable-fg)))) - `(font-lock-warning-face ((,class (:foreground ,warning-fg :background ,warning-bg)))) - - ;; Avy - `(avy-lead-face ((,class (:background ,search-bg-0 :foreground ,search-fg)))) - `(avy-lead-face-0 ((,class (:background ,search-bg-1 :foreground ,search-fg)))) - `(avy-lead-face-1 ((,class (:background ,search-bg-2 :foreground ,search-fg)))) - `(avy-lead-face-2 ((,class (:background ,search-bg-3 :foreground ,search-fg)))) - - ;; Company (auto-completion) - `(company-preview ((,class (:background ,default-bg :foreground ,completion-match-fg)))) - `(company-preview-common ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-preview-search ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-scrollbar-bg ((,class (:background ,scrollbar-bg)))) - `(company-scrollbar-fg ((,class (:background ,scrollbar-fg)))) - `(company-tooltip ((,class (:background ,completion-bg :foreground ,completion-fg)))) - `(company-tooltip-annotation ((,class (:foreground ,completion-annotation-fg)))) - `(company-tooltip-common ((,class (:background nil :foreground ,completion-match-fg)))) - `(company-tooltip-common-selection ((,class (:foreground ,completion-selection-fg)))) - `(company-tooltip-mouse ((,class (:background ,selection-bg :foreground ,completion-mouse-fg)))) - `(company-tooltip-search ((,class (:foreground ,completion-match-fg)))) - `(company-tooltip-selection ((,class (:background ,selection-bg :foreground nil)))))) - - -;;;###autoload -(when (and (boundp 'custom-theme-load-path) - load-file-name) - ;; add theme folder to `custom-theme-load-path' when installing over MELPA - (add-to-list 'custom-theme-load-path - (file-name-as-directory (file-name-directory load-file-name)))) - - -(provide-theme 'shortbrain) -(provide 'shortbrain-theme) - - -;;; shortbrain-theme.el ends here diff --git a/tmp/emacs-config/lisp/use-package-list.el b/tmp/emacs-config/lisp/use-package-list.el @@ -1,64 +0,0 @@ -;;; use-package-list.el --- List use-package declarations in config file - -;; Copyright (C) 2017 Matthew Bauer - -;; Author: Matthew Bauer <mjbauer95@gmail.com> - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;; βensureβ packages at compile time. - -;;; Code: - -(require 'json) -(require 'use-package) -(require 'package) -(eval-when-compile - (require 'cl)) - -(defun use-package-list (script) - "Count use-package declarations listed in SCRIPT." - - (defvar use-package-list--is-running t) - (lexical-let ((use-package-verbose t) - (use-package-debug t) - (use-package-always-ensure nil) - (use-package-always-defer t) - (use-package-list--packages nil) - (use-package-ensure-function 'ignore)) - (advice-add 'use-package - :before (lambda (name &rest args) - (unless (or (and (member :disabled args) - (plist-get args :disabled)) - (and (member :ensure args) - (not (plist-get args :ensure))) - (and (not (member :ensure args)) - (package-built-in-p name))) - (when (and (member :ensure args) - (not (eq (plist-get args :ensure) t)) - (symbolp (plist-get args :ensure))) - (setq name (plist-get args :ensure))) - (add-to-list 'use-package-list--packages name)))) - - (advice-add 'use-package-handler/:defer - :around (lambda (x name keyword arg rest state) - (let ((body (use-package-process-keywords name rest - (plist-put state :deferred t))) - (name-string (use-package-as-string name))) - (dolist (command - (delete-dups (plist-get state :commands))) - (fset command (lambda (&rest args)))) - body))) - - (advice-add 'use-package-load-name :override #'ignore) - - (load script nil nil t) - - (princ (json-encode use-package-list--packages)) - - use-package-list--packages)) - -(provide 'use-package-list) -;;; use-package-list.el ends here diff --git a/tmp/emacs-config/notes.css b/tmp/emacs-config/notes.css @@ -1,1274 +0,0 @@ -@font-face { - font-family: "GraublauWeb"; - src: url("/fonts/GraublauWeb.otf") format("opentype"); -} -@font-face { - font-family: "GraublauWeb"; - font-weight: bold; - src: url("/fonts/GraublauWebBold.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - src: url("/fonts/Merriweather-Regular.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - font-weight: bold; - src: url("/fonts/Merriweather-Bold.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - font-weight: bold; - font-style: italic; - src: url("/fonts/Merriweather-BoldItalic.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - font-style: italic; - src: url("/fonts/Merriweather-Italic.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - font-weight: lighter; - font-style: italic; - src: url("/fonts/Merriweather-LightItalic.otf") format("opentype"); -} -@font-face { - font-family: "Merriweather"; - font-weight: lighter; - src: url("/fonts/Merriweather-Light.otf") format("opentype"); -} - -html { - font-family:sans-serif; - line-height:1.15; - -ms-text-size-adjust:100%; - -webkit-text-size-adjust:100%; - --font-mono: 'Fira Code','Deja Vu Sans Mono','Bitstream Vera Sans Mono','Source Code Pro','Courier New',monospace; - --font-header: 'Merriweather','Linux Libertine','Georgia','Times',serif; - -} -body { - margin:0 -} -article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary { - display:block -} -audio,canvas,progress,video { - display:inline-block -} -audio:not([controls]) { - display:none; - height:0 -} -progress { - vertical-align:baseline -} -[hidden],template { - display:none -} -a { - background-color:transparent; - -webkit-text-decoration-skip:objects; - border-bottom:1px solid; -} -a:active,a:hover { - outline-width:0 -} -div#table-of-contents a { - border-bottom: 0px solid; -} -abbr[title] { - border-bottom:none; - text-decoration:underline; - text-decoration:underline dotted -} -b,strong { - font-weight:inherit; - font-weight:bolder -} -dfn { - font-style:italic -} -h1 { - font-size:2em; - margin:.67em 0 -} -mark { - background-color:#ff0; - color:#000 -} -small { - font-size:80% -} -sub,sup { - font-size:75%; - line-height:0; - position:relative; - vertical-align:baseline -} -sub { - bottom:-.25em -} -sup { - top:-.5em -} -img { - border-style:none -} -svg:not(:root) { - overflow:hidden -} -code,kbd,pre,samp { - font-family:monospace,monospace; - font-family: var(--font-mono); - font-size:1em -} -figure { - margin:1em 40px -} -hr { - box-sizing:content-box; - height:0; - overflow:visible -} -button,input,optgroup,select,textarea { - font:inherit; - margin:0 -} -optgroup { - font-weight:700 -} -button,input { - overflow:visible -} -button,select { - text-transform:none -} -[type=reset],[type=submit],button,html [type=button] { - -webkit-appearance:button -} -[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner { - border-style:none; - padding:0 -} -[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring { - outline:1px dotted ButtonText -} -fieldset { - border:1px solid silver; - margin:0 2px; - padding:.35em .625em .75em -} -legend { - box-sizing:border-box; - color:inherit; - display:table; - max-width:100%; - padding:0; - white-space:normal -} -textarea { - overflow:auto -} -[type=checkbox],[type=radio] { - box-sizing:border-box; - padding:0 -} -[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button { - height:auto -} -[type=search] { - -webkit-appearance:textfield; - outline-offset:-2px -} -[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration { - -webkit-appearance:none -} -::-webkit-input-placeholder { - color:inherit; - opacity:.54 -} -::-webkit-file-upload-button { - -webkit-appearance:button; - font:inherit -} -.org-bold { - font-weight:700 -} -.org-bold-italic { - font-weight:700; - font-style:italic -} -.org-buffer-menu-buffer { - font-weight:700 -} -.org-builtin { - color:#483d8b -} -.org-button { - color:#3a5fcd; - text-decoration:underline -} -.org-calendar-month-header { - color:#00f -} -.org-calendar-today { - text-decoration:underline -} -.org-calendar-weekday-header { - color:#008b8b -} -.org-calendar-weekend-header { - color:#b22222 -} -.org-comint-highlight-input { - font-weight:700 -} -.org-comint-highlight-prompt { - color:#0000cd -} -.org-comment,.org-comment-delimiter { - color:#b22222 -} -.org-constant { - color:#008b8b -} -.org-diary { - color:red -} -.org-doc { - color:#8b2252 -} -.org-error { - color:red; - font-weight:700 -} -.org-escape-glyph { - color:brown -} -.org-file-name-shadow { - color:#7f7f7f -} -.org-fringe { - background-color:#f2f2f2 -} -.org-function-name { - color:#00f -} -.org-glyphless-char { - font-size:60% -} -.org-header-line { - color:#333; - background-color:#e5e5e5 -} -.org-help-argument-name { - font-style:italic -} -.org-highlight { - background-color:#b4eeb4 -} -.org-holiday { - background-color:pink -} -.org-info-header-node { - color:brown; - font-weight:700; - font-style:italic -} -.org-info-header-xref { - color:#3a5fcd; - text-decoration:underline -} -.org-info-index-match { - background-color:#ff0 -} -.org-info-menu-header { - font-weight:700 -} -.org-info-menu-star { - color:red -} -.org-info-node { - color:brown; - font-weight:700; - font-style:italic -} -.org-info-title-1 { - font-size:172%; - font-weight:700 -} -.org-info-title-2 { - font-size:144%; - font-weight:700 -} -.org-info-title-3 { - font-size:120%; - font-weight:700 -} -.org-info-title-4 { - font-weight:700 -} -.org-info-xref { - color:#3a5fcd; - text-decoration:underline -} -.org-italic { - font-style:italic -} -.org-keyword { - color:#a020f0 -} -.org-lazy-highlight { - background-color:#afeeee -} -.org-link { - color:#3a5fcd; - text-decoration:underline -} -.org-link-visited { - color:#8b008b; - text-decoration:underline -} -.org-makefile-makepp-perl { - background-color:#bfefff -} -.org-makefile-space { - background-color:#ff69b4 -} -.org-makefile-targets { - color:#00f -} -.org-match { - background-color:#ff0 -} -.org-next-error { - background-color:gtk_selection_bg_color -} -.org-nobreak-space { - color:brown; - text-decoration:underline -} -.org-org-agenda-calendar-event,.org-org-agenda-calendar-sexp { - color:#000; - background-color:#fff -} -.org-org-agenda-clocking { - background-color:#ff0 -} -.org-org-agenda-column-dateline { - background-color:#e5e5e5 -} -.org-org-agenda-current-time { - color:#b8860b -} -.org-org-agenda-date { - color:#00f -} -.org-org-agenda-date-today { - color:#00f; - font-weight:700; - font-style:italic -} -.org-org-agenda-date-weekend { - color:#00f; - font-weight:700 -} -.org-org-agenda-diary { - color:#000; - background-color:#fff -} -.org-org-agenda-dimmed-todo { - color:#7f7f7f -} -.org-org-agenda-done { - color:#228b22 -} -.org-org-agenda-filter-category,.org-org-agenda-filter-effort,.org-org-agenda-filter-regexp,.org-org-agenda-filter-tags { - color:#000; - background-color:#bfbfbf -} -.org-org-agenda-restriction-lock { - background-color:#eee -} -.org-org-agenda-structure { - color:#00f -} -.org-org-archived,.org-org-block { - color:#7f7f7f -} -.org-org-block-begin-line,.org-org-block-end-line { - color:#b22222 -} -.org-org-checkbox { - font-weight:700 -} -.org-org-checkbox-statistics-done { - color:#228b22; - font-weight:700 -} -.org-org-checkbox-statistics-todo { - color:red; - font-weight:700 -} -.org-org-clock-overlay { - color:#000; - background-color:#d3d3d3 -} -.org-org-code { - color:#7f7f7f -} -.org-org-column,.org-org-column-title { - background-color:#e5e5e5 -} -.org-org-column-title { - font-weight:700; - text-decoration:underline -} -.org-org-date { - color:#a020f0; - text-decoration:underline -} -.org-org-date-selected { - color:red -} -.org-org-default { - color:#000; - background-color:#fff -} -.org-org-document-info { - color:#191970 -} -.org-org-document-info-keyword { - color:#7f7f7f -} -.org-org-document-title { - color:#191970; - font-weight:700 -} -.org-org-done { - color:#228b22; - font-weight:700 -} -.org-org-drawer { - color:#00f -} -.org-org-ellipsis { - color:#b8860b; - text-decoration:underline -} -.org-org-footnote { - color:#a020f0; - text-decoration:underline -} -.org-org-formula { - color:#b22222 -} -.org-org-headline-done { - color:#bc8f8f -} -.org-org-hide { - color:#fff -} -.org-org-latex-and-related { - color:#8b4513 -} -.org-org-level-1 { - color:#00f -} -.org-org-level-2 { - color:sienna -} -.org-org-level-3 { - color:#a020f0 -} -.org-org-level-4 { - color:#b22222 -} -.org-org-level-5 { - color:#228b22 -} -.org-org-level-6 { - color:#008b8b -} -.org-org-level-7 { - color:#483d8b -} -.org-org-level-8 { - color:#8b2252 -} -.org-org-link { - color:#3a5fcd; - text-decoration:underline -} -.org-org-list-dt { - font-weight:700 -} -.org-org-macro { - color:#8b4513 -} -.org-org-meta-line { - color:#b22222 -} -.org-org-mode-line-clock { - color:#000; - background-color:#bfbfbf -} -.org-org-mode-line-clock-overrun { - color:#000; - background-color:red -} -.org-org-priority { - color:#a020f0 -} -.org-org-quote { - color:#7f7f7f -} -.org-org-scheduled { - color:#006400 -} -.org-org-scheduled-previously { - color:#b22222 -} -.org-org-scheduled-today { - color:#006400 -} -.org-org-sexp-date,.org-org-special-keyword { - color:#a020f0 -} -.org-org-table { - color:#00f -} -.org-org-tag,.org-org-tag-group { - font-weight:700 -} -.org-org-target { - text-decoration:underline -} -.org-org-time-grid { - color:#b8860b -} -.org-org-todo { - color:red; - font-weight:700 -} -.org-org-upcoming-deadline { - color:#b22222 -} -.org-org-verbatim,.org-org-verse { - color:#7f7f7f -} -.org-org-warning { - color:red; - font-weight:700 -} -.org-outline-1 { - color:#00f -} -.org-outline-2 { - color:sienna -} -.org-outline-3 { - color:#a020f0 -} -.org-outline-4 { - color:#b22222 -} -.org-outline-5 { - color:#228b22 -} -.org-outline-6 { - color:#008b8b -} -.org-outline-7 { - color:#483d8b -} -.org-outline-8 { - color:#8b2252 -} -.org-preprocessor { - color:#483d8b -} -.org-regexp-grouping-backslash,.org-regexp-grouping-construct { - font-weight:700 -} -.org-region { - background-color:gtk_selection_bg_color -} -.org-secondary-selection { - background-color:#ff0 -} -.org-shadow { - color:#7f7f7f -} -.org-show-paren-match { - background-color:#40e0d0 -} -.org-show-paren-mismatch { - color:#fff; - background-color:#a020f0 -} -.org-string { - color:#8b2252 -} -.org-success { - color:#228b22; - font-weight:700 -} -.org-table-cell { - color:#e5e5e5; - background-color:#00f -} -.org-tooltip { - color:#000; - background-color:#ffffe0 -} -.org-trailing-whitespace { - background-color:red -} -.org-type { - color:#228b22 -} -.org-underline { - text-decoration:underline -} -.org-variable-name { - color:sienna -} -.org-warning { - color:#ff8c00; - font-weight:700 -} -.org-warning-1 { - color:red; - font-weight:700 -} -body { - width:85%; - margin:2% auto; - font-size:14px; - line-height:1.4em; - font-fannnnnmily:Georgia,serif; - color:#333 -} -@media screen and (min-width:600px) { - body { - font-size:18px - } -} -@media screen and (min-width:1270px) { - body { - width:1200px - } -} -::-moz-selection { - background:#d6edff -} -::selection { - background:#d6edff -} -dl,ol,p,ul { - margin:0 auto -} -#content p { - margin: 1em auto; -} -.title { - margin:.8em auto; - color:gray; -} -.subtitle,.title { - text-align:center -} -.subtitle { - font-size:0.7em; - line-height:1.4; - font-weight:700; - margin:1em auto; - color: lightgray; -} -.abstract { - margin:auto; - width:80%; - font-style:italic -} -.abstract p:last-of-type:before { - content:" "; - white-space:pre -} -.status { - font-size:90%; - margin:2em auto -} -[class^=section-number-] { - margin-right:.5em -} -[id^=orgheadline] { - clear:both -} -#footnotes { - font-size:90% -} -.footpara { - display:inline; - margin:.2em auto -} -.footdef { - margin-bottom:1em -} -.footdef sup { - padding-right:.5em -} -li.on { - list-style: "β "; -} -li.off { - list-style: "β "; -} -a { - color:#527d9a; - text-decoration:none -} -a:hover { - color:#035; - border-bottom:2px solid; -} -figure { - padding:0; - margin:1em auto; - text-align:center -} -img { - max-width:100%; - vertical-align:middle -} -.MathJax_Display { - margin:0!important; - width:90%!important -} -h1,h2,h3,h4,h5,h6 { - font-family: var(--font-header); -} -h1 { - color: grey; -} -h2,h3,h4,h5,h6 { - color:#a5573e; - line-height:1em; - font-family:Helvetica,sans-serif -} -h1,h2,h3 { - line-height:1.4em -} -h4,h5,h6 { - font-size:1em -} -@media screen and (min-width:600px) { - h1 { - font-size:2em - } - h2 { - font-size:1.5em - } - h3 { - font-size:1.3em - } - h1,h2,h3 { - line-height:1.4em - } - h4,h5,h6 { - font-size:1.1em - } -} -dt { - font-weight:700 -} -table { - margin:1em auto; - border-top:2px solid; - border-collapse:collapse -} -table,thead { - border-bottom:2px solid -} -table td+td,table th+th { - border-left:1px solid gray -} -table tr { - border-top:1px solid #d3d3d3 -} -td,th { - padding:.3em .6em; - vertical-align:middle -} -caption.t-above { - caption-side:top -} -caption.t-bottom { - caption-side:bottom -} -caption { - margin-bottom:.3em -} -figcaption { - margin-top:.3em -} -th.org-center,th.org-left,th.org-right { - text-align:center -} -td.org-right { - text-align:right -} -td.org-left { - text-align:left -} -td.org-center { - text-align:center -} -blockquote { - margin:1em 2em; - padding-left:1em; - border-left:3px solid #ccc -} -kbd { - background-color:#f7f7f7; - font-size:80%; - margin:0 .1em; - padding:.1em .6em -} -.todo { - background-color:red -} -.done,.todo { - color:#fff; - padding:.1em .3em; - border-radius:3px; - background-clip:padding-box; - font-size:80%; - font-family:Lucida Console,monospace; - line-height:1 -} -.done { - background-color:green -} -.priority { - color:orange; - font-family:Lucida Console,monospace -} -#table-of-contents li { - clear:both -} -.tag { - font-family:Lucida Console,monospace; - font-size:.7em; - font-weight:400 -} -.tag span { - padding:.3em; - float:right; - margin-right:.5em; - border:1px solid #bbb; - border-radius:3px; - background-clip:padding-box; - color:#333; - background-color:#eee; - line-height:1 -} -.timestamp { - color:#bebebe; - font-size:90% -} -.timestamp-kwd { - color:#5f9ea0 -} -.org-right { - margin-left:auto; - margin-right:0; - text-align:right -} -.org-left { - margin-left:0; - margin-right:auto; - text-align:left -} -.org-center { - margin-left:auto; - margin-right:auto; - text-align:center -} -.underline { - text-decoration:underline -} -#postamble p,#preamble p { - font-size:90%; - margin:.2em -} -p.verse { - margin-left:3% -} -:not(pre)>code { - padding:2px 5px; - margin:auto 1px; - border:1px solid #ddd; - border-radius:3px; - background-clip:padding-box; - color:#333; - font-size:80% -} -.org-src-container { - background-color: #FDFDFD; - border:1px solid #ccc; - box-shadow:3px 3px 3px #eee; - font-family:Lucida Console,monospace; - font-size:80%; - margin:1em auto; - padding:.1em .5em; - position:relative; - color: #000; -} -.org-src-container>pre { - overflow:auto -} -.org-src-container>pre:before { - display:block; - position:absolute; - background-color:#b3b3b3; - top:0; - right:0; - padding:0 .5em; - border-bottom-left-radius:8px; - border:0; - color:#fff; - font-size:80% -} -.org-src-container>pre.src-sh:before { - content:"sh" -} -.org-src-container>pre.src-bash:before { - content:"bash" -} -.org-src-container>pre.src-emacs-lisp:before { - content:"Emacs Lisp" -} -.org-src-container>pre.src-R:before { - content:"R" -} -.org-src-container>pre.src-cpp:before { - content:"C++" -} -.org-src-container>pre.src-c:before { - content:"C" -} -.org-src-container>pre.src-html:before { - content:"HTML" -} -.org-src-container>pre.src-javascript:before,.org-src-container>pre.src-js:before { - content:"Javascript" -} -// More languages 0% http://orgmode.org/worg/org-contrib/babel/languages.html .org-src-container>pre.src-abc:before { - content:"ABC" -} -.org-src-container>pre.src-asymptote:before { - content:"Asymptote" -} -.org-src-container>pre.src-awk:before { - content:"Awk" -} -.org-src-container>pre.src-C:before { - content:"C" -} -.org-src-container>pre.src-calc:before { - content:"Calc" -} -.org-src-container>pre.src-clojure:before { - content:"Clojure" -} -.org-src-container>pre.src-comint:before { - content:"comint" -} -.org-src-container>pre.src-css:before { - content:"CSS" -} -.org-src-container>pre.src-D:before { - content:"D" -} -.org-src-container>pre.src-ditaa:before { - content:"Ditaa" -} -.org-src-container>pre.src-dot:before { - content:"Dot" -} -.org-src-container>pre.src-ebnf:before { - content:"ebnf" -} -.org-src-container>pre.src-forth:before { - content:"Forth" -} -.org-src-container>pre.src-F90:before { - content:"Fortran" -} -.org-src-container>pre.src-gnuplot:before { - content:"Gnuplot" -} -.org-src-container>pre.src-haskell:before { - content:"Haskell" -} -.org-src-container>pre.src-io:before { - content:"Io" -} -.org-src-container>pre.src-java:before { - content:"Java" -} -.org-src-container>pre.src-latex:before { - content:"LaTeX" -} -.org-src-container>pre.src-ledger:before { - content:"Ledger" -} -.org-src-container>pre.src-ly:before { - content:"Lilypond" -} -.org-src-container>pre.src-lisp:before { - content:"Lisp" -} -.org-src-container>pre.src-makefile:before { - content:"Make" -} -.org-src-container>pre.src-matlab:before { - content:"Matlab" -} -.org-src-container>pre.src-max:before { - content:"Maxima" -} -.org-src-container>pre.src-mscgen:before { - content:"Mscgen" -} -.org-src-container>pre.src-Caml:before { - content:"Objective" -} -.org-src-container>pre.src-octave:before { - content:"Octave" -} -.org-src-container>pre.src-org:before { - content:"Org" -} -.org-src-container>pre.src-perl:before { - content:"Perl" -} -.org-src-container>pre.src-picolisp:before { - content:"Picolisp" -} -.org-src-container>pre.src-plantuml:before { - content:"PlantUML" -} -.org-src-container>pre.src-python:before { - content:"Python" -} -.org-src-container>pre.src-ruby:before { - content:"Ruby" -} -.org-src-container>pre.src-sass:before { - content:"Sass" -} -.org-src-container>pre.src-scala:before { - content:"Scala" -} -.org-src-container>pre.src-scheme:before { - content:"Scheme" -} -.org-src-container>pre.src-screen:before { - content:"Screen" -} -.org-src-container>pre.src-sed:before { - content:"Sed" -} -.org-src-container>pre.src-shell:before { - content:"shell" -} -.org-src-container>pre.src-shen:before { - content:"Shen" -} -.org-src-container>pre.src-sql:before { - content:"SQL" -} -.org-src-container>pre.src-sqlite:before { - content:"SQLite" -} -.org-src-container>pre.src-stan:before { - content:"Stan" -} -.org-src-container>pre.src-vala:before { - content:"Vala" -} -.org-src-container>pre.src-axiom:before { - content:"Axiom" -} -.org-src-container>pre.src-browser:before { - content:"HTML" -} -.org-src-container>pre.src-cypher:before { - content:"Neo4j" -} -.org-src-container>pre.src-elixir:before { - content:"Elixir" -} -.org-src-container>pre.src-request:before { - content:"http" -} -.org-src-container>pre.src-ipython:before { - content:"iPython" -} -.org-src-container>pre.src-kotlin:before { - content:"Kotlin" -} -.org-src-container>pre.src-Flavored Erlang lfe:before { - content:"Lisp" -} -.org-src-container>pre.src-mongo:before { - content:"MongoDB" -} -.org-src-container>pre.src-prolog:before { - content:"Prolog" -} -.org-src-container>pre.src-rec:before { - content:"rec" -} -.org-src-container>pre.src-ML sml:before { - content:"Standard" -} -.org-src-container>pre.src-Translate translate:before { - content:"Google" -} -.org-src-container>pre.src-typescript:before { - content:"Typescript" -} -.org-src-container>pre.src-rust:before { - content:"Rust" -} -.org-src-container>pre.src-go:before { - content:"Go" -} -.org-src-container>pre.src-http:before { - content:"HTTP" -} -.inlinetask { - background:#ffc; - border:2px solid gray; - margin:10px; - padding:10px -} -#org-div-home-and-up { - font-size:70%; - text-align:right; - white-space:nowrap -} -.linenr { - font-size:90% -} -.code-highlighted { - background-color:#ff0 -} -#bibliography { - font-size:90% -} -#bibliography table { - width:100% -} -.creator { - display:block -} -@media screen and (min-width:600px) { - .creator { - display:inline; - float:right - } -} - -div#nav ul li { - display: inline; -} - -div.drawer { - border:1px solid #ccc; - box-shadow:3px 3px 3px #eee; - font-size:85%; - margin:1em auto; - padding:.1em .5em; - position:relative -} -div.drawer h6 { - margin: 0; - padding: 0.1em; - color: #333; -} - -div.drawer.results { - font-family:monospace,monospace; - font-family: var(--font-mono); - background-color: #333; - color: #fff; -} -div.drawer p { - display: block; - unicode-bidi: embed; - white-space: pre; -} -div.drawer.results h6 { - color: #fff; -} - -.info { - border: 1px solid; - background-color: #BDE5F8; - color: #00529B; -} - -.tip { - border: 1px solid; - background-color: #DFF2BF; - color: #4F8A10; -} - -.note { - border: 1px solid; - background-color: #FFFCCB; - color: #9F6000; -} - -.warning { - border: 1px solid; - background-color: #FFBABA; - color: #D8000C; -} - -/* Set the colors in <pre> blocks from the Leuven theme */ -pre span.org-builtin {color:#006FE0;font-weight:bold;} -pre span.org-string {color:#008000;} -pre span.org-keyword {color:#0000FF;} -pre span.org-variable-name {color:#BA36A5;} -pre span.org-function-name {color:#006699;} -pre span.org-type {color:#6434A3;} -pre span.org-preprocessor {color:#808080;font-weight:bold;} -pre span.org-constant {color:#D0372D;} -pre span.org-comment-delimiter {color:#8D8D84;} -pre span.org-comment {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-1 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-2 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-3 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-4 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-5 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-6 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-7 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-8 {color:#8D8D84;font-style:italic} -pre span.org-outshine-level-9 {color:#8D8D84;font-style:italic} -pre span.org-rainbow-delimiters-depth-1 {color:#707183;} -pre span.org-rainbow-delimiters-depth-2 {color:#7388d6;} -pre span.org-rainbow-delimiters-depth-3 {color:#909183;} -pre span.org-rainbow-delimiters-depth-4 {color:#709870;} -pre span.org-rainbow-delimiters-depth-5 {color:#907373;} -pre span.org-rainbow-delimiters-depth-6 {color:#6276ba;} -pre span.org-rainbow-delimiters-depth-7 {color:#858580;} -pre span.org-rainbow-delimiters-depth-8 {color:#80a880;} -pre span.org-rainbow-delimiters-depth-9 {color:#887070;} -pre span.org-sh-quoted-exec {color:#FF1493;} diff --git a/tmp/emacs-config/publish.org b/tmp/emacs-config/publish.org @@ -1,230 +0,0 @@ -#+TITLE: Publish dotemacs notes using Emacs org-mode -#+AUTHOR: Vincent Demeester -#+EMAIL: vincent@sbr.pm -#+EXPORT_EXCLUDE_TAGS: noexport -#+CREATOR: Emacs 27.0.90 (Org mode 9.3) -#+LANGUAGE: en -#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./notes.css"/> -#+OPTIONS: html-style:nil - -This document is a literate version of my publishing /script/ on publishing my dotemacs -notes (that uses [[https://orgmode.org][=org-mode=]]). - -First let's import required libraries, which are =org= related. - -#+begin_src emacs-lisp :tangle yes -;; Add my personal libraries π -(add-to-list 'load-path (concat user-emacs-directory "lisp/")) - -(require 'org) -(require 'ox) -(require 'ox-publish) -(require 'ol-man) -(require 'ol-git-link) -(require 'ol-github) -(require 'ol-gitlab) -#+end_src - -To get syntax coloring on other mode than ~emacs-lisp~, we need to load them too[fn:1]. - -#+begin_src emacs-lisp :tangle yes - (require 'go-mode) - (require 'css-mode) - (require 'python-mode) - (require 'nix-mode) - (require 'ob-http) - (require 'yaml-mode) -#+end_src - -Now let's define variables to use later on. Those variables are where to find the project -we want to publish and where to publish theme. - -#+begin_src emacs-lisp :tangle yes - (setq site-directory "~/desktop/sites/") - - (setq org-default-publish-sbr (expand-file-name "sbr.pm" site-directory)) - (setq org-default-publish-dotemacs (expand-file-name "dotemacs" org-default-publish-sbr)) -#+end_src - -We want to republish everything every time β mainly to be used on CI. So we're telling -=org-mode= to disable the timestamp-based cache. - -#+begin_src emacs-lisp :tangle yes - (setq org-publish-use-timestamps-flag nil) -#+end_src - -Let's also customize a bit the /style/ of what =org-mode= will generate. - -- Set the default html coding system πΌ - #+begin_src emacs-lisp :tangle yes - (setq org-html-coding-system 'utf-8-unix) - #+end_src -- Let's disable the default script and style "includes". - #+begin_src emacs-lisp :tangle yes - (setq org-export-html-style-include-scripts nil - org-export-html-style-include-default nil) - #+end_src -- Let's also make sure the =#+begin_src= blocks are colorized, *but* using the css instead - of inlude style. - #+begin_src emacs-lisp :tangle yes - (setq org-src-fontify-natively t) - ;; (setq org-html-htmlize-output-type 'inline-css) ;; default - (setq org-html-htmlize-output-type 'css) - ;; (setq org-html-htmlize-font-prefix "") ;; default - (setq org-html-htmlize-font-prefix "org-") - #+end_src -- Customize how we export ~org-mode~ drawers - #+begin_src emacs-lisp :tangle yes - (defun my-org-export-format-drawer (name content) - (concat "<div class=\"drawer " (downcase name) "\">\n" - "<h6>" (capitalize name) "</h6>\n" - content - "\n</div>")) - (setq org-html-format-drawer-function 'my-org-export-format-drawer) - #+end_src -- And disable ~org-babel~ from trying to evaluate on export - #+begin_src emacs-lisp :tangle yes - (setq org-export-use-babel nil) - #+end_src - -I want [[https://writepermission.com/org-blogging-clickable-headlines.html][clickable headlines]], so let's define a ~html-format-headline-function~ for the -exporter to use. Not tangle currently as it doesn't work π. - -#+begin_src emacs-lisp :tangle no - (defun my-org-html-format-headline-function (todo todo-type priority text tags info) - "Format a headline with a link to itself." - (let* ((headline (get-text-property 0 :parent text)) - (id (or (org-element-property :CUSTOM_ID headline) - (org-export-get-reference headline info) - (org-element-property :ID headline))) - (link (if id - (format "<a href=\"#%s\">%s</a>" id text) - text))) - (org-html-format-headline-default-function todo todo-type priority link tags info))) - (setq org-html-format-headline-function 'my-org-html-format-headline-function) -#+end_src - -I also use some custom linksβ¦ First thing first, I want the =att:= link to be supporting -when exporting - -#+begin_src emacs-lisp :tangle yes -(require 'org-attach) -(setq org-link-abbrev-alist '(("att" . org-attach-expand-link))) -#+end_src - - -They are define in my [[https://github.com/vdemeester/emacs-config][emacs configuration]] repository : [[https://github.com/vdemeester/emacs-config/blob/master/lisp/setup-org.el][~setup-org.el~]]. - -#+begin_src emacs-lisp :tangle yes - (org-link-set-parameters "tag" - :follow #'endless/follow-tag-link) - (defun endless/follow-tag-link (tag) - "Display a list of TODO headlines with tag TAG. - With prefix argument, also display headlines without a TODO keyword." - (org-tags-view (null current-prefix-arg) tag)) - - (org-link-set-parameters "grep" - :follow #'vde/follow-grep-link - :face '(:foreground "DarkRed" :underline t)) - (defun vde/follow-grep-link (regexp) - "Run `rgrep' with REGEXP and FOLDER as argument, - like this : [[grep:REGEXP:FOLDER]]." - (setq expressions (split-string regexp ":")) - (setq exp (nth 0 expressions)) - (grep-compute-defaults) - (if (= (length expressions) 1) - (progn - (rgrep exp "*" (expand-file-name "./"))) - (progn - (setq folder (nth 1 expressions)) - (rgrep exp "*" (expand-file-name folder)))) - ) - - (org-link-set-parameters "rg" - :follow #'vde/follow-rg-link - :face '(:foreground "DarkGreen" :underline t)) - (defun vde/follow-rg-link (regexp) - "Run `ripgrep-regexp` with REXEP and FOLDER as argument, - like this : [[pt:REGEXP:FOLDER]]" - (setq expressions (split-string regexp ":")) - (setq exp (nth 0 expressions)) - (if (= (length expressions) 1) - (progn - (ripgrep-regexp exp (expand-file-name "./"))) - (progn - (setq folder (nth 1 expressions)) - (ripgrep-regexp exp (file-name-as-directory (expand-file-name folder))))) - ) - - (org-link-set-parameters - "org" - :complete (lambda () (+org-link-read-file "org" org-directory)) - :follow (lambda (link) (find-file (expand-file-name link org-directory))) - :face (lambda (link) - (if (file-exists-p (expand-file-name link org-directory)) - 'org-link - 'error))) - (defun +org-link-read-file (key dir) - (let ((file (read-file-name (format "%s: " (capitalize key)) dir))) - (format "%s:%s" - key - (file-relative-name file dir)))) -#+end_src - -Now, let's define projects. - -#+begin_src emacs-lisp :tangle yes - (setq org-publish-project-alist - `(("dotemacs-org" - :base-directory "." - :base-extension "org\\|txt" - :publishing-directory ,org-default-publish-dotemacs - :recursive t - :publishing-function org-html-publish-to-html - :headline-levels 4 - :auto-preamble t - :auto-sitemap t - :with-footnotes t - :with-toc nil - :with-drawers t - :exclude "_setup.org\\|sbr.pm\\|.extension\\|elpa\\|var" - :html-checkbox-type 'html - :html-preamble "<div id=\"nav\"> - <ul> - <li><a href=\"/\" class=\"home\">Home</a></li> - <li><a href=\"./\" class=\"index\">Index</a></li> - <li><a href=\"../\" class=\"up\">Up</a></li> - </ul> - </div>" - :html-postamble "<p class=\"creator\">%c</p><p class=\"postamble\">%a. Last Updated %C (exported %T).</p>") - ("dotemacs-static" - :base-directory "." - :base-extension "html\\|xml\\|css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|md\\|tar\\|gz\\|xz\\|zip\\|csv" - :exclude ".extension\\|elpa\\|var" - :publishing-directory ,org-default-publish-dotemacs - :recursive t - :publishing-function org-publish-attachment - ) - ("dotemacs" :components ("dotemacs-org" "dotemacs-static")) - )) -#+end_src - -I want the ~sites~ folder to be cleaned too, so let's define a function to be called that -will clean a folder and publish. - -#+begin_src emacs-lisp :tangle yes - (defun clean-and-publish () - "Clean the site folder and publish all projects" - (delete-directory org-default-publish-dotemacs t) - (org-publish-all)) -#+end_src - -Let's now create a ~Makefile~ so that I can just run ~make publish~ to automate that. - -#+INCLUDE: "Makefile" src makefile - -The rest is just /automation/ πΌ. The ~~/desktop/sites/~ folder is synced across a bunch -of my machines, including my servers (using [[https://syncthing.net/][syncthing]]). This means almost as soon as I run -this publish script, it will be available. - -[fn:1] Otherwise, emacs doesn't apply any syntax coloring. diff --git a/tmp/emacs-config/.gitattributes b/tools/emacs/.gitattributes diff --git a/tmp/emacs-config/.gitignore b/tools/emacs/.gitignore diff --git a/tmp/emacs-config/.ignore b/tools/emacs/.ignore diff --git a/tmp/emacs-config/COPYING b/tools/emacs/COPYING diff --git a/tmp/emacs-config/Makefile b/tools/emacs/Makefile diff --git a/tools/emacs/README.org b/tools/emacs/README.org @@ -0,0 +1 @@ +index.org+ \ No newline at end of file diff --git a/tmp/emacs-config/config/00-clean.el b/tools/emacs/config/00-clean.el diff --git a/tmp/emacs-config/config/00-environments.el b/tools/emacs/config/00-environments.el diff --git a/tmp/emacs-config/config/01-server.el b/tools/emacs/config/01-server.el diff --git a/tmp/emacs-config/config/README.org b/tools/emacs/config/README.org diff --git a/tmp/emacs-config/config/setup-buffers.el b/tools/emacs/config/setup-buffers.el diff --git a/tmp/emacs-config/config/setup-compile.el b/tools/emacs/config/setup-compile.el diff --git a/tmp/emacs-config/config/setup-completion.el b/tools/emacs/config/setup-completion.el diff --git a/tmp/emacs-config/config/setup-dired.el b/tools/emacs/config/setup-dired.el diff --git a/tmp/emacs-config/config/setup-docker.el b/tools/emacs/config/setup-docker.el diff --git a/tmp/emacs-config/config/setup-editing.el b/tools/emacs/config/setup-editing.el diff --git a/tmp/emacs-config/config/setup-files.el b/tools/emacs/config/setup-files.el diff --git a/tmp/emacs-config/config/setup-go.el b/tools/emacs/config/setup-go.el diff --git a/tmp/emacs-config/config/setup-hydras.el b/tools/emacs/config/setup-hydras.el diff --git a/tmp/emacs-config/config/setup-keybindings.el b/tools/emacs/config/setup-keybindings.el diff --git a/tmp/emacs-config/config/setup-mails.el b/tools/emacs/config/setup-mails.el diff --git a/tmp/emacs-config/config/setup-mouse.el b/tools/emacs/config/setup-mouse.el diff --git a/tmp/emacs-config/config/setup-multiple-cursors.el b/tools/emacs/config/setup-multiple-cursors.el diff --git a/tmp/emacs-config/config/setup-navigating.el b/tools/emacs/config/setup-navigating.el diff --git a/tmp/emacs-config/config/setup-nix.el b/tools/emacs/config/setup-nix.el diff --git a/tmp/emacs-config/config/setup-org.el b/tools/emacs/config/setup-org.el diff --git a/tmp/emacs-config/config/setup-projectile.el b/tools/emacs/config/setup-projectile.el diff --git a/tmp/emacs-config/config/setup-search.el b/tools/emacs/config/setup-search.el diff --git a/tmp/emacs-config/config/setup-shells.el b/tools/emacs/config/setup-shells.el diff --git a/tmp/emacs-config/config/setup-style.el b/tools/emacs/config/setup-style.el diff --git a/tmp/emacs-config/config/setup-vcs.el b/tools/emacs/config/setup-vcs.el diff --git a/tmp/emacs-config/config/setup-web.el b/tools/emacs/config/setup-web.el diff --git a/tmp/emacs-config/config/setup-windows.el b/tools/emacs/config/setup-windows.el diff --git a/tools/emacs/data/17/a3ed73-aaca-4a18-8ed1-3efe7bac855a/2020-02-29-14-41-59.png b/tools/emacs/data/17/a3ed73-aaca-4a18-8ed1-3efe7bac855a/2020-02-29-14-41-59.png Binary files differ. diff --git a/tools/emacs/data/1f/74bbae-c4a1-4723-977e-e48900fcd1c7/2020-02-29-13-46-08.png b/tools/emacs/data/1f/74bbae-c4a1-4723-977e-e48900fcd1c7/2020-02-29-13-46-08.png Binary files differ. diff --git a/tools/emacs/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-57-41.png b/tools/emacs/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-57-41.png Binary files differ. diff --git a/tools/emacs/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-59-22.png b/tools/emacs/data/83/bc2073-0681-4fe9-bcf7-3070bd1ab695/2020-03-03-21-59-22.png Binary files differ. diff --git a/tmp/emacs-config/early-init.el b/tools/emacs/early-init.el diff --git a/tmp/emacs-config/emacs.org b/tools/emacs/emacs.org diff --git a/tmp/emacs-config/etc/orgmode/journal.org b/tools/emacs/etc/orgmode/journal.org diff --git a/tmp/emacs-config/etc/orgmode/weekly.org b/tools/emacs/etc/orgmode/weekly.org diff --git a/tmp/emacs-config/etc/orgmode/worklog.org b/tools/emacs/etc/orgmode/worklog.org diff --git a/tmp/emacs-config/etc/pandoc.css b/tools/emacs/etc/pandoc.css diff --git a/tmp/emacs-config/etc/transient/levels.el b/tools/emacs/etc/transient/levels.el diff --git a/tmp/emacs-config/etc/transient/values.el b/tools/emacs/etc/transient/values.el diff --git a/tmp/emacs-config/etc/yasnippet/snippets/c++-mode/.yas-parents b/tools/emacs/etc/yasnippet/snippets/c++-mode/.yas-parents diff --git a/tmp/emacs-config/etc/yasnippet/snippets/c-mode/.yas-parents b/tools/emacs/etc/yasnippet/snippets/c-mode/.yas-parents diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/add b/tools/emacs/etc/yasnippet/snippets/cc-mode/add diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/addif b/tools/emacs/etc/yasnippet/snippets/cc-mode/addif diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/class b/tools/emacs/etc/yasnippet/snippets/cc-mode/class diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/com b/tools/emacs/etc/yasnippet/snippets/cc-mode/com diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/fopen b/tools/emacs/etc/yasnippet/snippets/cc-mode/fopen diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/inc b/tools/emacs/etc/yasnippet/snippets/cc-mode/inc diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/inc.1 b/tools/emacs/etc/yasnippet/snippets/cc-mode/inc.1 diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/main b/tools/emacs/etc/yasnippet/snippets/cc-mode/main diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/misra b/tools/emacs/etc/yasnippet/snippets/cc-mode/misra diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/ns b/tools/emacs/etc/yasnippet/snippets/cc-mode/ns diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/once b/tools/emacs/etc/yasnippet/snippets/cc-mode/once diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/tfunc b/tools/emacs/etc/yasnippet/snippets/cc-mode/tfunc diff --git a/tmp/emacs-config/etc/yasnippet/snippets/cc-mode/using b/tools/emacs/etc/yasnippet/snippets/cc-mode/using diff --git a/tmp/emacs-config/etc/yasnippet/snippets/emacs-lisp-mode/hdr b/tools/emacs/etc/yasnippet/snippets/emacs-lisp-mode/hdr diff --git a/tmp/emacs-config/etc/yasnippet/snippets/emacs-lisp-mode/test b/tools/emacs/etc/yasnippet/snippets/emacs-lisp-mode/test diff --git a/tmp/emacs-config/etc/yasnippet/snippets/fundamental-mode/date b/tools/emacs/etc/yasnippet/snippets/fundamental-mode/date diff --git a/tmp/emacs-config/etc/yasnippet/snippets/fundamental-mode/mail b/tools/emacs/etc/yasnippet/snippets/fundamental-mode/mail diff --git a/tmp/emacs-config/etc/yasnippet/snippets/fundamental-mode/time b/tools/emacs/etc/yasnippet/snippets/fundamental-mode/time diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/coloneq b/tools/emacs/etc/yasnippet/snippets/go-mode/coloneq diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/f b/tools/emacs/etc/yasnippet/snippets/go-mode/f diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/fm b/tools/emacs/etc/yasnippet/snippets/go-mode/fm diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/for b/tools/emacs/etc/yasnippet/snippets/go-mode/for diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/fore b/tools/emacs/etc/yasnippet/snippets/go-mode/fore diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/foreach b/tools/emacs/etc/yasnippet/snippets/go-mode/foreach diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/fori b/tools/emacs/etc/yasnippet/snippets/go-mode/fori diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/forw b/tools/emacs/etc/yasnippet/snippets/go-mode/forw diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/func b/tools/emacs/etc/yasnippet/snippets/go-mode/func diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/iferr b/tools/emacs/etc/yasnippet/snippets/go-mode/iferr diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/ifunc b/tools/emacs/etc/yasnippet/snippets/go-mode/ifunc diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/imp b/tools/emacs/etc/yasnippet/snippets/go-mode/imp diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/import b/tools/emacs/etc/yasnippet/snippets/go-mode/import diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/main b/tools/emacs/etc/yasnippet/snippets/go-mode/main diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/map b/tools/emacs/etc/yasnippet/snippets/go-mode/map diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/method b/tools/emacs/etc/yasnippet/snippets/go-mode/method diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/package b/tools/emacs/etc/yasnippet/snippets/go-mode/package diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/pkg b/tools/emacs/etc/yasnippet/snippets/go-mode/pkg diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/pr b/tools/emacs/etc/yasnippet/snippets/go-mode/pr diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/printf b/tools/emacs/etc/yasnippet/snippets/go-mode/printf diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/struct b/tools/emacs/etc/yasnippet/snippets/go-mode/struct diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/switch b/tools/emacs/etc/yasnippet/snippets/go-mode/switch diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/test b/tools/emacs/etc/yasnippet/snippets/go-mode/test diff --git a/tmp/emacs-config/etc/yasnippet/snippets/go-mode/while b/tools/emacs/etc/yasnippet/snippets/go-mode/while diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/break b/tools/emacs/etc/yasnippet/snippets/gud-mode/break diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/cd b/tools/emacs/etc/yasnippet/snippets/gud-mode/cd diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/const b/tools/emacs/etc/yasnippet/snippets/gud-mode/const diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/cree b/tools/emacs/etc/yasnippet/snippets/gud-mode/cree diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/expr b/tools/emacs/etc/yasnippet/snippets/gud-mode/expr diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/iar b/tools/emacs/etc/yasnippet/snippets/gud-mode/iar diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/icd b/tools/emacs/etc/yasnippet/snippets/gud-mode/icd diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/line b/tools/emacs/etc/yasnippet/snippets/gud-mode/line diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/mrun b/tools/emacs/etc/yasnippet/snippets/gud-mode/mrun diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/opencl b/tools/emacs/etc/yasnippet/snippets/gud-mode/opencl diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/oper b/tools/emacs/etc/yasnippet/snippets/gud-mode/oper diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/operkind b/tools/emacs/etc/yasnippet/snippets/gud-mode/operkind diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/run b/tools/emacs/etc/yasnippet/snippets/gud-mode/run diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/type b/tools/emacs/etc/yasnippet/snippets/gud-mode/type diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/ulpcd b/tools/emacs/etc/yasnippet/snippets/gud-mode/ulpcd diff --git a/tmp/emacs-config/etc/yasnippet/snippets/gud-mode/ulprun b/tools/emacs/etc/yasnippet/snippets/gud-mode/ulprun diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/.hgignore b/tools/emacs/etc/yasnippet/snippets/haskell-mode/.hgignore diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/README.md b/tools/emacs/etc/yasnippet/snippets/haskell-mode/README.md diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/.yas-ignore-filenames-as-triggers b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/.yas-ignore-filenames-as-triggers diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/.yas-make-groups b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/.yas-make-groups diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/case b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/case diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/comment.block b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/comment.block diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/constraint b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/constraint diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/data.inline b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/data.inline diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/data.record b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/data.record diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn.clause b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn.clause diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn.guarded b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/fn.guarded diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/get b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/get diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/if.block b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/if.block diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/if.inline b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/if.inline diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/import b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/import diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/import.qualified b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/import.qualified diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/instance b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/instance diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/lambda b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/lambda diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/lang-pragma b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/lang-pragma diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/let b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/let diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/main b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/main diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/module b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/module diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/module.exports b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/module.exports diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/haskell-mode/newtype b/tools/emacs/etc/yasnippet/snippets/haskell-mode/haskell-mode/newtype diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/hdr.yasnippet b/tools/emacs/etc/yasnippet/snippets/haskell-mode/hdr.yasnippet diff --git a/tmp/emacs-config/etc/yasnippet/snippets/haskell-mode/tr.yasnippet b/tools/emacs/etc/yasnippet/snippets/haskell-mode/tr.yasnippet diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/commonjs.require b/tools/emacs/etc/yasnippet/snippets/js-mode/commonjs.require diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/es6.import b/tools/emacs/etc/yasnippet/snippets/js-mode/es6.import diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.es5exportedfunction b/tools/emacs/etc/yasnippet/snippets/js-mode/js.es5exportedfunction diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.exportedconst b/tools/emacs/etc/yasnippet/snippets/js-mode/js.exportedconst diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.exportedfunction b/tools/emacs/etc/yasnippet/snippets/js-mode/js.exportedfunction diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.exportedvar b/tools/emacs/etc/yasnippet/snippets/js-mode/js.exportedvar diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.function b/tools/emacs/etc/yasnippet/snippets/js-mode/js.function diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/js.generator b/tools/emacs/etc/yasnippet/snippets/js-mode/js.generator diff --git a/tmp/emacs-config/etc/yasnippet/snippets/js-mode/jsdoc b/tools/emacs/etc/yasnippet/snippets/js-mode/jsdoc diff --git a/tmp/emacs-config/etc/yasnippet/snippets/latex-mode/acro b/tools/emacs/etc/yasnippet/snippets/latex-mode/acro diff --git a/tmp/emacs-config/etc/yasnippet/snippets/latex-mode/code b/tools/emacs/etc/yasnippet/snippets/latex-mode/code diff --git a/tmp/emacs-config/etc/yasnippet/snippets/latex-mode/gloss b/tools/emacs/etc/yasnippet/snippets/latex-mode/gloss diff --git a/tmp/emacs-config/etc/yasnippet/snippets/latex-mode/hafez b/tools/emacs/etc/yasnippet/snippets/latex-mode/hafez diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/case b/tools/emacs/etc/yasnippet/snippets/lisp-mode/case diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/ccase b/tools/emacs/etc/yasnippet/snippets/lisp-mode/ccase diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/cond b/tools/emacs/etc/yasnippet/snippets/lisp-mode/cond diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/ctypecase b/tools/emacs/etc/yasnippet/snippets/lisp-mode/ctypecase diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defclass b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defclass diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defconstant b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defconstant diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defgeneric b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defgeneric diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/define-compiler-macro b/tools/emacs/etc/yasnippet/snippets/lisp-mode/define-compiler-macro diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/define-condition b/tools/emacs/etc/yasnippet/snippets/lisp-mode/define-condition diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/define-symbol-macro b/tools/emacs/etc/yasnippet/snippets/lisp-mode/define-symbol-macro diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defmacro b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defmacro diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defmethod b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defmethod diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defpackage b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defpackage diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defparameter b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defparameter diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defstruct b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defstruct diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defsystem b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defsystem diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/deftype b/tools/emacs/etc/yasnippet/snippets/lisp-mode/deftype diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defun b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defun diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/defvar b/tools/emacs/etc/yasnippet/snippets/lisp-mode/defvar diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/destructuring-bind b/tools/emacs/etc/yasnippet/snippets/lisp-mode/destructuring-bind diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/do b/tools/emacs/etc/yasnippet/snippets/lisp-mode/do diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/do_ b/tools/emacs/etc/yasnippet/snippets/lisp-mode/do_ diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/dolist b/tools/emacs/etc/yasnippet/snippets/lisp-mode/dolist diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/dotimes b/tools/emacs/etc/yasnippet/snippets/lisp-mode/dotimes diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/ecase b/tools/emacs/etc/yasnippet/snippets/lisp-mode/ecase diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/etypecase b/tools/emacs/etc/yasnippet/snippets/lisp-mode/etypecase diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/flet b/tools/emacs/etc/yasnippet/snippets/lisp-mode/flet diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/format b/tools/emacs/etc/yasnippet/snippets/lisp-mode/format diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/gnugpl b/tools/emacs/etc/yasnippet/snippets/lisp-mode/gnugpl diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/if b/tools/emacs/etc/yasnippet/snippets/lisp-mode/if diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/in-package b/tools/emacs/etc/yasnippet/snippets/lisp-mode/in-package diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/labels b/tools/emacs/etc/yasnippet/snippets/lisp-mode/labels diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/let b/tools/emacs/etc/yasnippet/snippets/lisp-mode/let diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/mapc b/tools/emacs/etc/yasnippet/snippets/lisp-mode/mapc diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/mapcar b/tools/emacs/etc/yasnippet/snippets/lisp-mode/mapcar diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/mitlic b/tools/emacs/etc/yasnippet/snippets/lisp-mode/mitlic diff --git a/tmp/emacs-config/etc/yasnippet/snippets/lisp-mode/typecase b/tools/emacs/etc/yasnippet/snippets/lisp-mode/typecase diff --git a/tmp/emacs-config/etc/yasnippet/snippets/message-mode/check b/tools/emacs/etc/yasnippet/snippets/message-mode/check diff --git a/tmp/emacs-config/etc/yasnippet/snippets/message-mode/granted b/tools/emacs/etc/yasnippet/snippets/message-mode/granted diff --git a/tmp/emacs-config/etc/yasnippet/snippets/message-mode/proof b/tools/emacs/etc/yasnippet/snippets/message-mode/proof diff --git a/tmp/emacs-config/etc/yasnippet/snippets/message-mode/suggest b/tools/emacs/etc/yasnippet/snippets/message-mode/suggest diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/appt b/tools/emacs/etc/yasnippet/snippets/org-mode/appt diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/assem b/tools/emacs/etc/yasnippet/snippets/org-mode/assem diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/bbdb b/tools/emacs/etc/yasnippet/snippets/org-mode/bbdb diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/hask b/tools/emacs/etc/yasnippet/snippets/org-mode/hask diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/list b/tools/emacs/etc/yasnippet/snippets/org-mode/list diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/note b/tools/emacs/etc/yasnippet/snippets/org-mode/note diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/out b/tools/emacs/etc/yasnippet/snippets/org-mode/out diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/proj b/tools/emacs/etc/yasnippet/snippets/org-mode/proj diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/sh b/tools/emacs/etc/yasnippet/snippets/org-mode/sh diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/skip b/tools/emacs/etc/yasnippet/snippets/org-mode/skip diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/src b/tools/emacs/etc/yasnippet/snippets/org-mode/src diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/status b/tools/emacs/etc/yasnippet/snippets/org-mode/status diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/teach b/tools/emacs/etc/yasnippet/snippets/org-mode/teach diff --git a/tmp/emacs-config/etc/yasnippet/snippets/org-mode/todo b/tools/emacs/etc/yasnippet/snippets/org-mode/todo diff --git a/tmp/emacs-config/etc/yasnippet/snippets/python-mode/def b/tools/emacs/etc/yasnippet/snippets/python-mode/def diff --git a/tmp/emacs-config/etc/yasnippet/snippets/rust-mode/clone b/tools/emacs/etc/yasnippet/snippets/rust-mode/clone diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/default b/tools/emacs/etc/yasnippet/snippets/rust-mode/default @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: default +# key: default +# -- +default() -> Self { + ${0:Self::new()} +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/fmt b/tools/emacs/etc/yasnippet/snippets/rust-mode/fmt @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: fmt +# key: fmt +# -- +fmt(&self, f: &mut Formatter) -> Result<(), Error> { + $0 +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/impl b/tools/emacs/etc/yasnippet/snippets/rust-mode/impl @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: impl +# key: impl +# -- +impl$3 ${1:Trait} for ${2:Type}$3 { + $0 +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/implClone b/tools/emacs/etc/yasnippet/snippets/rust-mode/implClone @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: implClone +# key: Clone +# -- +impl$2 Clone for ${1:Type}$2 { + fn clone(&self) -> Self { + $0 + } +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/implDefault b/tools/emacs/etc/yasnippet/snippets/rust-mode/implDefault @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: implDefault +# key: Default +# -- +impl$2 Default for ${1:Type}$2 { + fn default() -> Self { + ${0:Self::new()} + } +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/is_empty b/tools/emacs/etc/yasnippet/snippets/rust-mode/is_empty @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: is_empty +# key: is_empty +# -- +is_empty(&self) -> bool { + ${0:self.len() == 0} +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/len b/tools/emacs/etc/yasnippet/snippets/rust-mode/len @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: len +# key: len +# -- +len(&self) -> usize { + $0 +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/rust-mode/new b/tools/emacs/etc/yasnippet/snippets/rust-mode/new @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: new +# key: new +# -- +new() -> Self { + $0 +}+ \ No newline at end of file diff --git a/tools/emacs/etc/yasnippet/snippets/text-mode/ggit b/tools/emacs/etc/yasnippet/snippets/text-mode/ggit @@ -0,0 +1 @@ +https://github.com/vdemeester/$0 diff --git a/tools/emacs/host/README.org b/tools/emacs/host/README.org @@ -0,0 +1 @@ +Put stuff here that are local to a specific machine, those are private, aka not shared via this git repository. diff --git a/tools/emacs/host/naruhodo.el b/tools/emacs/host/naruhodo.el @@ -0,0 +1 @@ +../../sync/emacs/naruhodo.el+ \ No newline at end of file diff --git a/tools/emacs/host/wakasu.el b/tools/emacs/host/wakasu.el @@ -0,0 +1 @@ +../../sync/emacs/wakasu.el+ \ No newline at end of file diff --git a/tools/emacs/index.org b/tools/emacs/index.org @@ -0,0 +1,40 @@ +#+TITLE: vdemeester's .emacs.d +#+AUTHOR: Vincent Demeester +#+EMAIL: vincent@sbr.pm +#+EXPORT_EXCLUDE_TAGS: noexport +#+CREATOR: Emacs 27.0.90 (Org mode 9.3) +#+LANGUAGE: en +#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./notes.css"/> +#+OPTIONS: html-style:nil + +#+BEGIN_QUOTE +My emacs setup is tested to work only with emacs 26.1 and newer versions. If you are on +older versions, I would recommend that you upgrade to the [[https://www.gnu.org/software/emacs/download.html][latest available stable version]]. +#+END_QUOTE + +*Warning: this repository is being /transformed/ a bit: slowly migrating to literate programming ([[./emacs.org][emacs.org]]) and most likely moving into [[https://github.com/vdemeester/home][=home=]] at some point* + +* Few notes + +- This works best in =NixOS=, coupled with my [[https://github.com/vdemeester/home][=home=]] repository (especially with my + [[https://github.com/vdemeester/home/blob/master/modules/profiles/emacs.nix][emacs.nix]] file). +- Almost all setup files have setup done as per my personal tastes and needs. +- If you want to change the default theme, font size, etc, you would want to edit + =setup-files/setup-style.el= + +* Key points + +- Use of my minor mode =vde-mode= to enable my custom key-bindings. Doing so allows me to + force override my bindings in all major and minor modes. If I ever need to try out the + default emacs bindings, I can simply disable =vde-mode= by doing =M-x vde-mode=. /It + is enabled globally by default./ +- Use of =use-package= in load all packages for faster load times. +- Use of =bind-keys= allows me to review my custom bindings in a single buffer by doing + =M-x describe-personal-keybindings=. +- Certain packages will be loaded only if you have the associated applications installed. + +* Feedback + +Use at your own risk, but I am definitely looking forward to suggestions, corrections. + +Thanks! diff --git a/tools/emacs/init.el b/tools/emacs/init.el @@ -0,0 +1,195 @@ +;;; init.el --- -*- lexical-binding: t -*- +;; +CheckVer +(let ((minver 26)) + (unless (>= emacs-major-version minver) + (error "Your Emacs is too old -- this configuration requires v%s or higher" minver))) + +(defconst emacs-start-time (current-time)) + +;; load early-init.el before Emacs 27.0 +(unless (>= emacs-major-version 27) + (message "Early init: Emacs Version < 27.0") + (load (expand-file-name "early-init.el" user-emacs-directory))) +;; -CheckVer + +;; Inhibit +(setq inhibit-default-init t) ; Disable the site default settings + +(setq inhibit-startup-message t + inhibit-startup-screen t) +;; -Inhibit + +;; Confirm +(setq confirm-kill-emacs #'y-or-n-p) +;; -Confirm + +;; DefaultMode +(setq initial-major-mode 'fundamental-mode + initial-scratch-message nil) +;; -DefaultMode + +;; Unicode +(prefer-coding-system 'utf-8) +(set-default-coding-systems 'utf-8) +(set-language-environment 'utf-8) +(set-selection-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +;; -Unicode + +;;; UsePackageSetup +(require 'package) + +(setq package-archives + '(("melpa" . "http://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/") + ("gnu" . "https://elpa.gnu.org/packages/"))) + +(setq package-archive-priorities + '(("melpa" . 3) + ("org" . 2) + ("gnu" . 1))) + +(require 'tls) + +;; From https://github.com/hlissner/doom-emacs/blob/5dacbb7cb1c6ac246a9ccd15e6c4290def67757c/core/core-packages.el#L102 +(setq gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this + tls-checktrust gnutls-verify-error + tls-program (list "gnutls-cli --x509cafile %t -p %p %h" + ;; compatibility fallbacks + "gnutls-cli -p %p %h" + "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")) + +;; Initialise the packages, avoiding a re-initialisation. +(unless (bound-and-true-p package--initialized) + (setq package-enable-at-startup nil) + (package-initialize)) + +(setq load-prefer-newer t) ; Always load newer compiled files +(setq ad-redefinition-action 'accept) ; Silence advice redefinition warnings + +;; Init `delight' +(unless (package-installed-p 'delight) + (package-refresh-contents) + (package-install 'delight)) + +;; Configure `use-package' prior to loading it. +(eval-and-compile + (setq use-package-always-ensure nil) + (setq use-package-always-defer nil) + (setq use-package-always-demand nil) + (setq use-package-expand-minimally nil) + (setq use-package-enable-imenu-support t)) + +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(eval-when-compile + (require 'use-package)) +;; -UsePackageSetup + +;; CustomFile +(defconst vde/custom-file (locate-user-emacs-file "custom.el") + "File used to store settings from Customization UI.") + +(use-package cus-edit + :config + (setq + custom-file vde/custom-file + custom-buffer-done-kill nil ; Kill when existing + custom-buffer-verbose-help nil ; Remove redundant help text + custom-unlispify-tag-names nil ; Show me the real variable name + custom-unlispify-menu-entries nil) + (unless (file-exists-p custom-file) + (write-region "" nil custom-file)) + + (load vde/custom-file 'no-error 'no-message)) +;; -CustomFile + +;; NoBuiltinOrg +(require 'cl-seq) +(setq load-path + (cl-remove-if + (lambda (x) + (string-match-p "org$" x)) + load-path)) +;; -NoBuiltinOrg + +;; PinEntry +(use-package pinentry + :config + (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version)) + (pinentry-start)) +;; -PinEntry + +;; LoadCfgFunc +(defun vde/el-load-dir (dir) + "Load el files from the given folder" + (let ((files (directory-files dir nil "\.el$"))) + (while files + (load-file (concat dir (pop files)))))) + +(defun vde/short-hostname () + "Return hostname in short (aka wakasu.local -> wakasu)" + (string-match "[0-9A-Za-z-]+" system-name) + (substring system-name (match-beginning 0) (match-end 0))) +;; -LoadCfgFunc + +;; CfgConstant +(defconst *sys/gui* + (display-graphic-p) + "Are we running on a GUI Emacs ?") +(defconst *sys/linux* + (eq system-type 'gnu/linux) + "Are we running on a GNU/Linux system?") +(defconst *sys/mac* + (eq system-type 'darwin) + "Are we running on a Mac system?") +(defconst *sys/root* + (string-equal "root" (getenv "USER")) + "Are you a ROOT user?") +(defconst *nix* + (executable-find "nix") + "Do we have nix? (aka are we running in NixOS or a system using nixpkgs)") +(defconst *rg* + (executable-find "rg") + "Do we have ripgrep?") +(defconst *gcc* + (executable-find "gcc") + "Do we have gcc?") +(defconst *git* + (executable-find "git") + "Do we have git?") + +(defvar *sys/full* + (member (vde/short-hostname) '("wakasu" "naruhodo")) ; "naruhodo" <- put naruhodo back in + "Is it a full system ?") +(defvar *sys/light* + (not *sys/full*) + "Is it a light system ?") +;; -CfgConstant + +;; CfgLoad +(add-to-list 'load-path (concat user-emacs-directory "lisp/")) +(require 'init-func) +(vde/el-load-dir (concat user-emacs-directory "/config/")) +;; -CfgLoad + +;; CfgHostLoad +(if (file-exists-p (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el"))) + (load-file (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el")))) +;; -CfgHostLoad + +;; LastInit +(let ((elapsed (float-time (time-subtract (current-time) + emacs-start-time)))) + (message "Loading %s...done (%.3fs)" load-file-name elapsed)) + +(add-hook 'after-init-hook + `(lambda () + (let ((elapsed + (float-time + (time-subtract (current-time) emacs-start-time)))) + (message "Loading %s...done (%.3fs) [after-init]" + ,load-file-name elapsed))) t) +;; -LastInit diff --git a/tools/emacs/lisp/gotest-ui.el b/tools/emacs/lisp/gotest-ui.el @@ -0,0 +1,625 @@ +;;; gotest-ui.el --- Major mode for running go test -json + +;; Copyright 2018 Andreas Fuchs +;; Authors: Andreas Fuchs <asf@boinkor.net> + +;; URL: https://github.com/antifuchs/gotest-ui-mode +;; Created: Feb 18, 2018 +;; Keywords: languages go +;; Version: 0.1.0 +;; Package-Requires: ((emacs "25") (s "1.12.0") (gotest "0.14.0")) + +;; This file is not a part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3.0, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Commentary: + +;; Provides support for running go tests with a nice user interface +;; that allows folding away output, highlighting failing tests. + +;;; Code: + +(eval-when-compile + (require 'cl)) + +(require 'subr-x) +(require 'ewoc) +(require 'json) +(require 'compile) + +(defgroup gotest-ui nil + "The go test runner." + :group 'tools) + +(defface gotest-ui-pass-face '((t :foreground "green")) + "Face for displaying the status of a passing test." + :group 'gotest-ui) + +(defface gotest-ui-skip-face '((t :foreground "grey")) + "Face for displaying the status of a skipped test." + :group 'gotest-ui) + +(defface gotest-ui-fail-face '((t :foreground "pink" :weight bold)) + "Face for displaying the status of a failed test." + :group 'gotest-ui) + +(defface gotest-ui-link-face '((t :foreground "white" :weight bold)) + "Face for displaying links to go source files." + :group 'gotest-ui) + +(defcustom gotest-ui-expand-test-statuses '(fail) + "Statuses to expand test cases for. +Whenever a test enters this state, it is automatically expanded." + :group 'gotest-ui) + +(defcustom gotest-ui-test-binary '("go") + "Command list used to invoke the `go' binary." + :group 'gotest-ui) + +(defcustom gotest-ui-test-args '("test" "-json") + "Argument list used to run tests with JSON output." + :group 'gotest-ui) + +(defcustom gotest-ui-additional-test-args '() + "Additional args to pass to `go test'." + :group 'gotest-ui) + +;;;; Data model: + +(defstruct (gotest-ui-section :named + (:constructor gotest-ui-section-create) + (:type vector) + (:predicate gotest-ui-section-p)) + title tests node) + +;;; `gotest-ui-thing' is a thing that can be under test: a +;;; package, or a single test. + +(defstruct gotest-ui-thing + (name) + (node) + (expanded-p) + (status) + (buffer) ; the buffer containing this test's output + (elapsed) ; a floating-point amount of seconds + ) + +;;; `gotest-ui-test' is a single test. It contains a status and +;;; output. +(defstruct (gotest-ui-test (:include gotest-ui-thing) + (:constructor gotest-ui--make-test-1)) + (package) + (reason)) + +(defun gotest-ui-test->= (test1 test2) + "Returns true if TEST1's name sorts greater than TEST2's." + (let ((pkg1 (gotest-ui-test-package test1)) + (pkg2 (gotest-ui-test-package test2)) + (name1 (or (gotest-ui-thing-name test1) "")) + (name2 (or (gotest-ui-thing-name test2) ""))) + (if (string= pkg1 pkg2) + (string> name1 name2) + (string> pkg1 pkg2)))) + +(defstruct (gotest-ui-status (:constructor gotest-ui--make-status-1)) + (state) + (cmdline) + (dir) + (output) + (node)) + +(cl-defun gotest-ui--make-status (ewoc cmdline dir) + (let ((status (gotest-ui--make-status-1 :state 'run :cmdline (s-join " " cmdline) :dir dir))) + (let ((node (ewoc-enter-first ewoc status))) + (setf (gotest-ui-status-node status) node)) + status)) + +(cl-defun gotest-ui--make-test (ewoc &rest args &key status package name &allow-other-keys) + (apply #'gotest-ui--make-test-1 :status (or status "run") args)) + +;;; Data manipulation routines: + +(cl-defun gotest-ui-ensure-test (ewoc package-name base-name &key (status 'run)) + (let* ((test-name (format "%s.%s" package-name base-name)) + (test (gethash test-name gotest-ui--tests))) + (if test + test + (setf (gethash test-name gotest-ui--tests) + (gotest-ui--make-test ewoc :name base-name :package package-name :status status))))) + +(defun gotest-ui-update-status (new-state) + (setf (gotest-ui-status-state gotest-ui--status) new-state) + (ewoc-invalidate gotest-ui--ewoc (gotest-ui-status-node gotest-ui--status))) + +(defun gotest-ui-update-status-output (new-output) + (setf (gotest-ui-status-output gotest-ui--status) new-output) + (ewoc-invalidate gotest-ui--ewoc (gotest-ui-status-node gotest-ui--status))) + +(defun gotest-ui-ensure-output-buffer (thing) + (unless (gotest-ui-thing-buffer thing) + (with-current-buffer + (setf (gotest-ui-thing-buffer thing) + (generate-new-buffer (format " *%s" (gotest-ui-thing-name thing)))) + (setq-local gotest-ui-parse-marker (point-min-marker)) + (setq-local gotest-ui-insertion-marker (point-min-marker)) + (set-marker-insertion-type gotest-ui-insertion-marker t))) + (gotest-ui-thing-buffer thing)) + +(defun gotest-ui-mouse-open-file (event) + "In gotest-ui mode, open the file/line reference in another window." + (interactive "e") + (let ((window (posn-window (event-end event))) + (pos (posn-point (event-end event))) + file line) + (if (not (windowp window)) + (error "No file chosen")) + (with-current-buffer (window-buffer window) + (goto-char pos) + (setq file (gotest-ui-get-file-for-visit)) + (setq line (gotest-ui-get-line-for-visit))) + (unless (file-exists-p file) + (error "Could not open %s:%d" file line)) + (with-current-buffer (find-file-other-window file) + (goto-char (point-min)) + (forward-line (1- line))))) + +(defun gotest-ui-get-file-for-visit () + (get-text-property (point) 'gotest-ui-file)) + +(defun gotest-ui-get-line-for-visit () + (string-to-number (get-text-property (point) 'gotest-ui-line))) + +(defun gotest-ui-file-from-gopath (package file-basename) + (if (or (file-name-absolute-p file-basename) + (string-match-p "/" file-basename)) + file-basename + (let ((gopath (or (getenv "GOPATH") + (expand-file-name "~/go")))) + (expand-file-name (concat gopath "/src/" package "/" file-basename))))) + +(defvar gotest-ui-click-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-2] 'gotest-ui-mouse-open-file) + map)) + +(defun gotest-ui-ensure-parsed (thing) + (save-excursion + (goto-char gotest-ui-parse-marker) + (while (re-search-forward "\\([^ \t]+\\.go\\):\\([0-9]+\\)" gotest-ui-insertion-marker t) + (let* ((file-basename (match-string 1)) + (file (gotest-ui-file-from-gopath (gotest-ui-test-package thing) file-basename))) + (set-text-properties (match-beginning 0) (match-end 0) + `(face gotest-ui-link-face + gotest-ui-file ,file + gotest-ui-line ,(match-string 2) + keymap ,gotest-ui-click-map + follow-link t + )))) + (set-marker gotest-ui-parse-marker gotest-ui-insertion-marker))) + +(defun gotest-ui-update-thing-output (thing output) + (with-current-buffer (gotest-ui-ensure-output-buffer thing) + (goto-char gotest-ui-insertion-marker) + (let ((overwrites (split-string output "\r"))) + (insert (car overwrites)) + (dolist (segment (cdr overwrites)) + (let ((delete-to (point))) + (forward-line 0) + (delete-region (point) delete-to)) + (insert segment))) + (set-marker gotest-ui-insertion-marker (point)) + (gotest-ui-ensure-parsed thing))) + +;; TODO: clean up buffers on kill + +;;;; Mode definition + +(defvar gotest-ui-mode-map + (let ((m (make-sparse-keymap))) + (suppress-keymap m) + ;; key bindings go here + (define-key m (kbd "TAB") 'gotest-ui-toggle-expanded) + (define-key m (kbd "g") 'gotest-ui-rerun) + m)) + +(define-derived-mode gotest-ui-mode special-mode "go test UI" + "Major mode for running go test with JSON output." + (setq truncate-lines t) + (setq buffer-read-only t) + (setq-local line-move-visual t) + (setq show-trailing-whitespace nil) + (setq list-buffers-directory default-directory) + (make-local-variable 'text-property-default-nonsticky) + (push (cons 'keymap t) text-property-default-nonsticky)) + + +(defun gotest-ui--clear-buffer (buffer) + (let ((dir default-directory)) + (with-current-buffer buffer + (when (buffer-live-p gotest-ui--process-buffer) + (kill-buffer gotest-ui--process-buffer)) + (kill-all-local-variables) + (let ((buffer-read-only nil)) + (erase-buffer)) + (buffer-disable-undo) + (setq-local default-directory dir)))) + +(defun gotest-ui--setup-buffer (buffer name cmdline dir) + (setq-local default-directory dir) + (setq gotest-ui--cmdline cmdline + gotest-ui--dir dir) + (let ((ewoc (ewoc-create 'gotest-ui--pp-test nil nil t)) + (tests (make-hash-table :test #'equal))) + (setq gotest-ui--tests tests) + (setq gotest-ui--ewoc ewoc) + ;; Drop in the first few ewoc nodes: + (setq gotest-ui--status (gotest-ui--make-status ewoc cmdline dir)) + (gotest-ui-add-section gotest-ui--ewoc 'fail "Failed Tests:") + (gotest-ui-add-section gotest-ui--ewoc 'run "Currently Running:") + (gotest-ui-add-section gotest-ui--ewoc 'skip "Skipped:") + (gotest-ui-add-section gotest-ui--ewoc 'pass "Passed Tests:")) + ;; Set up the other buffers: + (setq gotest-ui--stderr-process-buffer (generate-new-buffer (format " *%s (stderr)" name))) + (with-current-buffer gotest-ui--stderr-process-buffer + (setq gotest-ui--ui-buffer buffer)) + (setq gotest-ui--process-buffer (generate-new-buffer (format " *%s" name))) + (with-current-buffer gotest-ui--process-buffer + (setq gotest-ui--ui-buffer buffer))) + +(defun gotest-ui-add-section (ewoc state name) + (let ((section (gotest-ui-section-create :title name :tests (list nil)))) + (setf (gotest-ui-section-node section) + (ewoc-enter-last ewoc section)) + (push (cons state section) gotest-ui--section-alist))) + +(defun gotest-ui-sort-test-into-section (test previous-state) + (let (invalidate-nodes) + (when-let ((previous-section* (and previous-state + (assoc previous-state gotest-ui--section-alist)))) + (let ((previous-section (cdr previous-section*))) + (setf (gotest-ui-section-tests previous-section) + (delete test (gotest-ui-section-tests previous-section))) + (when (null (cdr (gotest-ui-section-tests previous-section))) + (push (gotest-ui-section-node previous-section) invalidate-nodes)))) + ;; Drop the node from the buffer: + (when-let (node (gotest-ui-thing-node test)) + (let ((buffer-read-only nil)) + (ewoc-delete gotest-ui--ewoc node)) + (setf (gotest-ui-thing-node test) nil)) + + ;; Put it in the next secion: + (when-let ((section* (assoc (gotest-ui-thing-status test) + gotest-ui--section-alist))) + (let* ((section (cdr section*)) + (insertion-cons (gotest-ui-section-tests section))) + (while (and (cdr insertion-cons) + (gotest-ui-test->= test (cadr insertion-cons))) + (setq insertion-cons (cdr insertion-cons))) + (rplacd insertion-cons (cons test (cdr insertion-cons))) + (let ((insertion-node (if (car insertion-cons) + (gotest-ui-thing-node (car insertion-cons)) + (gotest-ui-section-node section)))) + (setf (gotest-ui-thing-node test) + (ewoc-enter-after gotest-ui--ewoc insertion-node test))) + (when (null (cddr (gotest-ui-section-tests section))) + (push (gotest-ui-section-node section) invalidate-nodes)))) + (unless (null invalidate-nodes) + (apply 'ewoc-invalidate gotest-ui--ewoc invalidate-nodes)) + (gotest-ui-thing-node test))) + +;;;; Commands: + +(defun gotest-ui-toggle-expanded () + "Toggle expandedness of a test/package node" + (interactive) + (let* ((node (ewoc-locate gotest-ui--ewoc (point))) + (data (ewoc-data node))) + (when (and data (gotest-ui-thing-p data)) + (setf (gotest-ui-thing-expanded-p data) + (not (gotest-ui-thing-expanded-p data))) + (ewoc-invalidate gotest-ui--ewoc node)))) + +(defun gotest-ui-rerun () + (interactive) + (gotest-ui gotest-ui--cmdline :dir gotest-ui--dir)) + +;;;; Displaying the data: + +(defvar-local gotest-ui--tests nil) +(defvar-local gotest-ui--section-alist nil) +(defvar-local gotest-ui--ewoc nil) +(defvar-local gotest-ui--status nil) +(defvar-local gotest-ui--process-buffer nil) +(defvar-local gotest-ui--stderr-process-buffer nil) +(defvar-local gotest-ui--ui-buffer nil) +(defvar-local gotest-ui--process nil) +(defvar-local gotest-ui--stderr-process nil) +(defvar-local gotest-ui--cmdline nil) +(defvar-local gotest-ui--dir nil) + +(cl-defun gotest-ui (cmdline &key dir) + (let* ((dir (or dir default-directory)) + (name (format "*go test: %s in %s" (s-join " " cmdline) dir)) + (buffer (get-buffer-create name))) + (unless (eql buffer (current-buffer)) + (display-buffer buffer)) + (with-current-buffer buffer + (let ((default-directory dir)) + (gotest-ui--clear-buffer buffer) + (gotest-ui-mode) + (gotest-ui--setup-buffer buffer name cmdline dir)) + (setq gotest-ui--stderr-process + (make-pipe-process :name (s-concat name "(stderr)") + :buffer gotest-ui--stderr-process-buffer + :sentinel #'gotest-ui--stderr-process-sentinel + :filter #'gotest-ui-read-stderr)) + (setq gotest-ui--process + (make-process :name name + :buffer gotest-ui--process-buffer + :sentinel #'gotest-ui--process-sentinel + :filter #'gotest-ui-read-stdout + :stderr gotest-ui--stderr-process + :command cmdline))))) + +(defun gotest-ui-pp-status (status) + (propertize (format "%s" status) + 'face + (case status + (fail 'gotest-ui-fail-face) + (skip 'gotest-ui-skip-face) + (pass 'gotest-ui-pass-face) + (otherwise 'default)))) + +(defun gotest-ui--pp-test-output (test) + (with-current-buffer (gotest-ui-ensure-output-buffer test) + (propertize (buffer-substring (point-min) (point-max)) + 'line-prefix "\t"))) + +(defun gotest-ui--pp-test (test) + (cond + ((gotest-ui-section-p test) + (unless (null (cdr (gotest-ui-section-tests test))) + (insert "\n" (gotest-ui-section-title test) "\n"))) + ((gotest-ui-status-p test) + (insert (gotest-ui-pp-status (gotest-ui-status-state test))) + (insert (format " %s in %s\n\n" + (gotest-ui-status-cmdline test) + (gotest-ui-status-dir test))) + (unless (zerop (length (gotest-ui-status-output test))) + (insert (format "\n\n%s" (gotest-ui-status-output test))))) + ((gotest-ui-test-p test) + (let ((status (gotest-ui-thing-status test)) + (package (gotest-ui-test-package test)) + (name (gotest-ui-thing-name test))) + (insert (gotest-ui-pp-status status)) + (insert " ") + (insert (if name + (format "%s.%s" package name) + package)) + (when-let ((elapsed (gotest-ui-thing-elapsed test))) + (insert (format " (%.3fs)" elapsed))) + (when-let ((reason (gotest-ui-test-reason test))) + (insert (format " [%s]" reason)))) + (when (and (gotest-ui-thing-expanded-p test) + (> (length (gotest-ui--pp-test-output test)) 0)) + (insert "\n") + (insert (gotest-ui--pp-test-output test))) + (insert "\n")))) + +;;;; Handling input: + +(defun gotest-ui--process-sentinel (proc event) + (let* ((process-buffer (process-buffer proc)) + (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) + (inhibit-quit t)) + (with-local-quit + (with-current-buffer ui-buffer + (cond + ((string= event "finished\n") + (gotest-ui-update-status 'pass)) + ((s-prefix-p "exited abnormally" event) + (gotest-ui-update-status 'fail)) + (t + (gotest-ui-update-status event))))))) + +(defun gotest-ui--stderr-process-sentinel (proc event) + ;; ignore all events + nil) + +(defun gotest-ui-read-stderr (proc input) + (let* ((process-buffer (process-buffer proc)) + (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) + (inhibit-quit t)) + (with-local-quit + (when (buffer-live-p process-buffer) + (with-current-buffer process-buffer + (gotest-ui-read-compiler-spew proc process-buffer ui-buffer input)))))) + +(defun gotest-ui-read-stdout (proc input) + (let* ((process-buffer (process-buffer proc)) + (ui-buffer (with-current-buffer process-buffer gotest-ui--ui-buffer)) + (inhibit-quit t)) + (with-local-quit + (when (buffer-live-p process-buffer) + (gotest-ui-read-json process-buffer (process-mark proc) input))))) + +(defun gotest-ui-read-json (process-buffer marker input) + (with-current-buffer process-buffer + (gotest-ui-read-json-1 process-buffer marker gotest-ui--ui-buffer input))) + +(defvar-local gotest-ui--current-failing-test nil) + +(defun gotest-ui-read-failing-package (ui-buffer) + (when (looking-at "^# \\(.*\\)$") + (let* ((package (match-string 1)) + test) + (with-current-buffer ui-buffer + (setq test (gotest-ui-ensure-test gotest-ui--ewoc package nil :status 'fail)) + (gotest-ui-maybe-expand test) + (gotest-ui-sort-test-into-section test nil)) + (forward-line 1) + test))) + +(defun gotest-ui-read-compiler-spew (proc process-buffer ui-buffer input) + (with-current-buffer process-buffer + (save-excursion + (goto-char (point-max)) + (insert input) + (goto-char (process-mark proc)) + (while (and (/= (point-max) (line-end-position)) ; incomplete line + (/= (point-max) (point))) + (cond + (gotest-ui--current-failing-test + (cond + ((looking-at "^# \\(.*\\)$") + (gotest-ui-read-failing-package ui-buffer)) + (t + (let* ((line (buffer-substring (point) (line-end-position))) + (test gotest-ui--current-failing-test)) + (forward-line 1) + (set-marker (process-mark proc) (point)) + (with-current-buffer ui-buffer + (gotest-ui-update-thing-output test (concat line "\n")) + (ewoc-invalidate gotest-ui--ewoc (gotest-ui-thing-node test))))))) + (t + (let ((test (gotest-ui-read-failing-package ui-buffer))) + (setq gotest-ui--current-failing-test test) + (set-marker (process-mark proc) (point)) + (with-current-buffer ui-buffer + (ewoc-invalidate gotest-ui--ewoc (gotest-ui-thing-node test)))))))))) + +(defun gotest-ui-read-json-1 (process-buffer marker ui-buffer input) + (with-current-buffer process-buffer + (save-excursion + ;; insert the chunk of output at the end + (goto-char (point-max)) + (insert input) + + ;; try to read the next object (which is hopefully complete now): + (let ((nodes + (cl-loop + for (node . continue) = (gotest-ui-read-test-event process-buffer marker ui-buffer) + when node collect node into nodes + while continue + finally (return nodes)))) + (when nodes + (with-current-buffer ui-buffer + (apply #'ewoc-invalidate gotest-ui--ewoc + (cl-remove-if-not (lambda (node) (marker-buffer (ewoc-location node))) (cl-remove-duplicates nodes))))))))) + +(defun gotest-ui-read-test-event (process-buffer marker ui-buffer) + (goto-char marker) + (when (= (point) (line-end-position)) + (forward-line 1)) + (case (char-after (point)) + (?\{ + ;; It's JSON: + (condition-case err + (let ((obj (json-read))) + (set-marker marker (point)) + (with-current-buffer ui-buffer + (cons (gotest-ui-update-test-status obj) t))) + (json-error (cons nil nil)) + (wrong-type-argument + (if (and (eql (cadr err) 'characterp) + (eql (caddr err) :json-eof)) + ;; This is peaceful & we can ignore it: + (cons nil nil) + (signal 'wrong-type-argument err))))) + (?\F + ;; It's a compiler error: + (when (looking-at "^FAIL\t\\(.*\\)\s+\\[\\([^]]+\\)\\]\n") + (let* ((package-name (match-string 1)) + (reason (match-string 2)) + test node) + (with-current-buffer ui-buffer + (setq test (gotest-ui-ensure-test gotest-ui--ewoc package-name nil :status 'fail) + node (gotest-ui-thing-node test)) + (setf (gotest-ui-test-reason test) reason) + (gotest-ui-sort-test-into-section test nil) + (gotest-ui-maybe-expand test)) + (forward-line 1) + (set-marker marker (point)) + (cons node t)))) + (otherwise + ;; We're done: + (cons nil nil)))) + +(defun gotest-ui-maybe-expand (test) + (when (memq (gotest-ui-test-status test) gotest-ui-expand-test-statuses) + (setf (gotest-ui-test-expanded-p test) t))) + +(defun gotest-ui-update-test-status (json) + (let-alist json + (let* ((action (intern .Action)) + (test (gotest-ui-ensure-test gotest-ui--ewoc .Package .Test)) + (previous-status (gotest-ui-thing-status test))) + (case action + (run + (gotest-ui-sort-test-into-section test nil)) + (output (gotest-ui-update-thing-output test .Output)) + (pass + (setf (gotest-ui-thing-status test) 'pass + (gotest-ui-thing-elapsed test) .Elapsed) + (gotest-ui-sort-test-into-section test previous-status) + (gotest-ui-maybe-expand test)) + (fail + (setf (gotest-ui-thing-status test) 'fail + (gotest-ui-thing-elapsed test) .Elapsed) + (gotest-ui-sort-test-into-section test previous-status) + (gotest-ui-maybe-expand test)) + (skip + (setf (gotest-ui-thing-status test) 'skip + (gotest-ui-thing-elapsed test) .Elapsed) + (gotest-ui-sort-test-into-section test previous-status) + (gotest-ui-maybe-expand test)) + (otherwise + (setq test nil))) + (when test (gotest-ui-thing-node test))))) + +;;;; Commands for go-mode: + +(defun gotest-ui--command-line (&rest cmdline) + (append gotest-ui-test-binary gotest-ui-test-args gotest-ui-additional-test-args + cmdline)) + +;;;###autoload +(defun gotest-ui-current-test () + "Launch go test with the test that (point) is in." + (interactive) + (cl-destructuring-bind (test-suite test-name) (go-test--get-current-test-info) + (let ((test-flag (if (> (length test-suite) 0) "-m" "-run"))) + (when test-name + (gotest-ui (gotest-ui--command-line test-flag (s-concat test-name "$") ".")))))) + +;;;###autoload +(defun gotest-ui-current-file () + "Launch go test on the current buffer file." + (interactive) + (let* ((data (go-test--get-current-file-testing-data)) + (run-flag (s-concat "-run=" data "$"))) + (gotest-ui (gotest-ui--command-line run-flag ".")))) + +;;;###autoload +(defun gotest-ui-current-project () + "Launch go test on the current buffer's project." + (interactive) + (let ((default-directory (projectile-project-root))) + (gotest-ui (gotest-ui--command-line "./...")))) + +(provide 'gotest-ui) + +;;; gotest-ui.el ends here diff --git a/tools/emacs/lisp/init-func.el b/tools/emacs/lisp/init-func.el @@ -0,0 +1,53 @@ +;;; init-func.el --- -*- lexical-binding: t -*- +;; +;; OrgIncludeAuto +;; https://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html +(defun save-and-update-includes () + "Update the line numbers of #+INCLUDE:s in current buffer. +Only looks at INCLUDEs that have either :range-begin or :range-end. +This function does nothing if not in `org-mode', so you can safely +add it to `before-save-hook'." + (interactive) + (when (derived-mode-p 'org-mode) + (save-excursion + (goto-char (point-min)) + (while (search-forward-regexp + "^\\s-*#\\+INCLUDE: *\"\\([^\"]+\\)\".*:range-\\(begin\\|end\\)" + nil 'noerror) + (let* ((file (expand-file-name (match-string-no-properties 1))) + lines begin end) + (forward-line 0) + (when (looking-at "^.*:range-begin *\"\\([^\"]+\\)\"") + (setq begin (match-string-no-properties 1))) + (when (looking-at "^.*:range-end *\"\\([^\"]+\\)\"") + (setq end (match-string-no-properties 1))) + (setq lines (decide-line-range file begin end)) + (when lines + (if (looking-at ".*:lines *\"\\([-0-9]+\\)\"") + (replace-match lines :fixedcase :literal nil 1) + (goto-char (line-end-position)) + (insert " :lines \"" lines "\"")))))))) + +(add-hook 'before-save-hook #'save-and-update-includes) + +(defun decide-line-range (file begin end) + "Visit FILE and decide which lines to include. +BEGIN and END are regexps which define the line range to use." + (let (l r) + (save-match-data + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-min)) + (if (null begin) + (setq l "") + (search-forward-regexp begin) + (setq l (line-number-at-pos (match-beginning 0)))) + (if (null end) + (setq r "") + (search-forward-regexp end) + (setq r (1+ (line-number-at-pos (match-end 0))))) + (format "%s-%s" (+ l 1) (- r 1)))))) ;; Exclude wrapper +;; -OrgIncludeAuto + +(provide 'init-func) +;;; init-func.el ends here diff --git a/tools/emacs/lisp/ol-github.el b/tools/emacs/lisp/ol-github.el @@ -0,0 +1,67 @@ +;;; ol-github.el --- Links to GitHub -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Vincent Demeester + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: org link github +;; +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3.0, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to GitHub from within Org mode. +;; gh:tektoncd/pipeline : project +;; gh:tektoncd/pipeline#1 : issue or pr #1 + +;;; Code: + +(require 'ol) + +;; Install the link type +(org-link-set-parameters "gh" + :follow #'org-github-follow-link + :export #'org-github-export + :face '(:foreground "DimGrey" :underline t)) + + +(defun org-github-export (link description format) + "Export a github page link from Org files." + (let ((path (org-github-get-url link)) + (desc (or description link))) + (cond + ((eq format 'html) (format "<a hrefl=\"_blank\" href=\"%s\">%s</a>" path desc)) + ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) + ((eq format 'texinfo) (format "@uref{%s,%s}" path desc)) + ((eq format 'ascii) (format "%s (%s)" desc path)) + (t path)))) + +(defun org-github-follow-link (issue) + "Browse github issue/pr specified." + (browse-url (org-github-get-url issue))) + +(defun org-github-get-url (path) + "Translate org-mode link `gh:foo/bar#1' to github url." + (setq expressions (split-string path "#")) + (setq project (nth 0 expressions)) + (setq issue (nth 1 expressions)) + (if issue + (format "https://github.com/%s/issues/%s" project issue) + (format "https://github.com/%s" project))) + +(provide 'ol-github) +;;; ol-github.el ends here diff --git a/tools/emacs/lisp/ol-gitlab.el b/tools/emacs/lisp/ol-gitlab.el @@ -0,0 +1,78 @@ +;;; ol-gitlab.el --- Links to Gitlab -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Vincent Demeester + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: org link gitlab +;; +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3.0, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Gitlab from within Org mode. +;; gl:vdemeester/emacs-config : project +;; gl:vdemeester/emacs-config#1 : issue #1 +;; gl:vdemeester/emacs-config##1 : merge-request #1 + +;;; Code: + +(require 'ol) + +;; Install the link type +(org-link-set-parameters "gl" + :follow #'org-gitlab-follow-link + :export #'org-gitlab-export + :face '(:foreground "DimGrey" :underline t)) + + +(defun org-gitlab-export (link description format) + "Export a gitlab page link from Org files." + (let ((path (org-gitlab-get-url link)) + (desc (or description link))) + (cond + ((eq format 'html) (format "<a hrefl=\"_blank\" href=\"%s\">%s</a>" path desc)) + ((eq format 'latex) (format "\\href{%s}{%s}" path desc)) + ((eq format 'texinfo) (format "@uref{%s,%s}" path desc)) + ((eq format 'ascii) (format "%s (%s)" desc path)) + (t path)))) + +(defun org-gitlab-follow-link (issue) + "Browse gitlab issue/pr specified." + (browse-url (org-gitlab-get-url issue))) + +(defun org-gitlab-get-url (path) + "Translate org-mode link `gh:foo/bar#1' to gitlab url." + (setq expressions (split-string path "#")) + (setq project (nth 0 expressions)) + (setq issue (nth 1 expressions)) + (setq mr (nth 2 expressions)) + (message (format "issue: %s" issue)) + (message (format "mr: %s" mr)) + (if (not (empty-string-p mr)) + (format "https://gitlab.com/%s/-/merge_requests/%s" project mr) + (if (not (empty-string-p issue)) + (format "https://gitlab.com/%s/-/issues/%s" project issue) + (format "https://gitlab.com/%s" project)))) + +(defun empty-string-p (string) + "Return true if the STRING is empty or nil. Expects string type." + (or (null string) + (zerop (length (string-trim string))))) + +(provide 'ol-gitlab) +;;; ol-gitlab.el ends here diff --git a/tools/emacs/lisp/ol-grep.el b/tools/emacs/lisp/ol-grep.el @@ -0,0 +1,54 @@ +;;; ol-grep.el --- Links to Grep -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Vincent Demeester + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: org link grep +;; +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3.0, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Grep from within Org mode. +;; grep:orgmode : run grep on current working dir with orgmode expression +;; grep:orgmode:config/ : run grep on config/ dir with orgmode expression + +;;; Code: + +(require 'ol) + +;; Install the link type +(org-link-set-parameters "rg" + :follow #'org-grep-follow-link + :face '(:foreground "DarkRed" :underline t)) + +(defun org-grep-follow-link (issue) + "Run `rgrep' with REGEXP and FOLDER as argument, +like this : [[grep:REGEXP:FOLDER]]." + (setq expressions (split-string regexp ":")) + (setq exp (nth 0 expressions)) + (grep-compute-defaults) + (if (= (length expressions) 1) + (progn + (rgrep exp "*" (expand-file-name "./"))) + (progn + (setq folder (nth 1 expressions)) + (rgrep exp "*" (expand-file-name folder))))) + +(provide 'ol-grep) +;;; ol-grep.el ends here diff --git a/tools/emacs/lisp/ol-ripgrep.el b/tools/emacs/lisp/ol-ripgrep.el @@ -0,0 +1,53 @@ +;;; ol-ripgrep.el --- Links to Ripgrep -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Vincent Demeester + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: org link ripgrep +;; +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3.0, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to Ripgrep from within Org mode. +;; rg:orgmode : run ripgrep on current working dir with orgmode expression +;; rg:orgmode:config/ : run ripgrep on config/ dir with orgmode expression + +;;; Code: + +(require 'ol) + +;; Install the link type +(org-link-set-parameters "rg" + :follow #'org-ripgrep-follow-link + :face '(:foreground "DarkGreen" :underline t)) + +(defun org-ripgrep-follow-link (issue) + "Run `ripgrep-regexp` with REXEP and FOLDER as argument, +like this : [[pt:REGEXP:FOLDER]]" + (setq expressions (split-string regexp ":")) + (setq exp (nth 0 expressions)) + (if (= (length expressions) 1) + (progn + (ripgrep-regexp exp (expand-file-name "./"))) + (progn + (setq folder (nth 1 expressions)) + (ripgrep-regexp exp (file-name-as-directory (expand-file-name folder)))))) + +(provide 'ol-ripgrep) +;;; ol-ripgrep.el ends here diff --git a/tools/emacs/lisp/shortbrain-light-theme.el b/tools/emacs/lisp/shortbrain-light-theme.el @@ -0,0 +1,272 @@ +;;; shortbrain-light-theme.el --- A calm, light, almost monochrome color theme based on emacs-shortbrain-theme. + +;; Copyright (C) 2020 Vincent Demeester <vincent@sbr.pm> + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: themes +;; URL: https://github.com/vdemeester/emacs-config +;; Version: 2020.03 +;; Package-Requires: ((emacs "24.1")) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; To use the shortbrain-light theme, add the following to your Emacs +;; configuration file: +;; +;; (load-theme 'shortbrain-light) +;; +;; Requirements: Emacs 24. + +;;; Code: + + +(deftheme shortbrain-light "A calm, light, almost monochrome color theme") + + +(defconst shortbrain-light-theme-colors + '(;; Basics + (white . "#ffffff") + + ;; Greys + (default-grey . "#0f1619") + (grey . "#0f1619") + (grey-50 . "#fdfdfe") + (grey-100 . "#f5f8fa") + (grey-200 . "#d8dcde") + (grey-300 . "#bcc0c2") + (grey-400 . "#9fa3a6") + (grey-500 . "#9fa3a6") + (grey-600 . "#656b6e") + (grey-700 . "#494f52") + (grey-720 . "#474d50") + (grey-800 . "#2c3236") + (grey-820 . "#1e2428") + (grey-850 . "#1d2226") + (grey-900 . "#0f1619") + + ;; Primaries + (default-primary . "#0be5e5") + (primary . "#0be5e5") + (primary-50 . "#f3fefe") + (primary-100 . "#d4fafa") + (primary-200 . "#91f3f3") + (primary-300 . "#4eecec") + (primary-400 . "#0be5e5") + (primary-500 . "#09cccc") + (primary-600 . "#07b3b3") + (primary-700 . "#059999") + (primary-800 . "#028080") + (primary-900 . "#006666") + + ;; Greens + (default-green . "#0be541") + (green . "#0be441") + (green-50 . "#e7feec") + (green-100 . "#b6fcc7") + (green-200 . "#85f9a2") + (green-300 . "#3cf66b") + (green-400 . "#0be441") + (green-500 . "#0adb3f") + (green-600 . "#09c338") + (green-700 . "#08aa31") + (green-800 . "#07922a") + (green-900 . "#067a23") + + ;; Reds + (default-red. "#f24965") + (red . "#f24965") + (danger . "#f24965") + (red-50 . "#fff0f2") + (red-100 . "#ffd9df") + (red-200 . "#fba9b6") + (red-300 . "#f6798e") + (red-400 . "#f24965") + (red-500 . "#d6455d") + (red-600 . "#ba4054") + (red-700 . "#9e3c4c") + (red-800 . "#823743") + (red-900 . "#66333b") + + ;; Purples + (purple . "#b965e8"))) + + +(defun shortbrain-light-theme-color (name) + "Return the shortbrain-light theme color with the given NAME." + (cdr (assoc name shortbrain-light-theme-colors))) + + +(let ((class '((class color) (min-colors 256))) + (default-fg (shortbrain-light-theme-color 'grey-900)) + (default-bg (shortbrain-light-theme-color 'grey-50)) + (inactive-bg (shortbrain-light-theme-color 'grey-200)) + (minor-fg (shortbrain-light-theme-color 'grey-200)) + (minor-bg (shortbrain-light-theme-color 'grey-50)) + (inactive-fg (shortbrain-light-theme-color 'grey-600)) + (border-fg (shortbrain-light-theme-color 'grey-200)) + (frame-fg (shortbrain-light-theme-color 'grey-500)) + (cursor-fg (shortbrain-light-theme-color 'grey-900)) + (cursor-bg (shortbrain-light-theme-color 'grey-300)) + + ;; Scrollbars + (scrollbar-fg (shortbrain-light-theme-color 'grey-600)) + (scrollbar-bg (shortbrain-light-theme-color 'grey-100)) + + ;; Highlighting + (highlight-fg (shortbrain-light-theme-color 'white)) + (highlight-bg (shortbrain-light-theme-color 'red)) + + ;; Current line + (hl-line-bg (shortbrain-light-theme-color 'grey-100)) + + ;; Search + (search-fg (shortbrain-light-theme-color 'white)) + (search-bg (shortbrain-light-theme-color 'primary-600)) + (search-bg-0 (shortbrain-light-theme-color 'primary-500)) + (search-bg-1 (shortbrain-light-theme-color 'primary-400)) + (search-bg-2 (shortbrain-light-theme-color 'primary-300)) + (search-bg-3 (shortbrain-light-theme-color 'primary-100)) + + ;; Selection + (selection-bg (shortbrain-light-theme-color 'grey-200)) + + ;; Auto-completion + (completion-fg (shortbrain-light-theme-color 'grey-500)) + (completion-bg (shortbrain-light-theme-color 'grey-800)) + (completion-match-fg (shortbrain-light-theme-color 'red-500)) + (completion-mouse-fg (shortbrain-light-theme-color 'white)) + (completion-selection-fg (shortbrain-light-theme-color 'red-500)) + (completion-selection-bg (shortbrain-light-theme-color 'grey-200)) + (completion-annotation-fg (shortbrain-light-theme-color 'red-400)) + + ;; Warnings & errors + (warning-fg (shortbrain-light-theme-color 'white)) + (warning-bg (shortbrain-light-theme-color 'red-600)) + (error-fg (shortbrain-light-theme-color 'white)) + (error-bg (shortbrain-light-theme-color 'red)) + + ;; Org + (org-color-1 (shortbrain-light-theme-color 'green-900)) + (org-color-2 (shortbrain-light-theme-color 'purple)) + (org-color-3 (shortbrain-light-theme-color 'primary-700)) + (org-color-4 (shortbrain-light-theme-color 'primary-500)) + (org-color-5 (shortbrain-light-theme-color 'primary-400)) + (org-meta-fg (shortbrain-light-theme-color 'primary-900)) + + ;; Language syntax highlighting + (variable-fg (shortbrain-light-theme-color 'black)) + (function-fg (shortbrain-light-theme-color 'grey-900)) + (type-fg (shortbrain-light-theme-color 'grey-700)) + (constant-fg (shortbrain-light-theme-color 'grey-600)) + (keyword-fg (shortbrain-light-theme-color 'grey-500)) + (builtin-fg (shortbrain-light-theme-color 'grey-400)) + (string-fg (shortbrain-light-theme-color 'grey-600)) + (doc-fg (shortbrain-light-theme-color 'primary-600)) + (doc-bg (shortbrain-light-theme-color 'grey-50))) + (custom-theme-set-faces + 'shortbrain-light + ;; Regular + `(cursor ((,class (:foreground ,cursor-fg :background ,cursor-bg)))) + `(default ((,class (:foreground ,default-fg :background ,default-bg)))) + `(default-italic ((,class (:italic t)))) + + ;; Emacs UI + `(fringe ((,class (:foreground ,error-fg :background ,default-bg)))) + `(header-line ((,class :background ,default-bg))) + `(linum ((,class (:inherit shadow :background ,default-bg)))) + `(mode-line ((,class (:foreground ,frame-fg :background ,default-bg + :box (:line-width -1 :color ,default-bg))))) + `(mode-line-inactive ((,class (:foreground ,inactive-fg :background ,inactive-bg + :box (:line-width -1 :color ,inactive-bg))))) + `(nlinum-relative-current-face ((,class (:foreground ,frame-fg :background ,default-bg)))) + `(vertical-border ((,class (:foreground ,border-fg :background ,default-bg)))) + + ;; Highlighting + `(highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg)))) + `(hl-line ((,class (:background ,hl-line-bg)))) + + ;; Search + `(isearch ((,class (:foreground ,search-fg :background ,search-bg :weight bold)))) + `(lazy-highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg) :weight normal))) + + ;; Selection + `(region ((,class (:background ,selection-bg)))) + + ;; Erroneous whitespace + `(whitespace-line ((,class (:foreground ,error-fg :background ,error-bg)))) + `(whitespace-space ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) + `(whitespace-tab ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) + + ;; Language syntax highlighting + `(font-lock-builtin-face ((,class (:foreground ,builtin-fg)))) + `(font-lock-comment-face ((,class (:foreground ,doc-fg :background ,doc-bg)))) + `(font-lock-comment-delimiter-face ((,class (:foreground ,minor-fg, :background ,minor-bg)))) + `(font-lock-constant-face ((,class (:foreground ,constant-fg)))) + `(font-lock-doc-face ((,class (:foreground ,doc-fg)))) + `(font-lock-function-name-face ((,class (:foreground ,function-fg)))) + `(font-lock-keyword-face ((,class (:foreground ,keyword-fg)))) + `(font-lock-negation-char-face ((,class (:foreground ,error-fg)))) + `(font-lock-preprocessor-face ((,class (:foreground ,builtin-fg)))) + `(font-lock-string-face ((,class (:foreground ,string-fg)))) + `(font-lock-type-face ((,class (:foreground ,type-fg)))) + `(font-lock-variable-name-face ((,class (:foreground ,variable-fg)))) + `(font-lock-warning-face ((,class (:foreground ,warning-fg :background ,warning-bg)))) + + ;; Org + `(org-level-1 ((,class (:foreground ,org-color-1 :bold t :height 1.2)))) + `(org-level-2 ((,class (:foreground ,org-color-2 :bold t :height 1.1)))) + `(org-level-3 ((,class (:foreground ,org-color-3 :bold t :height 1.0)))) + `(org-level-4 ((,class (:foreground ,org-color-4 :bold t :height 1.0)))) + `(org-level-5 ((,class (:foreground ,org-color-5 :bold t :height 1.0)))) + `(org-level-6 ((,class (:foreground ,org-color-5 :bold t :height 1.0)))) + `(org-document-title ((,class (:bold t :foreground ,org-meta-fg :height 1.4)))) + `(org-meta-line ((,class (:foreground ,org-meta-fg :bold t)))) + + ;; Avy + `(avy-lead-face ((,class (:background ,search-bg-0 :foreground ,search-fg)))) + `(avy-lead-face-0 ((,class (:background ,search-bg-1 :foreground ,search-fg)))) + `(avy-lead-face-1 ((,class (:background ,search-bg-2 :foreground ,search-fg)))) + `(avy-lead-face-2 ((,class (:background ,search-bg-3 :foreground ,search-fg)))) + + ;; Company (auto-completion) + `(company-preview ((,class (:background ,default-bg :foreground ,completion-match-fg)))) + `(company-preview-common ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-preview-search ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-scrollbar-bg ((,class (:background ,scrollbar-bg)))) + `(company-scrollbar-fg ((,class (:background ,scrollbar-fg)))) + `(company-tooltip ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-tooltip-annotation ((,class (:foreground ,completion-annotation-fg)))) + `(company-tooltip-common ((,class (:background nil :foreground ,completion-match-fg)))) + `(company-tooltip-common-selection ((,class (:foreground ,completion-selection-fg + :background ,completion-selection-bg)))) + `(company-tooltip-mouse ((,class (:background ,selection-bg :foreground ,completion-mouse-fg)))) + `(company-tooltip-search ((,class (:foreground ,completion-match-fg)))) + `(company-tooltip-selection ((,class (:background ,selection-bg :foreground nil)))))) + + +;;;###autoload +(when (and (boundp 'custom-theme-load-path) + load-file-name) + ;; add theme folder to `custom-theme-load-path' when installing over MELPA + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + + +(provide-theme 'shortbrain-light) +(provide 'shortbrain-light-theme) + + +;;; shortbrain-light-theme.el ends here diff --git a/tools/emacs/lisp/shortbrain-theme.el b/tools/emacs/lisp/shortbrain-theme.el @@ -0,0 +1,235 @@ +;;; shortbrain-theme.el --- A calm, dark, almost monochrome color theme based on emacs-constant-theme + +;; Copyright (C) 2020 Vincent Demeester <vincent@sbr.pm> + +;; Author: Vincent Demeester <vincent@sbr.pm> +;; Keywords: themes +;; URL: https://github.com/vdemeester/emacs-config +;; Version: 2020:03 +;; Package-Requires: ((emacs "24.1")) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; To use the shortbrain theme, add the following to your Emacs +;; configuration file: +;; +;; (load-theme 'shortbrain) +;; +;; Requirements: Emacs 24. + +;;; Code: + + +(deftheme shortbrain "A calm, dark, almost monochrome theme") + +(defconst shortbrain-theme-colors + '(;; Basics + (white . "#ffffff") + + ;; Shades of grey + (default-grey . "#0f1619") + (grey . "#0f1619") + (grey-50 . "#fdfdfe") + (grey-100 . "#f5f8fa") + (grey-200 . "#d8dcde") + (grey-300 . "#bcc0c2") + (grey-400 . "#9fa3a6") + (grey-500 . "#9fa3a6") + (grey-600 . "#656b6e") + (grey-700 . "#494f52") + (grey-720 . "#474d50") + (grey-800 . "#2c3236") + (grey-820 . "#1e2428") + (grey-850 . "#1d2226") + (grey-900 . "#0f1619") + + ;; Priary color shades + (default-primary . "#0be5e5") + (primary . "#0be5e5") + (primary-50 . "#f3fefe") + (primary-100 . "#d4fafa") + (primary-200 . "#91f3f3") + (primary-300 . "#4eecec") + (primary-400 . "#0be5e5") + (primary-500 . "#09cccc") + (primary-600 . "#07b3b3") + (primary-700 . "#059999") + (primary-800 . "#028080") + (primary-900 . "#006666") + + ;; Reds + (default-red. "#f24965") + (red . "#f24965") + (danger . "#f24965") + (red-50 . "#fff0f2") + (red-100 . "#ffd9df") + (red-200 . "#fba9b6") + (red-300 . "#f6798e") + (red-400 . "#f24965") + (red-500 . "#d6455d") + (red-600 . "#ba4054") + (red-700 . "#9e3c4c") + (red-800 . "#823743") + (red-900 . "#66333b") + + ;; Purples + (purple . "#b965e8"))) + + +(defun shortbrain-theme-color (name) + "Return the shortbrain theme color with the given NAME." + (cdr (assoc name shortbrain-theme-colors))) + + +(let ((class '((class color) (min-colors 256))) + (default-fg (shortbrain-theme-color 'grey-100)) + (default-bg (shortbrain-theme-color 'grey-900)) + (minor-fg (shortbrain-theme-color 'grey-700)) + (inactive-fg (shortbrain-theme-color 'grey-600)) + (border-fg (shortbrain-theme-color 'grey-850)) + (frame-fg (shortbrain-theme-color 'grey-500)) + (cursor-fg (shortbrain-theme-color 'grey-500)) + (cursor-bg (shortbrain-theme-color 'grey-500)) + + ;; Scrollbars + (scrollbar-fg (shortbrain-theme-color 'grey-800)) + (scrollbar-bg (shortbrain-theme-color 'grey-600)) + + ;; Highlighting + (highlight-fg (shortbrain-theme-color 'white)) + (highlight-bg (shortbrain-theme-color 'red)) + + ;; Current line + (hl-line-bg (shortbrain-theme-color 'grey-810)) + + ;; Search + (search-fg (shortbrain-theme-color 'white)) + (search-bg (shortbrain-theme-color 'primary-700)) + (search-bg-0 (shortbrain-theme-color 'primary-700)) + (search-bg-1 (shortbrain-theme-color 'primary-500)) + (search-bg-2 (shortbrain-theme-color 'primary-300)) + (search-bg-3 (shortbrain-theme-color 'primary-100)) + + ;; Selection + (selection-bg (shortbrain-theme-color 'grey-800)) + + ;; Auto-completion + (completion-fg (shortbrain-theme-color 'primary)) + (completion-bg (shortbrain-theme-color 'grey-820)) + (completion-match-fg (shortbrain-theme-color 'red-500)) + (completion-mouse-fg (shortbrain-theme-color 'white)) + (completion-selection-fg (shortbrain-theme-color 'white)) + (completion-annotation-fg (shortbrain-theme-color 'purple)) + + ;; Warnings & errors + (warning-fg (shortbrain-theme-color 'white)) + (warning-bg (shortbrain-theme-color 'red-600)) + (error-fg (shortbrain-theme-color 'white)) + (error-bg (shortbrain-theme-color 'red)) + + ;; Language syntax highlighting + (variable-fg (shortbrain-theme-color 'white)) + (function-fg (shortbrain-theme-color 'grey-200)) + (type-fg (shortbrain-theme-color 'grey-300)) + (constant-fg (shortbrain-theme-color 'grey-500)) + (keyword-fg (shortbrain-theme-color 'grey-600)) + (builtin-fg (shortbrain-theme-color 'grey-700)) + (string-fg (shortbrain-theme-color 'grey-500)) + (doc-fg (shortbrain-theme-color 'primary-600))) + (custom-theme-set-faces + 'shortbrain + + ;; Regular + `(cursor ((,class (:foreground ,cursor-fg :background ,cursor-bg)))) + `(default ((,class (:foreground ,default-fg :background ,default-bg)))) + `(default-italic ((,class (:italic t)))) + + ;; Emacs UI + `(fringe ((,class (:foreground ,error-fg :background ,default-bg)))) + `(header-line ((,class :background ,default-bg))) + `(linum ((,class (:inherit shadow :background ,default-bg)))) + `(mode-line ((,class (:foreground ,frame-fg :background ,default-bg + :box (:line-width -1 :color ,default-bg))))) + `(mode-line-inactive ((,class (:foreground ,inactive-fg :background ,default-bg + :box (:line-width -1 :color ,default-bg))))) + `(nlinum-relative-current-face ((,class (:foreground ,frame-fg :background ,default-bg)))) + `(vertical-border ((,class (:foreground ,border-fg :background ,default-bg)))) + + ;; Highlighting + `(highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg)))) + `(hl-line ((,class (:background ,hl-line-bg)))) + + ;; Search + `(isearch ((,class (:foreground ,search-fg :background ,search-bg :weight bold)))) + `(lazy-highlight ((,class (:foreground ,highlight-fg :background ,highlight-bg) :weight normal))) + + ;; Selection + `(region ((,class (:background ,selection-bg)))) + + ;; Erroneous whitespace + `(whitespace-line ((,class (:foreground ,error-fg :background ,error-bg)))) + `(whitespace-space ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) + `(whitespace-tab ((,class (:foreground ,builtin-fg :background ,hl-line-bg)))) + + ;; Language syntax highlighting + `(font-lock-builtin-face ((,class (:foreground ,builtin-fg)))) + `(font-lock-comment-face ((,class (:foreground ,doc-fg)))) + `(font-lock-comment-delimiter-face ((,class (:foreground ,minor-fg)))) + `(font-lock-constant-face ((,class (:foreground ,constant-fg)))) + `(font-lock-doc-face ((,class (:foreground ,doc-fg)))) + `(font-lock-function-name-face ((,class (:foreground ,function-fg)))) + `(font-lock-keyword-face ((,class (:foreground ,keyword-fg)))) + `(font-lock-negation-char-face ((,class (:foreground ,error-fg)))) + `(font-lock-preprocessor-face ((,class (:foreground ,builtin-fg)))) + `(font-lock-string-face ((,class (:foreground ,string-fg)))) + `(font-lock-type-face ((,class (:foreground ,type-fg)))) + `(font-lock-variable-name-face ((,class (:foreground ,variable-fg)))) + `(font-lock-warning-face ((,class (:foreground ,warning-fg :background ,warning-bg)))) + + ;; Avy + `(avy-lead-face ((,class (:background ,search-bg-0 :foreground ,search-fg)))) + `(avy-lead-face-0 ((,class (:background ,search-bg-1 :foreground ,search-fg)))) + `(avy-lead-face-1 ((,class (:background ,search-bg-2 :foreground ,search-fg)))) + `(avy-lead-face-2 ((,class (:background ,search-bg-3 :foreground ,search-fg)))) + + ;; Company (auto-completion) + `(company-preview ((,class (:background ,default-bg :foreground ,completion-match-fg)))) + `(company-preview-common ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-preview-search ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-scrollbar-bg ((,class (:background ,scrollbar-bg)))) + `(company-scrollbar-fg ((,class (:background ,scrollbar-fg)))) + `(company-tooltip ((,class (:background ,completion-bg :foreground ,completion-fg)))) + `(company-tooltip-annotation ((,class (:foreground ,completion-annotation-fg)))) + `(company-tooltip-common ((,class (:background nil :foreground ,completion-match-fg)))) + `(company-tooltip-common-selection ((,class (:foreground ,completion-selection-fg)))) + `(company-tooltip-mouse ((,class (:background ,selection-bg :foreground ,completion-mouse-fg)))) + `(company-tooltip-search ((,class (:foreground ,completion-match-fg)))) + `(company-tooltip-selection ((,class (:background ,selection-bg :foreground nil)))))) + + +;;;###autoload +(when (and (boundp 'custom-theme-load-path) + load-file-name) + ;; add theme folder to `custom-theme-load-path' when installing over MELPA + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + + +(provide-theme 'shortbrain) +(provide 'shortbrain-theme) + + +;;; shortbrain-theme.el ends here diff --git a/tools/emacs/lisp/use-package-list.el b/tools/emacs/lisp/use-package-list.el @@ -0,0 +1,64 @@ +;;; use-package-list.el --- List use-package declarations in config file + +;; Copyright (C) 2017 Matthew Bauer + +;; Author: Matthew Bauer <mjbauer95@gmail.com> + +;; This file is NOT part of GNU Emacs. + +;;; Commentary: + +;; βensureβ packages at compile time. + +;;; Code: + +(require 'json) +(require 'use-package) +(require 'package) +(eval-when-compile + (require 'cl)) + +(defun use-package-list (script) + "Count use-package declarations listed in SCRIPT." + + (defvar use-package-list--is-running t) + (lexical-let ((use-package-verbose t) + (use-package-debug t) + (use-package-always-ensure nil) + (use-package-always-defer t) + (use-package-list--packages nil) + (use-package-ensure-function 'ignore)) + (advice-add 'use-package + :before (lambda (name &rest args) + (unless (or (and (member :disabled args) + (plist-get args :disabled)) + (and (member :ensure args) + (not (plist-get args :ensure))) + (and (not (member :ensure args)) + (package-built-in-p name))) + (when (and (member :ensure args) + (not (eq (plist-get args :ensure) t)) + (symbolp (plist-get args :ensure))) + (setq name (plist-get args :ensure))) + (add-to-list 'use-package-list--packages name)))) + + (advice-add 'use-package-handler/:defer + :around (lambda (x name keyword arg rest state) + (let ((body (use-package-process-keywords name rest + (plist-put state :deferred t))) + (name-string (use-package-as-string name))) + (dolist (command + (delete-dups (plist-get state :commands))) + (fset command (lambda (&rest args)))) + body))) + + (advice-add 'use-package-load-name :override #'ignore) + + (load script nil nil t) + + (princ (json-encode use-package-list--packages)) + + use-package-list--packages)) + +(provide 'use-package-list) +;;; use-package-list.el ends here diff --git a/tools/emacs/notes.css b/tools/emacs/notes.css @@ -0,0 +1,1274 @@ +@font-face { + font-family: "GraublauWeb"; + src: url("/fonts/GraublauWeb.otf") format("opentype"); +} +@font-face { + font-family: "GraublauWeb"; + font-weight: bold; + src: url("/fonts/GraublauWebBold.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + src: url("/fonts/Merriweather-Regular.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + font-weight: bold; + src: url("/fonts/Merriweather-Bold.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + font-weight: bold; + font-style: italic; + src: url("/fonts/Merriweather-BoldItalic.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + font-style: italic; + src: url("/fonts/Merriweather-Italic.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + font-weight: lighter; + font-style: italic; + src: url("/fonts/Merriweather-LightItalic.otf") format("opentype"); +} +@font-face { + font-family: "Merriweather"; + font-weight: lighter; + src: url("/fonts/Merriweather-Light.otf") format("opentype"); +} + +html { + font-family:sans-serif; + line-height:1.15; + -ms-text-size-adjust:100%; + -webkit-text-size-adjust:100%; + --font-mono: 'Fira Code','Deja Vu Sans Mono','Bitstream Vera Sans Mono','Source Code Pro','Courier New',monospace; + --font-header: 'Merriweather','Linux Libertine','Georgia','Times',serif; + +} +body { + margin:0 +} +article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary { + display:block +} +audio,canvas,progress,video { + display:inline-block +} +audio:not([controls]) { + display:none; + height:0 +} +progress { + vertical-align:baseline +} +[hidden],template { + display:none +} +a { + background-color:transparent; + -webkit-text-decoration-skip:objects; + border-bottom:1px solid; +} +a:active,a:hover { + outline-width:0 +} +div#table-of-contents a { + border-bottom: 0px solid; +} +abbr[title] { + border-bottom:none; + text-decoration:underline; + text-decoration:underline dotted +} +b,strong { + font-weight:inherit; + font-weight:bolder +} +dfn { + font-style:italic +} +h1 { + font-size:2em; + margin:.67em 0 +} +mark { + background-color:#ff0; + color:#000 +} +small { + font-size:80% +} +sub,sup { + font-size:75%; + line-height:0; + position:relative; + vertical-align:baseline +} +sub { + bottom:-.25em +} +sup { + top:-.5em +} +img { + border-style:none +} +svg:not(:root) { + overflow:hidden +} +code,kbd,pre,samp { + font-family:monospace,monospace; + font-family: var(--font-mono); + font-size:1em +} +figure { + margin:1em 40px +} +hr { + box-sizing:content-box; + height:0; + overflow:visible +} +button,input,optgroup,select,textarea { + font:inherit; + margin:0 +} +optgroup { + font-weight:700 +} +button,input { + overflow:visible +} +button,select { + text-transform:none +} +[type=reset],[type=submit],button,html [type=button] { + -webkit-appearance:button +} +[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner { + border-style:none; + padding:0 +} +[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring { + outline:1px dotted ButtonText +} +fieldset { + border:1px solid silver; + margin:0 2px; + padding:.35em .625em .75em +} +legend { + box-sizing:border-box; + color:inherit; + display:table; + max-width:100%; + padding:0; + white-space:normal +} +textarea { + overflow:auto +} +[type=checkbox],[type=radio] { + box-sizing:border-box; + padding:0 +} +[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button { + height:auto +} +[type=search] { + -webkit-appearance:textfield; + outline-offset:-2px +} +[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration { + -webkit-appearance:none +} +::-webkit-input-placeholder { + color:inherit; + opacity:.54 +} +::-webkit-file-upload-button { + -webkit-appearance:button; + font:inherit +} +.org-bold { + font-weight:700 +} +.org-bold-italic { + font-weight:700; + font-style:italic +} +.org-buffer-menu-buffer { + font-weight:700 +} +.org-builtin { + color:#483d8b +} +.org-button { + color:#3a5fcd; + text-decoration:underline +} +.org-calendar-month-header { + color:#00f +} +.org-calendar-today { + text-decoration:underline +} +.org-calendar-weekday-header { + color:#008b8b +} +.org-calendar-weekend-header { + color:#b22222 +} +.org-comint-highlight-input { + font-weight:700 +} +.org-comint-highlight-prompt { + color:#0000cd +} +.org-comment,.org-comment-delimiter { + color:#b22222 +} +.org-constant { + color:#008b8b +} +.org-diary { + color:red +} +.org-doc { + color:#8b2252 +} +.org-error { + color:red; + font-weight:700 +} +.org-escape-glyph { + color:brown +} +.org-file-name-shadow { + color:#7f7f7f +} +.org-fringe { + background-color:#f2f2f2 +} +.org-function-name { + color:#00f +} +.org-glyphless-char { + font-size:60% +} +.org-header-line { + color:#333; + background-color:#e5e5e5 +} +.org-help-argument-name { + font-style:italic +} +.org-highlight { + background-color:#b4eeb4 +} +.org-holiday { + background-color:pink +} +.org-info-header-node { + color:brown; + font-weight:700; + font-style:italic +} +.org-info-header-xref { + color:#3a5fcd; + text-decoration:underline +} +.org-info-index-match { + background-color:#ff0 +} +.org-info-menu-header { + font-weight:700 +} +.org-info-menu-star { + color:red +} +.org-info-node { + color:brown; + font-weight:700; + font-style:italic +} +.org-info-title-1 { + font-size:172%; + font-weight:700 +} +.org-info-title-2 { + font-size:144%; + font-weight:700 +} +.org-info-title-3 { + font-size:120%; + font-weight:700 +} +.org-info-title-4 { + font-weight:700 +} +.org-info-xref { + color:#3a5fcd; + text-decoration:underline +} +.org-italic { + font-style:italic +} +.org-keyword { + color:#a020f0 +} +.org-lazy-highlight { + background-color:#afeeee +} +.org-link { + color:#3a5fcd; + text-decoration:underline +} +.org-link-visited { + color:#8b008b; + text-decoration:underline +} +.org-makefile-makepp-perl { + background-color:#bfefff +} +.org-makefile-space { + background-color:#ff69b4 +} +.org-makefile-targets { + color:#00f +} +.org-match { + background-color:#ff0 +} +.org-next-error { + background-color:gtk_selection_bg_color +} +.org-nobreak-space { + color:brown; + text-decoration:underline +} +.org-org-agenda-calendar-event,.org-org-agenda-calendar-sexp { + color:#000; + background-color:#fff +} +.org-org-agenda-clocking { + background-color:#ff0 +} +.org-org-agenda-column-dateline { + background-color:#e5e5e5 +} +.org-org-agenda-current-time { + color:#b8860b +} +.org-org-agenda-date { + color:#00f +} +.org-org-agenda-date-today { + color:#00f; + font-weight:700; + font-style:italic +} +.org-org-agenda-date-weekend { + color:#00f; + font-weight:700 +} +.org-org-agenda-diary { + color:#000; + background-color:#fff +} +.org-org-agenda-dimmed-todo { + color:#7f7f7f +} +.org-org-agenda-done { + color:#228b22 +} +.org-org-agenda-filter-category,.org-org-agenda-filter-effort,.org-org-agenda-filter-regexp,.org-org-agenda-filter-tags { + color:#000; + background-color:#bfbfbf +} +.org-org-agenda-restriction-lock { + background-color:#eee +} +.org-org-agenda-structure { + color:#00f +} +.org-org-archived,.org-org-block { + color:#7f7f7f +} +.org-org-block-begin-line,.org-org-block-end-line { + color:#b22222 +} +.org-org-checkbox { + font-weight:700 +} +.org-org-checkbox-statistics-done { + color:#228b22; + font-weight:700 +} +.org-org-checkbox-statistics-todo { + color:red; + font-weight:700 +} +.org-org-clock-overlay { + color:#000; + background-color:#d3d3d3 +} +.org-org-code { + color:#7f7f7f +} +.org-org-column,.org-org-column-title { + background-color:#e5e5e5 +} +.org-org-column-title { + font-weight:700; + text-decoration:underline +} +.org-org-date { + color:#a020f0; + text-decoration:underline +} +.org-org-date-selected { + color:red +} +.org-org-default { + color:#000; + background-color:#fff +} +.org-org-document-info { + color:#191970 +} +.org-org-document-info-keyword { + color:#7f7f7f +} +.org-org-document-title { + color:#191970; + font-weight:700 +} +.org-org-done { + color:#228b22; + font-weight:700 +} +.org-org-drawer { + color:#00f +} +.org-org-ellipsis { + color:#b8860b; + text-decoration:underline +} +.org-org-footnote { + color:#a020f0; + text-decoration:underline +} +.org-org-formula { + color:#b22222 +} +.org-org-headline-done { + color:#bc8f8f +} +.org-org-hide { + color:#fff +} +.org-org-latex-and-related { + color:#8b4513 +} +.org-org-level-1 { + color:#00f +} +.org-org-level-2 { + color:sienna +} +.org-org-level-3 { + color:#a020f0 +} +.org-org-level-4 { + color:#b22222 +} +.org-org-level-5 { + color:#228b22 +} +.org-org-level-6 { + color:#008b8b +} +.org-org-level-7 { + color:#483d8b +} +.org-org-level-8 { + color:#8b2252 +} +.org-org-link { + color:#3a5fcd; + text-decoration:underline +} +.org-org-list-dt { + font-weight:700 +} +.org-org-macro { + color:#8b4513 +} +.org-org-meta-line { + color:#b22222 +} +.org-org-mode-line-clock { + color:#000; + background-color:#bfbfbf +} +.org-org-mode-line-clock-overrun { + color:#000; + background-color:red +} +.org-org-priority { + color:#a020f0 +} +.org-org-quote { + color:#7f7f7f +} +.org-org-scheduled { + color:#006400 +} +.org-org-scheduled-previously { + color:#b22222 +} +.org-org-scheduled-today { + color:#006400 +} +.org-org-sexp-date,.org-org-special-keyword { + color:#a020f0 +} +.org-org-table { + color:#00f +} +.org-org-tag,.org-org-tag-group { + font-weight:700 +} +.org-org-target { + text-decoration:underline +} +.org-org-time-grid { + color:#b8860b +} +.org-org-todo { + color:red; + font-weight:700 +} +.org-org-upcoming-deadline { + color:#b22222 +} +.org-org-verbatim,.org-org-verse { + color:#7f7f7f +} +.org-org-warning { + color:red; + font-weight:700 +} +.org-outline-1 { + color:#00f +} +.org-outline-2 { + color:sienna +} +.org-outline-3 { + color:#a020f0 +} +.org-outline-4 { + color:#b22222 +} +.org-outline-5 { + color:#228b22 +} +.org-outline-6 { + color:#008b8b +} +.org-outline-7 { + color:#483d8b +} +.org-outline-8 { + color:#8b2252 +} +.org-preprocessor { + color:#483d8b +} +.org-regexp-grouping-backslash,.org-regexp-grouping-construct { + font-weight:700 +} +.org-region { + background-color:gtk_selection_bg_color +} +.org-secondary-selection { + background-color:#ff0 +} +.org-shadow { + color:#7f7f7f +} +.org-show-paren-match { + background-color:#40e0d0 +} +.org-show-paren-mismatch { + color:#fff; + background-color:#a020f0 +} +.org-string { + color:#8b2252 +} +.org-success { + color:#228b22; + font-weight:700 +} +.org-table-cell { + color:#e5e5e5; + background-color:#00f +} +.org-tooltip { + color:#000; + background-color:#ffffe0 +} +.org-trailing-whitespace { + background-color:red +} +.org-type { + color:#228b22 +} +.org-underline { + text-decoration:underline +} +.org-variable-name { + color:sienna +} +.org-warning { + color:#ff8c00; + font-weight:700 +} +.org-warning-1 { + color:red; + font-weight:700 +} +body { + width:85%; + margin:2% auto; + font-size:14px; + line-height:1.4em; + font-fannnnnmily:Georgia,serif; + color:#333 +} +@media screen and (min-width:600px) { + body { + font-size:18px + } +} +@media screen and (min-width:1270px) { + body { + width:1200px + } +} +::-moz-selection { + background:#d6edff +} +::selection { + background:#d6edff +} +dl,ol,p,ul { + margin:0 auto +} +#content p { + margin: 1em auto; +} +.title { + margin:.8em auto; + color:gray; +} +.subtitle,.title { + text-align:center +} +.subtitle { + font-size:0.7em; + line-height:1.4; + font-weight:700; + margin:1em auto; + color: lightgray; +} +.abstract { + margin:auto; + width:80%; + font-style:italic +} +.abstract p:last-of-type:before { + content:" "; + white-space:pre +} +.status { + font-size:90%; + margin:2em auto +} +[class^=section-number-] { + margin-right:.5em +} +[id^=orgheadline] { + clear:both +} +#footnotes { + font-size:90% +} +.footpara { + display:inline; + margin:.2em auto +} +.footdef { + margin-bottom:1em +} +.footdef sup { + padding-right:.5em +} +li.on { + list-style: "β "; +} +li.off { + list-style: "β "; +} +a { + color:#527d9a; + text-decoration:none +} +a:hover { + color:#035; + border-bottom:2px solid; +} +figure { + padding:0; + margin:1em auto; + text-align:center +} +img { + max-width:100%; + vertical-align:middle +} +.MathJax_Display { + margin:0!important; + width:90%!important +} +h1,h2,h3,h4,h5,h6 { + font-family: var(--font-header); +} +h1 { + color: grey; +} +h2,h3,h4,h5,h6 { + color:#a5573e; + line-height:1em; + font-family:Helvetica,sans-serif +} +h1,h2,h3 { + line-height:1.4em +} +h4,h5,h6 { + font-size:1em +} +@media screen and (min-width:600px) { + h1 { + font-size:2em + } + h2 { + font-size:1.5em + } + h3 { + font-size:1.3em + } + h1,h2,h3 { + line-height:1.4em + } + h4,h5,h6 { + font-size:1.1em + } +} +dt { + font-weight:700 +} +table { + margin:1em auto; + border-top:2px solid; + border-collapse:collapse +} +table,thead { + border-bottom:2px solid +} +table td+td,table th+th { + border-left:1px solid gray +} +table tr { + border-top:1px solid #d3d3d3 +} +td,th { + padding:.3em .6em; + vertical-align:middle +} +caption.t-above { + caption-side:top +} +caption.t-bottom { + caption-side:bottom +} +caption { + margin-bottom:.3em +} +figcaption { + margin-top:.3em +} +th.org-center,th.org-left,th.org-right { + text-align:center +} +td.org-right { + text-align:right +} +td.org-left { + text-align:left +} +td.org-center { + text-align:center +} +blockquote { + margin:1em 2em; + padding-left:1em; + border-left:3px solid #ccc +} +kbd { + background-color:#f7f7f7; + font-size:80%; + margin:0 .1em; + padding:.1em .6em +} +.todo { + background-color:red +} +.done,.todo { + color:#fff; + padding:.1em .3em; + border-radius:3px; + background-clip:padding-box; + font-size:80%; + font-family:Lucida Console,monospace; + line-height:1 +} +.done { + background-color:green +} +.priority { + color:orange; + font-family:Lucida Console,monospace +} +#table-of-contents li { + clear:both +} +.tag { + font-family:Lucida Console,monospace; + font-size:.7em; + font-weight:400 +} +.tag span { + padding:.3em; + float:right; + margin-right:.5em; + border:1px solid #bbb; + border-radius:3px; + background-clip:padding-box; + color:#333; + background-color:#eee; + line-height:1 +} +.timestamp { + color:#bebebe; + font-size:90% +} +.timestamp-kwd { + color:#5f9ea0 +} +.org-right { + margin-left:auto; + margin-right:0; + text-align:right +} +.org-left { + margin-left:0; + margin-right:auto; + text-align:left +} +.org-center { + margin-left:auto; + margin-right:auto; + text-align:center +} +.underline { + text-decoration:underline +} +#postamble p,#preamble p { + font-size:90%; + margin:.2em +} +p.verse { + margin-left:3% +} +:not(pre)>code { + padding:2px 5px; + margin:auto 1px; + border:1px solid #ddd; + border-radius:3px; + background-clip:padding-box; + color:#333; + font-size:80% +} +.org-src-container { + background-color: #FDFDFD; + border:1px solid #ccc; + box-shadow:3px 3px 3px #eee; + font-family:Lucida Console,monospace; + font-size:80%; + margin:1em auto; + padding:.1em .5em; + position:relative; + color: #000; +} +.org-src-container>pre { + overflow:auto +} +.org-src-container>pre:before { + display:block; + position:absolute; + background-color:#b3b3b3; + top:0; + right:0; + padding:0 .5em; + border-bottom-left-radius:8px; + border:0; + color:#fff; + font-size:80% +} +.org-src-container>pre.src-sh:before { + content:"sh" +} +.org-src-container>pre.src-bash:before { + content:"bash" +} +.org-src-container>pre.src-emacs-lisp:before { + content:"Emacs Lisp" +} +.org-src-container>pre.src-R:before { + content:"R" +} +.org-src-container>pre.src-cpp:before { + content:"C++" +} +.org-src-container>pre.src-c:before { + content:"C" +} +.org-src-container>pre.src-html:before { + content:"HTML" +} +.org-src-container>pre.src-javascript:before,.org-src-container>pre.src-js:before { + content:"Javascript" +} +// More languages 0% http://orgmode.org/worg/org-contrib/babel/languages.html .org-src-container>pre.src-abc:before { + content:"ABC" +} +.org-src-container>pre.src-asymptote:before { + content:"Asymptote" +} +.org-src-container>pre.src-awk:before { + content:"Awk" +} +.org-src-container>pre.src-C:before { + content:"C" +} +.org-src-container>pre.src-calc:before { + content:"Calc" +} +.org-src-container>pre.src-clojure:before { + content:"Clojure" +} +.org-src-container>pre.src-comint:before { + content:"comint" +} +.org-src-container>pre.src-css:before { + content:"CSS" +} +.org-src-container>pre.src-D:before { + content:"D" +} +.org-src-container>pre.src-ditaa:before { + content:"Ditaa" +} +.org-src-container>pre.src-dot:before { + content:"Dot" +} +.org-src-container>pre.src-ebnf:before { + content:"ebnf" +} +.org-src-container>pre.src-forth:before { + content:"Forth" +} +.org-src-container>pre.src-F90:before { + content:"Fortran" +} +.org-src-container>pre.src-gnuplot:before { + content:"Gnuplot" +} +.org-src-container>pre.src-haskell:before { + content:"Haskell" +} +.org-src-container>pre.src-io:before { + content:"Io" +} +.org-src-container>pre.src-java:before { + content:"Java" +} +.org-src-container>pre.src-latex:before { + content:"LaTeX" +} +.org-src-container>pre.src-ledger:before { + content:"Ledger" +} +.org-src-container>pre.src-ly:before { + content:"Lilypond" +} +.org-src-container>pre.src-lisp:before { + content:"Lisp" +} +.org-src-container>pre.src-makefile:before { + content:"Make" +} +.org-src-container>pre.src-matlab:before { + content:"Matlab" +} +.org-src-container>pre.src-max:before { + content:"Maxima" +} +.org-src-container>pre.src-mscgen:before { + content:"Mscgen" +} +.org-src-container>pre.src-Caml:before { + content:"Objective" +} +.org-src-container>pre.src-octave:before { + content:"Octave" +} +.org-src-container>pre.src-org:before { + content:"Org" +} +.org-src-container>pre.src-perl:before { + content:"Perl" +} +.org-src-container>pre.src-picolisp:before { + content:"Picolisp" +} +.org-src-container>pre.src-plantuml:before { + content:"PlantUML" +} +.org-src-container>pre.src-python:before { + content:"Python" +} +.org-src-container>pre.src-ruby:before { + content:"Ruby" +} +.org-src-container>pre.src-sass:before { + content:"Sass" +} +.org-src-container>pre.src-scala:before { + content:"Scala" +} +.org-src-container>pre.src-scheme:before { + content:"Scheme" +} +.org-src-container>pre.src-screen:before { + content:"Screen" +} +.org-src-container>pre.src-sed:before { + content:"Sed" +} +.org-src-container>pre.src-shell:before { + content:"shell" +} +.org-src-container>pre.src-shen:before { + content:"Shen" +} +.org-src-container>pre.src-sql:before { + content:"SQL" +} +.org-src-container>pre.src-sqlite:before { + content:"SQLite" +} +.org-src-container>pre.src-stan:before { + content:"Stan" +} +.org-src-container>pre.src-vala:before { + content:"Vala" +} +.org-src-container>pre.src-axiom:before { + content:"Axiom" +} +.org-src-container>pre.src-browser:before { + content:"HTML" +} +.org-src-container>pre.src-cypher:before { + content:"Neo4j" +} +.org-src-container>pre.src-elixir:before { + content:"Elixir" +} +.org-src-container>pre.src-request:before { + content:"http" +} +.org-src-container>pre.src-ipython:before { + content:"iPython" +} +.org-src-container>pre.src-kotlin:before { + content:"Kotlin" +} +.org-src-container>pre.src-Flavored Erlang lfe:before { + content:"Lisp" +} +.org-src-container>pre.src-mongo:before { + content:"MongoDB" +} +.org-src-container>pre.src-prolog:before { + content:"Prolog" +} +.org-src-container>pre.src-rec:before { + content:"rec" +} +.org-src-container>pre.src-ML sml:before { + content:"Standard" +} +.org-src-container>pre.src-Translate translate:before { + content:"Google" +} +.org-src-container>pre.src-typescript:before { + content:"Typescript" +} +.org-src-container>pre.src-rust:before { + content:"Rust" +} +.org-src-container>pre.src-go:before { + content:"Go" +} +.org-src-container>pre.src-http:before { + content:"HTTP" +} +.inlinetask { + background:#ffc; + border:2px solid gray; + margin:10px; + padding:10px +} +#org-div-home-and-up { + font-size:70%; + text-align:right; + white-space:nowrap +} +.linenr { + font-size:90% +} +.code-highlighted { + background-color:#ff0 +} +#bibliography { + font-size:90% +} +#bibliography table { + width:100% +} +.creator { + display:block +} +@media screen and (min-width:600px) { + .creator { + display:inline; + float:right + } +} + +div#nav ul li { + display: inline; +} + +div.drawer { + border:1px solid #ccc; + box-shadow:3px 3px 3px #eee; + font-size:85%; + margin:1em auto; + padding:.1em .5em; + position:relative +} +div.drawer h6 { + margin: 0; + padding: 0.1em; + color: #333; +} + +div.drawer.results { + font-family:monospace,monospace; + font-family: var(--font-mono); + background-color: #333; + color: #fff; +} +div.drawer p { + display: block; + unicode-bidi: embed; + white-space: pre; +} +div.drawer.results h6 { + color: #fff; +} + +.info { + border: 1px solid; + background-color: #BDE5F8; + color: #00529B; +} + +.tip { + border: 1px solid; + background-color: #DFF2BF; + color: #4F8A10; +} + +.note { + border: 1px solid; + background-color: #FFFCCB; + color: #9F6000; +} + +.warning { + border: 1px solid; + background-color: #FFBABA; + color: #D8000C; +} + +/* Set the colors in <pre> blocks from the Leuven theme */ +pre span.org-builtin {color:#006FE0;font-weight:bold;} +pre span.org-string {color:#008000;} +pre span.org-keyword {color:#0000FF;} +pre span.org-variable-name {color:#BA36A5;} +pre span.org-function-name {color:#006699;} +pre span.org-type {color:#6434A3;} +pre span.org-preprocessor {color:#808080;font-weight:bold;} +pre span.org-constant {color:#D0372D;} +pre span.org-comment-delimiter {color:#8D8D84;} +pre span.org-comment {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-1 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-2 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-3 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-4 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-5 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-6 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-7 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-8 {color:#8D8D84;font-style:italic} +pre span.org-outshine-level-9 {color:#8D8D84;font-style:italic} +pre span.org-rainbow-delimiters-depth-1 {color:#707183;} +pre span.org-rainbow-delimiters-depth-2 {color:#7388d6;} +pre span.org-rainbow-delimiters-depth-3 {color:#909183;} +pre span.org-rainbow-delimiters-depth-4 {color:#709870;} +pre span.org-rainbow-delimiters-depth-5 {color:#907373;} +pre span.org-rainbow-delimiters-depth-6 {color:#6276ba;} +pre span.org-rainbow-delimiters-depth-7 {color:#858580;} +pre span.org-rainbow-delimiters-depth-8 {color:#80a880;} +pre span.org-rainbow-delimiters-depth-9 {color:#887070;} +pre span.org-sh-quoted-exec {color:#FF1493;} diff --git a/tools/emacs/publish.org b/tools/emacs/publish.org @@ -0,0 +1,230 @@ +#+TITLE: Publish dotemacs notes using Emacs org-mode +#+AUTHOR: Vincent Demeester +#+EMAIL: vincent@sbr.pm +#+EXPORT_EXCLUDE_TAGS: noexport +#+CREATOR: Emacs 27.0.90 (Org mode 9.3) +#+LANGUAGE: en +#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./notes.css"/> +#+OPTIONS: html-style:nil + +This document is a literate version of my publishing /script/ on publishing my dotemacs +notes (that uses [[https://orgmode.org][=org-mode=]]). + +First let's import required libraries, which are =org= related. + +#+begin_src emacs-lisp :tangle yes +;; Add my personal libraries π +(add-to-list 'load-path (concat user-emacs-directory "lisp/")) + +(require 'org) +(require 'ox) +(require 'ox-publish) +(require 'ol-man) +(require 'ol-git-link) +(require 'ol-github) +(require 'ol-gitlab) +#+end_src + +To get syntax coloring on other mode than ~emacs-lisp~, we need to load them too[fn:1]. + +#+begin_src emacs-lisp :tangle yes + (require 'go-mode) + (require 'css-mode) + (require 'python-mode) + (require 'nix-mode) + (require 'ob-http) + (require 'yaml-mode) +#+end_src + +Now let's define variables to use later on. Those variables are where to find the project +we want to publish and where to publish theme. + +#+begin_src emacs-lisp :tangle yes + (setq site-directory "~/desktop/sites/") + + (setq org-default-publish-sbr (expand-file-name "sbr.pm" site-directory)) + (setq org-default-publish-dotemacs (expand-file-name "dotemacs" org-default-publish-sbr)) +#+end_src + +We want to republish everything every time β mainly to be used on CI. So we're telling +=org-mode= to disable the timestamp-based cache. + +#+begin_src emacs-lisp :tangle yes + (setq org-publish-use-timestamps-flag nil) +#+end_src + +Let's also customize a bit the /style/ of what =org-mode= will generate. + +- Set the default html coding system πΌ + #+begin_src emacs-lisp :tangle yes + (setq org-html-coding-system 'utf-8-unix) + #+end_src +- Let's disable the default script and style "includes". + #+begin_src emacs-lisp :tangle yes + (setq org-export-html-style-include-scripts nil + org-export-html-style-include-default nil) + #+end_src +- Let's also make sure the =#+begin_src= blocks are colorized, *but* using the css instead + of inlude style. + #+begin_src emacs-lisp :tangle yes + (setq org-src-fontify-natively t) + ;; (setq org-html-htmlize-output-type 'inline-css) ;; default + (setq org-html-htmlize-output-type 'css) + ;; (setq org-html-htmlize-font-prefix "") ;; default + (setq org-html-htmlize-font-prefix "org-") + #+end_src +- Customize how we export ~org-mode~ drawers + #+begin_src emacs-lisp :tangle yes + (defun my-org-export-format-drawer (name content) + (concat "<div class=\"drawer " (downcase name) "\">\n" + "<h6>" (capitalize name) "</h6>\n" + content + "\n</div>")) + (setq org-html-format-drawer-function 'my-org-export-format-drawer) + #+end_src +- And disable ~org-babel~ from trying to evaluate on export + #+begin_src emacs-lisp :tangle yes + (setq org-export-use-babel nil) + #+end_src + +I want [[https://writepermission.com/org-blogging-clickable-headlines.html][clickable headlines]], so let's define a ~html-format-headline-function~ for the +exporter to use. Not tangle currently as it doesn't work π. + +#+begin_src emacs-lisp :tangle no + (defun my-org-html-format-headline-function (todo todo-type priority text tags info) + "Format a headline with a link to itself." + (let* ((headline (get-text-property 0 :parent text)) + (id (or (org-element-property :CUSTOM_ID headline) + (org-export-get-reference headline info) + (org-element-property :ID headline))) + (link (if id + (format "<a href=\"#%s\">%s</a>" id text) + text))) + (org-html-format-headline-default-function todo todo-type priority link tags info))) + (setq org-html-format-headline-function 'my-org-html-format-headline-function) +#+end_src + +I also use some custom linksβ¦ First thing first, I want the =att:= link to be supporting +when exporting + +#+begin_src emacs-lisp :tangle yes +(require 'org-attach) +(setq org-link-abbrev-alist '(("att" . org-attach-expand-link))) +#+end_src + + +They are define in my [[https://github.com/vdemeester/emacs-config][emacs configuration]] repository : [[https://github.com/vdemeester/emacs-config/blob/master/lisp/setup-org.el][~setup-org.el~]]. + +#+begin_src emacs-lisp :tangle yes + (org-link-set-parameters "tag" + :follow #'endless/follow-tag-link) + (defun endless/follow-tag-link (tag) + "Display a list of TODO headlines with tag TAG. + With prefix argument, also display headlines without a TODO keyword." + (org-tags-view (null current-prefix-arg) tag)) + + (org-link-set-parameters "grep" + :follow #'vde/follow-grep-link + :face '(:foreground "DarkRed" :underline t)) + (defun vde/follow-grep-link (regexp) + "Run `rgrep' with REGEXP and FOLDER as argument, + like this : [[grep:REGEXP:FOLDER]]." + (setq expressions (split-string regexp ":")) + (setq exp (nth 0 expressions)) + (grep-compute-defaults) + (if (= (length expressions) 1) + (progn + (rgrep exp "*" (expand-file-name "./"))) + (progn + (setq folder (nth 1 expressions)) + (rgrep exp "*" (expand-file-name folder)))) + ) + + (org-link-set-parameters "rg" + :follow #'vde/follow-rg-link + :face '(:foreground "DarkGreen" :underline t)) + (defun vde/follow-rg-link (regexp) + "Run `ripgrep-regexp` with REXEP and FOLDER as argument, + like this : [[pt:REGEXP:FOLDER]]" + (setq expressions (split-string regexp ":")) + (setq exp (nth 0 expressions)) + (if (= (length expressions) 1) + (progn + (ripgrep-regexp exp (expand-file-name "./"))) + (progn + (setq folder (nth 1 expressions)) + (ripgrep-regexp exp (file-name-as-directory (expand-file-name folder))))) + ) + + (org-link-set-parameters + "org" + :complete (lambda () (+org-link-read-file "org" org-directory)) + :follow (lambda (link) (find-file (expand-file-name link org-directory))) + :face (lambda (link) + (if (file-exists-p (expand-file-name link org-directory)) + 'org-link + 'error))) + (defun +org-link-read-file (key dir) + (let ((file (read-file-name (format "%s: " (capitalize key)) dir))) + (format "%s:%s" + key + (file-relative-name file dir)))) +#+end_src + +Now, let's define projects. + +#+begin_src emacs-lisp :tangle yes + (setq org-publish-project-alist + `(("dotemacs-org" + :base-directory "." + :base-extension "org\\|txt" + :publishing-directory ,org-default-publish-dotemacs + :recursive t + :publishing-function org-html-publish-to-html + :headline-levels 4 + :auto-preamble t + :auto-sitemap t + :with-footnotes t + :with-toc nil + :with-drawers t + :exclude "_setup.org\\|sbr.pm\\|.extension\\|elpa\\|var" + :html-checkbox-type 'html + :html-preamble "<div id=\"nav\"> + <ul> + <li><a href=\"/\" class=\"home\">Home</a></li> + <li><a href=\"./\" class=\"index\">Index</a></li> + <li><a href=\"../\" class=\"up\">Up</a></li> + </ul> + </div>" + :html-postamble "<p class=\"creator\">%c</p><p class=\"postamble\">%a. Last Updated %C (exported %T).</p>") + ("dotemacs-static" + :base-directory "." + :base-extension "html\\|xml\\|css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|md\\|tar\\|gz\\|xz\\|zip\\|csv" + :exclude ".extension\\|elpa\\|var" + :publishing-directory ,org-default-publish-dotemacs + :recursive t + :publishing-function org-publish-attachment + ) + ("dotemacs" :components ("dotemacs-org" "dotemacs-static")) + )) +#+end_src + +I want the ~sites~ folder to be cleaned too, so let's define a function to be called that +will clean a folder and publish. + +#+begin_src emacs-lisp :tangle yes + (defun clean-and-publish () + "Clean the site folder and publish all projects" + (delete-directory org-default-publish-dotemacs t) + (org-publish-all)) +#+end_src + +Let's now create a ~Makefile~ so that I can just run ~make publish~ to automate that. + +#+INCLUDE: "Makefile" src makefile + +The rest is just /automation/ πΌ. The ~~/desktop/sites/~ folder is synced across a bunch +of my machines, including my servers (using [[https://syncthing.net/][syncthing]]). This means almost as soon as I run +this publish script, it will be available. + +[fn:1] Otherwise, emacs doesn't apply any syntax coloring.