[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] scratch/editorconfig-cc ca7aeff4b3 159/351: Add variable to dis
From: |
Stefan Monnier |
Subject: |
[nongnu] scratch/editorconfig-cc ca7aeff4b3 159/351: Add variable to disable indent_size when conditions are met for lisp |
Date: |
Thu, 13 Jun 2024 18:38:49 -0400 (EDT) |
branch: scratch/editorconfig-cc
commit ca7aeff4b38bcb028d3529d8e3902cc0374d3611
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Add variable to disable indent_size when conditions are met for lisp
---
editorconfig.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/editorconfig.el b/editorconfig.el
index a2cd19746c..5564d18a34 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -232,6 +232,16 @@ Set by `editorconfig-apply' and nil if that is not invoked
in
current buffer yet.")
(make-variable-buffer-local 'editorconfig-properties-hash)
+(defvar editorconfig-lisp-use-default-indent nil
+ "Selectively ignore the value of indent_sizefor Lisp files.
+Prevents `lisp-indent-offset' from being set selectively.
+
+nil - `lisp-indent-offset' is always set normally.
+t - `lisp-indent-offset' is never set normally
+ (always use default indent for lisps).
+number - `lisp-indent-offset' is not set only if indent_size is
+ equal to this number. For example, if this is set to 2,
+ `lisp-indent-offset'will not be set only if indent_size is 2.")
(defun editorconfig-string-integer-p (string)
"Return non-nil if STRING represents integer."
@@ -246,6 +256,19 @@ current buffer yet.")
"Set `latex-mode' indent size to SIZE."
)
+(defun editorconfig--should-set (size symbol)
+ "Determines if editorconfig should set SYMBOL using SIZE."
+ (if (eq symbol 'lisp-indent-offset)
+ (cond
+ ((eql nil editorconfig-lisp-use-default-indent)
+ t)
+ ((eql t editorconfig-lisp-use-default-indent)
+ nil)
+ ((numberp editorconfig-lisp-use-default-indent)
+ (not (eql size editorconfig-lisp-use-default-indent)))
+ (t t))
+ t))
+
(defun editorconfig-set-indentation (style &optional size tab_width)
"Set indentation type from STYLE, SIZE and TAB_WIDTH."
(if (editorconfig-string-integer-p size)
- [nongnu] scratch/editorconfig-cc b4911d662f 075/351: Already 2016 :) Happy new year!, (continued)
- [nongnu] scratch/editorconfig-cc b4911d662f 075/351: Already 2016 :) Happy new year!, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 75139b95da 059/351: Use dedicated functions to manipulate hook, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ca854b55ff 064/351: Update README for charset support, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 649e645106 076/351: Bump version to 0.7.2, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc de2b791957 083/351: Add editorconfig-exclude-modes, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 044453e7ac 080/351: Add editorconfig-conf-mode, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc c93d216f39 087/351: Do not check metadata of files other than editorconfig.el, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 031ef9c1c1 081/351: Add one variable editorconfig-properties-hash, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 13f3c4951c 084/351: Bump required editorconfi-core version, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 9bd6af5f0e 097/351: Add EditorConfig group definition, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ca7aeff4b3 159/351: Add variable to disable indent_size when conditions are met for lisp,
Stefan Monnier <=
- [nongnu] scratch/editorconfig-cc b1d254fd14 122/351: Add a :lighter "EditorConfig" for editorconfig-mode., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 6f7137e593 113/351: Simplify definition of string-integer-p (#96), Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 5034a3ae16 145/351: Add function to open nearest .editorconfig file (#131), Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 851c96f125 116/351: Update README.md, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc d02b7027ae 132/351: Add plugin-tests submodule, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc a09b197c76 156/351: Add two test cases for fnmatch, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc d5c50cb9d7 102/351: Update README: add information about customize-variable., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc c48f549c3a 152/351: Fix typo, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 0b314fcbea 135/351: Update README for some variables, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 90fba8ee80 164/351: Add doc/.gitignore, Stefan Monnier, 2024/06/13