diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 131 |
1 files changed, 76 insertions, 55 deletions
diff --git a/README.md b/README.md index dc977c3..bf0f77e 100644 --- a/README.md +++ b/README.md | |||
@@ -129,17 +129,20 @@ This comes in handy when I want to garbage collect, say, or save recent files. | |||
129 | 129 | ||
130 | I use Emacs at home, with Linux, and at work, with Windows. | 130 | I use Emacs at home, with Linux, and at work, with Windows. |
131 | 131 | ||
132 | (defmacro at-work (&rest commands) | 132 | (defmacro when-at (conditions &rest commands) |
133 | "Only do COMMANDS when at work." | 133 | "Only do COMMANDS when CONDITIONS are met. |
134 | (declare (indent defun)) | 134 | CONDITIONS are one of `:work', `:home', or a list beginning with |
135 | `(when (memq system-type '(ms-dos windows-nt)) | 135 | the above and other conditions to check." |
136 | ,@commands)) | 136 | (declare (indent 1)) |
137 | 137 | (let ((at-work (memq system-type '(ms-dos windows-nt))) | |
138 | (defmacro at-home (&rest commands) | 138 | (at-home (memq system-type '(gnu gnu/linux gnu/kfreebsd)))) |
139 | "Only do COMMANDS when at home." | 139 | (pcase conditions |
140 | (declare (indent defun)) | 140 | (:work `(when ',at-work ,@commands)) |
141 | `(when (memq system-type '(gnu gnu/linux gnu/kfreebsd)) | 141 | (:home `(when ',at-home ,@commands)) |
142 | ,@commands)) | 142 | (`(:work ,others) `(when (and ',at-work ,others) |
143 | ,@commands)) | ||
144 | (`(:home ,others) `(when (and ',at-home ,others) | ||
145 | ,@commands))))) | ||
143 | 146 | ||
144 | 147 | ||
145 | ## Clean `.emacs.d` | 148 | ## Clean `.emacs.d` |
@@ -218,6 +221,12 @@ from [EmacsWiki](https://www.emacswiki.org/emacs/AlarmBell#h5o-3). | |||
218 | (cuss indicate-buffer-boundaries 'right | 221 | (cuss indicate-buffer-boundaries 'right |
219 | "Indicate the beginning and end of the buffer and whether it | 222 | "Indicate the beginning and end of the buffer and whether it |
220 | scrolls off-window in the right fringe.") | 223 | scrolls off-window in the right fringe.") |
224 | |||
225 | (cuss visual-line-fringe-indicators '(left-curly-arrow nil) | ||
226 | "Indicate continuing lines with a curly arrow in the left fringe.") | ||
227 | |||
228 | (set-fringe-bitmap-face 'left-curly-arrow | ||
229 | '((t :inherit 'comment))) | ||
221 | 230 | ||
222 | 231 | ||
223 | #### Minibuffer | 232 | #### Minibuffer |
@@ -798,6 +807,9 @@ UNIX line endings, so I don't want to hear it. | |||
798 | 807 | ||
799 | ### Auto-saves | 808 | ### Auto-saves |
800 | 809 | ||
810 | ;; turn off auto-save-mode until we can set up the right directory for them | ||
811 | (auto-save-mode -1) | ||
812 | |||
801 | (with-eval-after-load 'no-littering | 813 | (with-eval-after-load 'no-littering |
802 | (let ((dir (no-littering-expand-var-file-name "autosaves"))) | 814 | (let ((dir (no-littering-expand-var-file-name "autosaves"))) |
803 | (make-directory dir 'parents) | 815 | (make-directory dir 'parents) |
@@ -849,6 +861,12 @@ Because I like *overkill*, or at least … over-*saving*. | |||
849 | 861 | ||
850 | I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https://github.com/ncaq/recentf-remove-sudo-tramp-prefix/) – it’s a small enough package that I can just include it completely here. | 862 | I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https://github.com/ncaq/recentf-remove-sudo-tramp-prefix/) – it’s a small enough package that I can just include it completely here. |
851 | 863 | ||
864 | ;; appease the compiler | ||
865 | (declare-function tramp-tramp-file-p "tramp") | ||
866 | (declare-function tramp-dissect-file-name "tramp") | ||
867 | (declare-function tramp-file-name-method "tramp") | ||
868 | (declare-function tramp-file-name-localname "tramp") | ||
869 | |||
852 | (defun recentf-remove-sudo-tramp-prefix (path) | 870 | (defun recentf-remove-sudo-tramp-prefix (path) |
853 | "Remove sudo from PATH." | 871 | "Remove sudo from PATH." |
854 | (require 'tramp) | 872 | (require 'tramp) |
@@ -857,15 +875,15 @@ I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https:// | |||
857 | (if (string-equal "sudo" (tramp-file-name-method tx)) | 875 | (if (string-equal "sudo" (tramp-file-name-method tx)) |
858 | (tramp-file-name-localname tx) | 876 | (tramp-file-name-localname tx) |
859 | path)) | 877 | path)) |
860 | path)) | 878 | path) |
861 | 879 | ||
862 | (defun recentf-remove-sudo-tramp-prefix-from-recentf-list () | 880 | (defun recentf-remove-sudo-tramp-prefix-from-recentf-list () |
863 | (require 'recentf) | 881 | (require 'recentf) |
864 | (setq recentf-list | 882 | (setq recentf-list |
865 | (mapcar #'recentf-remove-sudo-tramp-prefix recentf-list))) | 883 | (mapcar #'recentf-remove-sudo-tramp-prefix recentf-list))) |
866 | 884 | ||
867 | (advice-add 'recentf-cleanup | 885 | (advice-add 'recentf-cleanup |
868 | :before #'recentf-remove-sudo-tramp-prefix-from-recentf-list) | 886 | :before #'recentf-remove-sudo-tramp-prefix-from-recentf-list)) |
869 | 887 | ||
870 | 888 | ||
871 | ## Text editing | 889 | ## Text editing |
@@ -1073,6 +1091,7 @@ I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https:// | |||
1073 | 1091 | ||
1074 | #### Indent Elisp like Common Lisp | 1092 | #### Indent Elisp like Common Lisp |
1075 | 1093 | ||
1094 | (require 'cl-lib) | ||
1076 | (setq lisp-indent-function 'common-lisp-indent-function) | 1095 | (setq lisp-indent-function 'common-lisp-indent-function) |
1077 | (put 'cl-flet 'common-lisp-indent-function | 1096 | (put 'cl-flet 'common-lisp-indent-function |
1078 | (get 'flet 'common-lisp-indent-function)) | 1097 | (get 'flet 'common-lisp-indent-function)) |
@@ -1203,7 +1222,7 @@ This has to be done *before* loading the package. It's included in `visual-fill | |||
1203 | "Or a new tab, in Firefox.") | 1222 | "Or a new tab, in Firefox.") |
1204 | 1223 | ||
1205 | ;; we need to add Firefox to `exec-path' on Windows | 1224 | ;; we need to add Firefox to `exec-path' on Windows |
1206 | (at-work | 1225 | (when-at :work |
1207 | (add-to-list 'exec-path "c:/Program Files/Mozilla Firefox")) | 1226 | (add-to-list 'exec-path "c:/Program Files/Mozilla Firefox")) |
1208 | 1227 | ||
1209 | 1228 | ||
@@ -1322,8 +1341,9 @@ from [mpereira](https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffe | |||
1322 | 1341 | ||
1323 | #### Source blocks | 1342 | #### Source blocks |
1324 | 1343 | ||
1325 | (set-face-attribute 'org-block-begin-line nil | 1344 | (with-eval-after-load 'org-faces |
1326 | :height 0.85) | 1345 | (set-face-attribute 'org-block-begin-line nil |
1346 | :height 0.85)) | ||
1327 | 1347 | ||
1328 | 1348 | ||
1329 | #### Prettify | 1349 | #### Prettify |
@@ -1610,7 +1630,7 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
1610 | * %^{What?}" :empty-lines 1) | 1630 | * %^{What?}" :empty-lines 1) |
1611 | 1631 | ||
1612 | ("d" "Diary entry" entry | 1632 | ("d" "Diary entry" entry |
1613 | (file+datetree "diary.org") | 1633 | (file+olp+datetree "diary.org") |
1614 | "* %? | 1634 | "* %? |
1615 | Entered on %U | 1635 | Entered on %U |
1616 | 1636 | ||
@@ -1619,6 +1639,8 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
1619 | 1639 | ||
1620 | #### Keybindings | 1640 | #### Keybindings |
1621 | 1641 | ||
1642 | (require 'org-capture) | ||
1643 | |||
1622 | (with-eval-after-load 'org-capture | 1644 | (with-eval-after-load 'org-capture |
1623 | (define-key acdw/map (kbd "C-c") #'org-capture)) | 1645 | (define-key acdw/map (kbd "C-c") #'org-capture)) |
1624 | 1646 | ||
@@ -1685,11 +1707,12 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1685 | "Disable `visual-fill-column-mode'." | 1707 | "Disable `visual-fill-column-mode'." |
1686 | (visual-fill-column-mode -1)) | 1708 | (visual-fill-column-mode -1)) |
1687 | 1709 | ||
1688 | (at-home | 1710 | (eval-when-compile |
1689 | (straight-use-package 'pdf-tools) | 1711 | (when-at :home |
1690 | (pdf-loader-install) | 1712 | (straight-use-package 'pdf-tools) |
1713 | (pdf-loader-install) | ||
1691 | 1714 | ||
1692 | (add-hook 'pdf-view-mode-hook #'acdw/disable-visual-fill-column-mode)) | 1715 | (add-hook 'pdf-view-mode-hook #'acdw/disable-visual-fill-column-mode))) |
1693 | 1716 | ||
1694 | 1717 | ||
1695 | ## E-book tools | 1718 | ## E-book tools |
@@ -1712,8 +1735,7 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1712 | 1735 | ||
1713 | 1736 | ||
1714 | 1737 | ||
1715 | (when (executable-find "mu") | 1738 | (when-at (:home (executable-find "mu")) |
1716 | |||
1717 | (add-to-list 'load-path | 1739 | (add-to-list 'load-path |
1718 | "/usr/share/emacs/site-lisp/mu4e") | 1740 | "/usr/share/emacs/site-lisp/mu4e") |
1719 | (require 'mu4e) | 1741 | (require 'mu4e) |
@@ -1752,18 +1774,18 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1752 | 1774 | ||
1753 | (cuss mu4e-bookmarks | 1775 | (cuss mu4e-bookmarks |
1754 | '((:name "Unread" | 1776 | '((:name "Unread" |
1755 | :query | 1777 | :query |
1756 | "flag:unread AND NOT flag:trashed AND NOT maildir:/Spam" | 1778 | "flag:unread AND NOT flag:trashed AND NOT maildir:/Spam" |
1757 | :key ?u) | 1779 | :key ?u) |
1758 | (:name "Today" | 1780 | (:name "Today" |
1759 | :query | 1781 | :query |
1760 | "date:today..now and not flag:trashed and not maildir:/Spam" | 1782 | "date:today..now and not flag:trashed and not maildir:/Spam" |
1761 | :key ?t) | 1783 | :key ?t) |
1762 | (:name "This week" | 1784 | (:name "This week" |
1763 | :query | 1785 | :query |
1764 | "date:7d..now and not maildir:/Spam and not flag:trashed" | 1786 | "date:7d..now and not maildir:/Spam and not flag:trashed" |
1765 | :hide-unread t | 1787 | :hide-unread t |
1766 | :key ?w))) | 1788 | :key ?w))) |
1767 | 1789 | ||
1768 | (cuss mu4e-headers-fields | 1790 | (cuss mu4e-headers-fields |
1769 | '((:human-date . 12) | 1791 | '((:human-date . 12) |
@@ -1779,23 +1801,23 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1779 | (,mu4e-drafts-folder . ?d) | 1801 | (,mu4e-drafts-folder . ?d) |
1780 | (,mu4e-trash-folder . ?t))) | 1802 | (,mu4e-trash-folder . ?t))) |
1781 | 1803 | ||
1804 | (cuss mu4e-get-mail-command (cond ((executable-find "mbsync") | ||
1805 | "mbsync -a")) | ||
1806 | "The command to update mail with.") | ||
1807 | (cuss mu4e-update-interval 300 | ||
1808 | "Update automatically every 5 minutes.") | ||
1809 | |||
1782 | (defun acdw/setup-mu4e-headers-mode () | 1810 | (defun acdw/setup-mu4e-headers-mode () |
1783 | (visual-line-mode -1)) | 1811 | (visual-line-mode -1)) |
1784 | |||
1785 | (add-hook 'mu4e-headers-mode #'acdw/setup-mu4e-headers-mode) | 1812 | (add-hook 'mu4e-headers-mode #'acdw/setup-mu4e-headers-mode) |
1786 | 1813 | ||
1787 | (defun acdw/setup-mu4e-view-mode () | 1814 | (defun acdw/setup-mu4e-view-mode () |
1788 | (setq visual-fill-column-center-text t) | 1815 | (setq visual-fill-column-center-text t) |
1789 | (visual-fill-column-mode +1)) | 1816 | (visual-fill-column-mode +1)) |
1790 | |||
1791 | (add-hook 'mu4e-view-mode-hook #'acdw/setup-mu4e-view-mode) | 1817 | (add-hook 'mu4e-view-mode-hook #'acdw/setup-mu4e-view-mode) |
1792 | (add-hook 'mu4e-compose-mode-hook #'acdw/setup-mu4e-view-mode) | 1818 | (add-hook 'mu4e-compose-mode-hook #'acdw/setup-mu4e-view-mode) |
1793 | 1819 | ||
1794 | (cuss mu4e-get-mail-command (cond ((executable-find "mbsync") | 1820 | (declare-function mu4e "mu4e") |
1795 | "mbsync -a")) | ||
1796 | "The command to update mail with.") | ||
1797 | (cuss mu4e-update-interval 300 | ||
1798 | "Update automatically every 5 minutes.") | ||
1799 | (mu4e +1)) | 1821 | (mu4e +1)) |
1800 | 1822 | ||
1801 | 1823 | ||
@@ -1884,10 +1906,8 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1884 | ### Gemini-write | 1906 | ### Gemini-write |
1885 | 1907 | ||
1886 | (straight-use-package '(gemini-write | 1908 | (straight-use-package '(gemini-write |
1887 | :repo "https://alexschroeder.ch/cgit/gemini-write")) | 1909 | :repo "https://tildegit.org/acdw/gemini-write.git")) |
1888 | (require 'gemini-write) | 1910 | (require 'gemini-write) |
1889 | |||
1890 | ;; TODO : add tokens ... somehow | ||
1891 | 1911 | ||
1892 | 1912 | ||
1893 | ## RSS | 1913 | ## RSS |
@@ -1945,13 +1965,14 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1945 | 1965 | ||
1946 | ### Exec path from shell | 1966 | ### Exec path from shell |
1947 | 1967 | ||
1948 | (at-home | 1968 | (eval-when-compile |
1949 | (straight-use-package 'exec-path-from-shell) | 1969 | (when-at :home |
1950 | (defvar acdw/exec-path-from-shell-initialized nil | 1970 | (straight-use-package 'exec-path-from-shell) |
1951 | "Stores whether we've initialized or not.") | 1971 | (defvar acdw/exec-path-from-shell-initialized nil |
1952 | (unless acdw/exec-path-from-shell-initialized | 1972 | "Stores whether we've initialized or not.") |
1953 | (exec-path-from-shell-initialize) | 1973 | (unless acdw/exec-path-from-shell-initialized |
1954 | (setq acdw/exec-path-from-shell-initialized (current-time)))) | 1974 | (exec-path-from-shell-initialize) |
1975 | (setq acdw/exec-path-from-shell-initialized (current-time))))) | ||
1955 | 1976 | ||
1956 | 1977 | ||
1957 | # Appendices | 1978 | # Appendices |