From f4b99662172402beb919ae870b487048f357173c Mon Sep 17 00:00:00 2001 From: Blendoit Date: Sun, 18 Oct 2020 11:11:17 -0700 Subject: Start work on one-click workflows. --- .gitignore | 1 + README.org | 4 +- README.pdf | Bin 102091 -> 43612 bytes custom.el | 66 +++++++++ init-custom.el | 66 --------- init.el | 14 +- smart-documents.org | 295 +++++++++++++++++++++++++++------------- smart-documents.pdf | Bin 107625 -> 112499 bytes templates/documents/general.org | 4 +- themes/blendoit-light-theme.el | 4 +- 10 files changed, 276 insertions(+), 178 deletions(-) create mode 100644 custom.el delete mode 100644 init-custom.el diff --git a/.gitignore b/.gitignore index 6007841..058ed0c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ smart-documents.el* # Misc .org-id-locations +async-bytecomp.log \ No newline at end of file diff --git a/README.org b/README.org index 1858144..159e679 100644 --- a/README.org +++ b/README.org @@ -1,7 +1,7 @@ #+TITLE: GNU Emacs Configuration #+AUTHOR: Marius Peter -#+DATE: <2020-07-23 Thu> -#+SETUPFILE: ~/org/templates/documents/personal.org +#+DATE: <2020-10-13 Tue> +#+SETUPFILE: ~/.emacs.d/templates/documents/general.org * Installation diff --git a/README.pdf b/README.pdf index 192f0b6..d7758b9 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/custom.el b/custom.el new file mode 100644 index 0000000..0fdac6a --- /dev/null +++ b/custom.el @@ -0,0 +1,66 @@ +;;; init-custom.el --- Where Emacs saves gui-settable customizations. + +;;; Commentary: + +;;; Code: + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ansi-color-names-vector + ["#3F3F3F" "#CC9393" "#7F9F7F" "#F0DFAF" "#8CD0D3" "#DC8CC3" "#93E0E3" "#DCDCCC"]) + '(company-quickhelp-color-background "#4F4F4F") + '(company-quickhelp-color-foreground "#DCDCCC") + '(custom-enabled-themes nil) + '(custom-safe-themes + '("8fb0949f4229860cf19034b924eb99c664327c9250fb92a2633bdf4b4abaf060" "c3a2a37e84e474c73c2b468553f9b5b73341419f72bbc1f4a4bcc1230ef86c85" "6495716176be0ced4142593b94a410135e0b373b686a869637824260d2f1ca11" "4467b1c8d7cc78fe98345c9c63eb62cf37844dc6868630add365494bde455715" "faeef63cb31f796b4bdf22f38e614934ab34d7deacaeb89b3e9cccf70aac5a85" "370fb305168fea1614535dc9ca30f496918eaca754b6c8969dd77fa872bec695" "e9f0c0c3397d07eb1c6c3551d67fd151e24bc6d72ec678841623ed572677c97a" "5c32236ef318adafe4102f627f330fa8f448046dfd838eef5cc09c7f682cf71f" "e343fecfb8d681186d594002c9b44ce48c2061599d7e4ec635cf1ca2a277a47a" "302dc61dc55600c7424f945dce9e74fba7df19f4a7bfb72aefd93193fa82ede4" "58f1f85248ba913387d1e7ed02a867161b315cfb5acff0c234e013ffd2577d22" "a256abf590bbc3257cc11d91a312e9fe8487dc1b95a5b7b732dd2f96a7fe5a45" "30368d6195cae9298304e6ac0534b90c85b1655965f1206c5c624270f0f46002" "311aa5df3223b5b4a7c638aad3befb4de9c7f46360d52acd1fa2cd2232b1dcbd" default)) + '(fci-rule-color "#383838") + '(fringe-mode 0 nil (fringe)) + '(indicate-empty-lines t) + '(line-number-mode t) + '(message-required-headers '((optional . References) From)) + '(nrepl-message-colors + '("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")) + '(org-agenda-diary-file "~/org/PERSONAL/diary/diary.org") + '(org-agenda-files '("~/org/PERSONAL/diary/diary.org")) + '(org-agenda-include-diary t) + '(org-agenda-skip-scheduled-if-deadline-is-shown 'not-today) + '(org-log-done 'time) + '(org-startup-align-all-tables t) + '(package-selected-packages + '(dashboard undo-tree hungry-delete smooth-scroll smooth-scrolling delight yasnippet-snippets yasnippet org-sticky-header awesome-tab tabbar-ruler tabbar-mode linum-relative dumb-jump csv-mode rainbow-mode org-mouse projectile minimap gnuplot ledger-mode company-mode wombat-theme wombar-theme which-key srefactor-lisp srefactor all-the-icons flycheck ibuffer-sidebar pdf-tools magit rainbow-delimiters smartparens mixed-pitch org-bullets use-package tabbar powerline ivy-hydra flatui-theme evil counsel company benchmark-init)) + '(pdf-view-midnight-colors '("#DCDCCC" . "#383838")) + '(save-place-mode t) + '(send-mail-function 'smtpmail-send-it) + '(smtpmail-smtp-server "smtp.gmail.com") + '(smtpmail-smtp-service 587) + '(vc-annotate-background "#2B2B2B") + '(vc-annotate-color-map + '((20 . "#BC8383") + (40 . "#CC9393") + (60 . "#DFAF8F") + (80 . "#D0BF8F") + (100 . "#E0CF9F") + (120 . "#F0DFAF") + (140 . "#5F7F5F") + (160 . "#7F9F7F") + (180 . "#8FB28F") + (200 . "#9FC59F") + (220 . "#AFD8AF") + (240 . "#BFEBBF") + (260 . "#93E0E3") + (280 . "#6CA0A3") + (300 . "#7CB8BB") + (320 . "#8CD0D3") + (340 . "#94BFF3") + (360 . "#DC8CC3"))) + '(vc-annotate-very-old-color "#DC8CC3") + '(window-divider-default-places t)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/init-custom.el b/init-custom.el deleted file mode 100644 index 3cbdb6e..0000000 --- a/init-custom.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; init-custom.el --- Where Emacs saves gui-settable customizations. - -;;; Commentary: - -;;; Code: - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(ansi-color-names-vector - ["#3F3F3F" "#CC9393" "#7F9F7F" "#F0DFAF" "#8CD0D3" "#DC8CC3" "#93E0E3" "#DCDCCC"]) - '(company-quickhelp-color-background "#4F4F4F") - '(company-quickhelp-color-foreground "#DCDCCC") - '(custom-enabled-themes nil) - '(custom-safe-themes - '("6495716176be0ced4142593b94a410135e0b373b686a869637824260d2f1ca11" "4467b1c8d7cc78fe98345c9c63eb62cf37844dc6868630add365494bde455715" "faeef63cb31f796b4bdf22f38e614934ab34d7deacaeb89b3e9cccf70aac5a85" "370fb305168fea1614535dc9ca30f496918eaca754b6c8969dd77fa872bec695" "e9f0c0c3397d07eb1c6c3551d67fd151e24bc6d72ec678841623ed572677c97a" "5c32236ef318adafe4102f627f330fa8f448046dfd838eef5cc09c7f682cf71f" "e343fecfb8d681186d594002c9b44ce48c2061599d7e4ec635cf1ca2a277a47a" "302dc61dc55600c7424f945dce9e74fba7df19f4a7bfb72aefd93193fa82ede4" "58f1f85248ba913387d1e7ed02a867161b315cfb5acff0c234e013ffd2577d22" "a256abf590bbc3257cc11d91a312e9fe8487dc1b95a5b7b732dd2f96a7fe5a45" "30368d6195cae9298304e6ac0534b90c85b1655965f1206c5c624270f0f46002" "311aa5df3223b5b4a7c638aad3befb4de9c7f46360d52acd1fa2cd2232b1dcbd" default)) - '(fci-rule-color "#383838") - '(fringe-mode 0 nil (fringe)) - '(indicate-empty-lines t) - '(line-number-mode t) - '(message-required-headers '((optional . References) From)) - '(nrepl-message-colors - '("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")) - '(org-agenda-diary-file "~/org/PERSONAL/diary/diary.org") - '(org-agenda-files '("~/org/PERSONAL/diary/diary.org")) - '(org-agenda-include-diary t) - '(org-agenda-skip-scheduled-if-deadline-is-shown 'not-today) - '(org-log-done 'time) - '(org-startup-align-all-tables t) - '(package-selected-packages - '(hungry-delete smooth-scroll smooth-scrolling delight yasnippet-snippets yasnippet org-sticky-header awesome-tab tabbar-ruler tabbar-mode linum-relative dumb-jump csv-mode rainbow-mode org-mouse projectile minimap gnuplot ledger-mode company-mode wombat-theme wombar-theme which-key srefactor-lisp srefactor all-the-icons flycheck ibuffer-sidebar pdf-tools magit rainbow-delimiters smartparens mixed-pitch org-bullets use-package tabbar powerline ivy-hydra flatui-theme evil counsel company benchmark-init)) - '(pdf-view-midnight-colors '("#DCDCCC" . "#383838")) - '(save-place-mode t) - '(send-mail-function 'smtpmail-send-it) - '(smtpmail-smtp-server "smtp.gmail.com") - '(smtpmail-smtp-service 587) - '(vc-annotate-background "#2B2B2B") - '(vc-annotate-color-map - '((20 . "#BC8383") - (40 . "#CC9393") - (60 . "#DFAF8F") - (80 . "#D0BF8F") - (100 . "#E0CF9F") - (120 . "#F0DFAF") - (140 . "#5F7F5F") - (160 . "#7F9F7F") - (180 . "#8FB28F") - (200 . "#9FC59F") - (220 . "#AFD8AF") - (240 . "#BFEBBF") - (260 . "#93E0E3") - (280 . "#6CA0A3") - (300 . "#7CB8BB") - (320 . "#8CD0D3") - (340 . "#94BFF3") - (360 . "#DC8CC3"))) - '(vc-annotate-very-old-color "#DC8CC3") - '(window-divider-default-places t)) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) diff --git a/init.el b/init.el index 81157c0..695891b 100644 --- a/init.el +++ b/init.el @@ -6,17 +6,15 @@ ;;; Code: ;; First of all, we indicate the path to our literate configuration file. -(setq my/literate-config (concat user-emacs-directory "smart-documents.org")) +(setq my/literate-config (concat user-emacs-directory "smart-documents")) ;; Emacs will startup faster next time, because it will load ;; a byte-compiled version of our literate configuration file. -(cond ((file-exists-p (concat (file-name-sans-extension my/literate-config) ".elc")) - (load (concat (file-name-sans-extension my/literate-config) ".elc"))) - ((file-exists-p (concat (file-name-sans-extension my/literate-config) ".el")) - (load (concat (file-name-sans-extension my/literate-config) ".el"))) - ((file-exists-p my/literate-config) - (org-babel-load-file my/literate-config)) - (t (message "There appears to be no literate configuration file. Reinstall?"))) +(cond ((file-exists-p (concat my/literate-config ".el")) + (load my/literate-config)) + ((file-exists-p (concat my/literate-config ".org")) + (org-babel-load-file (concat my/literate-config ".org"))) + (t (message "No literate configuration file detected."))) (provide 'init) diff --git a/smart-documents.org b/smart-documents.org index f62c39d..eb7097a 100644 --- a/smart-documents.org +++ b/smart-documents.org @@ -11,18 +11,25 @@ # By default, Org Babel does not tangle blocks. #+PROPERTY: header-args :tangle yes +# Beautiful font pairing #+LATEX_HEADER: \setmainfont{urw gothic} +#+LATEX_HEADER: \setmonofont{hermit} #+LATEX: \begin{abstract} The idea of /Smart Documents/ came to me as I was reflecting on how to improve -the document production process in my workplace. I really wanted to improve the -way we produced documents. - +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 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 /Smart Document/ itself! #+LATEX: \end{abstract} * Introduction -GNU Emacs is most often used as a text editor. The utmost level of +GNU Emacs is most often used as a text editor. It would be unfair to say it is +just that, because Emacs is capable of so much more. The utmost level of customization is afforded by enabling the user to rewrite /any/ part of the source code and observe the editor's modified behaviour in real time. Since its inception in 1984, GNU Emacs has grown to be much more than a full-featured, @@ -41,25 +48,37 @@ we ensured ~use-package~ is working properly.[fn::For more information on the detailed steps Emacs takes upon starting, refer to [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html]].] -Customizing Emacs goes far, far beyond this document---feel free to experiment -and discover. Here are three commands that will help you understand all the -symbols in this file, if you are browsing this paper within Emacs itself: +Customizing Emacs goes far, far beyond rewriting sections of this +document---feel free to experiment and discover. Here are three commands that +will help you understand all the symbols in this file, if you are browsing this +paper within Emacs itself: - ~C-h f~ describe function - ~C-h v~ describe variable - ~C-h k~ describe key -When Emacs first starts up, it looks for the following files in order and -attempts to load the contents of the first existing file. From the manual: - * TODO First-time setup +The following code blocks are normally evaluated once---upon starting Emacs for +the first time. + ** TODO User details -The advantage of working with /Smart Documents/ is that they can automatically +One advantage of working with /Smart Documents/ is that they can automatically be populated with our details in the header, footer, or other appropriate element. +#+NAME: user-details-get +#+BEGIN_SRC emacs-lisp +(defun my/user-details-get () +"Get user details." + (setq user-full-name (read-string "Enter full user name:")) + (setq user-mail-address (read-string "Enter user e-mail address:")) + (message "Successfully captured user details.")) +#+END_SRC + + + #+NAME: user-details #+BEGIN_SRC emacs-lisp (defun my/tokenize-user-details () @@ -69,8 +88,7 @@ element. (unless (file-exists-p (concat user-emacs-directory "meta/user-details")) - (setq user-full-name (read-string "Enter full user name:")) - (setq user-mail-address (read-string "Enter user e-mail address:")) + (setq user-details '(user-full-name user-mail-address)) (append-to-file "Foobar\n" nil "~/.emacs.d/meta/foobar")) @@ -90,7 +108,7 @@ https://git-scm.com/download/win] * Early setup -** The first file to load, =early-init.el= +** The first file to load This is the very first user-editable file loaded by Emacs.[fn::This feature became available in version 27.1.] In it, we disable GUI elements that would @@ -115,7 +133,7 @@ otherwise be loaded and displayed once Emacs is ready to accept user input. (my/create-early-init-file)) #+END_SRC -** The second file to load, =init.el= +** The second file to load #+BEGIN_QUOTE Traditionally, file =~/.emacs= is used as the init file, although Emacs also @@ -163,30 +181,19 @@ Makes opening emacs faster for following instances. ; (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) #+END_SRC -** Customization shortcuts +** Jumping to this file -We begin by defining a user shortcut to this very file. We load this as early as -possible, this facilitates debugging. +We begin by defining a function to open this very file. #+NAME: shortcut-config #+BEGIN_SRC emacs-lisp (defun my/find-literate-config () "Jump to this very file." (interactive) - (find-file my/literate-config)) - - (global-set-key (kbd "C-c c") 'my/find-literate-config) -#+END_SRC - -Now, different shortcuts for other customization actions: - -#+NAME: shortcuts-customization -#+BEGIN_SRC emacs-lisp - (global-set-key (kbd "C-c v") 'customize-variable) - (global-set-key (kbd "C-c f") 'customize-face) + (find-file (concat my/literate-config ".org"))) #+END_SRC -** Locations +** Meta-files In this section, we'll be tidying up the =.emacs.d/= directory---by default, many Emacs packages create files useful for themselves in our @@ -202,18 +209,6 @@ our meta-files together: (setq my/meta-files-location (concat user-emacs-directory "meta/")) #+END_SRC -*** Custom file - -Load settings created automatically by GNU Emacs Custom. (For example, any -clickable option/toggle is saved here.) Useful for fooling around with ~M-x -customize-group ~. - -#+NAME: custom-file-location -#+BEGIN_SRC emacs-lisp - (setq custom-file (concat user-emacs-directory "init-custom.el")) - (load custom-file) -#+END_SRC - *** Recently visited files #+BEGIN_SRC emacs-lisp @@ -238,10 +233,21 @@ customize-group ~. "places")) #+END_SRC +*** Custom file + +Load settings created automatically by GNU Emacs Custom. (For example, any +clickable option/toggle is saved here.) Useful for fooling around with ~M-x +customize-group ~. + +#+NAME: custom-file-location +#+BEGIN_SRC emacs-lisp + (setq custom-file (concat user-emacs-directory "custom.el")) + (load custom-file) +#+END_SRC + ** Backups -Backups are so important that they should be described right after the shortcut -to this file. +Backups are very important! #+BEGIN_SRC emacs-lisp (setq backup-directory-alist `((".*" . ,temporary-file-directory)) @@ -279,7 +285,7 @@ GNU/Linux. Frame transparency increases when focus is lost. ** Secrets -The code containe din the =secrets.org= file is loaded by Emacs, but not +The code contained in the =secrets.org= file is loaded by Emacs, but not rendered in this PDF for the sake of privacy. It contains individually identifying information such as names and e-mail addresses, which are used to populate Org templates (Section [[~org-mode~]]). You need to create this @@ -289,50 +295,90 @@ populate Org templates (Section [[~org-mode~]]). You need to create this (org-babel-load-file "~/.emacs.d/secrets.org") #+END_SRC -* Global key bindings +* Keyboard shortcuts The following bindings strive to further enhance CUA mode.[fn::Common User Access. This is a term coined by IBM which has influenced user navigation cues -on all modern desktop OSes. From IBM's CUA, we get the =Ctrl-v= and =Ctrl-v= +on all modern desktop OSes. From IBM's CUA, we get the =Ctrl-c= and =Ctrl-v= keyboard shortcuts.] #+BEGIN_SRC emacs-lisp (cua-mode) #+END_SRC -** Keyboard navigation +What follows are the most useful keybindings, as well as the keybindings to the +functions we defined ourselves. It doesn't matter if we haven't defined the +functions themselves yet; Emacs will accept a keybinding for any symbol and +does not check if the symbol's function definition exists, until the keybinding +is pressed. -*** Saving a file +** Files + +*** Save a file #+BEGIN_SRC emacs-lisp (global-set-key (kbd "C-s") 'save-buffer) #+END_SRC -*** Opening a file +*** Open a file #+BEGIN_SRC emacs-lisp (global-set-key (kbd "C-o") 'find-file) #+END_SRC -*** Opening a recently visited file +*** List open files #+BEGIN_SRC emacs-lisp - (global-set-key (kbd "C-r") 'counsel-recentf) + (global-set-key (kbd "C-b") 'ivy-switch-buffer) #+END_SRC -*** Make only window +*** Open this very file + +(Function defined in Section [[Jumping to this file]]) #+BEGIN_SRC emacs-lisp - (global-set-key (kbd "C-`") 'delete-other-windows) + (global-set-key (kbd "C-c c") 'my/find-literate-config) #+END_SRC -*** Locating a file +*** Open a recently visited file + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-r") 'counsel-recentf) +#+END_SRC + +*** Locate a file #+BEGIN_SRC emacs-lisp (global-set-key (kbd "C-c l") 'counsel-locate) #+END_SRC -*** Closing window and quitting Emacs +*** Open the agenda + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-c a") 'org-agenda-list) +#+END_SRC + +*** Open the diary + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-c d") 'my/find-diary-file) +#+END_SRC + +** Windows + +*** Make new window + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-n") 'make-frame) +#+END_SRC + +*** Make only window + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-`") 'delete-other-windows) +#+END_SRC + +*** Close window and quit #+BEGIN_SRC emacs-lisp (defun my/delete-window-or-previous-buffer () @@ -350,7 +396,9 @@ The following bindings lead to more natural exit behaviors. (global-set-key (kbd "C-q") 'save-buffers-kill-terminal) #+END_SRC -** Mouse zoom +** Text display + +*** Zoom The typical binding on both GNU/Linux and MS Windows is adequate here: ~C-=~ to zoom in, ~C--~ to zoom out. @@ -363,6 +411,50 @@ It seems that starting with Emacs 27.1, Control + mousewheel works. (global-set-key (kbd "C-+") 'text-scale-increase) #+END_SRC +*** Select all the text + +CUA, CUA, CUA, always & forever. + +#+BEGIN_SRC emacs-lisp +(global-set-key (kbd "C-a") 'mark-whole-buffer) +#+END_SRC + +** Customizing the editor + +*** Customize a variable + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-c v") 'customize-variable) +#+END_SRC + +*** Customize a face + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-c f") 'customize-face) +#+END_SRC + +** TODO One-click workflows + +A major advantage of the Emacs document production system: arbitrarily +complicated functions can be assigned to very simple keybindings. This means we +can automate workflows up to a pretty absurd level. + +*** Export to PDF + +PDF is probably the most prevalent file format for sharing static documents. + +**** document + +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "C-p") 'my/org-quick-export) +#+END_SRC + +**** TODO presentation + +#+BEGIN_SRC emacs-lisp + +#+END_SRC + * Packages Packages are collections of =.el= files providing added functionality to Emacs. @@ -470,6 +562,9 @@ executed by the Org Babel backend. (ledger . t) (gnuplot . t) (latex . t))) + + (org-babel-do-load-languages + 'org-babel-load-languages '((C . t) (shell . t) (gnuplot . t))) #+END_SRC *** Prevent or warn on invisible edits @@ -485,14 +580,10 @@ for which the heading or body contain a matching =org-time-stamp=.[fn::An =org-time-stamp= can be inserted with ~C-c .~ (period)] #+BEGIN_SRC emacs-lisp - (global-set-key (kbd "C-c a") 'org-agenda-list) - - (defun my/find-diary-file () - "Load `org-agenda-diary-file'." - (interactive) - (find-file org-agenda-diary-file)) - - (global-set-key (kbd "C-c d") 'my/find-diary-file) +(defun my/find-diary-file () + "Load `org-agenda-diary-file'." + (interactive) + (find-file org-agenda-diary-file)) #+END_SRC *** Timestamps @@ -621,26 +712,9 @@ however cleaner to separate table of contents with the rest of the work. (setq org-latex-toc-command "\\tableofcontents\\clearpage") #+END_SRC - - The following makes =TODO= items appear red and =CLOSED= items appear green in Org's LaTeX exports. Very stylish, much flair! -*** TODO Export - -This creates a shorter binding for the most common Org export: Org \rightarrow -LaTeX \rightarrow PDF. - -#+BEGIN_SRC emacs-lisp - (defun my/org-quick-export () - "Org async export to PDF and open. - This basically reimplements `C-c C-e C-a l o'." - (interactive) - (org-open-file (org-latex-export-to-pdf))) - - (global-set-key (kbd "C-c e") 'my/org-quick-export) -#+END_SRC - ** TODO ~evil-mode~ Forgive me, for I have sinned. @@ -660,9 +734,10 @@ keybindings, visit [[https://hea-www.harvard.edu/~fine/Tech/vi.html]].] The following customizations open the doors to vastly increased typing speed and accuracy. -*** ~flycheck~ +*** Syntax checking -Syntax highlighting for Emacs. +We require a package to highlight syntax errors and warnings. The ~flycheck~ +package ensures we are aware of all our code's syntactical shortcomings. #+NAME: flycheck #+BEGIN_SRC emacs-lisp @@ -670,7 +745,7 @@ Syntax highlighting for Emacs. (global-flycheck-mode) #+END_SRC -*** TODO ~flyspell~ +*** Spelling #+NAME: flyspell #+BEGIN_SRC emacs-lisp @@ -680,18 +755,21 @@ Syntax highlighting for Emacs. *** Insert template from keyword -Thanks to yasnippet, we can type certain keywords, press =TAB=, and this will -automatically insert a text snippet. We may then navigate through the snippet -by using =TAB= (next field) and =SHIFT-TAB= (previous field). +Thanks to ~yasnippet~, we can type certain keywords, then press =TAB=, to +automatically insert a predefined text snippet. We can then navigate through +the snippet by using == (next field) and == (previous +field).[fn::== is synonymous with pressing shift-tab.] -For instance: Typing =src= then pressing =TAB= will expand the keyword to the +For instance: typing =src= then pressing =TAB= will expand the keyword to the following text: : #+BEGIN_SRC emacs-lisp : : #+END_SRC -We notice that emacs-lisp is highlighted---this is the first modifiable field. +We notice that emacs-lisp is highlighted---this is the first modifiable +field. Many clever programming tricks can be performed with ~yasnippet~ to save +us a ton of time with boilerplate text! #+NAME: yasnippet #+BEGIN_SRC emacs-lisp @@ -746,6 +824,10 @@ This enables us to better manage our =.git= projects. *** Jump to symbol's definition +~dumb-jump~ is a reliable symbol definition finder. It uses different matching +algorithms and heuristics to provide a very educated guess on the location of a +symbol's definition. + #+BEGIN_SRC emacs-lisp (use-package dumb-jump) (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) @@ -898,9 +980,26 @@ This highlights hexadecimal numbers which look like colors, in that same color. (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))) #+END_SRC +* One-click workflows + +In this section, we'll implement useful one-click workflows. + +*** TODO Export dialogue + +This reimplements the most common Org mode export: Org \rightarrow LaTeX +\rightarrow PDF. The binding is defined in Section [[Export to PDF]]. + +#+BEGIN_SRC emacs-lisp + (defun my/org-quick-export () + "Org async export to PDF and open. + This basically reimplements `C-c C-e C-a l o'." + (interactive) + (org-open-file (org-latex-export-to-pdf))) +#+END_SRC + * Editing preferences -These customizations enhance editor usability. They are not brought about +These customizations enhance editor usability. ** Editor @@ -916,7 +1015,7 @@ This is just a better default. Don't @ me. *** Recent files The keybinding for opening a recently visited file is described in paragraph -[[Opening a recently visited file]]. +[[Open a recently visited file]]. #+BEGIN_SRC emacs-lisp (recentf-mode 1) @@ -988,7 +1087,7 @@ Disable minibuffer scroll bar. * Themes -Without a carefully designed theme, our editor could become unusable. Thus, we +Without a carefully designed theme, our editor would become unusable. Thus, we describe two themes that were developed purposefully and iteratively. #+BEGIN_SRC emacs-lisp @@ -1085,15 +1184,15 @@ At this point, our editor is almost ready to run. Phew! All that's left to do is to prepare for the next startup, interrupt our profiling activities, and smartly store the result of our profiling. -** TODO Speeding up the next startup +** Speeding up the next startup #+BEGIN_SRC emacs-lisp (defun byte-compile-literate-config () "Byte compile our literate configuration file." - (delete-file (concat (file-name-sans-extension my/literate-config) ".elc")) - (org-babel-tangle-file my/literate-config) - (byte-compile-file (concat (file-name-sans-extension my/literate-config) ".el")) - (message "c'mon work fucker")) + (delete-file (concat my/literate-config ".elc")) + (delete-file (concat my/literate-config ".el")) + (org-babel-tangle-file (concat my/literate-config ".org")) + (byte-compile-file (concat my/literate-config ".el"))) (add-hook 'kill-emacs-hook 'byte-compile-literate-config) #+END_SRC diff --git a/smart-documents.pdf b/smart-documents.pdf index e9b8cec..2846f9c 100644 Binary files a/smart-documents.pdf and b/smart-documents.pdf differ diff --git a/templates/documents/general.org b/templates/documents/general.org index 4d51867..4a3cc56 100644 --- a/templates/documents/general.org +++ b/templates/documents/general.org @@ -16,8 +16,8 @@ #+LATEX_HEADER: \usepackage{lastpage} #+LATEX_HEADER: \usepackage{titling} -#+LATEX_HEADER: \usepackage{enumitem} -#+LATEX_HEADER: \setlist{noitemsep} +# #+LATEX_HEADER: \usepackage{enumitem} +# #+LATEX_HEADER: \setlist{noitemsep} # Required to reset numbering of table rows from table to table. #+LATEX_HEADER: \usepackage{etoolbox} diff --git a/themes/blendoit-light-theme.el b/themes/blendoit-light-theme.el index a2e8be1..3ba0154 100644 --- a/themes/blendoit-light-theme.el +++ b/themes/blendoit-light-theme.el @@ -1,5 +1,5 @@ (deftheme blendoit-light - "Created 2020-10-05.") + "Created 2020-10-10.") (custom-theme-set-faces 'blendoit-light @@ -76,7 +76,7 @@ '(org-checkbox ((t (:weight bold :inherit org-meta-line)))) '(org-todo ((t (:background "tomato" :foreground "White" :weight bold :height 1.2 :family "Hermit")))) '(org-done ((t (:background "ForestGreen" :foreground "White" :weight bold :height 1.2 :family "Hermit")))) - '(org-date ((t (:inherit org-tag)))) + '(org-date ((t (:foreground "steel blue" :family "Hermit")))) '(Info-quoted ((t (:inherit org-block)))) '(org-priority ((t (:weight bold :inherit org-meta-line)))) '(powerline-active1 ((t (:inherit mode-line :background "grey17" :foreground "white" :family "Hack")))) -- cgit v1.2.3