3838; ; If you always want to use this library, add following lines to your init.el:
3939
4040; ; (setq editorconfig-get-properties-function
41- ; ; 'editorconfig-core-get-properties-hash)
41+ ; ; # 'editorconfig-core-get-properties-hash)
4242
4343
4444; ; Functions
5555; ; (KEY . VALUE) .
5656
5757
58- ; ; editorconfig-core-get-properties-hash (&optional file confname confversion )
58+ ; ; editorconfig-core-get-properties-hash (&optional file confname)
5959
6060; ; Get EditorConfig properties for FILE.
6161
@@ -85,7 +85,7 @@ RESULT is used internally and normally should not be used."
8585 (parent (file-name-directory (directory-file-name dir))))
8686 (if (or (string= parent dir)
8787 (and handle (editorconfig-core-handle-root-p handle)))
88- (cl-remove-if-not 'identity (cons handle result))
88+ (cl-remove-if-not # 'identity (cons handle result))
8989 (editorconfig-core--get-handles parent
9090 confname
9191 (cons handle result)))))
@@ -98,22 +98,6 @@ RESULT is used internally and normally should not be used."
9898 " .editorconfig" )))))
9999 (editorconfig-core-handle-path handle)))
100100
101- ;;;### autoload
102- (defun editorconfig-core-get-properties (&optional file confname confversion )
103- " Get EditorConfig properties for FILE.
104- If FILE is not given, use currently visiting file.
105- Give CONFNAME for basename of config file other than .editorconfig.
106- If need to specify config format version, give CONFVERSION.
107-
108- This function returns an alist of properties. Each element will
109- look like (KEY . VALUE)."
110- (let ((hash (editorconfig-core-get-properties-hash file confname confversion))
111- (result nil ))
112- (maphash (lambda (key value )
113- (add-to-list 'result (cons (symbol-name key) value)))
114- hash)
115- (sort result (lambda (x y ) (string< (car x) (car y))))))
116-
117101(defun editorconfig-core--hash-merge (into update )
118102 " Merge two hashes INTO and UPDATE.
119103
@@ -122,8 +106,7 @@ When the same key exists in both two hashes, values of UPDATE takes precedence."
122106 (maphash (lambda (key value ) (puthash key value into)) update)
123107 into)
124108
125- ;;;### autoload
126- (defun editorconfig-core-get-properties-hash (&optional file confname confversion )
109+ (defun editorconfig-core-get-properties-hash (&optional file confname )
127110 " Get EditorConfig properties for FILE.
128111If FILE is not given, use currently visiting file.
129112Give CONFNAME for basename of config file other than .editorconfig.
@@ -136,7 +119,6 @@ hash object instead."
136119 buffer-file-name
137120 (error " FILE is not given and `buffer-file-name' is nil " ))))
138121 (setq confname (or confname " .editorconfig" ))
139- (setq confversion (or confversion " 0.12.0" ))
140122 (let ((result (make-hash-table )))
141123 (dolist (handle (editorconfig-core--get-handles (file-name-directory file)
142124 confname))
@@ -145,37 +127,12 @@ hash object instead."
145127 file)))
146128
147129 ; ; Downcase known boolean values
130+ ; ; FIXME: Why not do that in `editorconfig-core-handle--parse-file' ?
148131 (dolist (key '( end_of_line indent_style indent_size insert_final_newline
149132 trim_trailing_whitespace charset))
150133 (when-let* ((val (gethash key result)))
151134 (puthash key (downcase val) result)))
152135
153- ; ; Add indent_size property
154- (let ((v-indent-size (gethash 'indent_size result))
155- (v-indent-style (gethash 'indent_style result)))
156- (when (and (not v-indent-size)
157- (string= v-indent-style " tab" )
158- ; ; If VERSION < 0.9.0, indent_size should have no default value
159- (version<= " 0.9.0"
160- confversion))
161- (puthash 'indent_size
162- " tab"
163- result)))
164- ; ; Add tab_width property
165- (let ((v-indent-size (gethash 'indent_size result))
166- (v-tab-width (gethash 'tab_width result)))
167- (when (and v-indent-size
168- (not v-tab-width)
169- (not (string= v-indent-size " tab" )))
170- (puthash 'tab_width v-indent-size result)))
171- ; ; Update indent-size property
172- (let ((v-indent-size (gethash 'indent_size result))
173- (v-tab-width (gethash 'tab_width result)))
174- (when (and v-indent-size
175- v-tab-width
176- (string= v-indent-size " tab" ))
177- (puthash 'indent_size v-tab-width result)))
178-
179136 result))
180137
181138(provide 'editorconfig-core )
0 commit comments