summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAshley Duckworth2021-01-22 13:12:56 -0600
committerAshley Duckworth2021-01-22 13:12:56 -0600
commitdd809699573c5116a6ad52088d568fcafb3a9261 (patch)
treecc9f497f796e031b90c2fb7ae6e1b35dc149ca48
parentAdd acdw/mode (diff)
downloademacs-dd809699573c5116a6ad52088d568fcafb3a9261.tar.gz
emacs-dd809699573c5116a6ad52088d568fcafb3a9261.zip
Add magit and git modes
-rw-r--r--config.org100
1 files changed, 98 insertions, 2 deletions
diff --git a/config.org b/config.org index 8556c33..66a795e 100644 --- a/config.org +++ b/config.org
@@ -1156,8 +1156,34 @@ that one item is.
1156 (add-hook 'dired-mode-hook #'dired-collapse-mode) 1156 (add-hook 'dired-mode-hook #'dired-collapse-mode)
1157#+end_src 1157#+end_src
1158 1158
1159** Git :package:
1160
1161*** Magit
1162
1163#+begin_src emacs-lisp :noweb-ref packages
1164 (straight-use-package 'magit)
1165#+end_src
1166
1167#+begin_src emacs-lisp :noweb-ref bindings
1168 (define-key acdw/leader "g" #'magit-status)
1169#+end_src
1170
1171*** Git file modes
1172
1173#+begin_src emacs-lisp :noweb-ref packages
1174 (dolist (feat '(gitattributes-mode
1175 gitconfig-mode
1176 gitignore-mode))
1177 (straight-use-package feat)
1178 (require feat))
1179#+end_src
1180
1159* Org mode :package: 1181* Org mode :package:
1160 1182
1183** Install it with =straight.el=
1184
1185I want to use the newest version of Org that I can.
1186
1161#+begin_src emacs-lisp :noweb-ref packages 1187#+begin_src emacs-lisp :noweb-ref packages
1162 (straight-use-package 'org) 1188 (straight-use-package 'org)
1163 1189
@@ -1166,6 +1192,8 @@ that one item is.
1166 (require 'ox-md)) 1192 (require 'ox-md))
1167#+end_src 1193#+end_src
1168 1194
1195** Basic settings
1196
1169#+begin_src emacs-lisp :noweb-ref settings 1197#+begin_src emacs-lisp :noweb-ref settings
1170 (setq-default 1198 (setq-default
1171 ;; Where to look for Org files 1199 ;; Where to look for Org files
@@ -1191,6 +1219,24 @@ that one item is.
1191 org-export-headline-levels 8) 1219 org-export-headline-levels 8)
1192#+end_src 1220#+end_src
1193 1221
1222** Aesthetics
1223
1224*** Prettify some other symbols
1225
1226#+begin_src emacs-lisp :noweb-ref functions
1227 (defun acdw/org-mode-prettify ()
1228 "Prettify `org-mode'."
1229 (dolist (cell '(("[ ]" . ?☐) ("[X]" . ?☑) ("[-]" . ?◐)
1230 ("#+BEGIN_SRC" . ?✎) ("#+begin_src" . ?✎)
1231 ("#+END_SRC" . ?■) ("#+end_src" . ?■)))
1232 (add-to-list 'prettify-symbols-alist cell :append))
1233 (prettify-symbols-mode +1))
1234#+end_src
1235
1236#+begin_src emacs-lisp :noweb-ref hooks
1237 (add-hook 'org-mode-hook #'acdw/org-mode-prettify)
1238#+end_src
1239
1194** Org templates 1240** Org templates
1195 1241
1196#+begin_src emacs-lisp :noweb-ref settings 1242#+begin_src emacs-lisp :noweb-ref settings
@@ -1314,6 +1360,55 @@ that one item is.
1314 (define-key org-mode-map (kbd "RET") #'unpackaged/org-return-dwim)) 1360 (define-key org-mode-map (kbd "RET") #'unpackaged/org-return-dwim))
1315#+end_src 1361#+end_src
1316 1362
1363** Insert blank lines around headers :unpackaged:
1364
1365#+begin_src emacs-lisp :noweb-ref functions
1366 (defun unpackaged/org-fix-blank-lines (&optional prefix)
1367 "Ensure that blank lines exist between headings and between headings and their contents.
1368 With prefix, operate on whole buffer. Ensures that blank lines
1369 exist after each headings's drawers."
1370 (interactive "P")
1371 (org-map-entries (lambda ()
1372 (org-with-wide-buffer
1373 ;; `org-map-entries' narrows the buffer, which prevents us
1374 ;; from seeing newlines before the current heading, so we
1375 ;; do this part widened.
1376 (while (not (looking-back "\n\n" nil))
1377 ;; Insert blank lines before heading.
1378 (insert "\n")))
1379 (let ((end (org-entry-end-position)))
1380 ;; Insert blank lines before entry content
1381 (forward-line)
1382 (while (and (org-at-planning-p)
1383 (< (point) (point-max)))
1384 ;; Skip planning lines
1385 (forward-line))
1386 (while (re-search-forward org-drawer-regexp end t)
1387 ;; Skip drawers. You might think that `org-at-drawer-p'
1388 ;; would suffice, but for some reason it doesn't work
1389 ;; correctly when operating on hidden text. This
1390 ;; works, taken from `org-agenda-get-some-entry-text'.
1391 (re-search-forward "^[ \t]*:END:.*\n?" end t)
1392 (goto-char (match-end 0)))
1393 (unless (or (= (point) (point-max))
1394 (org-at-heading-p)
1395 (looking-at-p "\n"))
1396 (insert "\n"))))
1397 t (if prefix
1398 nil
1399 'tree)))
1400#+end_src
1401
1402I fix the headline spacing every time I save.
1403
1404#+begin_src emacs-lisp :noweb-ref hooks
1405 (defun hook--org-mode-fix-blank-lines ()
1406 (when (eq major-mode 'org-mode)
1407 (let ((current-prefix-arg 4)) ; Emulate C-u
1408 (call-interactively 'unpackaged/org-fix-blank-lines))))
1409
1410 (add-hook 'before-save-hook #'hook--org-mode-fix-blank-lines)
1411#+end_src
1317 1412
1318* Package management :package: 1413* Package management :package:
1319:PROPERTIES: 1414:PROPERTIES:
@@ -1340,12 +1435,13 @@ any data loss. Here's what all that looks like.
1340 (let ((win-app-dir "~/Applications")) 1435 (let ((win-app-dir "~/Applications"))
1341 (dolist (path (list 1436 (dolist (path (list
1342 ;; Windows 1437 ;; Windows
1438 (expand-file-name "exe" win-app-dir)
1343 (expand-file-name "Git/bin" win-app-dir) 1439 (expand-file-name "Git/bin" win-app-dir)
1344 (expand-file-name "Git/usr/bin" win-app-dir) 1440 (expand-file-name "Git/usr/bin" win-app-dir)
1345 (expand-file-name "Git/mingw64/bin" win-app-dir) 1441 (expand-file-name "Git/mingw64/bin" win-app-dir)
1442 (expand-file-name "Everything" win-app-dir)
1346 ;; Linux 1443 ;; Linux
1347 (expand-file-name "bin" 1444 (expand-file-name "bin" user-emacs-directory)
1348 user-emacs-directory)
1349 (expand-file-name "~/bin") 1445 (expand-file-name "~/bin")
1350 (expand-file-name "~/.local/bin") 1446 (expand-file-name "~/.local/bin")
1351 (expand-file-name "~/Scripts") 1447 (expand-file-name "~/Scripts")