[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode 78c3832e48 333/500: Make smie-setup optional
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode 78c3832e48 333/500: Make smie-setup optional |
Date: |
Sat, 29 Jan 2022 08:27:18 -0500 (EST) |
branch: elpa/nix-mode
commit 78c3832e48862f8eb748007707e3eea5e31335dc
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>
Make smie-setup optional
Some really large files can take a little bit to load. You can smie by
setting nix-mode-use-smie to nil. It is still enabled by default.
---
CHANGELOG.md | 8 ++++++++
nix-mode.el | 32 +++++++++++++++++++++-----------
2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e438be6dc2..98fa64df99 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 1.4.1
+
+### Changes
+
+* Made smie-setup optional. Some really large files can take a little
+ bit to load. You can smie by setting nix-mode-use-smie to nil. It is
+ still enabled by default.
+
## 1.4.0
### Changes
diff --git a/nix-mode.el b/nix-mode.el
index edc154c18b..4fddae5862 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -34,11 +34,18 @@
Valid functions for this are:
- ‘indent-relative’
-- nix-indent-line (buggy)
-- smie-indent-line"
+- ‘nix-indent-line' (buggy)
+- `smie-indent-line' (‘nix-mode-use-smie’ must be enabled)"
:group 'nix-mode
:type 'function)
+(defcustom nix-mode-use-smie t
+ "Whether to use SMIE when editing Nix files.
+This is enabled by default, but can take a while to load with
+very large Nix files (all-packages.nix)."
+ :group 'nix-mode
+ :type 'boolean)
+
(defgroup nix-faces nil
"Nix faces."
:group 'nix-mode
@@ -919,16 +926,19 @@ The hook `nix-mode-hook' is run when Nix mode is started.
;; Look at text properties when parsing
(setq-local parse-sexp-lookup-properties t)
+ ;; Setup SMIE integration
+ (when nix-mode-use-smie
+ (smie-setup nix-smie-grammar 'nix-smie-rules
+ :forward-token 'nix-smie--forward-token
+ :backward-token 'nix-smie--backward-token)
+ (setq-local smie-indent-basic 2)
+ (fset (make-local-variable 'smie-indent-exps)
+ (symbol-function 'nix-smie--indent-exps))
+ (fset (make-local-variable 'smie-indent-close)
+ (symbol-function 'nix-smie--indent-close)))
+
;; Automatic indentation [C-j]
- (smie-setup nix-smie-grammar 'nix-smie-rules
- :forward-token 'nix-smie--forward-token
- :backward-token 'nix-smie--backward-token)
- (setq-local smie-indent-basic 2)
- (setq-local indent-line-function nix-indent-function)
- (fset (make-local-variable 'smie-indent-exps)
- (symbol-function 'nix-smie--indent-exps))
- (fset (make-local-variable 'smie-indent-close)
- (symbol-function 'nix-smie--indent-close))
+ (setq-local indent-line-function (lambda () (funcall nix-indent-function)))
;; Indenting of comments
(setq-local comment-start "# ")
- [nongnu] elpa/nix-mode d27820b040 442/500: Merge pull request #131 from nagy/nix-process-refactor, (continued)
- [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, 2022/01/29
- [nongnu] elpa/nix-mode 78c3832e48 333/500: Make smie-setup optional,
ELPA Syncer <=
- [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
- [nongnu] elpa/nix-mode 76df9f3e6b 044/500: Add let indent level counter., ELPA Syncer, 2022/01/29