diff options
author | Case Duckworth | 2021-01-13 20:19:56 -0600 |
---|---|---|
committer | Case Duckworth | 2021-01-13 20:19:56 -0600 |
commit | 57841624b6c75ad87a146210b0952350fd8229fd (patch) | |
tree | fcd225f64e4523c4abb7c278ef7b08549c4c94e1 | |
parent | Fix bugs for compilation (diff) | |
download | emacs-57841624b6c75ad87a146210b0952350fd8229fd.tar.gz emacs-57841624b6c75ad87a146210b0952350fd8229fd.zip |
Delete re-definition of lisp-indent-function for something simpler
The compiler kept complaining about how the variable ‘calculate-lisp-indent-last-sexp’ was “free,” which is due to (according to [1]) the fact that it’s dynamically bound, as opposed to lexical – so it’s actually defined further up the function call-chain, meaning it works but the compiler complains about it. I didn’t like all the complaining, so I tried installing ‘el-patch’ per this StackOverflow discussion[2], thinking that a package built allegedly specifically for this purpose would fix the dynamic/lexical binding mess, but of course it didn’t. So I just went and applied the changes in abo-abo’s answer[3], which set the indent-functions for elisp to be the same as cl. C’est la vie. [1]: https://emacs.stackexchange.com/questions/52782/ [2]: https://stackoverflow.com/questions/22166895/ [3]: https://stackoverflow.com/a/22167050
-rw-r--r-- | README.md | 233 | ||||
-rw-r--r-- | config.org | 93 |
2 files changed, 225 insertions, 101 deletions
diff --git a/README.md b/README.md index bde17e1..dc977c3 100644 --- a/README.md +++ b/README.md | |||
@@ -90,7 +90,7 @@ doesn't work, I'll call git directly and clone the repo myself. | |||
90 | 90 | ||
91 | ### Emulate use-package’s `:custom` | 91 | ### Emulate use-package’s `:custom` |
92 | 92 | ||
93 | (defmacro cuss (var val &optional docstring) | 93 | (defmacro cuss (var val &optional _docstring) |
94 | "Basically, `:custom' from `use-package', but without `use-package'." | 94 | "Basically, `:custom' from `use-package', but without `use-package'." |
95 | (declare (doc-string 3) | 95 | (declare (doc-string 3) |
96 | (indent 2)) | 96 | (indent 2)) |
@@ -407,7 +407,7 @@ helper function, though, to add things to the whitelist. | |||
407 | (: (any ?a ?A ?p ?P) (any ?m ?M))) | 407 | (: (any ?a ?A ?p ?P) (any ?m ?M))) |
408 | (* nonl))) | 408 | (* nonl))) |
409 | (ss (sunrise-sunset)) | 409 | (ss (sunrise-sunset)) |
410 | (m_ (string-match times-regex ss)) | 410 | (_m (string-match times-regex ss)) |
411 | (sunrise-time (match-string 1 ss)) | 411 | (sunrise-time (match-string 1 ss)) |
412 | (sunset-time (match-string 2 ss))) | 412 | (sunset-time (match-string 2 ss))) |
413 | (run-at-time sunrise-time (* 60 60 24) sunrise-command) | 413 | (run-at-time sunrise-time (* 60 60 24) sunrise-command) |
@@ -640,6 +640,20 @@ from [u/TheFrenchPoulp](https://www.reddit.com/r/emacs/comments/km9by4/weekly_ti | |||
640 | (apply original arguments))) | 640 | (apply original arguments))) |
641 | 641 | ||
642 | 642 | ||
643 | ### Scroll much faster | ||
644 | |||
645 | from [mpereira](https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-magnitude-faster), from somewhere else. | ||
646 | |||
647 | (cuss auto-window-vscroll nil | ||
648 | "Don't auto-adjust `window-vscroll' to view long lines.") | ||
649 | |||
650 | (cuss fast-but-imprecise-scrolling t | ||
651 | "Scroll fast, but possibly with inaccurate text rendering.") | ||
652 | |||
653 | (cuss jit-lock-defer-time 0 | ||
654 | "Only defer font-locking when input is pending.") | ||
655 | |||
656 | |||
643 | ## Persistence | 657 | ## Persistence |
644 | 658 | ||
645 | 659 | ||
@@ -743,9 +757,7 @@ from [Mastering Emacs](https://www.masteringemacs.org/article/working-coding-sys | |||
743 | (set-keyboard-coding-system 'utf-8) | 757 | (set-keyboard-coding-system 'utf-8) |
744 | ;; backwards compatibility: | 758 | ;; backwards compatibility: |
745 | ;; `default-buffer-file-coding-system' is deprecated in 23.2. | 759 | ;; `default-buffer-file-coding-system' is deprecated in 23.2. |
746 | (if (boundp 'buffer-file-coding-system) | 760 | (setq default-buffer-file-coding-system 'utf-8) |
747 | (setq-default buffer-file-coding-system 'utf-8) | ||
748 | (setq default-buffer-file-coding-system 'utf-8)) | ||
749 | 761 | ||
750 | ;; Treat clipboard as UTF-8 string first; compound text next, etc. | 762 | ;; Treat clipboard as UTF-8 string first; compound text next, etc. |
751 | (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) | 763 | (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) |
@@ -830,7 +842,7 @@ Because I like *overkill*, or at least … over-*saving*. | |||
830 | (straight-use-package 'sudo-edit) | 842 | (straight-use-package 'sudo-edit) |
831 | 843 | ||
832 | (with-eval-after-load 'sudo-edit | 844 | (with-eval-after-load 'sudo-edit |
833 | (global-set-key acdw/map (kbd "C-r") #'sudo-edit)) | 845 | (define-key acdw/map (kbd "C-r") #'sudo-edit)) |
834 | 846 | ||
835 | 847 | ||
836 | #### Don’t add `/sudo:` files to `recentf`, though | 848 | #### Don’t add `/sudo:` files to `recentf`, though |
@@ -867,7 +879,14 @@ I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https:// | |||
867 | ### View long lines like filled lines in the beginning | 879 | ### View long lines like filled lines in the beginning |
868 | 880 | ||
869 | (straight-use-package 'adaptive-wrap) | 881 | (straight-use-package 'adaptive-wrap) |
870 | (adaptive-wrap-prefix-mode +1) | 882 | |
883 | (when (fboundp 'adaptive-wrap-prefix-mode) | ||
884 | (defun acdw/activate-adaptive-wrap-prefix-mode () | ||
885 | "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously." | ||
886 | (adaptive-wrap-prefix-mode (if visual-line-mode | ||
887 | +1 | ||
888 | -1))) | ||
889 | (add-hook 'visual-line-mode-hook #'acdw/activate-adaptive-wrap-prefix-mode)) | ||
871 | 890 | ||
872 | 891 | ||
873 | ### Stay snappy with long-lined files | 892 | ### Stay snappy with long-lined files |
@@ -1042,6 +1061,28 @@ I’ve pretty much cribbed this from [recentf-remove-sudo-tramp-prefix](https:// | |||
1042 | "Don't truncate printed expressions by level.") | 1061 | "Don't truncate printed expressions by level.") |
1043 | 1062 | ||
1044 | 1063 | ||
1064 | #### Eros (Evaluation Result OverlayS) | ||
1065 | |||
1066 | (straight-use-package 'eros) | ||
1067 | |||
1068 | (cuss eros-eval-result-prefix ";; => " | ||
1069 | "Prefix displayed before eros overlays.") | ||
1070 | |||
1071 | (eros-mode +1) | ||
1072 | |||
1073 | |||
1074 | #### Indent Elisp like Common Lisp | ||
1075 | |||
1076 | (setq lisp-indent-function 'common-lisp-indent-function) | ||
1077 | (put 'cl-flet 'common-lisp-indent-function | ||
1078 | (get 'flet 'common-lisp-indent-function)) | ||
1079 | (put 'cl-labels 'common-lisp-indent-function | ||
1080 | (get 'labels 'common-lisp-indent-function)) | ||
1081 | (put 'if 'common-lisp-indent-function 2) | ||
1082 | (put 'dotimes-protect 'common-lisp-indent-function | ||
1083 | (get 'when 'common-lisp-indent-function)) | ||
1084 | |||
1085 | |||
1045 | ### Janet | 1086 | ### Janet |
1046 | 1087 | ||
1047 | (straight-use-package 'janet-mode) | 1088 | (straight-use-package 'janet-mode) |
@@ -1151,19 +1192,44 @@ This has to be done *before* loading the package. It's included in `visual-fill | |||
1151 | # Applications | 1192 | # Applications |
1152 | 1193 | ||
1153 | 1194 | ||
1195 | ## Web browsing | ||
1196 | |||
1197 | (cuss browse-url-browser-function 'browse-url-firefox) | ||
1198 | (cuss browse-url-new-window-flag t | ||
1199 | "Always open a new browser window.") | ||
1200 | |||
1201 | ;;(cuss browse-url-generic-program "firefox") | ||
1202 | (cuss browse-url-firefox-new-window-is-tab t | ||
1203 | "Or a new tab, in Firefox.") | ||
1204 | |||
1205 | ;; we need to add Firefox to `exec-path' on Windows | ||
1206 | (at-work | ||
1207 | (add-to-list 'exec-path "c:/Program Files/Mozilla Firefox")) | ||
1208 | |||
1209 | |||
1154 | ## Dired | 1210 | ## Dired |
1155 | 1211 | ||
1156 | 1212 | ||
1157 | ### Basic customization | 1213 | ### Basic customization |
1158 | 1214 | ||
1215 | (defun acdw/setup-dired-mode () | ||
1216 | (hl-line-mode) | ||
1217 | (dired-hide-details-mode)) | ||
1218 | |||
1159 | ;; highlight the current line in dired. | 1219 | ;; highlight the current line in dired. |
1160 | (add-hook 'dired-mode-hook #'hl-line-mode) | 1220 | (add-hook 'dired-mode-hook #'acdw/setup-dired-mode) |
1161 | 1221 | ||
1162 | (cuss dired-recursive-copies 'always | 1222 | (cuss dired-recursive-copies 'always |
1163 | "Always recursively copy.") | 1223 | "Always recursively copy.") |
1164 | 1224 | ||
1225 | (cuss dired-recursive-deletes 'always | ||
1226 | "Always recursively delete.") | ||
1227 | |||
1228 | (cuss delete-by-moving-to-trash t) | ||
1229 | |||
1165 | (cuss dired-listing-switches "-alh" | 1230 | (cuss dired-listing-switches "-alh" |
1166 | "Show All items, Listed out, with Human-readable sizes.") | 1231 | "Show (A)lmost all items, |
1232 | (l)isted out, with (h)uman-readable sizes.") | ||
1167 | 1233 | ||
1168 | 1234 | ||
1169 | ### Expand subtrees | 1235 | ### Expand subtrees |
@@ -1241,13 +1307,32 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m | |||
1241 | (variable-pitch)))))) | 1307 | (variable-pitch)))))) |
1242 | 1308 | ||
1243 | 1309 | ||
1310 | ##### Align all tags in the buffer on changes | ||
1311 | |||
1312 | from [mpereira](https://github.com/mpereira/.emacs.d#align-all-tags-in-the-buffer-on-tag-changes). | ||
1313 | |||
1314 | (defun acdw/org-align-all-tags () | ||
1315 | "Align all org tags in the buffer." | ||
1316 | (interactive) | ||
1317 | (when (eq major-mode 'org-mode) | ||
1318 | (org-align-tags t))) | ||
1319 | |||
1320 | (add-hook 'org-after-tags-change-hook #'acdw/org-align-all-tags) | ||
1321 | |||
1322 | |||
1323 | #### Source blocks | ||
1324 | |||
1325 | (set-face-attribute 'org-block-begin-line nil | ||
1326 | :height 0.85) | ||
1327 | |||
1328 | |||
1244 | #### Prettify | 1329 | #### Prettify |
1245 | 1330 | ||
1246 | (defun acdw/org-mode-prettify () | 1331 | (defun acdw/org-mode-prettify () |
1247 | "Prettify `org-mode'." | 1332 | "Prettify `org-mode'." |
1248 | (dolist (cell '(("[ ]" . ?) ("[X]" . ?☑) ("[-]" . ?◐) | 1333 | (dolist (cell '(("[ ]" . ?) ("[X]" . ?☑) ("[-]" . ?◐) |
1249 | ("#+begin_src" . ?✎) ("#+begin_src" . ?✎) | 1334 | ("#+BEGIN_SRC" . ?✎) ("#+begin_src" . ?✎) |
1250 | ("#+end_src" . ?■) ("#+end_src" . ?■))) | 1335 | ("#+END_SRC" . ?■) ("#+end_src" . ?■))) |
1251 | (add-to-list 'prettify-symbols-alist cell :append)) | 1336 | (add-to-list 'prettify-symbols-alist cell :append)) |
1252 | (prettify-symbols-mode +1)) | 1337 | (prettify-symbols-mode +1)) |
1253 | 1338 | ||
@@ -1413,8 +1498,9 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
1413 | 1498 | ||
1414 | ### Org Templates (`org-tempo`) | 1499 | ### Org Templates (`org-tempo`) |
1415 | 1500 | ||
1416 | (add-to-list 'org-structure-template-alist | 1501 | (with-eval-after-load 'org |
1417 | '("el" . "src emacs-lisp")) | 1502 | (add-to-list 'org-structure-template-alist |
1503 | '("el" . "src emacs-lisp"))) | ||
1418 | 1504 | ||
1419 | 1505 | ||
1420 | ### Org Agenda | 1506 | ### Org Agenda |
@@ -1429,6 +1515,9 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
1429 | 1515 | ||
1430 | (define-key acdw/map (kbd "C-a") #'org-agenda) | 1516 | (define-key acdw/map (kbd "C-a") #'org-agenda) |
1431 | 1517 | ||
1518 | (cuss org-agenda-span 5 | ||
1519 | "Show today + N days.") | ||
1520 | |||
1432 | (cuss org-todo-keywords | 1521 | (cuss org-todo-keywords |
1433 | '((sequence "RECUR(r)" "TODO(t)" "|" "DONE(d)") | 1522 | '((sequence "RECUR(r)" "TODO(t)" "|" "DONE(d)") |
1434 | (sequence "APPT(a)") | 1523 | (sequence "APPT(a)") |
@@ -1438,9 +1527,100 @@ from [unpackaged.el](https://github.com/alphapapa/unpackaged.el#ensure-blank-lin | |||
1438 | (cuss org-agenda-skip-deadline-if-done t) | 1527 | (cuss org-agenda-skip-deadline-if-done t) |
1439 | (cuss org-deadline-warning-days 0 | 1528 | (cuss org-deadline-warning-days 0 |
1440 | "Don't warn of an impending deadline.") | 1529 | "Don't warn of an impending deadline.") |
1441 | 1530 | ||
1442 | 1531 | (cuss org-log-into-drawer "LOGBOOK" | |
1443 | ### TODO Capture | 1532 | "Log state changes into the LOGBOOK drawer, instead of after |
1533 | the headline.") | ||
1534 | (cuss org-log-done t | ||
1535 | "Save CLOSED timestamp when done.") | ||
1536 | |||
1537 | |||
1538 | ### Capture | ||
1539 | |||
1540 | |||
1541 | #### Templates | ||
1542 | |||
1543 | (cuss org-default-notes-file (expand-file-name "inbox.org" | ||
1544 | org-directory) | ||
1545 | "Put unfiled notes in ~/Org/inbox.org.") | ||
1546 | |||
1547 | |||
1548 | (cuss org-capture-templates | ||
1549 | '(("w" "Work Todo") ;;; Work stuff | ||
1550 | ("ws" "Small Business" entry | ||
1551 | (file+headline "work.org" "Small Business") | ||
1552 | "* TODO %? | ||
1553 | :PROPERTIES: | ||
1554 | :Via: | ||
1555 | :Note: | ||
1556 | :END: | ||
1557 | :LOGBOOK: | ||
1558 | - State \"TODO\" from \"\" %U | ||
1559 | :END:" :empty-lines 1) | ||
1560 | ("wc" "Career Center" entry | ||
1561 | (file+headline "work.org" "Career Center") | ||
1562 | "* TODO %? | ||
1563 | :PROPERTIES: | ||
1564 | :Via: | ||
1565 | :Note: | ||
1566 | :END: | ||
1567 | :LOGBOOK: | ||
1568 | - State \"TODO\" from \"\" %U | ||
1569 | :END:" :empty-lines 1) | ||
1570 | ("wg" "General" entry | ||
1571 | (file+headline "work.org" "General") | ||
1572 | "* TODO %? | ||
1573 | :PROPERTIES: | ||
1574 | :Via: | ||
1575 | :Note: | ||
1576 | :END: | ||
1577 | :LOGBOOK: | ||
1578 | - State \"TODO\" from \"\" %U | ||
1579 | :END:" :empty-lines 1) | ||
1580 | |||
1581 | ;;; Regular To-Dos | ||
1582 | ("t" "Todo") | ||
1583 | ("tt" "Todo" entry | ||
1584 | (file+headline "home.org" "TODOs") | ||
1585 | "* TODO %? | ||
1586 | :PROPERTIES: | ||
1587 | :Via: | ||
1588 | :Note: | ||
1589 | :END: | ||
1590 | :LOGBOOK: | ||
1591 | - State \"TODO\" from \"\" %U | ||
1592 | :END:" :empty-lines 1) | ||
1593 | |||
1594 | ("td" "Todo with deadline" entry | ||
1595 | (file+headline "home.org" "TODOs") | ||
1596 | "* TODO %? | ||
1597 | DEADLINE: %^t | ||
1598 | :PROPERTIES: | ||
1599 | :Via: | ||
1600 | :Note: | ||
1601 | :END: | ||
1602 | :LOGBOOK: | ||
1603 | - State \"TODO\" from \"\" %U | ||
1604 | :END:" :empty-lines 1) | ||
1605 | |||
1606 | |||
1607 | ("g" "Gift idea" entry | ||
1608 | (file+headline "home.org" "Gift ideas") | ||
1609 | "* %^{Who?} | ||
1610 | * %^{What?}" :empty-lines 1) | ||
1611 | |||
1612 | ("d" "Diary entry" entry | ||
1613 | (file+datetree "diary.org") | ||
1614 | "* %? | ||
1615 | Entered on %U | ||
1616 | |||
1617 | " :empty-lines 1))) | ||
1618 | |||
1619 | |||
1620 | #### Keybindings | ||
1621 | |||
1622 | (with-eval-after-load 'org-capture | ||
1623 | (define-key acdw/map (kbd "C-c") #'org-capture)) | ||
1444 | 1624 | ||
1445 | 1625 | ||
1446 | ### Include Org links in source code | 1626 | ### Include Org links in source code |
@@ -1742,9 +1922,19 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1742 | (list "ttrss+https://acdw@rss.tildeverse.org" | 1922 | (list "ttrss+https://acdw@rss.tildeverse.org" |
1743 | :use-authinfo t))) | 1923 | :use-authinfo t))) |
1744 | 1924 | ||
1745 | (setq elfeed-log-level 'debug) | 1925 | ;; Uncomment this line if elfeed is giving problems. |
1926 | ;; (setq elfeed-log-level 'debug) | ||
1746 | 1927 | ||
1747 | (elfeed-protocol-enable) | 1928 | (elfeed-protocol-enable) |
1929 | |||
1930 | (defun acdw/update-elfeed-protocol-feeds () | ||
1931 | "Wrap various (non-working) protocol updaters. | ||
1932 | I could probably do this in a much more ... better way." | ||
1933 | (interactive) | ||
1934 | (elfeed-protocol-ttrss-reinit "https://rss.tildeverse.org")) | ||
1935 | |||
1936 | (with-eval-after-load 'elfeed | ||
1937 | (define-key elfeed-search-mode-map "G" #'acdw/update-elfeed-protocol-feeds)) | ||
1748 | 1938 | ||
1749 | 1939 | ||
1750 | # System integration | 1940 | # System integration |
@@ -1816,7 +2006,7 @@ I’m only enabling this at home for now, since it requires building stuff. | |||
1816 | (interactive "P") | 2006 | (interactive "P") |
1817 | (let ((config (expand-file-name "config.org" user-emacs-directory))) | 2007 | (let ((config (expand-file-name "config.org" user-emacs-directory))) |
1818 | (save-mark-and-excursion | 2008 | (save-mark-and-excursion |
1819 | (with-current-buffer (find-file config) | 2009 | (with-current-buffer (find-file-noselect config) |
1820 | (let ((prog-mode-hook nil)) | 2010 | (let ((prog-mode-hook nil)) |
1821 | ;; generate the readme | 2011 | ;; generate the readme |
1822 | (when (file-newer-than-file-p config (expand-file-name | 2012 | (when (file-newer-than-file-p config (expand-file-name |
@@ -1918,3 +2108,8 @@ GPL, for what should be fairly obvious reasons. To that, I say: | |||
1918 | 2108 | ||
1919 | **SUE ME, RMS!** | 2109 | **SUE ME, RMS!** |
1920 | 2110 | ||
2111 | |||
2112 | ## TODO Local variables | ||
2113 | |||
2114 | 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. | ||
2115 | |||
diff --git a/config.org b/config.org index d430220..949ef22 100644 --- a/config.org +++ b/config.org | |||
@@ -5,7 +5,7 @@ | |||
5 | #+EXPORT_FILE_NAME: README.md | 5 | #+EXPORT_FILE_NAME: README.md |
6 | #+OPTIONS: toc:nil | 6 | #+OPTIONS: toc:nil |
7 | #+BANKRUPTCY_COUNT: 3.2 | 7 | #+BANKRUPTCY_COUNT: 3.2 |
8 | #+Time-stamp: <2021-01-13 17:27:55 aduckworth> | 8 | #+Time-stamp: <2021-01-13 20:19:13 acdw> |
9 | 9 | ||
10 | * Basics | 10 | * Basics |
11 | 11 | ||
@@ -1255,89 +1255,18 @@ from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-mag | |||
1255 | (eros-mode +1) | 1255 | (eros-mode +1) |
1256 | #+end_src | 1256 | #+end_src |
1257 | 1257 | ||
1258 | **** Fix plists in elisp | 1258 | **** Indent Elisp like Common Lisp |
1259 | |||
1260 | from [[https://github.com/Fuco1/.emacs.d/blob/a8230343bb7e2f07f5eac8e63e5506fa164344f6/site-lisp/my-redef.el#L25][Fuco1]], via mpereira – it’s also in another config I looked at, but using =el-patch=, which I’m not ready to do quite yet. | ||
1261 | 1259 | ||
1262 | #+begin_src emacs-lisp | 1260 | #+begin_src emacs-lisp |
1263 | 1261 | (require 'cl-lib) | |
1264 | ;; redefines the silly indent of keyword lists | 1262 | (setq lisp-indent-function 'common-lisp-indent-function) |
1265 | ;; before | 1263 | (put 'cl-flet 'common-lisp-indent-function |
1266 | ;; (:foo bar | 1264 | (get 'flet 'common-lisp-indent-function)) |
1267 | ;; :baz qux) | 1265 | (put 'cl-labels 'common-lisp-indent-function |
1268 | ;; after | 1266 | (get 'labels 'common-lisp-indent-function)) |
1269 | ;; (:foo bar | 1267 | (put 'if 'common-lisp-indent-function 2) |
1270 | ;; :baz qux) | 1268 | (put 'dotimes-protect 'common-lisp-indent-function |
1271 | (eval-after-load "lisp-mode" | 1269 | (get 'when 'common-lisp-indent-function)) |
1272 | '(defun lisp-indent-function (indent-point state) | ||
1273 | "This function is the normal value of the variable `lisp-indent-function'. | ||
1274 | The function `calculate-lisp-indent' calls this to determine | ||
1275 | if the arguments of a Lisp function call should be indented specially. | ||
1276 | INDENT-POINT is the position at which the line being indented begins. | ||
1277 | Point is located at the point to indent under (for default indentation); | ||
1278 | STATE is the `parse-partial-sexp' state for that position. | ||
1279 | If the current line is in a call to a Lisp function that has a non-nil | ||
1280 | property `lisp-indent-function' (or the deprecated `lisp-indent-hook'), | ||
1281 | it specifies how to indent. The property value can be: | ||
1282 | ,* `defun', meaning indent `defun'-style | ||
1283 | \(this is also the case if there is no property and the function | ||
1284 | has a name that begins with \"def\", and three or more arguments); | ||
1285 | ,* an integer N, meaning indent the first N arguments specially | ||
1286 | (like ordinary function arguments), and then indent any further | ||
1287 | arguments like a body; | ||
1288 | ,* a function to call that returns the indentation (or nil). | ||
1289 | `lisp-indent-function' calls this function with the same two arguments | ||
1290 | that it itself received. | ||
1291 | This function returns either the indentation to use, or nil if the | ||
1292 | Lisp function does not specify a special indentation." | ||
1293 | (let ((normal-indent (current-column)) | ||
1294 | (orig-point (point))) | ||
1295 | (goto-char (1+ (elt state 1))) | ||
1296 | (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) | ||
1297 | (cond | ||
1298 | ;; car of form doesn't seem to be a symbol, or is a keyword | ||
1299 | ((and (elt state 2) | ||
1300 | (or (not (looking-at "\\sw\\|\\s_")) | ||
1301 | (looking-at ":"))) | ||
1302 | (if (not (> (save-excursion (forward-line 1) (point)) | ||
1303 | calculate-lisp-indent-last-sexp)) | ||
1304 | (progn (goto-char calculate-lisp-indent-last-sexp) | ||
1305 | (beginning-of-line) | ||
1306 | (parse-partial-sexp (point) | ||
1307 | calculate-lisp-indent-last-sexp 0 t))) | ||
1308 | ;; Indent under the list or under the first sexp on the same | ||
1309 | ;; line as calculate-lisp-indent-last-sexp. Note that first | ||
1310 | ;; thing on that line has to be complete sexp since we are | ||
1311 | ;; inside the innermost containing sexp. | ||
1312 | (backward-prefix-chars) | ||
1313 | (current-column)) | ||
1314 | ((and (save-excursion | ||
1315 | (goto-char indent-point) | ||
1316 | (skip-syntax-forward " ") | ||
1317 | (not (looking-at ":"))) | ||
1318 | (save-excursion | ||
1319 | (goto-char orig-point) | ||
1320 | (looking-at ":"))) | ||
1321 | (save-excursion | ||
1322 | (goto-char (+ 2 (elt state 1))) | ||
1323 | (current-column))) | ||
1324 | (t | ||
1325 | (let ((function (buffer-substring (point) | ||
1326 | (progn (forward-sexp 1) (point)))) | ||
1327 | method) | ||
1328 | (setq method (or (function-get (intern-soft function) | ||
1329 | 'lisp-indent-function) | ||
1330 | (get (intern-soft function) 'lisp-indent-hook))) | ||
1331 | (cond ((or (eq method 'defun) | ||
1332 | (and (null method) | ||
1333 | (> (length function) 3) | ||
1334 | (string-match "\\`def" function))) | ||
1335 | (lisp-indent-defform state indent-point)) | ||
1336 | ((integerp method) | ||
1337 | (lisp-indent-specform method state | ||
1338 | indent-point normal-indent)) | ||
1339 | (method | ||
1340 | (funcall method indent-point state))))))))) | ||
1341 | #+end_src | 1270 | #+end_src |
1342 | 1271 | ||
1343 | *** Janet | 1272 | *** Janet |