Let's go ... first commit after a major refactor
Why yes, this will look like it sprung, like Athena, fully grown and in armor from my head, but this is really just the mid-point of a new endeavor.
This commit is contained in:
commit
513f2f06de
48 changed files with 2727 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
*~
|
||||
/bootstrap.el
|
||||
/ha-config.el
|
||||
/ha-display.el
|
||||
/ha-org-word-processor.el
|
||||
/ha-org.el
|
21
README.org
Normal file
21
README.org
Normal file
|
@ -0,0 +1,21 @@
|
|||
#+TITLE: My Emacs Configuration
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+DATE: 2021-11-01 November
|
||||
#+TAGS: emacs
|
||||
|
||||
My Emacs configuration, that I'm cheekily calling /hamacs/ is a literate programming model heavily inspired by my recent journey into [[https://www.youtube.com/watch?v=LKegZI9vWUU][Henrik Lissner's]] [[https://github.com/hlissner/doom-emacs][Doom Emacs]] and [[https://www.spacemacs.org/][Spacemacs]]. I used both extensively, but decided that I would /roll my own/ as Emacs people tend to be /control freaks/ (at least a little bit).
|
||||
|
||||
Why yes, feel free to steal whatever you find interesting, as sharing is what makes our community great. Hit me up with questions =@howardabrams=. If you want to try this out, after installing Emacs, and cloning this repo, run:
|
||||
#+BEGIN_SRC sh
|
||||
./initialize
|
||||
#+END_SRC
|
||||
This creates [[file:~/.emacs.d/init.el][~/.emacs.d/init.el]] that starts the process loading the files:
|
||||
|
||||
- [[file:bootstrap.org][bootstrap.org]] :: configures =straight= and loads basic libraries the rest of the code depends on. It then loads the following files in order:
|
||||
- [[file:ha-config.org][ha-config.org]] :: contains /most/ of my configuration, setting up my sequence key menus, evil, etc.
|
||||
- [[file:ha-display.org][ha-display.org]] :: sets up the visual aspects of an Emacs GUI, including themes, fonts and the dashboard.
|
||||
- [[file:ha-org.org][ha-org.org]] :: configures the basics for org-mode formatted files. Specific features, however, come from their own files, however.
|
||||
- [[file:ha-org-word-processor.org][ha-org-word-processor.org]] :: attempts to make Org files /visually/ look like what one might see in a word processor, including turning off the colors for headers, and instead increasing their size.
|
||||
|
||||
*Note:* Other functions and files come from essays written on [[http://www.howardism.org][my blog]]. To help with this, see [[file:support/final-initialize.el][support/final-initialize.el]] file.
|
125
bootstrap.org
Normal file
125
bootstrap.org
Normal file
|
@ -0,0 +1,125 @@
|
|||
#+TITLE: My Emacs Bootstrap
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+DATE: 2021-10-08
|
||||
#+FILETAGS: :emacs:
|
||||
|
||||
A literate programming file for bootstraping my Emacs Configuration.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
;;; bootstrap.el --- file for bootstraping my Emacs Configuration
|
||||
;;
|
||||
;; Copyright (C) 2021 Howard X. Abrams
|
||||
;;
|
||||
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: Howard X. Abrams <howard.abrams@gmail.com>
|
||||
;; Created: October 8, 2021
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
|
||||
;; /Users/howard.abrams/other/hamacs/bootstrap.org
|
||||
;; And tangle the file to recreate this one.
|
||||
;;
|
||||
;;; Code:
|
||||
#+END_SRC
|
||||
* Introduction
|
||||
This file contains all the variable definitions and library loading for the other files in my project.
|
||||
** Straight Package Installer
|
||||
I'm going to be installing everything using the [[https://github.com/raxod502/straight.el#getting-started][straight.el]] for package installation and management. Here is the initialization/installation for it:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar bootstrap-version)
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
||||
(bootstrap-version 5))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
#+END_SRC
|
||||
Let's get the Straight project working with =use-package=:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(straight-use-package 'use-package)
|
||||
#+END_SRC
|
||||
While that enables the =:straight t= extension to =use-package=, let's just have that be the default:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package straight
|
||||
:custom (straight-use-package-by-default t))
|
||||
#+END_SRC
|
||||
See the details in [[https://dev.to/jkreeftmeijer/emacs-package-management-with-straight-el-and-use-package-3oc8][this essay]].
|
||||
** Basic Libraries
|
||||
The following packages come with Emacs, but seems like they still need loading:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'subr-x)
|
||||
#+END_SRC
|
||||
While most libraries will take care of their dependencies, I want to install /my dependent libraries/. Especially, [[https://github.com/magnars/.emacs.d/][Magnar Sveen]]'s Clojure-inspired [[https://github.com/magnars/dash.el][dash.el]] project:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package dash)
|
||||
#+END_SRC
|
||||
|
||||
The [[https://github.com/magnars/s.el][s.el]] project is a simpler string manipulation library that I (and other projects) use:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package s)
|
||||
#+END_SRC
|
||||
|
||||
Manipulate file paths with the [[https://github.com/rejeep/f.el][f.el]] project:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package f)
|
||||
#+END_SRC
|
||||
** My Code Location
|
||||
Much of my more complicated code comes from my website essays and other projects. The destination, however, shows up here:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'load-path (f-expand "~/.emacs.d/elisp"))
|
||||
#+END_SRC
|
||||
|
||||
Hopefully, this will tie me over while I transition.
|
||||
* Load the Rest
|
||||
The following loads the rest of my org-mode literate files. I add them as they are /ready/, but eventually, I'll trim this up into a nicer pattern.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(dolist (file '("ha-config.org"
|
||||
"ha-display.org"
|
||||
"ha-org.org"
|
||||
"ha-org-word-processor.org"
|
||||
;; "org-clipboard.org"
|
||||
;; "org-journaling.org"
|
||||
;; "org-publishing.org"
|
||||
;; "org-sprint.org"
|
||||
;; "capturing-notes.org"
|
||||
;; "general-programming.org"
|
||||
;; "ha-agendas.org"
|
||||
;; "ha-email.org"
|
||||
;; "ha-irc.org"
|
||||
;; "ha-passwords.org"
|
||||
;; "ha-remoting.org"
|
||||
;; "my-feeds.org"
|
||||
))
|
||||
(org-babel-load-file (f-join hamacs-source-dir file)))
|
||||
#+END_SRC
|
||||
We can test/debug any individual file, via:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(org-babel-load-file (f-join hamacs-source-dir "ha-config.org"))
|
||||
#+END_SRC
|
||||
* Technical Artifacts :noexport:
|
||||
Let's provide a name so that the file can be required:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(provide 'bootstrap)
|
||||
;;; bootstrap.el ends here
|
||||
#+END_SRC
|
||||
|
||||
Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~
|
||||
|
||||
#+DESCRIPTION: A literate programming file for bootstrapping my environment.
|
||||
|
||||
#+PROPERTY: header-args:sh :tangle no
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
|
||||
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
|
||||
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
1045
ha-config.org
Normal file
1045
ha-config.org
Normal file
File diff suppressed because it is too large
Load diff
267
ha-display.org
Normal file
267
ha-display.org
Normal file
|
@ -0,0 +1,267 @@
|
|||
#+TITLE: Emacs Graphical Display Configuration
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+DATE: 2020-09-10
|
||||
#+FILETAGS: :emacs:
|
||||
|
||||
A literate programming file to configure the Emacs UI.
|
||||
# *Note:* After each change, /tangle it/ to the source destination with ~C-c C-v t~.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
;;; ha-display.org --- A literate programming file to configure the Emacs UI. -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2020 Howard X. Abrams
|
||||
;;
|
||||
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: Howard X. Abrams <howard.abrams@gmail.com>
|
||||
;; Created: September 10, 2020
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
|
||||
;; ~/other/hamacs/ha-display.org
|
||||
;; Using `find-file-at-point', and tangle the file to recreate this one .
|
||||
;;
|
||||
;;; Code:
|
||||
#+END_SRC
|
||||
* Dashboard
|
||||
The [[https://github.com/emacs-dashboard/emacs-dashboard][emacs-dashboard]] project makes a nicer startup screen.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package dashboard
|
||||
:init
|
||||
(setq dashboard-banner-logo-title "Welcome to Emacs"
|
||||
dashboard-startup-banner "~/other/hamacs/support/levitating-gnu.png"
|
||||
dashboard-center-content t
|
||||
dashboard-set-init-info t
|
||||
dashboard-projects-switch-function 'projectile-persp-switch-project
|
||||
dashboard-items '((projects . 5)
|
||||
;; (agenda . 5)
|
||||
(bookmarks . 5)))
|
||||
:config
|
||||
(dashboard-setup-startup-hook)
|
||||
|
||||
(setq dashboard-footer-messages (list (ha--dad-joke))))
|
||||
#+END_SRC
|
||||
* Mode Line
|
||||
Let's install and load some of packages from the [[https://github.com/hlissner/doom-emacs][Doom Emacs]] project, like [[https://github.com/seagle0128/doom-modeline][doom-modeline]] and maybe the themes:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package doom-modeline
|
||||
:init
|
||||
(setq doom-modeline-minor-modes nil
|
||||
doom-modeline-buffer-encoding nil
|
||||
doom-modeline-percent-position nil)
|
||||
:config
|
||||
(doom-modeline-mode +1))
|
||||
|
||||
(use-package doom-themes)
|
||||
#+END_SRC
|
||||
* Themes
|
||||
One does get used to a particular collection of colors. Mine is Tomorrow:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package color-theme-sanityinc-tomorrow)
|
||||
#+END_SRC
|
||||
Most of the time, Emacs is on my desk is a darkened room, so I choose the dark theme:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun laptop-inside ()
|
||||
(interactive)
|
||||
(load-theme 'sanityinc-tomorrow-night t)
|
||||
(set-face-attribute 'region nil :background "#000096")
|
||||
;; font-lock-comment-face #8a8b8a
|
||||
(set-face-attribute 'mode-line nil :background "black")
|
||||
(set-face-attribute 'mode-line-inactive nil :background "#333333"))
|
||||
#+END_SRC
|
||||
|
||||
But, when feeling adventurous, I /sometimes/ take my laptop outside:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun laptop-in-the-sun ()
|
||||
(interactive)
|
||||
(load-theme 'sanityinc-tomorrow-day t)
|
||||
(set-face-attribute 'region nil :background "orange1")
|
||||
;; font-lock-comment-face #8a8b8a
|
||||
(set-face-attribute 'mode-line nil :background "#cccccc")
|
||||
(set-face-attribute 'mode-line-inactive nil :background "#888888"))
|
||||
#+END_SRC
|
||||
|
||||
Oh, and turn off the line highlighting:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(global-hl-line-mode -1)
|
||||
#+END_SRC
|
||||
|
||||
And of course, the default is /inside/ where it is dark and safe:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(laptop-inside)
|
||||
#+END_SRC
|
||||
* Full Size Frame
|
||||
|
||||
Taken from [[https://emacsredux.com/blog/2020/12/04/maximize-the-emacs-frame-on-startup/][this essay]], I figured I would start the initial frame automatically in fullscreen, but not any subsequent frames (as this could be part of the capturing system).
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
|
||||
#+END_SRC
|
||||
|
||||
* Font Configuration
|
||||
Am I ever really ever satisfied with any font? I regularly change my font based on the monospace du jour... [[http://blogs.adobe.com/typblography/2012/09/source-code-pro.html][Source Code Pro]] is attractive, and has been a staple on every programmers' screen. However, we all want ligatures, [[https://github.com/i-tu/Hasklig][Hasklig]] is a nice font that is thinner and easier to read than [[https://github.com/tonsky/FiraCode][Fira]], but [[https://typeof.net/Iosevka/][Iosevka]] seems to have it all. Oh, Microsoft just gave us [[https://docs.microsoft.com/en-us/windows/terminal/cascadia-code][Cascadia]] and that seems shiny. However, the [[https://github.com/ryanoasis/nerd-fonts][Nerd Font project]] adds the ligatures as well as all the other niceties to a font.
|
||||
** Choosing a Font
|
||||
I stole the following idea from [[https://protesilaos.com/dotemacs/#h:9035a1ed-e988-4731-89a5-0d9e302c3dea][Protesilaos Stavrou's dotfile configuration]], and the following should minimally be /readable/:
|
||||
| Similarities | Regular |
|
||||
|--------------+----------------------------|
|
||||
| ()[]{}<>«»‹› | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|
||||
| 6bB8& | abcdefghijklmnopqrstuvwxyz |
|
||||
| 0ODdoaoOQGC | 0123456789 |
|
||||
| I1tilIJL | ~!@#$%^&*+ |
|
||||
| !¡ij | `'"‘’“”.,;:… |
|
||||
| 5$§SsS5 | ()[]{}—-_=<>/\ |
|
||||
| 17ZzZ2 | ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ |
|
||||
| 9gqpG6 | αβγδεζηθικλμνξοπρστυφχψω |
|
||||
| hnmMN | |
|
||||
| uvvwWuuwvy | |
|
||||
| x×X | #include <stdio.h> // <= quickly. |
|
||||
| .,·°% | int main(int argc, char **argv) { |
|
||||
| ¡!¿? | long il1[]={1-2/3.4,5+6==7/8}; |
|
||||
| :; | int OxFaced=0xBAD||"[{(CQUINE"; |
|
||||
| `''"‘’“” | unsigned O0,l1,Z2,S5,G6,B8__XY; |
|
||||
| —-~≈=≠+*_ | printf("@$Hamburgefo%c`",'\n'); |
|
||||
| …⋯ | return ~7&8^9?0:l1|!"j->k+=*w"; |
|
||||
| ... | |
|
||||
|
||||
|
||||
The following is from [[https://source-foundry.github.io/Hack/font-specimen.html][Hack's website]]:
|
||||
#+BEGIN_SRC c
|
||||
// The four boxing wizards jump
|
||||
#include <stdio.h> // <= quickly.
|
||||
int main(int argc, char **argv) {
|
||||
long il1[]={1-2/3.4,5+6==7/8};
|
||||
int OxFaced=0xBAD||"[{(CQUINE";
|
||||
unsigned O0,l1,Z2,S5,G6,B8__XY;
|
||||
printf("@$Hamburgefo%c`",'\n');
|
||||
return ~7&8^9?0:l1|!"j->k+=*w";
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
To install a font, I use the following command on my Mac:
|
||||
#+BEGIN_SRC sh
|
||||
brew tap homebrew/cask-fonts
|
||||
brew install --cask font-hack-nerd-font
|
||||
#+END_SRC
|
||||
** Specifying a Font
|
||||
My /current/ favorite font is actually the top list of fonts that may be installed on my system (they usually are):
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar ha/fixed-font
|
||||
(when window-system
|
||||
(cond ((x-list-fonts "Hack Nerd Font") "Hack Nerd Font")
|
||||
((x-list-fonts "Cousine Nerd Font") "Cousine Nerd Font")
|
||||
((x-list-fonts "Iosevka Nerd Font") "Iosevka Nerd Font")
|
||||
((x-list-fonts "Iosevka") "Iosevka")
|
||||
((x-list-fonts "FantasqueSansMono Nerd Font") "FantasqueSansMono Nerd Font")
|
||||
((x-list-fonts "Monoid Nerd Font") "Monoid Nerd Font")
|
||||
((x-list-fonts "Hasklig") "Hasklig")
|
||||
((x-list-fonts "Cascadia Code PL") "Cascadia Code PL")
|
||||
((x-list-fonts "Source Code Pro") "Source Code Pro")
|
||||
((x-list-fonts "Anonymous Pro") "Anonymous Pro")
|
||||
(t "monospaced")))
|
||||
"My fixed width font based on what is installed, `nil' if not defined.")
|
||||
#+END_SRC
|
||||
|
||||
Force something as well:
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq ha/fixed-font "Hack Nerd Font")
|
||||
#+END_SRC
|
||||
|
||||
I probably don't need to have such a ranking system, as chances are really good that I'll have all of them installed. Still.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar ha/variable-font
|
||||
(when window-system
|
||||
(cond ((x-list-fonts "Overpass") "Overpass")
|
||||
((x-list-fonts "Source Sans Pro") "Source Sans Pro")
|
||||
((x-list-fonts "Lucida Grande") "Lucida Grande")
|
||||
((x-list-fonts "Verdana") "Verdana")
|
||||
((x-family-fonts "Sans Serif") "Sans Serif")
|
||||
(nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro."))))
|
||||
"My variable width font available to org-mode files and whatnot.")
|
||||
#+END_SRC
|
||||
|
||||
Simple function that gives me the font information based on the size I need.
|
||||
This calls =set-frame-font=, but also sets the monospaced font for org code blocks.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :results none
|
||||
(defun ha/set-favorite-font-size (size)
|
||||
(let ((fav-font (format "%s-%d" ha/fixed-font size)))
|
||||
(set-frame-font fav-font nil t)
|
||||
|
||||
;; When using variable-pitch in org, we need to specifically set the
|
||||
;; fixed-pitch as my default fixed-pitched font.
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(variable-pitch ((t (:family ,ha/variable-font :slant normal :weight normal :height 1.1 :width normal))))
|
||||
`(fixed-pitch ((t (:family ,ha/fixed-font :slant normal :weight normal :height 1.0 :width normal)))))))
|
||||
#+END_SRC
|
||||
|
||||
Define a few /interactive/ functions to quickly adjusting the font size based on my computing scenario:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/mac-monitor-fontsize ()
|
||||
"Quickly set reset my font size when I connect my laptop to a monitor on a Mac."
|
||||
(interactive)
|
||||
(ha/set-favorite-font-size 13))
|
||||
|
||||
(defun ha/linux-monitor-fontsize ()
|
||||
"Quickly set reset my font size when I connect my laptop to a monitor on Linux."
|
||||
(interactive)
|
||||
(ha/set-favorite-font-size 12))
|
||||
|
||||
(defun ha/mac-laptop-fontsize ()
|
||||
"Quickly set reset my font size when I disconnect my laptop to a monitor from a Mac."
|
||||
(interactive)
|
||||
(ha/set-favorite-font-size 32))
|
||||
|
||||
(defun ha/linux-laptop-fontsize ()
|
||||
"Quickly set reset my font size when I disconnect my laptop to a monitor from Linux."
|
||||
(interactive)
|
||||
(ha/set-favorite-font-size 14))
|
||||
#+END_SRC
|
||||
|
||||
Which font to choose?
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(if (eq system-type 'gnu/linux)
|
||||
(ha/linux-laptop-fontsize)
|
||||
(ha/mac-monitor-fontsize))
|
||||
#+END_SRC
|
||||
* Ligatures
|
||||
|
||||
Seems like getting ligatures to work in Emacs has been a Holy Grail. On Mac, I've used special builds that have hacks, but now with Emacs 27 and Harfbuzz, I should be able to get --> to look like it should.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq prettify-symbols-unprettify-at-point 'right-edge)
|
||||
|
||||
(global-prettify-symbols-mode +1)
|
||||
(prettify-symbols-mode +1)
|
||||
#+END_SRC
|
||||
|
||||
Note, in Doom, is appears we have a =ligatures= module.
|
||||
We'll start using that instead, but changing it in [[file:general-programming.org][general-programming]] file.
|
||||
|
||||
* Technical Artifacts :noexport:
|
||||
|
||||
Let's provide a name so that the file can be required:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(provide 'ha-display)
|
||||
;;; ha-display.el ends here
|
||||
#+END_SRC
|
||||
|
||||
Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~
|
||||
|
||||
#+DESCRIPTION: A literate programming file to configure the Emacs UI.
|
||||
|
||||
#+PROPERTY: header-args:sh :tangle no
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
#+PROPERTY: header-args :results none :eval no-export :comments no :mkdirp yes
|
||||
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
|
||||
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
204
ha-org-word-processor.org
Normal file
204
ha-org-word-processor.org
Normal file
|
@ -0,0 +1,204 @@
|
|||
#+TITLE: Org As A Word Processor
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+DATE: 2020-09-10
|
||||
#+FILETAGS: :emacs:
|
||||
|
||||
A literate programming file for making Org file more readable.
|
||||
# *Note:* After each change, /tangle it/ to the source destination with ~C-c C-v t~.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
;;; ha-org-word-processor.org --- A literate programming file for making Org file more readable. -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2020 Howard X. Abrams
|
||||
;;
|
||||
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: Howard X. Abrams <howard.abrams@gmail.com>
|
||||
;; Created: September 10, 2020
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
|
||||
;; ~/other/hamacs/ha-org-word-processor.org
|
||||
;; Using `find-file-at-point', and tangle the file to recreate this one .
|
||||
;;
|
||||
;;; Code:
|
||||
#+END_SRC
|
||||
* Introduction
|
||||
I like having org-mode files look more like editing in a word processor than having it look like programming code. But that is just me.
|
||||
* General Org Settings
|
||||
Since I use ellipsis in my writing... I like to /change/ how org renders a collapsed heading.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-pretty-entities t
|
||||
org-ellipsis "⤵" ; …, ➡, ⚡, ▼, ↴, , ∞, ⬎, ⤷, ⤵
|
||||
org-agenda-breadcrumbs-separator " ❱ "
|
||||
org-src-fontify-natively t ;; Pretty code blocks
|
||||
org-hide-emphasis-markers t)
|
||||
#+END_SRC
|
||||
* Org Beautify
|
||||
I really want to use the Org Beautify package, but it overrides my darker themes (and all I really want is headlines to behave).
|
||||
|
||||
First step is to make all Org header levels to use the variable font, and be the same color as the default text:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(when window-system
|
||||
(let ((default-color (face-attribute 'default :foreground)))
|
||||
(dolist (face '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5 org-level-6 org-level-7 org-level-8))
|
||||
(set-face-attribute face nil
|
||||
:foreground default-color :weight 'bold :font ha/variable-font))))
|
||||
#+END_SRC
|
||||
|
||||
Next, we just need to change the header sizes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(when window-system
|
||||
(set-face-attribute 'org-level-1 nil :height 2.2 :inherit 'default)
|
||||
(set-face-attribute 'org-level-2 nil :height 1.8 :inherit 'default)
|
||||
(set-face-attribute 'org-level-3 nil :height 1.4 :inherit 'default)
|
||||
(set-face-attribute 'org-level-4 nil :height 1.1 :inherit 'default))
|
||||
#+END_SRC
|
||||
* Superstar
|
||||
Now that headers are noticeable, I have no reason to see a number of asterisks. Once I used the [[https://github.com/sabof/org-bullets][org-bullets]] package, but believe we've replaced it with [[https://github.com/integral-dw/org-superstar-mode][org-superstar-mode]], so the following is an improvement, especially with the sub-bullets:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org-superstar
|
||||
:init
|
||||
(add-hook 'org-mode 'org-superstar-mode)
|
||||
(setq org-superstar-headline-bullets-list '("▶")
|
||||
org-superstar-special-todo-items t
|
||||
org-superstar-todo-bullet-alist t
|
||||
org-superstar-prettify-item-bullets t
|
||||
org-superstar-item-bullet-alist '((42 . "⊙") ; *
|
||||
(43 . "⁍") ; +
|
||||
(45 . "•"))))
|
||||
#+END_SRC
|
||||
|
||||
Oh, and as I indent lists, they should change the /bulleting/ in a particular sequence. If I begin with an =*= asterisk, I walk down the chain, but with the dashed bullets (my default choice), I just stay with dashed bullets. Numeric bullets should cycle:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-list-demote-modify-bullet '(("*" . "+") ("+" . "-") ("-" . "-")
|
||||
("1." . "a.") ("a." . "1.")))
|
||||
#+END_SRC
|
||||
|
||||
Since the following code does not work like I would have expected:
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-hide-leading-stars t)
|
||||
#+END_SRC
|
||||
|
||||
I add a hook to standard Org, and since this is a Lisp-2, I can get away with:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-hide-leading-stars ()
|
||||
(let* ((keyword
|
||||
`(("^\\(\\*+ \\)\\s-*\\S-" ; Do not hide empty headings!
|
||||
(1 (put-text-property (match-beginning 1) (match-end 1) 'invisible t)
|
||||
nil)))))
|
||||
(font-lock-add-keywords nil keyword)))
|
||||
|
||||
(add-hook 'org-mode-hook 'org-hide-leading-stars)
|
||||
#+END_SRC
|
||||
* Checkboxes
|
||||
According to an idea by [[https://jft.home.blog/2019/07/17/use-unicode-symbol-to-display-org-mode-checkboxes/][Huy Trần]], we can prettify the list checkboxes as well:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/org-prettify-checkboxes ()
|
||||
"Beautify Org Checkbox Symbol"
|
||||
(push '("[ ]" . "☐") prettify-symbols-alist)
|
||||
(push '("[X]" . "☒") prettify-symbols-alist)
|
||||
(push '("[-]" . "☐-") prettify-symbols-alist)
|
||||
(prettify-symbols-mode))
|
||||
#+END_SRC
|
||||
|
||||
And now we can attach it to a newly loaded org files:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'org-mode-hook 'ha/org-prettify-checkboxes)
|
||||
#+END_SRC
|
||||
|
||||
To make it more distinguishable, he also changed the colors:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defface org-checkbox-done-text
|
||||
'((t (:foreground "#71696A" :strike-through t)))
|
||||
"Face for the text part of a checked org-mode checkbox.")
|
||||
|
||||
(font-lock-add-keywords
|
||||
'org-mode
|
||||
`(("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
|
||||
1 'org-checkbox-done-text prepend))
|
||||
'append)
|
||||
#+END_SRC
|
||||
* Padding
|
||||
The [[https://github.com/TonCherAmi/org-padding][org-padding]] project looks places extra space before and after headers and blocks (essentially leading), to create a more word-processor-y experience. Great idea, however, I have spent a lot of extra time entering blank lines before and after my headers and blocks:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org-padding
|
||||
:straight (org-padding :type git :host github :repo "TonCherAmi/org-padding")
|
||||
:hook
|
||||
(org-mode . org-padding-mode)
|
||||
:config
|
||||
(setq org-padding-block-begin-line-padding '(0.5 . 0.3)
|
||||
org-padding-block-end-line-padding '(0.1 . 0.5)
|
||||
org-padding-heading-padding-alist
|
||||
'((4.0 . 1.5) (3.0 . 0.5) (3.0 . 0.5) (3.0 . 0.5) (2.5 . 0.5) (2.0 . 0.5) (1.5 . 0.5) (0.5 . 0.5))))
|
||||
#+END_SRC
|
||||
However, I'm just going to have to write a function to clean this.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/remove-superfluous-org-padding ()
|
||||
(interactive)
|
||||
(goto-char (point-min))
|
||||
(ha/remove-org-header-padding)
|
||||
(goto-char (point-min))
|
||||
(ha/remove-org-block-padding))
|
||||
|
||||
(defun ha/remove-org-header-padding ()
|
||||
;; (goto-char (point-min))
|
||||
(while (re-search-forward (rx (optional bol (zero-or-more space) eol "\n")
|
||||
(group bol (one-or-more "*") (one-or-more space) (one-or-more any) "\n")
|
||||
(optional bol (zero-or-more space) eol "\n")) nil t)
|
||||
(replace-match (match-string 1) nil :no-error)))
|
||||
|
||||
(defun ha/remove-org-block-padding ()
|
||||
;; (goto-char (point-min))
|
||||
(while (re-search-forward (rx (optional bol (zero-or-more space) eol "\n")
|
||||
(group bol (zero-or-more space) "#+BEGIN" (one-or-more any) eol "\n"
|
||||
(zero-or-more (group bol (zero-or-more any) eol "\n"))
|
||||
bol (zero-or-more space) "#+END" (zero-or-more any) eol "\n")
|
||||
(optional bol (zero-or-more space) eol "\n")) nil t)
|
||||
(replace-match (match-string 1) nil :no-error)))
|
||||
#+END_SRC
|
||||
Now that is some complicated regular expressions.
|
||||
* Pasting
|
||||
I like the idea that I will paste HTML text from the clipboard and have it converted to org-formatted text:
|
||||
#+BEGIN_SRC emacs-lisp :results silent
|
||||
(defun ha/org-paste ()
|
||||
(interactive)
|
||||
(if (eq system-type 'gnu/linux)
|
||||
(shell-command "xclip -t text/html -o | pandoc -r html -w org" t)))
|
||||
#+END_SRC
|
||||
* Presentations
|
||||
The [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] still seems to be the best presentation tool for Org files, but I really need to issue a pull request to fix a few warnings.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org-tree-slide
|
||||
:init
|
||||
(setq org-tree-slide-skip-outline-level 4)
|
||||
:config
|
||||
(org-tree-slide-simple-profile))
|
||||
#+END_SRC
|
||||
* Technical Artifacts :noexport:
|
||||
Let's provide a name so that the file can be required:
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(provide 'ha-org-word-processor)
|
||||
;;; ha-org-word-processor.el ends here
|
||||
#+END_SRC
|
||||
Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~
|
||||
|
||||
#+DESCRIPTION: A literate programming file for making Org file more readable.
|
||||
|
||||
#+PROPERTY: header-args:sh :tangle no
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
#+PROPERTY: header-args :results none :eval no-export :comments no
|
||||
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
|
||||
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
332
ha-org.org
Normal file
332
ha-org.org
Normal file
|
@ -0,0 +1,332 @@
|
|||
#+TITLE: General Org-Mode Configuration
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+DATE: 2020-09-18
|
||||
#+FILETAGS: :emacs:
|
||||
|
||||
A literate programming file for configuring org-mode and those files.
|
||||
# *Note:* After each change, /tangle it/ to the source destination with ~C-c C-v t~.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
;;
|
||||
;; Copyright (C) 2020 Howard X. Abrams
|
||||
;;
|
||||
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: Howard X. Abrams <howard.abrams@gmail.com>
|
||||
;; Created: September 18, 2020
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
|
||||
;; /home/howard/other/hamacs/ha-org.org
|
||||
;; And tangle the file to recreate this one.
|
||||
;;
|
||||
;;; Code:
|
||||
(use-package org
|
||||
:mode ("\\.org" . org-mode) ; Addresses an odd warning
|
||||
:init
|
||||
#+END_SRC
|
||||
* Initialization Section
|
||||
Org is an important part of my Emacs world, and with a lot of customization (even though Spacemacs and Doom do a good job getting things started).
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-return-follows-link t
|
||||
org-startup-indented t
|
||||
;; Speed Commands: If point is at the beginning of a headline or code
|
||||
;; block in org-mode, single keys do fun things. See
|
||||
;; org-speed-command-help for details (or hit the ? key at a headline).
|
||||
org-use-speed-commands t
|
||||
|
||||
org-directory "~/personal"
|
||||
org-default-notes-file "~/personal/general-notes.txt"
|
||||
|
||||
org-enforce-todo-dependencies t ; Can't close a task until subtasks are done
|
||||
org-agenda-dim-blocked-tasks t
|
||||
org-log-done 'time
|
||||
|
||||
org-completion-use-ido t
|
||||
org-outline-path-complete-in-steps nil
|
||||
org-src-tab-acts-natively t
|
||||
org-agenda-span 'day ; Default is 'week
|
||||
org-confirm-babel-evaluate nil)
|
||||
#+END_SRC
|
||||
Overcoming a bug:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-clocking-buffer (&rest ignored))
|
||||
#+END_SRC
|
||||
* Configuration Section
|
||||
The following sections assume that org has been loaded, as this begin the configuration section:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
:config
|
||||
#+END_SRC
|
||||
I pretend that my org files are word processing files that wrap automatically:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'org-mode-hook #'visual-line-mode)
|
||||
#+END_SRC
|
||||
Files that end in =.txt= are still org files to me:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode))
|
||||
#+END_SRC
|
||||
Many of the files that I edit close some, but not all, of the headers using a file variable. Let's allow that to not insist that I need to approve that:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'safe-local-variable-values '(org-content . 2))
|
||||
#+END_SRC
|
||||
** Better Return
|
||||
Hitting the ~Return~ key in an org file should format the following line based on context. For instance, at the end of a list, insert a new item.
|
||||
We begin with the interactive function that calls our code only if we are at the end of the line.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/org-return ()
|
||||
"If at the end of a line, do something special based on the
|
||||
information about the line by calling `ha/org-special-return',
|
||||
otherwise, just call `org-return' as usual."
|
||||
(interactive)
|
||||
(if (eolp)
|
||||
(ha/org-special-return)
|
||||
(org-return)))
|
||||
#+END_SRC
|
||||
|
||||
And bind it to the Return key:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(define-key org-mode-map (kbd "RET") #'ha/org-return)
|
||||
#+END_SRC
|
||||
|
||||
What should we do if we are at the end of a line?
|
||||
- Given a prefix, call =org-return= as usual in an org file.
|
||||
- On a link, call =org-return= in order to open it.
|
||||
- On a header? Let's create a new header (or maybe not).
|
||||
- In a table? Let's create a new row.
|
||||
- If we are really in a list, we can create a new item.
|
||||
|
||||
I really should break this function into smaller bits ...
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/org-special-return (&optional ignore)
|
||||
"Add new list item, heading or table row with RET.
|
||||
A double return on an empty element deletes it.
|
||||
Use a prefix arg to get regular RET."
|
||||
(interactive "P")
|
||||
(if ignore
|
||||
(org-return)
|
||||
(cond
|
||||
;; Open links like usual
|
||||
((eq 'link (car (org-element-context)))
|
||||
(org-return))
|
||||
|
||||
((and (org-really-in-item-p) (not (bolp)))
|
||||
(if (org-element-property :contents-begin (org-line-element-context))
|
||||
(progn
|
||||
(end-of-line)
|
||||
(org-insert-item))
|
||||
(delete-region (line-beginning-position) (line-end-position))))
|
||||
|
||||
;; ((org-at-heading-p)
|
||||
;; (if (string= "" (org-element-property :title (org-element-context)))
|
||||
;; (delete-region (line-beginning-position) (line-end-position))
|
||||
;; (org-insert-heading-after-current)))
|
||||
|
||||
((org-at-table-p)
|
||||
(if (-any?
|
||||
(lambda (x) (not (string= "" x)))
|
||||
(nth
|
||||
(- (org-table-current-dline) 1)
|
||||
(org-table-to-lisp)))
|
||||
(org-return)
|
||||
;; empty row
|
||||
(beginning-of-line)
|
||||
(setf (buffer-substring
|
||||
(line-beginning-position) (line-end-position)) "")
|
||||
(org-return)))
|
||||
|
||||
(t
|
||||
(org-return)))))
|
||||
#+END_SRC
|
||||
|
||||
How do we know if we are in a list item? Lists end with two blank lines, so we need to make sure we are also not at the beginning of a line to avoid a loop where a new entry gets created with only one blank line.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-really-in-item-p ()
|
||||
"Similar to `org-in-item-p', however, this works around an
|
||||
issue where the point could actually be in some =code= words, but
|
||||
still be on an item element."
|
||||
(save-excursion
|
||||
(let ((location (org-element-property :contents-begin (org-line-element-context))))
|
||||
(when location
|
||||
(goto-char location))
|
||||
(org-in-item-p))))
|
||||
#+END_SRC
|
||||
|
||||
The org API allows getting the context associated with /current element/. However, this could be a line-level symbol, like paragraph or =list-item= only if the point isn't /inside/ a bold or italics item. You know how HTML distinguishes between /block/ and /inline/ elements, org doesn't. So, let's make a function that makes that distinction:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-line-element-context ()
|
||||
"Return the symbol of the current block element, e.g. paragraph or list-item."
|
||||
(let ((context (org-element-context)))
|
||||
(while (member (car context) '(verbatim code bold italic underline))
|
||||
(setq context (org-element-property :parent context)))
|
||||
context))
|
||||
#+END_SRC
|
||||
** Unfill Paragraph
|
||||
Unfilling a paragraph joins all the lines in a paragraph into a single line. Taken [[http://www.emacswiki.org/UnfillParagraph][from here]] ... I use this all the time:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun unfill-paragraph ()
|
||||
"Convert a multi-line paragraph into a single line of text."
|
||||
(interactive)
|
||||
(let ((fill-column (point-max)))
|
||||
(fill-paragraph nil)))
|
||||
#+END_SRC
|
||||
** Tasks
|
||||
I need to add a /blocked/ state:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-todo-keywords '((sequence "TODO(t)" "DOING(g)" "|" "DONE(d)" )
|
||||
(sequence "BLOCKED(b)" "|" "CANCELLED(c)")))
|
||||
#+END_SRC
|
||||
|
||||
And I would like to have cute little icons for those states:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(dolist (m '(org-mode org-journal-mode))
|
||||
(font-lock-add-keywords m ; A bit silly but my headers are now
|
||||
`(("^\\*+ \\(TODO\\) " ; shorter, and that is nice canceled
|
||||
(1 (progn (compose-region (match-beginning 1) (match-end 1) "⚑") nil)))
|
||||
("^\\*+ \\(DOING\\) "
|
||||
(1 (progn (compose-region (match-beginning 1) (match-end 1) "⚐") nil)))
|
||||
("^\\*+ \\(CANCELED\\) "
|
||||
(1 (progn (compose-region (match-beginning 1) (match-end 1) "✘") nil)))
|
||||
("^\\*+ \\(BLOCKED\\) "
|
||||
(1 (progn (compose-region (match-beginning 1) (match-end 1) "✋") nil)))
|
||||
("^\\*+ \\(DONE\\) "
|
||||
(1 (progn (compose-region (match-beginning 1) (match-end 1) "✔") nil)))
|
||||
;; Here is my approach for quickly making the
|
||||
;; initial asterisks for listing items and whatnot,
|
||||
;; appear as Unicode bullets (without actually
|
||||
;; affecting the text file or the behavior).
|
||||
("^ +\\([-*]\\) "
|
||||
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
|
||||
#+END_SRC
|
||||
|
||||
** Meetings
|
||||
I've notice that while I really like taking notes in a meeting, I don't always like the multiple windows I have opened, so I created this function that I can easily call to eliminate distractions during a meeting.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun meeting-notes ()
|
||||
"Call this after creating an org-mode heading for where the notes for the meeting
|
||||
should be. After calling this function, call 'meeting-done' to reset the environment."
|
||||
(interactive)
|
||||
(outline-mark-subtree) ; Select org-mode section
|
||||
(narrow-to-region (region-beginning) (region-end)) ; Only show that region
|
||||
(deactivate-mark)
|
||||
(delete-other-windows) ; remove other windows
|
||||
(text-scale-set 2) ; readable by others
|
||||
(fringe-mode 0)
|
||||
(message "When finished taking your notes, run meeting-done."))
|
||||
#+END_SRC
|
||||
|
||||
Of course, I need an 'undo' feature when the meeting is over...
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun meeting-done ()
|
||||
"Attempt to 'undo' the effects of taking meeting notes."
|
||||
(interactive)
|
||||
(widen) ; Opposite of narrow-to-region
|
||||
(text-scale-set 0) ; Reset the font size increase
|
||||
(fringe-mode 1)
|
||||
(winner-undo)) ; Put the windows back in place
|
||||
#+END_SRC
|
||||
** Misc
|
||||
*** Babel Blocks
|
||||
Whenever I edit Emacs Lisp blocks from my tangle-able configuration files, I get a lot of superfluous warnings. Let's turn them off.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun disable-fylcheck-in-org-src-block ()
|
||||
(setq-local flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
|
||||
|
||||
(add-hook 'org-src-mode-hook 'disable-fylcheck-in-org-src-block)
|
||||
#+END_SRC
|
||||
*** Next Image
|
||||
When I create images or other artifacts that I consider /part/ of the org document, I want to have them based on the org file, but with a prepended number. Keeping track of what numbers are now free is difficult, so for a /default/ let's figure it out:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/org-next-image-number (&optional prefix)
|
||||
(when (null prefix)
|
||||
(if (null (buffer-file-name))
|
||||
(setq prefix "cool-image")
|
||||
(setq prefix (file-name-base (buffer-file-name)))))
|
||||
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((largest 0)
|
||||
(png-reg (rx (literal prefix) "-" (group (one-or-more digit)) (or ".png" ".svg"))))
|
||||
(while (re-search-forward png-reg nil t)
|
||||
(setq largest (max largest (string-to-number (match-string-no-properties 1)))))
|
||||
(format "%s-%02d" prefix (1+ largest)))))
|
||||
#+END_SRC
|
||||
*** In a PlantUML Block
|
||||
To make the snippets more context aware, this predicate
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha/org-nested-in-plantuml-block ()
|
||||
"Predicate is true if point is inside a Plantuml Source code block in org-mode."
|
||||
(equal "plantuml"
|
||||
(plist-get (cadr (org-element-at-point)) :language)))
|
||||
#+END_SRC
|
||||
* Supporting Packages
|
||||
At this point, we assume that the =use-package= for org is complete, so we can close it and allow other projects to be loaded:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
)
|
||||
#+END_SRC
|
||||
** Exporters
|
||||
Need a few extra exporters:
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(use-package ox-md)
|
||||
|
||||
(use-package ox-confluence
|
||||
:load-path "~/.doom.d/elisp")
|
||||
#+END_SRC
|
||||
|
||||
And Graphviz configuration using [[https://github.com/ppareit/graphviz-dot-mode][graphviz-dot-mode]]:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package graphviz-dot-mode
|
||||
:mode "\\.dot\\'"
|
||||
:init
|
||||
(setq tab-width 4
|
||||
graphviz-dot-indent-width 2
|
||||
graphviz-dot-auto-indent-on-newline t
|
||||
graphviz-dot-auto-indent-on-braces t
|
||||
graphviz-dot-auto-indent-on-semi t))
|
||||
#+END_SRC
|
||||
And we can install company support:
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(use-package company-graphviz-dot)
|
||||
#+END_SRC
|
||||
** Writegood
|
||||
|
||||
The [[https://github.com/bnbeckwith/writegood-mode][writegood-mode]] highlights passive and weasel words as typed. Shame it doesn't check for dangled prepositions.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package writegood-mode
|
||||
:hook ((org-mode . writegood-mode)))
|
||||
#+END_SRC
|
||||
* Technical Artifacts :noexport:
|
||||
|
||||
Let's provide a name so that the file can be required:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(provide 'ha-org)
|
||||
;;; ha-org.el ends here
|
||||
#+END_SRC
|
||||
|
||||
Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~
|
||||
|
||||
#+DESCRIPTION: A literate programming file for configuring org-mode and those files.
|
||||
|
||||
#+PROPERTY: header-args:sh :tangle no
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
|
||||
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
|
||||
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
48
initialize
Executable file
48
initialize
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
HAMACS_DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
HAMACS_DEST=$HOME/.emacs.hamacs # A symlink to ~/.emacs.d
|
||||
|
||||
mkdir -p $HAMACS_DEST
|
||||
mkdir -p $HAMACS_DEST/elisp
|
||||
|
||||
cat > $HAMACS_DEST/init.el <<EOF
|
||||
;;; init.el --- Hamacs Init -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is my Emacs Bootloader. Simply put, I initialize the package management
|
||||
;; system, and then tangle my literate files. This simple idea came from
|
||||
;; https://github.com/susamn/dotfiles
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; We'll be using straight. So, we don't want duplicated package loading:
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
;; Configure package.el to include MELPA.
|
||||
;; (require 'package)
|
||||
;; (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
|
||||
;; (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
|
||||
;; (package-initialize)
|
||||
|
||||
;; Ensure that use-package is installed.
|
||||
;;
|
||||
;; If use-package isn't already installed, it's extremely likely that this is a
|
||||
;; fresh installation! So we'll want to update the package repository and
|
||||
;; install use-package before loading the literate configuration.
|
||||
;; (when (not (package-installed-p 'use-package))
|
||||
;; (package-refresh-contents)
|
||||
;; (package-install 'use-package))
|
||||
|
||||
(defvar hamacs-source-dir "$HAMACS_DIR" "Where we be.")
|
||||
|
||||
;; Let's rock:
|
||||
(org-babel-load-file "$HAMACS_DIR/bootstrap.org")
|
||||
|
||||
(provide 'init.el)
|
||||
;;; init ends here
|
||||
EOF
|
||||
|
||||
echo Created $HAMACS_DEST/init.el
|
21
snippets/emacs-lisp-mode/emacs-lisp-init
Normal file
21
snippets/emacs-lisp-mode/emacs-lisp-init
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: emacs-lisp-init
|
||||
# key: __
|
||||
# --
|
||||
;;; `(file-name-base (buffer-file-name)))`.el --- $1 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) `(format-time-string "%Y")` `user-full-name`
|
||||
;;
|
||||
;; Author: `user-full-name` <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: `user-full-name` <`user-mail-address`>
|
||||
;; Created: `(format-time-string "%B %e, %Y")`
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
$0
|
||||
|
||||
(provide '`(file-name-base (buffer-file-name)))`)
|
||||
;;; `(file-name-base (buffer-file-name)))`.el ends here
|
6
snippets/emacs-lisp-mode/ert-deftest
Normal file
6
snippets/emacs-lisp-mode/ert-deftest
Normal file
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: ert-deftest
|
||||
# key: edt
|
||||
# --
|
||||
(ert-deftest $1-test ()
|
||||
(should (= $0)))
|
10
snippets/emacs-lisp-mode/npc
Normal file
10
snippets/emacs-lisp-mode/npc
Normal file
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: npc
|
||||
# key: npc
|
||||
# --
|
||||
(defun rpgdm-npc--${1:$(replace-regexp-in-string " " "-" yas-text)} ()
|
||||
"Return string from a random $1."
|
||||
(let ((roll (rpgdm--roll-die $2)))
|
||||
(cond
|
||||
((<= roll $3) $4)
|
||||
((<= roll $5) $6)))
|
8
snippets/markdown-mode/h1
Normal file
8
snippets/markdown-mode/h1
Normal file
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: header
|
||||
# key: h1
|
||||
# --
|
||||
${1:Header}
|
||||
${1:$(make-string (string-width yas-text) ?\=)}
|
||||
|
||||
$0
|
8
snippets/markdown-mode/h2
Normal file
8
snippets/markdown-mode/h2
Normal file
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: subheader
|
||||
# key: h2
|
||||
# --
|
||||
${1:Header}
|
||||
${1:$(make-string (string-width yas-text) ?\-)}
|
||||
|
||||
$0
|
7
snippets/mhtml-mode/div
Normal file
7
snippets/mhtml-mode/div
Normal file
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: div
|
||||
# key: div
|
||||
# --
|
||||
<div${1: id="${2:some_id}"}${3: class="${4:some_class}"}>
|
||||
$0
|
||||
</div>
|
7
snippets/org-journal-mode/__journal
Normal file
7
snippets/org-journal-mode/__journal
Normal file
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __journal
|
||||
# key: __journal
|
||||
# --
|
||||
#+TITLE: Journal Entry- `(ha/journal-file-datestamp)`
|
||||
|
||||
$0
|
62
snippets/org-mode/__hamacs
Normal file
62
snippets/org-mode/__hamacs
Normal file
|
@ -0,0 +1,62 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __hamacs
|
||||
# key: __hamacs
|
||||
# --
|
||||
#+TITLE: ${1:`(->> (buffer-file-name)
|
||||
(file-name-base)
|
||||
(s-split-words)
|
||||
(--map (s-capitalize it))
|
||||
(s-join " "))`}
|
||||
#+AUTHOR: `user-full-name`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d")`
|
||||
#+FILETAGS: :emacs:
|
||||
|
||||
${2:A literate programming file configuring Emacs.}
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
;;; `(file-name-base (buffer-file-name)))`.el --- $2 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) `(format-time-string "%Y")` `user-full-name`
|
||||
;;
|
||||
;; Author: `user-full-name` <http://gitlab.com/howardabrams>
|
||||
;; Maintainer: `user-full-name` <`user-mail-address`>
|
||||
;; Created: `(format-time-string "%B %e, %Y")`
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
|
||||
;; `(buffer-file-name)`
|
||||
;; And tangle the file to recreate this one.
|
||||
;;
|
||||
;;; Code:
|
||||
#+END_SRC
|
||||
|
||||
* Introduction
|
||||
|
||||
$0
|
||||
|
||||
* Technical Artifacts :noexport:
|
||||
|
||||
Let's provide a name so that the file can be required:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(provide '`(file-name-base (buffer-file-name)))`)
|
||||
;;; `(file-name-base (buffer-file-name)))`.el ends here
|
||||
#+END_SRC
|
||||
|
||||
Before you can build this on a new system, make sure that you put the cursor over any of these properties, and hit: ~C-c C-c~
|
||||
|
||||
#+DESCRIPTION: $2
|
||||
|
||||
#+PROPERTY: header-args:sh :tangle no
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle yes
|
||||
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
|
||||
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil date:nil
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
|
||||
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
|
||||
|
||||
# Local Variables:
|
||||
# eval: (add-hook 'after-save-hook #'org-babel-tangle t t)
|
||||
# End:
|
24
snippets/org-mode/__mythic_rpg_overview
Normal file
24
snippets/org-mode/__mythic_rpg_overview
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __mythic_rpg_overview
|
||||
# key: mythic-rpg-overview
|
||||
# --
|
||||
#+TITLE: ${1:`(replace-regexp-in-string "-" " " (capitalize (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))))`}
|
||||
#+AUTHOR: `(user-full-name)`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d %B")`
|
||||
#+TAGS: mythic rpg adventure
|
||||
|
||||
Current Chaos Factor: 5
|
||||
|
||||
* Adventure Notes
|
||||
$0
|
||||
|
||||
* Scenes
|
||||
* Characters
|
||||
-
|
||||
* Threads
|
||||
-
|
||||
|
||||
# Local Variables:
|
||||
# eval: (progn (load-library "rpgdm") (load-library "rpgdm-mythic") (rpgdm-tables-load))
|
||||
# End:
|
28
snippets/org-mode/__mythic_rpg_player
Normal file
28
snippets/org-mode/__mythic_rpg_player
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __mythic_rpg_player
|
||||
# key: mythic-rpg-player
|
||||
# --
|
||||
#+TITLE: ${1:`(replace-regexp-in-string "-" " " (capitalize (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))))`}
|
||||
#+AUTHOR: `(user-full-name)`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d %B")`
|
||||
#+TAGS: mythic rpg player pc character
|
||||
|
||||
Favor Points: 50
|
||||
|
||||
* Character Summary
|
||||
$0
|
||||
* Attributes
|
||||
| Strength | |
|
||||
| Agility | |
|
||||
| Reflex | |
|
||||
| IQ | |
|
||||
| Intuition | |
|
||||
| Willpower | |
|
||||
| Toughness | |
|
||||
* Abilities
|
||||
| Ability | Rank |
|
||||
|---------|------|
|
||||
| | |
|
||||
* Notes
|
||||
* Strengthes and Weaknesses
|
24
snippets/org-mode/__mythic_rpg_resolution
Normal file
24
snippets/org-mode/__mythic_rpg_resolution
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __mythic_rpg_resolution
|
||||
# key: mythic-rpg-resolution
|
||||
# --
|
||||
#+TITLE: ${1:`(replace-regexp-in-string "-" " " (capitalize (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))))`}
|
||||
#+AUTHOR: `(user-full-name)`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d %B")`
|
||||
#+TAGS: mythic rpg resolution chart
|
||||
|
||||
${0:Summary Description}
|
||||
|
||||
*Acting Rank:* $2
|
||||
|
||||
*Difficulty Rank:* $3
|
||||
|
||||
*Modifiers:*
|
||||
- $4
|
||||
|
||||
*Results:*
|
||||
| Yes | |
|
||||
| No | |
|
||||
| Exceptional Yes | |
|
||||
| Exceptional No | |
|
26
snippets/org-mode/__mythic_rpg_scaling
Normal file
26
snippets/org-mode/__mythic_rpg_scaling
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: __mythic_rpg_scaling
|
||||
# key: mythic-rpg-scaling
|
||||
# --
|
||||
#+TITLE: ${1:`(replace-regexp-in-string "-" " " (capitalize (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))))`}
|
||||
#+AUTHOR: `(user-full-name)`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d %B")`
|
||||
#+TAGS: mythic rpg scaling skill box
|
||||
|
||||
${0:Example of...}
|
||||
|
||||
| Description | Mythic Rank |
|
||||
|-------------+---------------|
|
||||
| | |
|
||||
| | Miniscule |
|
||||
| | Weak |
|
||||
| | Low |
|
||||
| | Below Average |
|
||||
| $2 | Average |
|
||||
| | Above Average |
|
||||
| | High |
|
||||
| | Exceptional |
|
||||
| | Incredible |
|
||||
| | Awesome |
|
||||
| | |
|
61
snippets/org-mode/__sprint
Normal file
61
snippets/org-mode/__sprint
Normal file
|
@ -0,0 +1,61 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: sprint
|
||||
# key: __sprint
|
||||
# --
|
||||
#+TITLE: `(sprint-current-name)`
|
||||
#+AUTHOR: `user-full-name`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(sprint-date-range)`
|
||||
#+CATEGORY: sprint
|
||||
#+FILETAGS: :work:
|
||||
|
||||
* Work Issues
|
||||
|
||||
$0
|
||||
|
||||
* Onboarding Work
|
||||
|
||||
See [[file:Onboarding-Work.org][Onboard-Work]] for all details.
|
||||
|
||||
* Distractions and Support
|
||||
|
||||
Anything that doesn't fit the above goes here.
|
||||
|
||||
* Meeting Notes :meeting:
|
||||
* Scrum Status :status:
|
||||
|
||||
* Sprint Demonstration
|
||||
SCHEDULED: <`(sprint-date-from-start 12)`> DEADLINE: <`(sprint-date-from-start 13)`>
|
||||
|
||||
* Sprint Retrospective
|
||||
SCHEDULED: <`(sprint-date-from-start 14)`>
|
||||
|
||||
* Notes for Next Sprint
|
||||
|
||||
** Support Section
|
||||
|
||||
We should always allow the display of this file for a demonstration.
|
||||
|
||||
#+BEGIN_SRC elisp :results silent
|
||||
(use-package demo-it
|
||||
:load-path "~/Other/demo-it"
|
||||
:config
|
||||
(demo-it-create :advanced-mode :single-window
|
||||
(demo-it-presentation (buffer-file-name) 3 :both "Sprint Demonstration")
|
||||
(osx-browse-url-forwork "https://...")
|
||||
(demo-it-load-fancy-file "~/work/wpc4/wpc/dashboards/wpc4/hypervisor.yml"
|
||||
:line 116 133)
|
||||
(demo-it-presentation-return-noadvance)
|
||||
;; ...
|
||||
))
|
||||
#+END_SRC
|
||||
|
||||
Have fun and start the show: =demo-it-start= and hit ~F5~ (or the ~Num~ key on Keyboardio).
|
||||
|
||||
#+DESCRIPTION: Notes taken during Sprint #`(sprint-number)`
|
||||
#+PROPERTY: header-args: :results drawer :tangle no :eval no-export :comments org
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil skip:nil author:nil email:nil creator:nil timestamp:nil ^:nil
|
||||
|
||||
# Local Variables:
|
||||
# eval: (org-content 2)
|
||||
# End:
|
18
snippets/org-mode/activity-diagram
Normal file
18
snippets/org-mode/activity-diagram
Normal file
|
@ -0,0 +1,18 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: activity-diagram
|
||||
# key: activity
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/activity-diagram-betastart
|
||||
start
|
||||
|
||||
if (Graphviz installed?) then (yes)
|
||||
:process all\ndiagrams;
|
||||
else (no)
|
||||
:process only
|
||||
__sequence__ and __activity__ diagrams;
|
||||
endif
|
||||
|
||||
stop
|
34
snippets/org-mode/component-diagram
Normal file
34
snippets/org-mode/component-diagram
Normal file
|
@ -0,0 +1,34 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: component-diagram
|
||||
# key: component
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/component-diagram
|
||||
package "Some Group" {
|
||||
HTTP - [First Component]
|
||||
[Another Component]
|
||||
}
|
||||
|
||||
node "Other Groups" {
|
||||
FTP - [Second Component]
|
||||
[First Component] --> FTP
|
||||
}
|
||||
|
||||
cloud {
|
||||
[Example 1]
|
||||
}
|
||||
|
||||
database "MySql" {
|
||||
folder "This is my folder" {
|
||||
[Folder 3]
|
||||
}
|
||||
frame "Foo" {
|
||||
[Frame 4]
|
||||
}
|
||||
}
|
||||
|
||||
[Another Component] --> [Example 1]
|
||||
[Example 1] --> [Folder 3]
|
||||
[Folder 3] --> [Frame 4]
|
31
snippets/org-mode/deployment-diagram
Normal file
31
snippets/org-mode/deployment-diagram
Normal file
|
@ -0,0 +1,31 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: deployment-diagram
|
||||
# key: deployment
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/deployment-diagram
|
||||
agent agent
|
||||
artifact artifact
|
||||
boundary boundary
|
||||
card card
|
||||
circle circle
|
||||
cloud cloud
|
||||
collections collections
|
||||
component component
|
||||
control control
|
||||
database database
|
||||
entity entity
|
||||
file file
|
||||
folder folder
|
||||
frame frame
|
||||
interface interface
|
||||
label label
|
||||
node node
|
||||
package package
|
||||
queue queue
|
||||
stack stack
|
||||
rectangle rectangle
|
||||
storage storage
|
||||
usecase usecase
|
12
snippets/org-mode/dm-screen
Normal file
12
snippets/org-mode/dm-screen
Normal file
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: dm-screen
|
||||
# key: __dm
|
||||
# --
|
||||
#+TITLE: ${1:`(->> (buffer-file-name)
|
||||
(file-name-base)
|
||||
(s-split-words)
|
||||
(--map (s-capitalize it))
|
||||
(s-join " "))`}
|
||||
#+AUTHOR: Howard X. Abrams
|
||||
#+EMAIL: howard.abrams@gmail.com
|
||||
#+FILETAGS: :rpg:5e:dm-screen:
|
5
snippets/org-mode/document-property-header
Normal file
5
snippets/org-mode/document-property-header
Normal file
|
@ -0,0 +1,5 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: document-property-header
|
||||
# key: topprop
|
||||
# --
|
||||
#+PROPERTY: header-args${1::emacs-lisp} :${2:results} ${3:silent}
|
7
snippets/org-mode/emacs-lisp-code
Normal file
7
snippets/org-mode/emacs-lisp-code
Normal file
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: emacs-lisp-code
|
||||
# key: <sl
|
||||
# --
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
$0
|
||||
#+END_SRC
|
14
snippets/org-mode/fullstatus
Normal file
14
snippets/org-mode/fullstatus
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: fullstatus
|
||||
# uuid:
|
||||
# key: fullstatus
|
||||
# condition: t
|
||||
# --
|
||||
- *Sprint:*
|
||||
- $1
|
||||
- *Crossway:*
|
||||
- $2
|
||||
- *Onboarding:*
|
||||
- $3
|
||||
- *Other:*
|
||||
- $0
|
11
snippets/org-mode/header
Normal file
11
snippets/org-mode/header
Normal file
|
@ -0,0 +1,11 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: header
|
||||
# key: header
|
||||
# --
|
||||
#+TITLE: ${1:`(replace-regexp-in-string "-" " " (capitalize (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))))`}
|
||||
#+AUTHOR: `(user-full-name)`
|
||||
#+EMAIL: `user-mail-address`
|
||||
#+DATE: `(format-time-string "%Y-%m-%d %B")`
|
||||
#+TAGS: $2
|
||||
|
||||
$0
|
5
snippets/org-mode/name
Normal file
5
snippets/org-mode/name
Normal file
|
@ -0,0 +1,5 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: name
|
||||
# key: name
|
||||
# --
|
||||
#+NAME: ${0}
|
21
snippets/org-mode/object-diagram
Normal file
21
snippets/org-mode/object-diagram
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: object-diagram
|
||||
# key: object
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/object-diagram
|
||||
object Extends
|
||||
object Extension
|
||||
object Composes
|
||||
object Composition
|
||||
object Aggregates
|
||||
object Aggregation
|
||||
object Relates
|
||||
object Relation
|
||||
|
||||
Extends <|-- Extension
|
||||
Composes *-- Composition
|
||||
Aggregates o-- "4" Aggregation
|
||||
Relates .. Relation : some labels
|
14
snippets/org-mode/onboard
Normal file
14
snippets/org-mode/onboard
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: onboard
|
||||
# key: onboard
|
||||
# --
|
||||
** TODO $1
|
||||
|
||||
Status:
|
||||
- Waiting to fill out Requirements Document
|
||||
|
||||
Summary:
|
||||
- Initial meeting on `(format-time-string "<%Y-%m-%d %a>")`
|
||||
|
||||
Personnel:
|
||||
- $2
|
14
snippets/org-mode/plantuml
Normal file
14
snippets/org-mode/plantuml
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: plantuml
|
||||
# key: <p
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# group: plantuml
|
||||
# --
|
||||
|
||||
#+begin_src plantuml :file ${1:`(ha/org-next-image-number)`}.${2:png} :exports file :results file
|
||||
@startuml
|
||||
!include plantuml-dark-theme.puml
|
||||
' See details at https://plantuml.com/
|
||||
$0
|
||||
@enduml
|
||||
#+end_src
|
6
snippets/org-mode/rpgdm-npc
Normal file
6
snippets/org-mode/rpgdm-npc
Normal file
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: RPG DM NPC
|
||||
# key: rpgdm-npc
|
||||
# --
|
||||
|
||||
Name: `name`
|
7
snippets/org-mode/section-property
Normal file
7
snippets/org-mode/section-property
Normal file
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: section-property
|
||||
# key: prop
|
||||
# --
|
||||
:PROPERTIES:
|
||||
:header-args:${1:emacs-lisp} :${2:results} ${3:silent}
|
||||
:END:
|
13
snippets/org-mode/sequence-diagram
Normal file
13
snippets/org-mode/sequence-diagram
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: sequence-diagram
|
||||
# key: sequence
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/sequence-diagram
|
||||
Alice -> Bob: Authentication Request
|
||||
Bob --> Alice: Authentication Response
|
||||
|
||||
Alice -> Bob: Another authentication Request
|
||||
Alice <-- Bob: Another authentication Response
|
7
snippets/org-mode/shell-script-code
Normal file
7
snippets/org-mode/shell-script-code
Normal file
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: shell-script-code
|
||||
# key: <ss
|
||||
# --
|
||||
#+BEGIN_SRC sh
|
||||
$0
|
||||
#+END_SRC
|
15
snippets/org-mode/state-diagram
Normal file
15
snippets/org-mode/state-diagram
Normal file
|
@ -0,0 +1,15 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: state-diagram
|
||||
# key: state
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/state-diagram
|
||||
[*] --> State1
|
||||
State1 --> [*]
|
||||
State1 : this is a string
|
||||
State1 : this is another string
|
||||
|
||||
State1 -> State2
|
||||
State2 --> [*]
|
21
snippets/org-mode/timing-diagram
Normal file
21
snippets/org-mode/timing-diagram
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: timing-diagram
|
||||
# key: timing
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/timing-diagram
|
||||
robust "Web Browser" as WB
|
||||
concise "Web User" as WU
|
||||
|
||||
@0
|
||||
WU is Idle
|
||||
WB is Idle
|
||||
|
||||
@100
|
||||
WU is Waiting
|
||||
WB is Processing
|
||||
|
||||
@300
|
||||
WB is Waiting
|
5
snippets/org-mode/title
Normal file
5
snippets/org-mode/title
Normal file
|
@ -0,0 +1,5 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: title
|
||||
# key: title
|
||||
# --
|
||||
#+TITLE: ${0}
|
12
snippets/org-mode/use-case-diagram
Normal file
12
snippets/org-mode/use-case-diagram
Normal file
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# contributor: Howard Abrams <howard.abrams@gmail.com>
|
||||
# name: use-case-diagram
|
||||
# key: use-case
|
||||
# condition: (ha/org-nested-in-plantuml-block)
|
||||
# group: plantuml
|
||||
# --
|
||||
' See details at https://plantuml.com/use-case-diagram
|
||||
User -> (Start)
|
||||
User --> (Use the application) : A small label
|
||||
|
||||
:Main Admin: ---> (Use the application) : This is\nyet another\nlabel
|
5
snippets/ruby-mode/rubocop-disable-comment
Normal file
5
snippets/ruby-mode/rubocop-disable-comment
Normal file
|
@ -0,0 +1,5 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Rubocop disable comment
|
||||
# key: rd
|
||||
# --
|
||||
# rubocop:disable ${1:Lint/MethodLength}
|
12
snippets/sh-mode/__
Normal file
12
snippets/sh-mode/__
Normal file
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: shell-init
|
||||
# key: __
|
||||
# --
|
||||
#!/usr/bin/env `(if (equal (file-name-extension buffer-file-name) "zsh") "zsh" "bash")`
|
||||
# ----------------------------------------------------------------------
|
||||
# `(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`: $0
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
$0
|
14
snippets/sh-mode/getopt
Normal file
14
snippets/sh-mode/getopt
Normal file
|
@ -0,0 +1,14 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: getopt
|
||||
# uuid:
|
||||
# key: getopt
|
||||
# --
|
||||
${1:OPT1}="${2:default value}"
|
||||
$0
|
||||
while getopts "${3:s}" o
|
||||
do case "$o" in
|
||||
$3) $1="$OPTARG";;
|
||||
[?]) usage;;
|
||||
esac
|
||||
done
|
||||
shift $(expr $OPTIND - 1)
|
9
snippets/sh-mode/usage
Normal file
9
snippets/sh-mode/usage
Normal file
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: usage
|
||||
# key: usage
|
||||
# --
|
||||
|
||||
function usage {
|
||||
print >&2 "Usage: \$0 ${1:[-s] [-d seplist] file ...}"
|
||||
$0exit 1
|
||||
}
|
BIN
support/beep-notify.wav
Normal file
BIN
support/beep-notify.wav
Normal file
Binary file not shown.
75
support/final-initialize.el
Normal file
75
support/final-initialize.el
Normal file
|
@ -0,0 +1,75 @@
|
|||
;; -*- mode: emacs-lisp-mode -*-
|
||||
;;; final-initialize.el --- Reinstall my Emacs configuration files -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2020 Howard X. Abrams
|
||||
;;
|
||||
;; Author: Howard X. Abrams <http://github/howard>
|
||||
;; Maintainer: Howard X. Abrams <howard.abrams@gmail.com>
|
||||
;; Created: September 11, 2020
|
||||
;; Modified: September 11, 2020
|
||||
;; Version: 0.0.1
|
||||
;; Homepage: https://gitlab.com/howardabrams/hamacs
|
||||
;; Package-Requires: ((emacs 27.1.50) (cl-lib "0.5"))
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Reinstall my Emacs configuration files
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'ob)
|
||||
(require 'f)
|
||||
|
||||
;; The project source is actually defined in ~/.doom.d/hamacs-init.el
|
||||
;; However, we define it here to get rid of Emacs linter warnings. ;-)
|
||||
(defvar hamacs-source-dir
|
||||
(f-parent (f-parent (or load-file-name (buffer-file-name))))
|
||||
"My configuration's source code directory.")
|
||||
|
||||
;; Where should the code end up?
|
||||
(defvar hamacs-private-code-dir (f-join user-emacs-directory "elisp")
|
||||
"Location for most of the `hamacs' source code and configuration Lisp files.")
|
||||
|
||||
(defun ha/install-by-tangling (source-files)
|
||||
(dolist (file source-files)
|
||||
(message "Tangling: %s" file)
|
||||
(org-babel-tangle-file file)))
|
||||
|
||||
(defun ha/install-code-from-essays ()
|
||||
"Tangle select website essays into the elisp bucket."
|
||||
(ha/install-by-tangling
|
||||
'("~/website/Technical/Emacs/getting-more-boxes-done.org"
|
||||
"~/website/Technical/Emacs/getting-even-more-boxes-done.org"
|
||||
"~/website/Technical/Emacs/beep-for-emacs.org"
|
||||
"~/website/Technical/Emacs/focused-work.org")))
|
||||
|
||||
(defun ha/install-code-from-hamacs ()
|
||||
"Copy Emacs Lisp code without needing to translate."
|
||||
(dolist (file (directory-files
|
||||
(f-join hamacs-source-dir "elisp") t (rx bol (not "."))))
|
||||
(copy-file file (file-name-as-directory hamacs-private-code-dir) t)))
|
||||
|
||||
(defun ha/install-configuration ()
|
||||
"Two primary jobs: tangle all source configuration files and link
|
||||
non-tangled files."
|
||||
(interactive)
|
||||
(unless (f-exists? user-emacs-directory)
|
||||
(make-directory user-emacs-directory))
|
||||
(unless (f-exists? hamacs-private-code-dir)
|
||||
(make-directory hamacs-private-code-dir))
|
||||
|
||||
(ha/install-code-from-essays)
|
||||
(ha/install-code-from-hamacs)
|
||||
|
||||
;; Link some source-controlled directories into ~/.doom.d ...
|
||||
;; This used to be a longer list. ;-)
|
||||
(dolist (something '("snippets"))
|
||||
(let ((dir (f-join user-emacs-directory something))
|
||||
(src (f-join default-directory something)))
|
||||
(unless (f-symlink? dir)
|
||||
(f-symlink src dir)))))
|
||||
|
||||
(provide 'final-initialize)
|
||||
;;; final-initialize.el ends here
|
BIN
support/levitating-gnu.png
Normal file
BIN
support/levitating-gnu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
Loading…
Reference in a new issue