From 8b711333bad01a8f834bcc42db3f09b67dce414b Mon Sep 17 00:00:00 2001 From: Kore Francis Date: Fri, 2 Apr 2021 23:15:38 +0300 Subject: [PATCH] config: change to literate programming --- config.el | 164 +++++++++---------------- config.org | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++ init.el | 8 +- 3 files changed, 408 insertions(+), 112 deletions(-) create mode 100644 config.org diff --git a/config.el b/config.el index 25f79c6..932e500 100644 --- a/config.el +++ b/config.el @@ -1,61 +1,17 @@ -;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- - -;; Place your private configuration here! Remember, you do not need to run 'doom -;; sync' after modifying this file! - - -;; Some functionality uses this to identify you, e.g. GPG configuration, email -;; clients, file templates and snippets. (setq user-full-name "Francis Kore" user-mail-address "me@korefrancis.com") -;; Doom exposes five (optional) variables for controlling fonts in Doom. Here -;; are the three important ones: -;; -;; + `doom-font' -;; + `doom-variable-pitch-font' -;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for -;; presentations or streaming. -;; -;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd -;; font string. You generally only need these two: ;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light) ;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) -;; There are two ways to load a theme. Both assume the theme is installed and -;; available. You can either set `doom-theme' or manually load a theme with the -;; `load-theme' function. This is the default: (setq doom-theme 'doom-one) -;; If you use `org' and don't want your org files in the default location below, -;; change `org-directory'. It must be set before org loads! (setq org-directory "~/org/") (setq deft-directory "~/org/deft") (setq org-superstar-headline-bullets-list '("⁖" "◉" "○" "✸" "✿")) -;; This determines the style of line numbers in effect. If set to `nil', line -;; numbers are disabled. For relative line numbers, set this to `relative'. (setq display-line-numbers-type t) - -;; Here are some additional functions/macros that could help you configure Doom: -;; -;; - `load!' for loading external *.el files relative to this one -;; - `use-package!' for configuring packages -;; - `after!' for running code after a package has loaded -;; - `add-load-path!' for adding directories to the `load-path', relative to -;; this file. Emacs searches the `load-path' when you load packages with -;; `require' or `use-package'. -;; - `map!' for binding new keys -;; -;; To get information about any of these functions/macros, move the cursor over -;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). -;; This will open documentation for it, including demos of how they are used. -;; -;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how -;; they are implemented. - -;; this controls the color of bold, italic, underline, verbatim, strikethrough (setq org-emphasis-alist '(("*" (bold :slant italic :weight black )) ;; this make bold both italic and bold, but not color change ("/" (italic :foreground "dark salmon" )) ;; italic text, the text will be "dark salmon" @@ -64,27 +20,21 @@ ("~" (:background "PaleGreen1" :foreground "dim gray" )) ("+" (:strike-through nil :foreground "dark orange" )))) -(setq org-hide-emphasis-markers t) ;; hides the emphasis markers -;; org-roam-server - (setq org-roam-server-host "127.0.0.1" - org-roam-server-port 8080 - org-roam-server-authenticate nil - org-roam-server-export-inline-images t - org-roam-server-serve-files nil - org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") - org-roam-server-network-poll t - org-roam-server-network-arrows nil - org-roam-server-network-label-truncate t - org-roam-server-network-label-truncate-length 60 - org-roam-server-network-label-wrap-length 20) +(setq org-hide-emphasis-markers t) ;; hides the emphasis markers -(setq ispell-program-name "aspell") -(setq ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")) -(setq spell-fu-directory "~/.config/+STORE/dictionary") ;; Please create this directory manually. -(setq ispell-personal-dictionary "~/.config/+STORE/dictionary/.pws") +(setq org-roam-server-host "127.0.0.1" + org-roam-server-port 8080 + org-roam-server-authenticate nil + org-roam-server-export-inline-images t + org-roam-server-serve-files nil + org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") + org-roam-server-network-poll t + org-roam-server-network-arrows nil + org-roam-server-network-label-truncate t + org-roam-server-network-label-truncate-length 60 + org-roam-server-network-label-wrap-length 20) -(setq writeroom-fullscreen-effect t) (setq org-fancy-priorities-list '((?A . "❗") (?B . "⬆") (?C . "⬇") @@ -95,6 +45,50 @@ (?4 . "☕") (?I . "Important"))) +(after! (:all org pdf-view)) + +(setq + org-noter-notes-window-location 'other-frame + org-noter-always-create-frame nil + org-noter-hide-other nil + org-noter-notes-search-path (list org-directory)) + +(use-package! org-super-agenda + :after org-agenda + :init + (setq org-super-agenda-groups '((:name "Today" + :time-grid t + :scheduled today) + (:name "Due Today" + :deadline today) + (:name "Important" + :priority "❗") + (:name "Overdue" + :deadline past) + (:name "Due Soon" + :deadline future) + (:name "Big Outcomes" + :tag "bo"))) + :config + (org-super-agenda-mode)) + +(setq ispell-program-name "aspell") +(setq ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")) +(setq spell-fu-directory "~/.config/+STORE/dictionary") ;; Please create this directory manually. +(setq ispell-personal-dictionary "~/.config/+STORE/dictionary/.pws") + +(setq writeroom-fullscreen-effect t) + +(setq + global-whitespace-mode t + whitespace-style '(face tabs tab-mark spaces space-mark trailing lines-tail newline newline-mark) + whitespace-display-mappings '( + (space-mark ?\ [?\u00B7] [?.]) + (space-mark ?\xA0 [?\u00A4] [?_]) + (newline-mark ?\n [?¬ ?\n]) + (tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t]))) + +(global-whitespace-mode +1) (setq +zen-text-scale 0.6) @@ -124,7 +118,6 @@ org-superstar-remove-leading-stars -org-superstar-remove-leading-stars) (org-superstar-restart)))))) - (use-package! nov :mode ("\\.epub\\'" . nov-mode) :config @@ -191,7 +184,6 @@ (add-hook 'nov-mode-hook #'+nov-mode-setup)) - (after! treemacs (defvar treemacs-file-ignore-extensions '() "File extension which `treemacs-ignore-filter' will ensure are ignored") @@ -241,54 +233,10 @@ "*/_region_.log" "*/_region_.tex")) - -(use-package! org-super-agenda - :after org-agenda - :init - (setq org-super-agenda-groups '((:name "Today" - :time-grid t - :scheduled today) - (:name "Due Today" - :deadline today) - (:name "Important" - :priority "❗") - (:name "Overdue" - :deadline past) - (:name "Due Soon" - :deadline future) - (:name "Big Outcomes" - :tag "bo"))) - :config - (org-super-agenda-mode)) -;; Configure Zen mode -;; AAutomatically go to full screen mode when activated - (setq writeroom-fullscreen-effect t) - -(setq - global-whitespace-mode t - whitespace-style '(face tabs tab-mark spaces space-mark trailing lines-tail newline newline-mark) - whitespace-display-mappings '( - (space-mark ?\ [?\u00B7] [?.]) - (space-mark ?\xA0 [?\u00A4] [?_]) - (newline-mark ?\n [?¬ ?\n]) - (tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t]))) - -(global-whitespace-mode +1) - -;; Setup spray for reading (map! :leader :desc "Change to spray mode" "" #'spray-mode) -(after! (:all org pdf-view)) - -(setq - org-noter-notes-window-location 'other-frame - org-noter-always-create-frame nil - org-noter-hide-other nil - org-noter-notes-search-path (list org-directory)) - - (use-package! mixed-pitch :hook (org-mode . mixed-pitch-mode) :config diff --git a/config.org b/config.org new file mode 100644 index 0000000..a2fdaf2 --- /dev/null +++ b/config.org @@ -0,0 +1,348 @@ +#+TITLE: Config + + +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + +* Identity +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. +#+begin_src emacs-lisp +(setq user-full-name "Francis Kore" + user-mail-address "me@korefrancis.com") +#+end_src + +* Doom +** Fonts +;; Doom exposes five (optional) variables for controlling fonts in Doom. Here +;; are the three important ones: +;; +;; + `doom-font' +;; + `doom-variable-pitch-font' +;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; +;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd +;; font string. You generally only need these two: +#+begin_src emacs-lisp + +;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) + +#+end_src +** Theme + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: + +#+begin_src emacs-lisp +(setq doom-theme 'doom-one) +#+end_src + +* Org +** Basic +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +#+begin_src emacs-lisp +(setq org-directory "~/org/") +(setq deft-directory "~/org/deft") +(setq org-superstar-headline-bullets-list '("⁖" "◉" "○" "✸" "✿")) +#+end_src + +** Line Number +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. + +#+begin_src emacs-lisp +(setq display-line-numbers-type t) +#+end_src + + +;; Here are some additional functions/macros that could help you configure Doom: +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. + +** Org Emphasis +;; this controls the color of bold, italic, underline, verbatim, strikethrough +#+begin_src emacs-lisp +(setq org-emphasis-alist + '(("*" (bold :slant italic :weight black )) ;; this make bold both italic and bold, but not color change + ("/" (italic :foreground "dark salmon" )) ;; italic text, the text will be "dark salmon" + ("_" underline :foreground "cyan" ) ;; underlined text, color is "cyan" + ("=" (:background "snow1" :foreground "deep slate blue" )) ;; background of text is "snow1" and text is "deep slate blue" + ("~" (:background "PaleGreen1" :foreground "dim gray" )) + ("+" (:strike-through nil :foreground "dark orange" )))) + + +(setq org-hide-emphasis-markers t) ;; hides the emphasis markers +#+end_src + +** Org Roam Server +#+begin_src emacs-lisp + (setq org-roam-server-host "127.0.0.1" + org-roam-server-port 8080 + org-roam-server-authenticate nil + org-roam-server-export-inline-images t + org-roam-server-serve-files nil + org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") + org-roam-server-network-poll t + org-roam-server-network-arrows nil + org-roam-server-network-label-truncate t + org-roam-server-network-label-truncate-length 60 + org-roam-server-network-label-wrap-length 20) +#+end_src + +** Fancy Priorities +#+begin_src emacs-lisp +(setq org-fancy-priorities-list '((?A . "❗") + (?B . "⬆") + (?C . "⬇") + (?D . "☕") + (?1 . "⚡") + (?2 . "⮬") + (?3 . "⮮") + (?4 . "☕") + (?I . "Important"))) +#+end_src + +** Org Noter +#+begin_src emacs-lisp +(after! (:all org pdf-view)) + +(setq + org-noter-notes-window-location 'other-frame + org-noter-always-create-frame nil + org-noter-hide-other nil + org-noter-notes-search-path (list org-directory)) +#+end_src + +** Super-Agenda +#+begin_src emacs-lisp +(use-package! org-super-agenda + :after org-agenda + :init + (setq org-super-agenda-groups '((:name "Today" + :time-grid t + :scheduled today) + (:name "Due Today" + :deadline today) + (:name "Important" + :priority "❗") + (:name "Overdue" + :deadline past) + (:name "Due Soon" + :deadline future) + (:name "Big Outcomes" + :tag "bo"))) + :config + (org-super-agenda-mode)) +#+end_src +* Spelling +#+begin_src emacs-lisp +(setq ispell-program-name "aspell") +(setq ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")) +(setq spell-fu-directory "~/.config/+STORE/dictionary") ;; Please create this directory manually. +(setq ispell-personal-dictionary "~/.config/+STORE/dictionary/.pws") +#+end_src + +* Writeroom + +Configure Zen mode +Automatically go to full screen mode when activated + +#+begin_src emacs-lisp +(setq writeroom-fullscreen-effect t) + +(setq + global-whitespace-mode t + whitespace-style '(face tabs tab-mark spaces space-mark trailing lines-tail newline newline-mark) + whitespace-display-mappings '( + (space-mark ?\ [?\u00B7] [?.]) + (space-mark ?\xA0 [?\u00A4] [?_]) + (newline-mark ?\n [?¬ ?\n]) + (tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t]))) + +(global-whitespace-mode +1) + +(setq +zen-text-scale 0.6) + +(after! writeroom-mode + (add-hook 'writeroom-mode-hook + (defun +zen-cleaner-org () + (when (and (eq major-mode 'org-mode) writeroom-mode) + (setq-local -display-line-numbers display-line-numbers + display-line-numbers nil) + (setq-local -org-indent-mode org-indent-mode) + (org-indent-mode -1) + (when (featurep 'org-superstar) + (setq-local -org-superstar-headline-bullets-list org-superstar-headline-bullets-list + ;; org-superstar-headline-bullets-list '("🙐" "🙑" "🙒" "🙓" "🙔" "🙕" "🙖" "🙗") + org-superstar-headline-bullets-list '("🙘" "🙙" "🙚" "🙛") + -org-superstar-remove-leading-stars org-superstar-remove-leading-stars + org-superstar-remove-leading-stars t) + (org-superstar-restart))))) + (add-hook 'writeroom-mode-disable-hook + (defun +zen-dirty-org () + (when (eq major-mode 'org-mode) + (setq-local display-line-numbers -display-line-numbers) + (when -org-indent-mode + (org-indent-mode 1)) + (when (featurep 'org-superstar) + (setq-local org-superstar-headline-bullets-list -org-superstar-headline-bullets-list + org-superstar-remove-leading-stars -org-superstar-remove-leading-stars) + (org-superstar-restart)))))) +#+end_src + +* Nov Mode +#+begin_src emacs-lisp +(use-package! nov + :mode ("\\.epub\\'" . nov-mode) + :config + (map! :map nov-mode-map + :n "RET" #'nov-scroll-up) + + (defun doom-modeline-segment--nov-info () + (concat + " " + (propertize + (cdr (assoc 'creator nov-metadata)) + 'face 'doom-modeline-project-parent-dir) + " " + (cdr (assoc 'title nov-metadata)) + " " + (propertize + (format "%d/%d" + (1+ nov-documents-index) + (length nov-documents)) + 'face 'doom-modeline-info))) + + (advice-add 'nov-render-title :override #'ignore) + + (defun +nov-mode-setup () + (face-remap-add-relative 'variable-pitch + :family "Merriweather" + :height 1.4 + :width 'semi-expanded) + (face-remap-add-relative 'default :height 1.3) + (setq-local line-spacing 0.2 + next-screen-context-lines 4 + shr-use-colors nil) + (require 'visual-fill-column nil t) + (setq-local visual-fill-column-center-text t + visual-fill-column-width 80 + nov-text-width 80) + (visual-fill-column-mode 1) + (hl-line-mode -1) + + (add-to-list '+lookup-definition-functions #'+lookup/dictionary-definition) + + (setq-local mode-line-format + `((:eval + (doom-modeline-segment--workspace-name)) + (:eval + (doom-modeline-segment--window-number)) + (:eval + (doom-modeline-segment--nov-info)) + ,(propertize + " %P " + 'face 'doom-modeline-buffer-minor-mode) + ,(propertize + " " + 'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive) + 'display `((space + :align-to + (- (+ right right-fringe right-margin) + ,(* (let ((width (doom-modeline--font-width))) + (or (and (= width 1) 1) + (/ width (frame-char-width) 1.0))) + (string-width + (format-mode-line (cons "" '(:eval (doom-modeline-segment--major-mode)))))))))) + (:eval (doom-modeline-segment--major-mode))))) + + (add-hook 'nov-mode-hook #'+nov-mode-setup)) +#+end_src + +* Treemacs +#+begin_src emacs-lisp +(after! treemacs + (defvar treemacs-file-ignore-extensions '() + "File extension which `treemacs-ignore-filter' will ensure are ignored") + (defvar treemacs-file-ignore-globs '() + "Globs which will are transformed to `treemacs-file-ignore-regexps' which `treemacs-ignore-filter' will ensure are ignored") + (defvar treemacs-file-ignore-regexps '() + "RegExps to be tested to ignore files, generated from `treeemacs-file-ignore-globs'") + (defun treemacs-file-ignore-generate-regexps () + "Generate `treemacs-file-ignore-regexps' from `treemacs-file-ignore-globs'" + (setq treemacs-file-ignore-regexps (mapcar 'dired-glob-regexp treemacs-file-ignore-globs))) + (if (equal treemacs-file-ignore-globs '()) nil (treemacs-file-ignore-generate-regexps)) + (defun treemacs-ignore-filter (file full-path) + "Ignore files specified by `treemacs-file-ignore-extensions', and `treemacs-file-ignore-regexps'" + (or (member (file-name-extension file) treemacs-file-ignore-extensions) + (let ((ignore-file nil)) + (dolist (regexp treemacs-file-ignore-regexps ignore-file) + (setq ignore-file (or ignore-file (if (string-match-p regexp full-path) t nil))))))) + (add-to-list 'treemacs-ignored-file-predicates #'treemacs-ignore-filter)) + +(setq treemacs-file-ignore-extensions + '(;; LaTeX + "aux" + "ptc" + "fdb_latexmk" + "fls" + "synctex.gz" + "toc" + ;; LaTeX - glossary + "glg" + "glo" + "gls" + "glsdefs" + "ist" + "acn" + "acr" + "alg" + ;; LaTeX - pgfplots + "mw" + ;; LaTeX - pdfx + "pdfa.xmpi" + )) +(setq treemacs-file-ignore-globs + '(;; LaTeX + "*/_minted-*" + ;; AucTeX + "*/.auctex-auto" + "*/_region_.log" + "*/_region_.tex")) +#+end_src + +* Spray +#+begin_src emacs-lisp +(map! :leader + :desc "Change to spray mode" + "" #'spray-mode) +#+end_src + + +* Mixed Pitch +#+begin_src emacs-lisp +(use-package! mixed-pitch + :hook (org-mode . mixed-pitch-mode) + :config + (setq mixed-pitch-set-heigth t) + (set-face-attribute 'variable-pitch nil :height 180)) +#+end_src diff --git a/init.el b/init.el index 97deedd..dff7a0f 100644 --- a/init.el +++ b/init.el @@ -30,7 +30,7 @@ doom ; what makes DOOM look the way it does doom-dashboard ; a nifty splash screen for Emacs doom-quit ; DOOM quit-message prompts when you quit Emacs - ;;(emoji +unicode) ; 🙂 + (emoji +ascii +github +unicode) ; 🙂 ;;fill-column ; a `fill-column' indicator hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra @@ -88,7 +88,7 @@ ;;ansible ;;debugger ; FIXME stepping through code, to help you add bugs ;;direnv - ;;docker + docker ;;editorconfig ; let someone else argue about tabs vs spaces ;;ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) @@ -112,7 +112,7 @@ :lang ;;agda ; types of types of types of types... - ;;cc ; C/C++/Obj-C madness + cc ; C/C++/Obj-C madness ;;clojure ; java with a lisp ;;common-lisp ; if you've seen one lisp, you've seen them all coq ; proofs-as-programs @@ -181,5 +181,5 @@ ;;twitter ; twitter client https://twitter.com/vnought :config - ;;literate + literate (default +bindings +smartparens))