[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/emacs-editorconfig a9f66410739 16/21: editorconfig-core.el: Remo
From: |
Stefan Monnier |
Subject: |
scratch/emacs-editorconfig a9f66410739 16/21: editorconfig-core.el: Remove unneeded defaulting code |
Date: |
Wed, 19 Jun 2024 14:43:54 -0400 (EDT) |
branch: scratch/emacs-editorconfig
commit a9f66410739bc7baa606c506f9423d35439330e2
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
editorconfig-core.el: Remove unneeded defaulting code
This code risks setting `tab-width` even when it's not
requested, and these rules are better handled in
`editorconfig--get-indentation` in any case.
* lisp/editorconfig-core.el (editorconfig-core-get-properties):
Delete function, unused.
(editorconfig-core-get-properties-hash): Comment out defaulting code.
---
lisp/editorconfig-core.el | 75 ++++++++++++++++-------------------------------
1 file changed, 26 insertions(+), 49 deletions(-)
diff --git a/lisp/editorconfig-core.el b/lisp/editorconfig-core.el
index 3dfdd5c7188..02a2b7885ec 100644
--- a/lisp/editorconfig-core.el
+++ b/lisp/editorconfig-core.el
@@ -43,18 +43,6 @@
;; Functions
-;; editorconfig-core-get-properties (&optional file confname confversion)
-
-;; Get EditorConfig properties for FILE.
-
-;; If FILE is not given, use currently visiting file.
-;; Give CONFNAME for basename of config file other than .editorconfig.
-;; If need to specify config format version, give CONFVERSION.
-
-;; This functions returns alist of properties. Each element will look like
-;; (KEY . VALUE) .
-
-
;; editorconfig-core-get-properties-hash (&optional file confname confversion)
;; Get EditorConfig properties for FILE.
@@ -97,21 +85,6 @@ RESULT is used internally and normally should not be used."
".editorconfig")))))
(editorconfig-core-handle-path handle)))
-(defun editorconfig-core-get-properties (&optional file confname confversion)
- "Get EditorConfig properties for FILE.
-If FILE is not given, use currently visiting file.
-Give CONFNAME for basename of config file other than .editorconfig.
-If need to specify config format version, give CONFVERSION.
-
-This function returns an alist of properties. Each element will
-look like (KEY . VALUE)."
- (let ((hash (editorconfig-core-get-properties-hash file confname
confversion))
- (result nil))
- (maphash (lambda (key value)
- (add-to-list 'result (cons (symbol-name key) value)))
- hash)
- result))
-
(defun editorconfig-core--hash-merge (into update)
"Merge two hashes INTO and UPDATE.
@@ -142,36 +115,40 @@ hash object instead."
file)))
;; Downcase known boolean values
+ ;; FIXME: Why not do that in `editorconfig-core-handle--parse-file'?
(dolist (key '( end_of_line indent_style indent_size insert_final_newline
trim_trailing_whitespace charset))
(when-let* ((val (gethash key result)))
(puthash key (downcase val) result)))
;; Add indent_size property
- (let ((v-indent-size (gethash 'indent_size result))
- (v-indent-style (gethash 'indent_style result)))
- (when (and (not v-indent-size)
- (string= v-indent-style "tab")
- ;; If VERSION < 0.9.0, indent_size should have no default
value
- (version<= "0.9.0"
- confversion))
- (puthash 'indent_size
- "tab"
- result)))
+ ;; FIXME: Why? Which part of the spec requires that?
+ ;;(let ((v-indent-size (gethash 'indent_size result))
+ ;; (v-indent-style (gethash 'indent_style result)))
+ ;; (when (and (not v-indent-size)
+ ;; (string= v-indent-style "tab")
+ ;; ;; If VERSION < 0.9.0, indent_size should have no default
value
+ ;; (version<= "0.9.0"
+ ;; confversion))
+ ;; (puthash 'indent_size
+ ;; "tab"
+ ;; result)))
;; Add tab_width property
- (let ((v-indent-size (gethash 'indent_size result))
- (v-tab-width (gethash 'tab_width result)))
- (when (and v-indent-size
- (not v-tab-width)
- (not (string= v-indent-size "tab")))
- (puthash 'tab_width v-indent-size result)))
+ ;; FIXME: Why? Which part of the spec requires that?
+ ;;(let ((v-indent-size (gethash 'indent_size result))
+ ;; (v-tab-width (gethash 'tab_width result)))
+ ;; (when (and v-indent-size
+ ;; (not v-tab-width)
+ ;; (not (string= v-indent-size "tab")))
+ ;; (puthash 'tab_width v-indent-size result)))
;; Update indent-size property
- (let ((v-indent-size (gethash 'indent_size result))
- (v-tab-width (gethash 'tab_width result)))
- (when (and v-indent-size
- v-tab-width
- (string= v-indent-size "tab"))
- (puthash 'indent_size v-tab-width result)))
+ ;; FIXME: Why? Which part of the spec requires that?
+ ;;(let ((v-indent-size (gethash 'indent_size result))
+ ;; (v-tab-width (gethash 'tab_width result)))
+ ;; (when (and v-indent-size
+ ;; v-tab-width
+ ;; (string= v-indent-size "tab"))
+ ;; (puthash 'indent_size v-tab-width result)))
result))
- scratch/emacs-editorconfig 25523847e79 08/21: (editorconfig--should-set): Eliminate `lisp-indent-offset` special case, (continued)
- scratch/emacs-editorconfig 25523847e79 08/21: (editorconfig--should-set): Eliminate `lisp-indent-offset` special case, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig a20f20aa8c7 12/21: lisp/editorconfig: Advise `find-auto-coding` i.s.o `insert-file-contents`, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig 7a4208a54c0 17/21: editorconfig-fnmatch.el: Eliminate O(N^2) complexity, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig 35744aae563 18/21: editorconfig-core-handle.el: Reduce allocation in parser, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig 91339a9f1fa 20/21: (editorconfig-indentation-alist): Sync with upstream, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig f2803456f02 10/21: (editorconfig-set-local-variables): Get first, set later, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig c1466f16b10 15/21: editorconfig-core-handle.el: Don't use file names as glob pattern, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig a72b1ca231c 21/21: Integrate feedback from Stefan Kangas and Michael Albinus, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig 527a45abc37 09/21: lisp/editorconfig: Don't hook into `read-only-mode-hook`, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig f8576f6638d 14/21: lisp/editorconfig: Minor cosmetic fixes, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig a9f66410739 16/21: editorconfig-core.el: Remove unneeded defaulting code,
Stefan Monnier <=
- scratch/emacs-editorconfig 691da81747e 11/21: lisp/editorconfig: Use new Emacs-30 hooks, Stefan Monnier, 2024/06/19
- scratch/emacs-editorconfig 1d85088ab5f 19/21: Add doc for EditorConfig support, Stefan Monnier, 2024/06/19