branch: scratch/editorconfig-cc
commit 625073f793eb45502c9c655e1db0e9e2de7d17cb
Author: 10sr <[email protected]>
Commit: Stefan Monnier <[email protected]>
Implement --hash-merge
---
editorconfig-core.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/editorconfig-core.el b/editorconfig-core.el
index 512d7d8dfb..a49841aca3 100644
--- a/editorconfig-core.el
+++ b/editorconfig-core.el
@@ -186,6 +186,18 @@ This functions returns alist of properties. Each element
will look like
result))
+(defun editorconfig-core--hash-merge (into update)
+ "Merge to hashes INTO and UPDATE.
+
+This is a destructive function, hash INTO will be modified.
+When the same key exists in both two hashes, values of UPDATE takes
precedence."
+ (maphash (lambda (key value)
+ (puthash key
+ value
+ into))
+ update)
+ into)
+
;;;###autoload
(defun editorconfig-core-get-properties-hash (&optional file confname
confversion)
"Get EditorConfig properties for FILE.