diff options
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | config.org | 60 |
2 files changed, 70 insertions, 10 deletions
diff --git a/README.md b/README.md index 866b4d3..dfcc845 100644 --- a/README.md +++ b/README.md | |||
@@ -601,7 +601,7 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t | |||
601 | :config | 601 | :config |
602 | (show-smartparens-global-mode +1) | 602 | (show-smartparens-global-mode +1) |
603 | :hook | 603 | :hook |
604 | (prog-mode-hook . smart-parens-strict-mode)) | 604 | (prog-mode-hook . smartparens-strict-mode)) |
605 | 605 | ||
606 | 606 | ||
607 | ## Line numbers | 607 | ## Line numbers |
@@ -620,8 +620,6 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t | |||
620 | (add-hook 'prog-mode-hook #'acdw/enable-line-numbers) | 620 | (add-hook 'prog-mode-hook #'acdw/enable-line-numbers) |
621 | 621 | ||
622 | 622 | ||
623 | <a id="org92fae61"></a> | ||
624 | |||
625 | # Writing | 623 | # Writing |
626 | 624 | ||
627 | 625 | ||
@@ -659,7 +657,7 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t | |||
659 | 657 | ||
660 | ## Org mode | 658 | ## Org mode |
661 | 659 | ||
662 | I’ve put org mode under Applications, as opposed to [8](#org92fae61), because it’s more generally-applicable than that. | 660 | I’ve put org mode under Applications, as opposed to Writing, because it’s more generally-applicable than that. |
663 | 661 | ||
664 | (use-package org | 662 | (use-package org |
665 | :custom | 663 | :custom |
@@ -668,6 +666,7 @@ I’ve put org mode under Applications, as opposed to [8](#org92fae61), because | |||
668 | (org-fontify-whole-heading-line t) | 666 | (org-fontify-whole-heading-line t) |
669 | (org-fontify-quote-and-verse-blocks t) | 667 | (org-fontify-quote-and-verse-blocks t) |
670 | (org-pretty-entities t) | 668 | (org-pretty-entities t) |
669 | (org-num-mode +1) | ||
671 | 670 | ||
672 | (org-src-tab-acts-natively t) | 671 | (org-src-tab-acts-natively t) |
673 | (org-src-fontify-natively t) | 672 | (org-src-fontify-natively t) |
@@ -820,6 +819,14 @@ I’ve put org mode under Applications, as opposed to [8](#org92fae61), because | |||
820 | (byte-compile-file f (not disable-load)))))))))) | 819 | (byte-compile-file f (not disable-load)))))))))) |
821 | 820 | ||
822 | 821 | ||
822 | ### Add a hook to tangle when quitting | ||
823 | |||
824 | (defun acdw/refresh-emacs-no-load () | ||
825 | (refresh-emacs t)) | ||
826 | |||
827 | (add-hook 'kill-emacs-hook #'acdw/refresh-emacs-no-load) | ||
828 | |||
829 | |||
823 | ## License | 830 | ## License |
824 | 831 | ||
825 | Copyright © 2020 Case Duckworth <acdw@acdw.net> | 832 | Copyright © 2020 Case Duckworth <acdw@acdw.net> |
@@ -852,8 +859,3 @@ GPL, for what should be fairly obvious reasons. To that, I say: | |||
852 | 859 | ||
853 | **SUE ME, RMS!** | 860 | **SUE ME, RMS!** |
854 | 861 | ||
855 | |||
856 | ## Keymaps for *this* file | ||
857 | |||
858 | This isn’t working … yet. | ||
859 | |||
diff --git a/config.org b/config.org index 51fb369..1c1b319 100644 --- a/config.org +++ b/config.org | |||
@@ -4,11 +4,12 @@ | |||
4 | #+EXPORT_FILE_NAME: README.md | 4 | #+EXPORT_FILE_NAME: README.md |
5 | #+OPTIONS: toc:nil | 5 | #+OPTIONS: toc:nil |
6 | #+BANKRUPTCY_COUNT: 3 | 6 | #+BANKRUPTCY_COUNT: 3 |
7 | #+Time-stamp: <2020-12-09 20:27:25 acdw> | 7 | #+Time-stamp: <2020-12-10 00:15:33 acdw> |
8 | 8 | ||
9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. | 9 | Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. |
10 | 10 | ||
11 | * Pave the way | 11 | * Pave the way |
12 | |||
12 | ** Correct =exec-path= | 13 | ** Correct =exec-path= |
13 | 14 | ||
14 | #+begin_src emacs-lisp | 15 | #+begin_src emacs-lisp |
@@ -591,8 +592,11 @@ Until the =marginalia-annotators= settles, I’m disabling this section. | |||
591 | #+end_src | 592 | #+end_src |
592 | 593 | ||
593 | * Files | 594 | * Files |
595 | |||
594 | 596 | ||
597 | |||
595 | ** Encoding | 598 | ** Encoding |
599 | |||
596 | *** UTF-8 | 600 | *** UTF-8 |
597 | 601 | ||
598 | #+begin_src emacs-lisp | 602 | #+begin_src emacs-lisp |
@@ -861,8 +865,61 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m | |||
861 | 'scimax/org-return) | 865 | 'scimax/org-return) |
862 | #+end_src | 866 | #+end_src |
863 | 867 | ||
868 | *** Insert blank lines | ||
869 | |||
870 | from [[https://github.com/alphapapa/unpackaged.el#ensure-blank-lines-between-headings-and-before-contents][unpackaged.el]]. | ||
871 | |||
872 | #+begin_src emacs-lisp | ||
873 | ;;;###autoload | ||
874 | (defun unpackaged/org-fix-blank-lines (&optional prefix) | ||
875 | "Ensure that blank lines exist between headings and between headings and their contents. | ||
876 | With prefix, operate on whole buffer. Ensures that blank lines | ||
877 | exist after each headings's drawers." | ||
878 | (interactive "P") | ||
879 | (org-map-entries (lambda () | ||
880 | (org-with-wide-buffer | ||
881 | ;; `org-map-entries' narrows the buffer, which prevents us from seeing | ||
882 | ;; newlines before the current heading, so we do this part widened. | ||
883 | (while (not (looking-back "\n\n" nil)) | ||
884 | ;; Insert blank lines before heading. | ||
885 | (insert "\n"))) | ||
886 | (let ((end (org-entry-end-position))) | ||
887 | ;; Insert blank lines before entry content | ||
888 | (forward-line) | ||
889 | (while (and (org-at-planning-p) | ||
890 | (< (point) (point-max))) | ||
891 | ;; Skip planning lines | ||
892 | (forward-line)) | ||
893 | (while (re-search-forward org-drawer-regexp end t) | ||
894 | ;; Skip drawers. You might think that `org-at-drawer-p' would suffice, but | ||
895 | ;; for some reason it doesn't work correctly when operating on hidden text. | ||
896 | ;; This works, taken from `org-agenda-get-some-entry-text'. | ||
897 | (re-search-forward "^[ \t]*:END:.*\n?" end t) | ||
898 | (goto-char (match-end 0))) | ||
899 | (unless (or (= (point) (point-max)) | ||
900 | (org-at-heading-p) | ||
901 | (looking-at-p "\n")) | ||
902 | (insert "\n")))) | ||
903 | t (if prefix | ||
904 | nil | ||
905 | 'tree))) | ||
906 | #+end_src | ||
907 | |||
908 | **** Add a before-save-hook | ||
909 | |||
910 | #+begin_src emacs-lisp | ||
911 | (defun cribbed/org-mode-fix-blank-lines () | ||
912 | (when (eq major-mode 'org-mode) | ||
913 | (let ((current-prefix-arg 4)) ; Emulate C-u | ||
914 | (call-interactively 'unpackaged/org-fix-blank-lines)))) | ||
915 | |||
916 | (add-hook 'before-save-hook #'cribbed/org-mode-fix-blank-lines) | ||
917 | #+end_src | ||
918 | |||
864 | * Appendices | 919 | * Appendices |
920 | |||
865 | ** Emacs' files | 921 | ** Emacs' files |
922 | |||
866 | *** init.el | 923 | *** init.el |
867 | :PROPERTIES: | 924 | :PROPERTIES: |
868 | :header-args: :tangle init.el | 925 | :header-args: :tangle init.el |
@@ -871,6 +928,7 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m | |||
871 | #+begin_src emacs-lisp :comments no | 928 | #+begin_src emacs-lisp :comments no |
872 | ;; init.el -*- lexical-binding: t -*- | 929 | ;; init.el -*- lexical-binding: t -*- |
873 | #+end_src | 930 | #+end_src |
931 | |||
874 | **** Load config | 932 | **** Load config |
875 | 933 | ||
876 | from [[https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028][Protesilaos Stavrou]]. | 934 | from [[https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028][Protesilaos Stavrou]]. |