[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode 75b907c767 328/500: Improve indentation of functi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode 75b907c767 328/500: Improve indentation of function bodies. |
Date: |
Sat, 29 Jan 2022 08:27:18 -0500 (EST) |
branch: elpa/nix-mode
commit 75b907c767126dc97fde85208d422d4d694e1912
Author: Jakub Piecuch <j.piecuch96@gmail.com>
Commit: Jakub Piecuch <j.piecuch96@gmail.com>
Improve indentation of function bodies.
---
nix-mode.el | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/nix-mode.el b/nix-mode.el
index 792501ae95..1a41d83705 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -442,15 +442,8 @@ STRING-TYPE type of string based off of Emacs syntax table
types"
`(column . ,(current-column))
(nix-smie--indent-anchor)))
(`(:after . ":")
- ;; Skip over the argument.
- (smie-backward-sexp " -bseqskip- ")
- (cond
- ((smie-rule-bolp)
- `(column . ,(current-column)))
- ((= (current-indentation) 0)
- '(column . 0))
- (t
- (nix-smie--indent-anchor))))
+ (or (nix-smie--indent-args-line)
+ (nix-smie--indent-anchor)))
(`(:after . ",")
(smie-rule-parent tab-width))
(`(:before . "in")
@@ -502,6 +495,18 @@ STRING-TYPE type of string based off of Emacs syntax table
types"
(let ((indent (or indent tab-width)))
`(column . ,(+ indent (nix-smie--anchor)))))
+(defun nix-smie--indent-args-line ()
+ "Indent the body of a lambda whose argument(s) are on a line of their own."
+ (save-excursion
+ ;; Assume that point is right before ':', skip it
+ (forward-char)
+ (let ((tok ":"))
+ (catch 'break
+ (while (equal tok ":")
+ (setq tok (nth 2 (smie-backward-sexp t)))
+ (when (smie-rule-bolp)
+ (throw 'break `(column . ,(current-column)))))))))
+
(defconst nix-smie--path-chars "a-zA-Z0-9-+_.:/~")
(defun nix-smie--skip-path (how)
- [nongnu] elpa/nix-mode aae6f710e0 404/500: Address review comments, (continued)
- [nongnu] elpa/nix-mode aae6f710e0 404/500: Address review comments, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode d27820b040 442/500: Merge pull request #131 from nagy/nix-process-refactor, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 5f44621864 474/500: nix-flake: Make the argument bindings more predictable, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a18a226ce9 123/500: Add nix-mode tests., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 9e59bcf59e 216/500: Fix read only .drv file issue, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8ab089b251 230/500: Set nix-shell-attribute, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 84ee98019f 271/500: Skip over comments in indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a30e88362a 290/500: Remove line that caused tests to not indent at all in the tests, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 82399e6bc3 305/500: Add missing check for '?' when lexing forward., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode ec19a472ec 318/500: Update documentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 75b907c767 328/500: Improve indentation of function bodies.,
ELPA Syncer <=
- [nongnu] elpa/nix-mode 78c3832e48 333/500: Make smie-setup optional, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 56748ac556 457/500: Merge pull request #136 from bcc32/replace-buffer-contents, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e61ecb95ef 456/500: Merge pull request #137 from bcc32/nix-format-before-save, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0d65c482b2 477/500: nix-flake: Avoid use of flatten-list to support older Emacs versions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 07b6069c78 491/500: nix-flake: Fix an unexpected error in assert, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 14f1bb20b9 487/500: chore: Bump install-nix-action to v14.1, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 00b2b8da57 500/500: Merge pull request #145 from NixOS/dependabot/github_actions/cachix/install-nix-action-16, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1e0709acde 028/500: Fixup indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode aee3dea8ec 031/500: Refactor font lock, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8cb5ba0bc8 048/500: Change nix keymaps, ELPA Syncer, 2022/01/29