mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Editorconfig: Merge a few more changes from upstream
* lisp/editorconfig-core.el: Fix up leading comment. (editorconfig-core-get-properties-hash): Remove unused `confversion` arg. * lisp/editorconfig-fnmatch.el (editorconfig-fnmatch--cache-hashtable): Use `defconst`. (editorconfig-fnmatch--do-translate): Don't escape `,` or `-` in regexps. * lisp/editorconfig.el (editorconfig-indentation-alist): Remove redundant entries for `ess-mode` and `terra-mode`.
This commit is contained in:
parent
96bb95c8cc
commit
aa5a9df828
3 changed files with 11 additions and 52 deletions
|
|
@ -39,18 +39,16 @@
|
|||
;; and fallback to this library if not found.
|
||||
;; If you always want to use this library, add following lines to your init.el:
|
||||
|
||||
;; (setq editorconfig-get-properties-function
|
||||
;; 'editorconfig-core-get-properties-hash)
|
||||
|
||||
|
||||
;; Functions
|
||||
|
||||
;; editorconfig-core-get-properties-hash (&optional file confname confversion)
|
||||
;; editorconfig-core-get-properties-hash (&optional file confname)
|
||||
|
||||
;; Get EditorConfig properties for FILE.
|
||||
|
||||
;; This function is almost same as `editorconfig-core-get-properties', but
|
||||
;; returns hash object instead.
|
||||
;; If FILE is not given, use currently visiting file.
|
||||
;; Give CONFNAME for basename of config file other than .editorconfig.
|
||||
|
||||
;; This functions returns hash table of properties' values.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
|
@ -95,11 +93,10 @@ When the same key exists in both two hashes, values of UPDATE takes precedence."
|
|||
(maphash (lambda (key value) (puthash key value into)) update)
|
||||
into)
|
||||
|
||||
(defun editorconfig-core-get-properties-hash (&optional file confname confversion)
|
||||
(defun editorconfig-core-get-properties-hash (&optional file confname)
|
||||
"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 is almost same as `editorconfig-core-get-properties', but returns
|
||||
hash object instead."
|
||||
|
|
@ -108,7 +105,6 @@ hash object instead."
|
|||
buffer-file-name
|
||||
(error "FILE is not given and `buffer-file-name' is nil"))))
|
||||
(setq confname (or confname ".editorconfig"))
|
||||
(setq confversion (or confversion "0.12.0"))
|
||||
(let ((result (make-hash-table)))
|
||||
(dolist (handle (editorconfig-core--get-handles (file-name-directory file)
|
||||
confname))
|
||||
|
|
@ -123,35 +119,6 @@ hash object instead."
|
|||
(when-let* ((val (gethash key result)))
|
||||
(puthash key (downcase val) result)))
|
||||
|
||||
;; Add indent_size property
|
||||
;; 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
|
||||
;; 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
|
||||
;; 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))
|
||||
|
||||
(provide 'editorconfig-core)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
;;; editorconfig-fnmatch.el --- Glob pattern matching -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2011-2025 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2011-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: EditorConfig Team <editorconfig@googlegroups.com>
|
||||
;; Package: editorconfig
|
||||
|
|
@ -55,13 +55,9 @@
|
|||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar editorconfig-fnmatch--cache-hashtable
|
||||
nil
|
||||
(defconst editorconfig-fnmatch--cache-hashtable ;; Clear cache on file reload.
|
||||
(make-hash-table :test 'equal)
|
||||
"Cache of shell pattern and its translation.")
|
||||
;; Clear cache on file reload
|
||||
(setq editorconfig-fnmatch--cache-hashtable
|
||||
(make-hash-table :test 'equal))
|
||||
|
||||
|
||||
(defconst editorconfig-fnmatch--left-brace-regexp
|
||||
"\\(^\\|[^\\]\\){"
|
||||
|
|
@ -147,7 +143,7 @@ translation is found for PATTERN."
|
|||
|
||||
(while (< index length)
|
||||
(if (and (not is-escaped)
|
||||
(string-match "[^]\\*?[{},/-]+"
|
||||
(string-match "[^]\\*?[{},/]+"
|
||||
;;(string-match "[^]\\*?[{},/\\-]+" "?.a")
|
||||
pattern
|
||||
index)
|
||||
|
|
@ -203,8 +199,6 @@ translation is found for PATTERN."
|
|||
"[^")
|
||||
"[")))))
|
||||
|
||||
(?- (if in-brackets "-" "\\-"))
|
||||
|
||||
(?\] (setq in-brackets nil) "]")
|
||||
|
||||
(?\{
|
||||
|
|
@ -249,7 +243,7 @@ translation is found for PATTERN."
|
|||
(?,
|
||||
(if (and (> brace-level 0)
|
||||
(not is-escaped))
|
||||
"\\|" "\\,"))
|
||||
"\\|" ","))
|
||||
|
||||
(?\}
|
||||
(if (and (> brace-level 0)
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ This hook will be run even when there are no matching sections in
|
|||
(d-mode c-basic-offset)
|
||||
(elixir-ts-mode elixir-ts-indent-offset)
|
||||
(emacs-lisp-mode . editorconfig--get-indentation-lisp-mode)
|
||||
(ess-mode ess-indent-offset)
|
||||
(f90-mode f90-associate-indent
|
||||
f90-continuation-indent
|
||||
f90-critical-indent
|
||||
|
|
@ -211,7 +210,6 @@ This hook will be run even when there are no matching sections in
|
|||
(scala-mode scala-indent:step)
|
||||
(scss-mode css-indent-offset)
|
||||
(swift-mode swift-mode:basic-offset)
|
||||
(terra-mode terra-indent-level)
|
||||
(tcl-mode tcl-indent-level
|
||||
tcl-continued-indent-level)
|
||||
(toml-ts-mode toml-ts-mode-indent-offset)
|
||||
|
|
|
|||
Loading…
Reference in a new issue