From 981ff3ce9a26c24ad5fd0a2cdfed33a015156edf Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Fri, 21 Dec 2018 21:19:05 -0500 Subject: [PATCH] [emacs] add page-break-lines and divide init up into pages corresponding to the current Org top-level headings --- .gitmodules | 3 ++ init.el | 43 ++++++++++++++++++++++++---- init.org | 67 ++++++++++++++++++++++++++++++++++++++++---- lib/page-break-lines | 1 + 4 files changed, 104 insertions(+), 10 deletions(-) create mode 160000 lib/page-break-lines diff --git a/.gitmodules b/.gitmodules index 72e0ae2..0ec969b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -208,6 +208,9 @@ [submodule "packed"] path = lib/packed url = git@github.com:emacscollective/packed.git +[submodule "page-break-lines"] + path = lib/page-break-lines + url = git@github.com:purcell/page-break-lines.git [submodule "pdf-tools"] path = lib/pdf-tools url = git@github.com:politza/pdf-tools.git diff --git a/init.el b/init.el index fbf2af1..b80e00f 100644 --- a/init.el +++ b/init.el @@ -1,4 +1,4 @@ -;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t ; eval: (view-mode 1)-*- +;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*- ;; Copyright (C) 2018 Amin Bandali @@ -27,7 +27,6 @@ ;; amin-... public variables or non-interactive functions ;; amin--... private anything (non-interactive), not safe for direct use ;; amin/... an interactive function; safe for M-x or keybinding -;; amin:... an evil operator, motion, or command ;; amin|... a hook function ;; amin*... an advising function ;; amin@... a hydra command @@ -35,6 +34,9 @@ ;;; Code: + +;; * Initial setup + (defvar amin--before-user-init-time (current-time) "Value of `current-time' when Emacs begins loading `user-init-file'.") (message "Loading Emacs...done (%.3fs)" @@ -223,6 +225,9 @@ compilation." (declare (indent defun) (debug t)) `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) + +;; * Core + ;; (fringe-mode '(3 . 1)) (fringe-mode nil) @@ -570,6 +575,9 @@ compilation." ("h" . outline-hide-subtree) ("s" . outline-show-subtree))) + +;; * Borg's `layer/essentials' + (use-package dash :config (dash-enable-font-lock)) @@ -655,6 +663,9 @@ compilation." ;; (setq undo-tree-mode-lighter "" ;; undo-tree-auto-save-history t)) + +;; * Editing + (use-package company :defer 1 :bind @@ -670,6 +681,9 @@ compilation." :config (global-company-mode t)) + +;; * Syntax and spell checking + (use-package flycheck :defer 3 :hook (prog-mode . flycheck-mode) @@ -710,6 +724,9 @@ compilation." (advice-add #'ispell-parse-output :filter-args #'endless/replace-quote)) + +;; * Programming modes + (use-package alloy-mode :defer t :config (setq alloy-basic-offset 2)) @@ -787,6 +804,9 @@ compilation." :defer t :mode "\\.nix\\'") + +;; * Emacs Enhancements + (use-package which-key :defer 1 :config (which-key-mode)) @@ -1073,9 +1093,9 @@ create a new window and switch to it. (use-package multi-term :defer 1 - :bind (("C-c C-j" . term-line-mode) - ("C-c m m" . multi-term) - ("C-c m p" . multi-term-dedicated-toggle)) + :bind (("C-c C-j" . term-line-mode) + ("C-c a s m m" . multi-term) + ("C-c a s m p" . multi-term-dedicated-toggle)) :config (setq multi-term-program "/bin/screen" ;; TODO: add separate bindings for connecting to existing @@ -1100,6 +1120,13 @@ create a new window and switch to it. term-unbind-key-alist '("C-z" "C-x" "C-c" "C-h" "C-y" ""))) +(use-package page-break-lines + :config + (global-page-break-lines-mode)) + + +;; * Email + (defvar amin-maildir (expand-file-name "~/mail/")) (after! recentf (add-to-list 'recentf-exclude amin-maildir)) @@ -1313,12 +1340,18 @@ create a new window and switch to it. (gnus-harvest-install 'message-x) (gnus-harvest-install))) + +;; * Blogging + (use-package ox-hugo :after ox) (use-package ox-hugo-auto-export :load-path "lib/ox-hugo") + +;; * Post initialization + (message "Loading %s...done (%.3fs)" user-init-file (float-time (time-subtract (current-time) amin--before-user-init-time))) diff --git a/init.org b/init.org index b06abe7..79dbbd2 100644 --- a/init.org +++ b/init.org @@ -65,7 +65,7 @@ make build ** First line #+begin_src emacs-lisp :comments none -;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t ; eval: (view-mode 1)-*- +;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*- #+end_src Enable =view-mode=, which both makes the file read-only (as a reminder @@ -113,7 +113,6 @@ The conventions below were inspired by [[https://github.com/hlissner/doom-emacs] ;; amin-... public variables or non-interactive functions ;; amin--... private anything (non-interactive), not safe for direct use ;; amin/... an interactive function; safe for M-x or keybinding -;; amin:... an evil operator, motion, or command ;; amin|... a hook function ;; amin*... an advising function ;; amin@... a hydra command @@ -127,6 +126,9 @@ The conventions below were inspired by [[https://github.com/hlissner/doom-emacs] #+begin_src emacs-lisp :comments none ;;; Code: + + +;; * Initial setup #+end_src ** Emacs initialization @@ -496,6 +498,11 @@ Convenience macro for =setq='ing multiple variables to the same value: :CUSTOM_ID: core :END: +#+begin_src emacs-lisp :comments none + +;; * Core +#+end_src + ** Defaults *** Time and battery in mode-line @@ -1049,6 +1056,11 @@ There's no way I could top that, so I won't attempt to. * Borg's =layer/essentials= +#+begin_src emacs-lisp :comments none + +;; * Borg's `layer/essentials' +#+end_src + TODO: break this giant source block down into individual org sections. #+begin_src emacs-lisp @@ -1140,6 +1152,11 @@ TODO: break this giant source block down into individual org sections. * Editing +#+begin_src emacs-lisp :comments none + +;; * Editing +#+end_src + ** Company #+begin_src emacs-lisp @@ -1160,6 +1177,12 @@ TODO: break this giant source block down into individual org sections. #+end_src * Syntax and spell checking + +#+begin_src emacs-lisp :comments none + +;; * Syntax and spell checking +#+end_src + #+begin_src emacs-lisp (use-package flycheck :defer 3 @@ -1203,6 +1226,11 @@ TODO: break this giant source block down into individual org sections. #+end_src * Programming modes +#+begin_src emacs-lisp :comments none + +;; * Programming modes +#+end_src + ** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]]) #+begin_src emacs-lisp @@ -1563,6 +1591,11 @@ treemacs * Emacs Enhancements +#+begin_src emacs-lisp :comments none + +;; * Emacs Enhancements +#+end_src + ** [[https://github.com/justbur/emacs-which-key][which-key]] #+begin_quote @@ -1948,9 +1981,9 @@ Hopefully temporary. #+begin_src emacs-lisp (use-package multi-term :defer 1 - :bind (("C-c C-j" . term-line-mode) - ("C-c m m" . multi-term) - ("C-c m p" . multi-term-dedicated-toggle)) + :bind (("C-c C-j" . term-line-mode) + ("C-c a s m m" . multi-term) + ("C-c a s m p" . multi-term-dedicated-toggle)) :config (setq multi-term-program "/bin/screen" ;; TODO: add separate bindings for connecting to existing @@ -1976,8 +2009,21 @@ Hopefully temporary. '("C-z" "C-x" "C-c" "C-h" "C-y" ""))) #+end_src +** page-break-lines + +#+begin_src emacs-lisp +(use-package page-break-lines + :config + (global-page-break-lines-mode)) +#+end_src + * Email +#+begin_src emacs-lisp :comments none + +;; * Email +#+end_src + #+begin_src emacs-lisp (defvar amin-maildir (expand-file-name "~/mail/")) (after! recentf @@ -2244,6 +2290,12 @@ I tried using =borg-elpa= instead of doing it like this, but it added #+end_src * Blogging + +#+begin_src emacs-lisp :comments none + +;; * Blogging +#+end_src + ** [[https://ox-hugo.scripter.co][ox-hugo]] #+begin_src emacs-lisp @@ -2259,6 +2311,11 @@ I tried using =borg-elpa= instead of doing it like this, but it added :CUSTOM_ID: post-initialization :END: +#+begin_src emacs-lisp :comments none + +;; * Post initialization +#+end_src + Display how long it took to load the init file. #+begin_src emacs-lisp diff --git a/lib/page-break-lines b/lib/page-break-lines new file mode 160000 index 0000000..87e801e --- /dev/null +++ b/lib/page-break-lines @@ -0,0 +1 @@ +Subproject commit 87e801efb816b24e83ebf84c052001e178e180bc -- 2.20.1