diff options
author | Case Duckworth | 2021-01-13 19:52:44 -0600 |
---|---|---|
committer | Case Duckworth | 2021-01-13 19:52:44 -0600 |
commit | bc2d8c64174a7a9d15210468f8253f2da667cbc4 (patch) | |
tree | 4735fa272ea6b7f8ad438398ded68ac83fd65777 | |
parent | add adaptive-wrap-prefix-mode to a hook (diff) | |
download | emacs-bc2d8c64174a7a9d15210468f8253f2da667cbc4.tar.gz emacs-bc2d8c64174a7a9d15210468f8253f2da667cbc4.zip |
Elisp: Add Eros, fix plist indentation
-rw-r--r-- | config.org | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/config.org b/config.org index bb89424..bc094c7 100644 --- a/config.org +++ b/config.org | |||
@@ -1246,6 +1246,102 @@ from [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-order-of-mag | |||
1246 | "Don't truncate printed expressions by level.") | 1246 | "Don't truncate printed expressions by level.") |
1247 | #+end_src | 1247 | #+end_src |
1248 | 1248 | ||
1249 | **** Eros (Evaluation Result OverlayS) | ||
1250 | |||
1251 | #+begin_src emacs-lisp | ||
1252 | (straight-use-package 'eros) | ||
1253 | |||
1254 | (cuss eros-eval-result-prefix ";; => " | ||
1255 | "Prefix displayed before eros overlays.") | ||
1256 | |||
1257 | (eros-mode +1) | ||
1258 | #+end_src | ||
1259 | |||
1260 | **** Fix plists in elisp | ||
1261 | |||
1262 | 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. | ||
1263 | |||
1264 | #+begin_src emacs-lisp | ||
1265 | |||
1266 | ;; redefines the silly indent of keyword lists | ||
1267 | ;; before | ||
1268 | ;; (:foo bar | ||
1269 | ;; :baz qux) | ||
1270 | ;; after | ||
1271 | ;; (:foo bar | ||
1272 | ;; :baz qux) | ||
1273 | (eval-after-load "lisp-mode" | ||
1274 | '(defun lisp-indent-function (indent-point state) | ||
1275 | "This function is the normal value of the variable `lisp-indent-function'. | ||
1276 | The function `calculate-lisp-indent' calls this to determine | ||
1277 | if the arguments of a Lisp function call should be indented specially. | ||
1278 | INDENT-POINT is the position at which the line being indented begins. | ||
1279 | Point is located at the point to indent under (for default indentation); | ||
1280 | STATE is the `parse-partial-sexp' state for that position. | ||
1281 | If the current line is in a call to a Lisp function that has a non-nil | ||
1282 | property `lisp-indent-function' (or the deprecated `lisp-indent-hook'), | ||
1283 | it specifies how to indent. The property value can be: | ||
1284 | ,* `defun', meaning indent `defun'-style | ||
1285 | \(this is also the case if there is no property and the function | ||
1286 | has a name that begins with \"def\", and three or more arguments); | ||
1287 | ,* an integer N, meaning indent the first N arguments specially | ||
1288 | (like ordinary function arguments), and then indent any further | ||
1289 | arguments like a body; | ||
1290 | ,* a function to call that returns the indentation (or nil). | ||
1291 | `lisp-indent-function' calls this function with the same two arguments | ||
1292 | that it itself received. | ||
1293 | This function returns either the indentation to use, or nil if the | ||
1294 | Lisp function does not specify a special indentation." | ||
1295 | (let ((normal-indent (current-column)) | ||
1296 | (orig-point (point))) | ||
1297 | (goto-char (1+ (elt state 1))) | ||
1298 | (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) | ||
1299 | (cond | ||
1300 | ;; car of form doesn't seem to be a symbol, or is a keyword | ||
1301 | ((and (elt state 2) | ||
1302 | (or (not (looking-at "\\sw\\|\\s_")) | ||
1303 | (looking-at ":"))) | ||
1304 | (if (not (> (save-excursion (forward-line 1) (point)) | ||
1305 | calculate-lisp-indent-last-sexp)) | ||
1306 | (progn (goto-char calculate-lisp-indent-last-sexp) | ||
1307 | (beginning-of-line) | ||
1308 | (parse-partial-sexp (point) | ||
1309 | calculate-lisp-indent-last-sexp 0 t))) | ||
1310 | ;; Indent under the list or under the first sexp on the same | ||
1311 | ;; line as calculate-lisp-indent-last-sexp. Note that first | ||
1312 | ;; thing on that line has to be complete sexp since we are | ||
1313 | ;; inside the innermost containing sexp. | ||
1314 | (backward-prefix-chars) | ||
1315 | (current-column)) | ||
1316 | ((and (save-excursion | ||
1317 | (goto-char indent-point) | ||
1318 | (skip-syntax-forward " ") | ||
1319 | (not (looking-at ":"))) | ||
1320 | (save-excursion | ||
1321 | (goto-char orig-point) | ||
1322 | (looking-at ":"))) | ||
1323 | (save-excursion | ||
1324 | (goto-char (+ 2 (elt state 1))) | ||
1325 | (current-column))) | ||
1326 | (t | ||
1327 | (let ((function (buffer-substring (point) | ||
1328 | (progn (forward-sexp 1) (point)))) | ||
1329 | method) | ||
1330 | (setq method (or (function-get (intern-soft function) | ||
1331 | 'lisp-indent-function) | ||
1332 | (get (intern-soft function) 'lisp-indent-hook))) | ||
1333 | (cond ((or (eq method 'defun) | ||
1334 | (and (null method) | ||
1335 | (> (length function) 3) | ||
1336 | (string-match "\\`def" function))) | ||
1337 | (lisp-indent-defform state indent-point)) | ||
1338 | ((integerp method) | ||
1339 | (lisp-indent-specform method state | ||
1340 | indent-point normal-indent)) | ||
1341 | (method | ||
1342 | (funcall method indent-point state))))))))) | ||
1343 | #+end_src | ||
1344 | |||
1249 | *** Janet | 1345 | *** Janet |
1250 | 1346 | ||
1251 | #+begin_src emacs-lisp | 1347 | #+begin_src emacs-lisp |