From eed187911ed77f7cdd9b77006388b0d12421bca6 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Wed, 13 Oct 2021 18:15:51 -0700 Subject: Edward Liu --- smart-documents.org | 135 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 54 deletions(-) (limited to 'smart-documents.org') diff --git a/smart-documents.org b/smart-documents.org index c7a4c2e..627555a 100644 --- a/smart-documents.org +++ b/smart-documents.org @@ -6,7 +6,8 @@ #+EMAIL: smart-documents@tuta.io #+OPTIONS: html-style:nil -#+MACRO: sd /Smart Documents/ +#+MACRO: SD /Smart Document/ +#+MACRO: SDs /Smart Documents/ # LaTeX setup #+SETUPFILE: ~/.emacs.d/resources/templates/documents/gnu-default.setup @@ -16,7 +17,7 @@ #+LATEX_HEADER_EXTRA: \newfontfamily\publicsans{Public Sans} #+LATEX: \begin{abstract} -The idea of {{{sd}}} came to me as I was reflecting on how to improve +The idea of {{{SDs}}} came to me as I was reflecting on how to improve the document creation process in my workplace. The GNU Emacs editor had captured my imagination, and I wanted to create an accessible and highly productive text editor to benefit my organization. In this @@ -24,7 +25,7 @@ paper, I'll lay out my vision for the /Smart Document/, a file containing both text destined to the reader, and code describing how to update, validate, and present this text; then, I'll weave my personal GNU Emacs customizations with a tutorial. This paper is a -{{{sd}}} itself! +{{{SD}}} itself! #+LATEX: \end{abstract} * COMMENT All TODOs @@ -64,7 +65,7 @@ You can press ~f1~ at any time to access Emacs built-in help. ** TODO User details -One advantage of working with {{{sd}}} is that they can automatically +One advantage of working with {{{SDs}}} is that they can automatically be populated with our details in the header, footer, or other appropriate element. @@ -106,6 +107,7 @@ from https://git-scm.com/download/win] (add-to-list 'exec-path "C:/Users/marius.peter/PortableGit/bin/")) #+END_SRC + * Early setup ** The first file to load @@ -156,11 +158,9 @@ We start the profiler now , and will interrupt it in Section (profiler-start) #+END_SRC - - ** Usual paths to files & directories -This section defines the paths that structure the overall {{{sd}}} +This section defines the paths that structure the overall {{{SD}}} logic. - File :: A collection of information recognized by a computer---to @@ -339,6 +339,7 @@ ignored by =git= by default. (when (file-exists-p secrets) (org-babel-load-file secrets))) #+END_SRC + * Keyboard shortcuts What follows are the most useful keybindings, as well as the @@ -386,13 +387,18 @@ navigation cues on all modern desktop OSes. From IBM's CUA, we get the (global-set-key (kbd "C-c c") 'sd-find-literate-config) #+END_SRC - -*** TODO Open the Org diary +*** Open the Org diary #+BEGIN_SRC emacs-lisp :tangle yes (global-set-key (kbd "C-c d") 'sd-find-org-diary) #+END_SRC +*** Capture Org content + +#+BEGIN_SRC emacs-lisp :tangle yes + (global-set-key (kbd "C-c k") 'org-capture) +#+END_SRC + *** Open a recently visited file #+BEGIN_SRC emacs-lisp :tangle yes @@ -422,7 +428,6 @@ navigation cues on all modern desktop OSes. From IBM's CUA, we get the (find-file org-agenda-diary-file))) #+END_SRC - *** Open Org mode document properties #+BEGIN_SRC emacs-lisp :tangle no @@ -599,6 +604,7 @@ Clean up buffer in every mode. (global-set-key [f12] 'sd-beautify-buffer) #+END_SRC + * Packages Packages are collections of =.el= files providing added functionality @@ -648,7 +654,7 @@ described in this configuration file. (require 'bind-key) #+END_SRC -** ~evil-mode~ +** COMMENT ~evil-mode~ Forgive me, for I have sinned. @@ -657,7 +663,7 @@ This is the 2^{nd} most significant customization after keys.[fn::For more information on =vi= keybindings, visit [[https://hea-www.harvard.edu/~fine/Tech/vi.html]].] -#+BEGIN_SRC emacs-lisp :tangle no +#+BEGIN_SRC emacs-lisp :tangle yes (use-package evil) (setq evil-toggle-key "C-c d") (evil-mode 1) @@ -1058,6 +1064,7 @@ B-) \smiley :hook (after-init . global-emojify-mode))) #+END_SRC + * ~org-mode~ Org mode is so significant that this section of the paper deserves its @@ -1217,11 +1224,16 @@ custom format: *** Sequence of TODOs + #+begin_src emacs-lisp :tangle yes (setq org-todo-keywords '((sequence "TODO" "|" "DONE") - (sequence "STUCK" "WAITING" "|" "N/A" "COMPLETED") - (sequence "CONSTRUCTION" "REVIEWED" "|" "INSTALLED"))) + (sequence "APPLY" "FOLLOW UP" "|" "REJECTED" "STOP" "OFFER") + (sequence "STUCK" "WAITING" "|" "N/A" "COMPLETED"))) + +#+end_src + +#+begin_src emacs-lisp :tangle yes (setq org-todo-keyword-faces '(("STUCK" . (:height 1.6 :background "red" :foreground "white" :weight bold)) @@ -1230,26 +1242,6 @@ custom format: ("COMPLETED" . (:height 1.6 :background "green" :foreground "white")))) #+end_src -** Programming a Smart Documents - -The following languages can be used inside =SRC= blocks, in view of -being executed by the Org Babel backend upon document export. - -#+BEGIN_SRC emacs-lisp :tangle yes - (org-babel-do-load-languages - 'org-babel-load-languages - '((shell . t) - (python . t) - (ditaa . t) - (plantuml . t) - (emacs-lisp . t) - (awk . t) - (ledger . t) - (latex . t) - (C . t) - (gnuplot . t))) -#+END_SRC - ** Agenda The agenda displays a chronological list of headings across all agenda @@ -1257,7 +1249,8 @@ files for which the heading or body contain a matching =org-time-stamp=.[fn::An =org-time-stamp= can be inserted with ~C-c .~ (period)] -*** Open agenda in separate frame +*** COMMENT Open agenda in separate frame +# Meh We open the agenda in a separate frame. @@ -1281,7 +1274,35 @@ The list of agenda files is saved at the following location. (setq org-agenda-files (concat sd-path-meta "org-agenda-files")) #+END_SRC -** LaTeX export +** Org Capture + +#+BEGIN_SRC emacs-lisp :tangle yes + (setq org-default-notes-file (concat sd-path-resources "org/default-notes.org")) +#+END_SRC + +** Programming a {{{SD}}} + +The following languages can be used inside =SRC= blocks, in view of +being executed by the Org Babel backend upon document export. + +#+BEGIN_SRC emacs-lisp :tangle yes + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (python . t) + (ditaa . t) + (plantuml . t) + (emacs-lisp . t) + (awk . t) + (ledger . t) + (latex . t) + (C . t) + (gnuplot . t))) +#+END_SRC + +** Exporting {{{SDs}}} + +*** LaTeX export We'll be compiling our documents with LuaTeX. This will afford us some future-proofing, since it was designated as the successor to pdfTeX by @@ -1305,11 +1326,17 @@ Options and why we need them: -interaction=nonstopmode -outdir=%o %f")) #+END_SRC -*** Exporting timestamps +**** Exporting timestamps We customize the format for org time stamps to make them appear -monospaced in our exported LaTeX documents. This makes them visually -distinguishable from body text. +monospaced in our exported LaTeX documents. This makes it easy to +distinguish time stamps from body text, and make them align nicely in +definition lists, which I prefer when logging events: + +- [2021-10-03 Sun] :: Did something +- [2021-10-04 Mon] :: Did something else +- [2021-10-05 Tue] :: Did yet another thing + #+BEGIN_SRC emacs-lisp :tangle yes (setq org-latex-active-timestamp-format @@ -1318,7 +1345,7 @@ distinguishable from body text. "\\texttt{%s}") #+END_SRC -*** LaTeX packages +**** LaTeX packages The following packages are loaded for every time we export to LaTeX. @@ -1342,7 +1369,7 @@ The following packages are loaded for every time we export to LaTeX. ("pdflatex" "lualatex")))) #+END_SRC -*** COMMENT Colored source blocks in PDF export +**** COMMENT Colored source blocks in PDF export # Too distracting. Focus on fonts. @@ -1359,7 +1386,7 @@ blocks in LaTeX exports. ("breakanywhere" "true")))) #+END_SRC -*** Cleaning directory after export +**** Cleaning directory after export Now, we set the files to be deleted when a LaTeX \rightarrow PDF compilation occurs. We only care about two files, in the end: the Org @@ -1373,7 +1400,7 @@ mode file for edition, and the PDF for distribution. "tex" "lot" "lof")) #+END_SRC -*** Chronological diary entries +**** Chronological diary entries By default, Org agenda inserts diary entries as the first under the selected date. It is preferable to insert entries in the order that @@ -1383,7 +1410,7 @@ they were recorded, i.e. chronologically. (setq org-agenda-insert-diary-strategy 'date-tree-last) #+END_SRC -*** Extra LaTeX class +**** Extra LaTeX class This /letter/ template completes the other default LaTeX classes. @@ -1405,7 +1432,7 @@ This /letter/ template completes the other default LaTeX classes. ("\\subsubsection*{%s}" . "\\subsubsection*{%s}"))) #+END_SRC -*** COMMENT Table of contents +**** COMMENT Table of contents # Commented out on <2021-09-21 Tue>. By default, body text can immediately follow the table of contents. It @@ -1419,7 +1446,7 @@ work. The following makes =TODO= items appear red and =CLOSED= items appear green in Org's LaTeX exports. Very stylish, much flair! -*** AUCTEX +**** AUCTEX #+BEGIN_SRC emacs-lisp :tangle yes (use-package tex @@ -1432,7 +1459,7 @@ green in Org's LaTeX exports. Very stylish, much flair! (auctex-latexmk-setup) #+END_SRC -*** Groff export +**** Groff export #+BEGIN_SRC emacs-lisp :tangle no (require 'ox-groff) @@ -1442,7 +1469,7 @@ green in Org's LaTeX exports. Very stylish, much flair! This is a mind-bending capacity of Org mode: we can assign arbitrary functions to be executed when a user follows an Org link. Org links -appear like hyperlinks both in buffers and PDF exports---e.g. the +appear as hyperlinks both in buffers and PDF exports---e.g. the following link to this very section, Section [[Org links]]---but their in-buffer behavior can be arbitrarily assigned. @@ -1458,6 +1485,7 @@ in-buffer behavior can be arbitrarily assigned. [[tag:work+phonenumber-boss][Optional Description]] #+END_SRC + * One-click workflows In this section, we'll implement useful one-click workflows. It comes @@ -1472,12 +1500,10 @@ later than the keybinding definitions for two reasons: keybinding subsection, and not the subsection describing the ``one-click workflow''. - ** Opening files First off, we identify files that we'd like to jump to conveniently. - *** This very file We begin by defining a function to open this very file. @@ -1498,7 +1524,6 @@ We begin by defining a function to open this very file. (find-file org-agenda-diary-file)) #+END_SRC - ** TODO Export to PDF This series of ~quick-export~ functions have one objective: harmonize @@ -1609,7 +1634,6 @@ PDF. The binding is defined in Section [[Export to PDF]]. #+END_SRC - **** TODO COMMENT For Org mode, specifically #+BEGIN_SRC emacs-lisp :tangle yes @@ -1626,13 +1650,11 @@ PDF. The binding is defined in Section [[Export to PDF]]. (newline)))) #+END_SRC - ** Smart quitting :PROPERTIES: :test: t :END: - *** Window #+BEGIN_SRC emacs-lisp :tangle yes @@ -1655,6 +1677,7 @@ PDF. The binding is defined in Section [[Export to PDF]]. (save-buffers-kill-terminal))) #+END_SRC + * Editing preferences These customizations enhance editor usability. They also encompass @@ -1911,6 +1934,7 @@ Disable minibuffer scroll bar. (set-window-scroll-bars (minibuffer-window) nil nil) #+END_SRC + * Themes # This is just another comment. @@ -2109,6 +2133,7 @@ From [[https://en.wikipedia.org/wiki/Claude_Garamond]] ** TODO ~minimal~ + * Late setup At this point, our editor is almost ready to run. Phew! All that's @@ -2127,12 +2152,14 @@ the result of our profiling. (profiler-report) #+END_SRC + * Conclusion In this configuration file, we described a series of customization steps taken to make Emacs more palatable to modern word processors users. + * Local files variables :PROPERTIES: :UNNUMBERED: t -- cgit v1.2.3