diff options
Diffstat (limited to 'config.org')
-rw-r--r-- | config.org | 93 |
1 files changed, 11 insertions, 82 deletions
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 |