emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] scratch/editorconfig-cc 60b39fadfb 209/351: Add variable -hack-


From: Stefan Monnier
Subject: [nongnu] scratch/editorconfig-cc 60b39fadfb 209/351: Add variable -hack-properties-functions
Date: Thu, 13 Jun 2024 18:38:54 -0400 (EDT)

branch: scratch/editorconfig-cc
commit 60b39fadfbf879c56b002d76e37d025ba8f93d98
Author: 10sr <8.slashes@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Add variable -hack-properties-functions
---
 editorconfig.el | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/editorconfig.el b/editorconfig.el
index bfd74671ad..6dd4ae0068 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -114,6 +114,24 @@ show line numbers on the left:
   'editorconfig-after-apply-functions
   "0.7.14")
 
+(defcustom editorconfig-hack-properties-functions ()
+  "A list of function to alter property values before applying them.
+
+These functions will be run after loading \".editorconfig\" files and before
+applying them to current buffer, so that you can alter some properties from
+\".editorconfig\" before they take effect.
+
+For example, Makefiles always use tab characters for indentation: you can
+overwrite \"indent_style\" property when current `major-mode' is a
+`makefile-mode' with following code:
+
+  (add-hook 'editorconfig-hack-properties-functions
+            '(lambda (props)
+               (when (derived-mode-p makefile-mode)
+                 (puthash 'indent_style \"tab\" props))))"
+  :type 'hook
+  :group 'editorconfig)
+
 (defcustom editorconfig-indentation-alist
   ;; For contributors: Sort modes in alphabetical order, please :)
   '((apache-mode apache-indent-level)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]