summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org456
1 files changed, 228 insertions, 228 deletions
diff --git a/config.org b/config.org index 38b487c..30a606f 100644 --- a/config.org +++ b/config.org
@@ -291,7 +291,7 @@
291 291
292**** Switch windows or buffers if one window 292**** Switch windows or buffers if one window
293 293
294from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_do_you_like_best/gjlnp2c/][u/astoff1]]. 294 from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_do_you_like_best/gjlnp2c/][u/astoff1]].
295 295
296 #+begin_src emacs-lisp 296 #+begin_src emacs-lisp
297 (defun acdw/other-window-or-buffer () 297 (defun acdw/other-window-or-buffer ()
@@ -347,10 +347,10 @@ from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_
347 "Funtion return new function that ignore errors. 347 "Funtion return new function that ignore errors.
348 The function wraps a function with `ignore-errors' macro." 348 The function wraps a function with `ignore-errors' macro."
349 (lexical-let ((fn fn)) 349 (lexical-let ((fn fn))
350 (lambda () 350 (lambda ()
351 (interactive) 351 (interactive)
352 (ignore-errors 352 (ignore-errors
353 (funcall fn))))) 353 (funcall fn)))))
354 354
355 (global-set-key [S-left] (ignore-error-wrapper 'windmove-left)) 355 (global-set-key [S-left] (ignore-error-wrapper 'windmove-left))
356 (global-set-key [S-right] (ignore-error-wrapper 'windmove-right)) 356 (global-set-key [S-right] (ignore-error-wrapper 'windmove-right))
@@ -530,25 +530,25 @@ from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_
530 ;; fixed-pitch /is/ the default 530 ;; fixed-pitch /is/ the default
531 (set-face-from-alternatives face nil 531 (set-face-from-alternatives face nil
532 '(:family "Input Mono" 532 '(:family "Input Mono"
533 :slant normal 533 :slant normal
534 :weight normal 534 :weight normal
535 :height 110) 535 :height 110)
536 '(:family "Go Mono" 536 '(:family "Go Mono"
537 :slant normal 537 :slant normal
538 :weight normal 538 :weight normal
539 :height 100) 539 :height 100)
540 '(:family "Consolas" 540 '(:family "Consolas"
541 :slant normal 541 :slant normal
542 :weight normal 542 :weight normal
543 :height 100))) 543 :height 100)))
544 ;; variable-pitch is different 544 ;; variable-pitch is different
545 (set-face-from-alternatives 'variable-pitch nil 545 (set-face-from-alternatives 'variable-pitch nil
546 '(:family "Input Sans" 546 '(:family "Input Sans"
547 :slant normal 547 :slant normal
548 :weight normal) 548 :weight normal)
549 '(:family "Georgia" 549 '(:family "Georgia"
550 :slant normal 550 :slant normal
551 :weight normal))) 551 :weight normal)))
552 552
553 ;; remove myself from the hook 553 ;; remove myself from the hook
554 (remove-function after-focus-change-function #'acdw/setup-fonts)) 554 (remove-function after-focus-change-function #'acdw/setup-fonts))
@@ -690,9 +690,9 @@ from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_
690 (defun bk/go-straight-home () 690 (defun bk/go-straight-home ()
691 (interactive) 691 (interactive)
692 (cond 692 (cond
693 ((looking-back "~/") (insert "projects/")) 693 ((looking-back "~/") (insert "projects/"))
694 ((looking-back "/") (insert "~/")) 694 ((looking-back "/") (insert "~/"))
695 (:else (call-interactively 'self-insert-command)))) 695 (:else (call-interactively 'self-insert-command))))
696 696
697 (defun ido-disable-line-truncation () 697 (defun ido-disable-line-truncation ()
698 (set (make-local-variable 'truncate-lines) nil)) 698 (set (make-local-variable 'truncate-lines) nil))
@@ -817,18 +817,18 @@ from [[https://www.reddit.com/r/emacs/comments/kz347f/what_parts_of_your_config_
817 817
818*** Scroll much faster 818*** Scroll much faster
819 819
820from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-magnitude-faster][mpereira]], from somewhere else. 820 from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-magnitude-faster][mpereira]], from somewhere else.
821 821
822#+begin_src emacs-lisp 822 #+begin_src emacs-lisp
823 (cuss auto-window-vscroll nil 823 (cuss auto-window-vscroll nil
824 "Don't auto-adjust `window-vscroll' to view long lines.") 824 "Don't auto-adjust `window-vscroll' to view long lines.")
825 825
826 (cuss fast-but-imprecise-scrolling t 826 (cuss fast-but-imprecise-scrolling t
827 "Scroll fast, but possibly with inaccurate text rendering.") 827 "Scroll fast, but possibly with inaccurate text rendering.")
828 828
829 (cuss jit-lock-defer-time 0 829 (cuss jit-lock-defer-time 0
830 "Only defer font-locking when input is pending.") 830 "Only defer font-locking when input is pending.")
831#+end_src 831 #+end_src
832 832
833** Persistence 833** Persistence
834 834
@@ -1318,17 +1318,17 @@ from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-mag
1318 1318
1319**** Indent Elisp like Common Lisp 1319**** Indent Elisp like Common Lisp
1320 1320
1321#+begin_src emacs-lisp 1321 #+begin_src emacs-lisp
1322 (require 'cl-lib) 1322 (require 'cl-lib)
1323 (setq lisp-indent-function 'common-lisp-indent-function) 1323 (setq lisp-indent-function 'common-lisp-indent-function)
1324 (put 'cl-flet 'common-lisp-indent-function 1324 (put 'cl-flet 'common-lisp-indent-function
1325 (get 'flet 'common-lisp-indent-function)) 1325 (get 'flet 'common-lisp-indent-function))
1326 (put 'cl-labels 'common-lisp-indent-function 1326 (put 'cl-labels 'common-lisp-indent-function
1327 (get 'labels 'common-lisp-indent-function)) 1327 (get 'labels 'common-lisp-indent-function))
1328 (put 'if 'common-lisp-indent-function 2) 1328 (put 'if 'common-lisp-indent-function 2)
1329 (put 'dotimes-protect 'common-lisp-indent-function 1329 (put 'dotimes-protect 'common-lisp-indent-function
1330 (get 'when 'common-lisp-indent-function)) 1330 (get 'when 'common-lisp-indent-function))
1331#+end_src 1331 #+end_src
1332 1332
1333*** Janet 1333*** Janet
1334 1334
@@ -1569,17 +1569,17 @@ from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-mag
1569 1569
1570***** Align all tags in the buffer on changes 1570***** Align all tags in the buffer on changes
1571 1571
1572from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-changes][mpereira]]. 1572 from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-changes][mpereira]].
1573 1573
1574#+begin_src emacs-lisp 1574 #+begin_src emacs-lisp
1575 (defun acdw/org-align-all-tags () 1575 (defun acdw/org-align-all-tags ()
1576 "Align all org tags in the buffer." 1576 "Align all org tags in the buffer."
1577 (interactive) 1577 (interactive)
1578 (when (eq major-mode 'org-mode) 1578 (when (eq major-mode 'org-mode)
1579 (org-align-tags t))) 1579 (org-align-tags t)))
1580 1580
1581 (add-hook 'org-after-tags-change-hook #'acdw/org-align-all-tags) 1581 (add-hook 'org-after-tags-change-hook #'acdw/org-align-all-tags)
1582#+end_src 1582 #+end_src
1583 1583
1584**** Source blocks 1584**** Source blocks
1585 1585
@@ -1608,105 +1608,105 @@ from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-
1608**** [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][Org Return: DWIM]] 1608**** [[https://github.com/alphapapa/unpackaged.el#org-return-dwim][Org Return: DWIM]]
1609 1609
1610 #+begin_src emacs-lisp 1610 #+begin_src emacs-lisp
1611 (defun unpackaged/org-element-descendant-of (type element) 1611 (defun unpackaged/org-element-descendant-of (type element)
1612 "Return non-nil if ELEMENT is a descendant of TYPE. 1612 "Return non-nil if ELEMENT is a descendant of TYPE.
1613 TYPE should be an element type, like `item' or `paragraph'. 1613 TYPE should be an element type, like `item' or `paragraph'.
1614 ELEMENT should be a list like that returned by `org-element-context'." 1614 ELEMENT should be a list like that returned by `org-element-context'."
1615 ;; MAYBE: Use `org-element-lineage'. 1615 ;; MAYBE: Use `org-element-lineage'.
1616 (when-let* ((parent (org-element-property :parent element))) 1616 (when-let* ((parent (org-element-property :parent element)))
1617 (or (eq type (car parent)) 1617 (or (eq type (car parent))
1618 (unpackaged/org-element-descendant-of type parent)))) 1618 (unpackaged/org-element-descendant-of type parent))))
1619 1619
1620 ;;;###autoload 1620 ;;;###autoload
1621 (defun unpackaged/org-return-dwim (&optional default) 1621 (defun unpackaged/org-return-dwim (&optional default)
1622 "A helpful replacement for `org-return'. With prefix, call `org-return'. 1622 "A helpful replacement for `org-return'. With prefix, call `org-return'.
1623 1623
1624 On headings, move point to position after entry content. In 1624 On headings, move point to position after entry content. In
1625 lists, insert a new item or end the list, with checkbox if 1625 lists, insert a new item or end the list, with checkbox if
1626 appropriate. In tables, insert a new row or end the table." 1626 appropriate. In tables, insert a new row or end the table."
1627 ;; Inspired by John Kitchin: http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/ 1627 ;; Inspired by John Kitchin: http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/
1628 (interactive "P") 1628 (interactive "P")
1629 (if default 1629 (if default
1630 (org-return) 1630 (org-return)
1631 (cond 1631 (cond
1632 ;; Act depending on context around point. 1632 ;; Act depending on context around point.
1633 1633
1634 ;; NOTE: I prefer RET to not follow links, but by uncommenting this block, links will be 1634 ;; NOTE: I prefer RET to not follow links, but by uncommenting this block, links will be
1635 ;; followed. 1635 ;; followed.
1636 1636
1637 ;; ((eq 'link (car (org-element-context))) 1637 ;; ((eq 'link (car (org-element-context)))
1638 ;; ;; Link: Open it. 1638 ;; ;; Link: Open it.
1639 ;; (org-open-at-point-global)) 1639 ;; (org-open-at-point-global))
1640 1640
1641 ((org-at-heading-p) 1641 ((org-at-heading-p)
1642 ;; Heading: Move to position after entry content. 1642 ;; Heading: Move to position after entry content.
1643 ;; NOTE: This is probably the most interesting feature of this function. 1643 ;; NOTE: This is probably the most interesting feature of this function.
1644 (let ((heading-start (org-entry-beginning-position))) 1644 (let ((heading-start (org-entry-beginning-position)))
1645 (goto-char (org-entry-end-position)) 1645 (goto-char (org-entry-end-position))
1646 (cond ((and (org-at-heading-p) 1646 (cond ((and (org-at-heading-p)
1647 (= heading-start (org-entry-beginning-position))) 1647 (= heading-start (org-entry-beginning-position)))
1648 ;; Entry ends on its heading; add newline after 1648 ;; Entry ends on its heading; add newline after
1649 (end-of-line) 1649 (end-of-line)
1650 (insert "\n\n")) 1650 (insert "\n\n"))
1651 (t 1651 (t
1652 ;; Entry ends after its heading; back up 1652 ;; Entry ends after its heading; back up
1653 (forward-line -1) 1653 (forward-line -1)
1654 (end-of-line) 1654 (end-of-line)
1655 (when (org-at-heading-p) 1655 (when (org-at-heading-p)
1656 ;; At the same heading 1656 ;; At the same heading
1657 (forward-line) 1657 (forward-line)
1658 (insert "\n") 1658 (insert "\n")
1659 (forward-line -1)) 1659 (forward-line -1))
1660 ;; FIXME: looking-back is supposed to be called with more arguments. 1660 ;; FIXME: looking-back is supposed to be called with more arguments.
1661 (while (not (looking-back (rx (repeat 3 (seq (optional blank) "\n"))) nil)) 1661 (while (not (looking-back (rx (repeat 3 (seq (optional blank) "\n"))) nil))
1662 (insert "\n")) 1662 (insert "\n"))
1663 (forward-line -1))))) 1663 (forward-line -1)))))
1664 1664
1665 ((org-at-item-checkbox-p) 1665 ((org-at-item-checkbox-p)
1666 ;; Checkbox: Insert new item with checkbox. 1666 ;; Checkbox: Insert new item with checkbox.
1667 (org-insert-todo-heading nil)) 1667 (org-insert-todo-heading nil))
1668 1668
1669 ((org-in-item-p) 1669 ((org-in-item-p)
1670 ;; Plain list. Yes, this gets a little complicated... 1670 ;; Plain list. Yes, this gets a little complicated...
1671 (let ((context (org-element-context))) 1671 (let ((context (org-element-context)))
1672 (if (or (eq 'plain-list (car context)) ; First item in list 1672 (if (or (eq 'plain-list (car context)) ; First item in list
1673 (and (eq 'item (car context)) 1673 (and (eq 'item (car context))
1674 (not (eq (org-element-property :contents-begin context) 1674 (not (eq (org-element-property :contents-begin context)
1675 (org-element-property :contents-end context)))) 1675 (org-element-property :contents-end context))))
1676 (unpackaged/org-element-descendant-of 'item context)) ; Element in list item, e.g. a link 1676 (unpackaged/org-element-descendant-of 'item context)) ; Element in list item, e.g. a link
1677 ;; Non-empty item: Add new item. 1677 ;; Non-empty item: Add new item.
1678 (org-insert-item) 1678 (org-insert-item)
1679 ;; Empty item: Close the list. 1679 ;; Empty item: Close the list.
1680 ;; TODO: Do this with org functions rather than operating on the text. Can't seem to find the right function. 1680 ;; TODO: Do this with org functions rather than operating on the text. Can't seem to find the right function.
1681 (delete-region (line-beginning-position) (line-end-position)) 1681 (delete-region (line-beginning-position) (line-end-position))
1682 (insert "\n")))) 1682 (insert "\n"))))
1683 1683
1684 ((when (fboundp 'org-inlinetask-in-task-p) 1684 ((when (fboundp 'org-inlinetask-in-task-p)
1685 (org-inlinetask-in-task-p)) 1685 (org-inlinetask-in-task-p))
1686 ;; Inline task: Don't insert a new heading. 1686 ;; Inline task: Don't insert a new heading.
1687 (org-return)) 1687 (org-return))
1688 1688
1689 ((org-at-table-p) 1689 ((org-at-table-p)
1690 (cond ((save-excursion 1690 (cond ((save-excursion
1691 (beginning-of-line) 1691 (beginning-of-line)
1692 ;; See `org-table-next-field'. 1692 ;; See `org-table-next-field'.
1693 (cl-loop with end = (line-end-position) 1693 (cl-loop with end = (line-end-position)
1694 for cell = (org-element-table-cell-parser) 1694 for cell = (org-element-table-cell-parser)
1695 always (equal (org-element-property :contents-begin cell) 1695 always (equal (org-element-property :contents-begin cell)
1696 (org-element-property :contents-end cell)) 1696 (org-element-property :contents-end cell))
1697 while (re-search-forward "|" end t))) 1697 while (re-search-forward "|" end t)))
1698 ;; Empty row: end the table. 1698 ;; Empty row: end the table.
1699 (delete-region (line-beginning-position) (line-end-position)) 1699 (delete-region (line-beginning-position) (line-end-position))
1700 (org-return)) 1700 (org-return))
1701 (t 1701 (t
1702 ;; Non-empty row: call `org-return'. 1702 ;; Non-empty row: call `org-return'.
1703 (org-return)))) 1703 (org-return))))
1704 (t 1704 (t
1705 ;; All other cases: call `org-return'. 1705 ;; All other cases: call `org-return'.
1706 (org-return))))) 1706 (org-return)))))
1707 1707
1708 (with-eval-after-load 'org 1708 (with-eval-after-load 'org
1709 (define-key org-mode-map (kbd "RET") #'unpackaged/org-return-dwim)) 1709 (define-key org-mode-map (kbd "RET") #'unpackaged/org-return-dwim))
1710 #+end_src 1710 #+end_src
1711 1711
1712**** Insert blank lines around headers 1712**** Insert blank lines around headers
@@ -1778,7 +1778,7 @@ from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-
1778 (dolist (file '(;; add more files to this list 1778 (dolist (file '(;; add more files to this list
1779 "home.org" 1779 "home.org"
1780 "work.org") 1780 "work.org")
1781 list) 1781 list)
1782 (push (expand-file-name file org-directory) list)))) 1782 (push (expand-file-name file org-directory) list))))
1783 1783
1784 (define-key acdw/map (kbd "C-a") #'org-agenda) 1784 (define-key acdw/map (kbd "C-a") #'org-agenda)
@@ -1807,83 +1807,83 @@ from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-
1807 1807
1808**** Templates 1808**** Templates
1809 1809
1810 #+begin_src emacs-lisp 1810 #+begin_src emacs-lisp
1811 (cuss org-default-notes-file (expand-file-name "inbox.org" 1811 (cuss org-default-notes-file (expand-file-name "inbox.org"
1812 org-directory) 1812 org-directory)
1813 "Put unfiled notes in ~/Org/inbox.org.") 1813 "Put unfiled notes in ~/Org/inbox.org.")
1814 1814
1815 1815
1816 (cuss org-capture-templates 1816 (cuss org-capture-templates
1817 '(("w" "Work Todo") ;;; Work stuff 1817 '(("w" "Work Todo") ;;; Work stuff
1818 ("ws" "Small Business" entry 1818 ("ws" "Small Business" entry
1819 (file+headline "work.org" "Small Business") 1819 (file+headline "work.org" "Small Business")
1820 "* TODO %? 1820 "* TODO %?
1821 :PROPERTIES: 1821 :PROPERTIES:
1822 :Via: 1822 :Via:
1823 :Note: 1823 :Note:
1824 :END: 1824 :END:
1825 :LOGBOOK: 1825 :LOGBOOK:
1826 - State \"TODO\" from \"\" %U 1826 - State \"TODO\" from \"\" %U
1827 :END:" :empty-lines 1) 1827 :END:" :empty-lines 1)
1828 ("wc" "Career Center" entry 1828 ("wc" "Career Center" entry
1829 (file+headline "work.org" "Career Center") 1829 (file+headline "work.org" "Career Center")
1830 "* TODO %? 1830 "* TODO %?
1831 :PROPERTIES: 1831 :PROPERTIES:
1832 :Via: 1832 :Via:
1833 :Note: 1833 :Note:
1834 :END: 1834 :END:
1835 :LOGBOOK: 1835 :LOGBOOK:
1836 - State \"TODO\" from \"\" %U 1836 - State \"TODO\" from \"\" %U
1837 :END:" :empty-lines 1) 1837 :END:" :empty-lines 1)
1838 ("wg" "General" entry 1838 ("wg" "General" entry
1839 (file+headline "work.org" "General") 1839 (file+headline "work.org" "General")
1840 "* TODO %? 1840 "* TODO %?
1841 :PROPERTIES: 1841 :PROPERTIES:
1842 :Via: 1842 :Via:
1843 :Note: 1843 :Note:
1844 :END: 1844 :END:
1845 :LOGBOOK: 1845 :LOGBOOK:
1846 - State \"TODO\" from \"\" %U 1846 - State \"TODO\" from \"\" %U
1847 :END:" :empty-lines 1) 1847 :END:" :empty-lines 1)
1848 1848
1849 ;;; Regular To-Dos 1849 ;;; Regular To-Dos
1850 ("t" "Todo") 1850 ("t" "Todo")
1851 ("tt" "Todo" entry 1851 ("tt" "Todo" entry
1852 (file+headline "home.org" "TODOs") 1852 (file+headline "home.org" "TODOs")
1853 "* TODO %? 1853 "* TODO %?
1854 :PROPERTIES: 1854 :PROPERTIES:
1855 :Via: 1855 :Via:
1856 :Note: 1856 :Note:
1857 :END: 1857 :END:
1858 :LOGBOOK: 1858 :LOGBOOK:
1859 - State \"TODO\" from \"\" %U 1859 - State \"TODO\" from \"\" %U
1860 :END:" :empty-lines 1) 1860 :END:" :empty-lines 1)
1861 1861
1862 ("td" "Todo with deadline" entry 1862 ("td" "Todo with deadline" entry
1863 (file+headline "home.org" "TODOs") 1863 (file+headline "home.org" "TODOs")
1864 "* TODO %? 1864 "* TODO %?
1865 DEADLINE: %^t 1865 DEADLINE: %^t
1866 :PROPERTIES: 1866 :PROPERTIES:
1867 :Via: 1867 :Via:
1868 :Note: 1868 :Note:
1869 :END: 1869 :END:
1870 :LOGBOOK: 1870 :LOGBOOK:
1871 - State \"TODO\" from \"\" %U 1871 - State \"TODO\" from \"\" %U
1872 :END:" :empty-lines 1) 1872 :END:" :empty-lines 1)
1873 1873
1874 1874
1875 ("g" "Gift idea" entry 1875 ("g" "Gift idea" entry
1876 (file+headline "home.org" "Gift ideas") 1876 (file+headline "home.org" "Gift ideas")
1877 "* %^{Who?} 1877 "* %^{Who?}
1878 ,* %^{What?}" :empty-lines 1) 1878 ,* %^{What?}" :empty-lines 1)
1879 1879
1880 ("d" "Diary entry" entry 1880 ("d" "Diary entry" entry
1881 (file+olp+datetree "diary.org") 1881 (file+olp+datetree "diary.org")
1882 "* %? 1882 "* %?
1883 Entered on %U 1883 Entered on %U
1884 1884
1885 " :empty-lines 1))) 1885 " :empty-lines 1)))
1886 #+end_src 1886 #+end_src
1887 1887
1888**** Keybindings 1888**** Keybindings
1889 1889
@@ -2407,4 +2407,4 @@ from [[https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-
2407 2407
2408** TODO Local variables 2408** TODO Local variables
2409 2409
2410One day, I’m going to add a Local Variables block to the end of this file, which will add an =after-save-hook= to auto-tangle the file after saving. But first I need to research how best to do that asynchronously. So. 2410 One day, I’m going to add a Local Variables block to the end of this file, which will add an =after-save-hook= to auto-tangle the file after saving. But first I need to research how best to do that asynchronously. So.