[nongnu] scratch/editorconfig-cc 71604c32eb 316/351: chore: Place emacs dependency to the front (#285)
branch: scratch/editorconfig-cc commit 71604c32eb30a9ac4316e6294a433c9b3cf10cfa Author: Jen-Chieh Shen Commit: Stefan Monnier chore: Place emacs dependency to the front (#285) * chore: Place emacs dependency infront * Update copyright year --- editorconfig-conf-mode.el | 2 +- editorconfig-core-handle.el | 2 +- editorconfig-core.el| 2 +- editorconfig-fnmatch.el | 2 +- editorconfig.el | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el index 2694ad48a4..4f84dd708a 100644 --- a/editorconfig-conf-mode.el +++ b/editorconfig-conf-mode.el @@ -1,6 +1,6 @@ ;;; editorconfig-conf-mode.el --- Major mode for editing .editorconfig files -*- lexical-binding: t -*- -;; Copyright (C) 2011-2021 EditorConfig Team +;; Copyright (C) 2011-2022 EditorConfig Team ;; Author: EditorConfig Team diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index c94296f9fd..1b914c2e64 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -1,6 +1,6 @@ ;;; editorconfig-core-handle.el --- Handle Class for EditorConfig File -*- lexical-binding: t -*- -;; Copyright (C) 2011-2021 EditorConfig Team +;; Copyright (C) 2011-2022 EditorConfig Team ;; Author: EditorConfig Team diff --git a/editorconfig-core.el b/editorconfig-core.el index 17c90139e9..21c5cc6d2e 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -1,6 +1,6 @@ ;;; editorconfig-core.el --- EditorConfig Core library in Emacs Lisp -*- lexical-binding: t -*- -;; Copyright (C) 2011-2021 EditorConfig Team +;; Copyright (C) 2011-2022 EditorConfig Team ;; Author: EditorConfig Team diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index c58c62c78b..68f2f58a55 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -1,6 +1,6 @@ ;;; editorconfig-fnmatch.el --- Glob pattern matching in Emacs lisp -*- lexical-binding: t -*- -;; Copyright (C) 2011-2021 EditorConfig Team +;; Copyright (C) 2011-2022 EditorConfig Team ;; Author: EditorConfig Team diff --git a/editorconfig.el b/editorconfig.el index d5ba245c51..06fe6a7d8c 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -1,11 +1,11 @@ ;;; editorconfig.el --- EditorConfig Emacs Plugin -*- lexical-binding: t -*- -;; Copyright (C) 2011-2021 EditorConfig Team +;; Copyright (C) 2011-2022 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.9.1 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme -;; Package-Requires: ((cl-lib "0.5") (nadvice "0.3") (emacs "24")) +;; Package-Requires: ((emacs "24") (cl-lib "0.5") (nadvice "0.3")) ;; See ;; http://github.com/editorconfig/editorconfig-emacs/graphs/contributors
[nongnu] scratch/editorconfig-cc bf4f51783c 250/351: Bump version to v0.8.0
branch: scratch/editorconfig-cc commit bf4f51783c316826953112b2f710c9522bf27677 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Bump version to v0.8.0 (#192) --- editorconfig.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index b3f15b6e1e..aa712cb0d7 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.14 +;; Version: 0.8.0 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5") (emacs "24"))
[nongnu] scratch/editorconfig-cc e109c02e6c 137/351: Prepare v0.7.9
branch: scratch/editorconfig-cc commit e109c02e6c8944036817c092398ab76ce9828594 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Prepare v0.7.9 Closes #122 --- editorconfig-core.el | 2 +- editorconfig.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editorconfig-core.el b/editorconfig-core.el index 831b15dcc2..d4aa56d5d7 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -69,7 +69,7 @@ (defconst editorconfig-core-version - "0.7.8" + "0.7.9" "EditorConfig core version.") (defun editorconfig-core--remove-duplicate (alist) diff --git a/editorconfig.el b/editorconfig.el index 903beb9cf6..f5c4e44054 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2017 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.8 +;; Version: 0.7.9 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5"))
[nongnu] scratch/editorconfig-cc 60b51f311d 147/351: Add document about file_type_emacs property
branch: scratch/editorconfig-cc commit 60b51f311dbeb0e31b7a6877389ab8503b1c8b0f Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add document about file_type_emacs property --- README.md | 10 ++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 77fff42692..e99f033618 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,16 @@ Alternatively, you can find the package available on * `charset` * `max_line_length` +* `file_type_emacs` (Experimental) + +This plugin also has an experimental support for `file_type_emacs`, +which specifies "file types" for files. +As for Emacs, it means `major-mode` can be specified: for example, +when `file_type_emacs` is set to `markdown` for `a.txt`, +`markdown-mode` will be enabled when opening `a.txt`. +This propertiy is experimental and its meaning might change in +the future updates. + ## Customize
[nongnu] scratch/editorconfig-cc 39ef110ef2 299/351: Add fixes for compile warning
branch: scratch/editorconfig-cc commit 39ef110ef21c9b71610f0a3cc495237841002870 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add fixes for compile warning --- editorconfig.el | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index f3f5b43d71..156e885521 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -587,10 +587,12 @@ any of regexps in `editorconfig-exclude-regexps'." "Function to run when major-mode has been changed." (display-warning '(editorconfig editorconfig-local-major-mode-hook) (format "editorconfig-mode: %S -properties-hash: %S" - editorconfig-mode + (and (boundp 'editorconfig-mode) +editorconfig-mode) editorconfig-properties-hash) :debug) - (when (and editorconfig-mode + (when (and (boundp 'editorconfig-mode) + editorconfig-mode editorconfig-properties-hash) (editorconfig-set-variables editorconfig-properties-hash)))
[nongnu] scratch/editorconfig-cc 876e476ded 238/351: Update README
branch: scratch/editorconfig-cc commit 876e476dedcf30b263cabac3e932926bb2f0b8ce Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update README --- README.md | 85 +++-- editorconfig.el | 21 +- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index dabf1753da..dd957fa901 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,38 @@ [![MELPA](http://melpa.org/packages/editorconfig-badge.svg)](http://melpa.org/#/editorconfig) [![MELPA Stable](https://stable.melpa.org/packages/editorconfig-badge.svg)](https://stable.melpa.org/#/editorconfig) -This plugin also has a built-in core library implemented in Emacs-Lisp, and -fallback to it when no core executable is found. +## Setup + +This package is available on [MELPA](https://melpa.org/#/editorconfig) +and [MELPA Stable](https://stable.melpa.org/#/editorconfig). +Install from there and enable global minor-mode `editorconfig-mode`: ```emacs-lisp -(require 'editorconfig) -(editorconfig-mode 1) +(editorconfig-mode 1) ``` -Alternatively, you can find the package available on -[MELPA](https://melpa.org/#/editorconfig) and [MELPA Stable](https://stable.melpa.org/#/editorconfig) -([The Marmalade package](http://marmalade-repo.org/packages/editorconfig) is deprecated). + +To install manually copy all `.el` files in this repository to +`~/.emacs.d/lisp` and add the following to your `init.el` file: + +```emacs-lisp +(add-to-list 'load-path "~/.emacs.d/lisp") +(require 'editorconfig) +(editorconfig-mode 1) +``` + +### Install a Core Program + +This package requires a Core program. +The officially recommended one is [EditorConfig C Core][], +follow the instructions in the README and INSTALL files to install it. + +Though using C Core is recommended, but this plugin also +includes a core library implemented in Emacs Lisp. +This plugin uses this as a fallback method when no core executable +is found, so it works out-of-the-box without explicitly installing +any other core program. + ## Supported properties @@ -41,6 +62,12 @@ future updates. When both are specified, `file_type_ext` takes precedence. ## Customize +`editorconfig-emacs` provides some customize variables. + +Here are some of these variables: for the full list of available variables, +type M-x customize-group [RET] editorconfig [RET]. + + ### `editorconfig-after-apply-functions` (Formerly `editorconfig-custom-hooks`) @@ -59,6 +86,7 @@ only blocks of `web-mode`: it can be achieved by adding following to your init.e You can also define your own custom properties and enable them here. + ### `editorconfig-hack-properties-functions` A list of function to alter property values before applying them. @@ -79,6 +107,7 @@ overwrite \"indent_style\" property when current `major-mode` is a ``` + ### `editorconfig-indentation-alist` Alist of indentaion setting mothods by modes. @@ -92,52 +121,18 @@ add a pair of major-mode symbol and its indentation variables: '(c-mode c-basic-offset)) ``` -You can also modify this variable with the command -M-x customize-variable [RET] editorconfig-indentation-alist [RET]. -For a bit more compilicated cases please take a look at the docstring of this variable. - -### `editorconfig-exec-path` - -String of `editorconfig` executable name (command name or full path to -the executable). - - -### `editorconfig-get-properties-function` - -Function to use to get EditorConfig properties. - -For example, if you always want to use built-in core library instead -of any EditorConfig executable to get properties, add following to -your init.el: - -``` emacs-lisp -(set-variable 'editorconfig-get-properties-function - #'editorconfig-core-get-properties-hash) -``` - -Possible known values are: - -* `editorconfig-get-properties` (default) - * Use `editorconfig-get-properties-from-exec` when -`editorconfig-exec-path` executable is found, otherwise use -`editorconfig-core-get-properties-hash` -* `editorconfig-get-properties-from-exec` - * Get properties by executing EditorConfig executable specified in -`editorconfig-exec-path` -* `editorconfig-core-get-properties-hash` - * Always use built-in Emacs-Lisp implementation to get properties - ### `editorconfig-trim-whitespaces-mode` Buffer local minor-mode to use to trim trailing whitespaces. -If set, enable that mode when `trim_trailing_whitespace` is set to true. -Otherwise, use `delete-trailing-whitespace`. +If set, enable/disable that mode in accord with `trim_trailing_whitespace` +property in `.editorconfig`. +Otherwise, use Emacs built-in `delete-trailing-whitespace` function. One possible value is [`ws-butler-mode`](https://github.com/lewang/ws-butler), with which -only lines touched get trimmed. To use it, add following to yo +only lines touched get trimmed. To use it, add following to your init.el:
[nongnu] scratch/editorconfig-cc 1faf52f0ae 144/351: Always do submodule update when test-ert
branch: scratch/editorconfig-cc commit 1faf52f0ae80cc5ffb49e9cb253fca9242f5e248 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Always do submodule update when test-ert --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3fd94ef422..d25311ed80 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ test: test-ert test-core test-metadata $(OBJS) # ert test test-ert: $(ERT_TESTS) $(OBJS) + git submodule update --init $(EMACS) $(BATCHFLAGS) \ --eval "(require 'ert) (setq debug-on-error t)" \ --eval "(setq metadata-el-files '($(MAIN_SRC:%=\"%\")))" \
[nongnu] scratch/editorconfig-cc fbbcb58e5b 284/351: Use revert-buffer-with-coding-system to set coding system (#236)
branch: scratch/editorconfig-cc commit fbbcb58e5b48024b328cde7f9d58dceecc7dc53c Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Use revert-buffer-with-coding-system to set coding system (#236) * Use revert-buffer-with-coding-system to set coding system * Avoid infinite call * Do not ask user for revert when buffer is not modified * Refactor -set-coding-system * Do not use revert when the file does not exist yet * Refactor -set-coding-system --- editorconfig.el | 55 +-- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 5e74fb9049..6fbde1e678 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -335,26 +335,45 @@ number - `lisp-indent-offset' is not set only if indent_size is (when (not (equal size "tab")) (setq size nil))) ) -(defun editorconfig-set-coding-system (end-of-line charset) +(defvar editorconfig--apply-coding-system-currently nil + "Used internally.") +(make-variable-buffer-local 'editorconfig--apply-coding-system-currently) +(put 'editorconfig--apply-coding-system-currently + 'permanent-local + t) + +(cl-defun editorconfig-set-coding-system (end-of-line charset) "Set buffer coding system by END-OF-LINE and CHARSET." - (let ((eol (cond - ((equal end-of-line "lf") 'undecided-unix) - ((equal end-of-line "cr") 'undecided-mac) - ((equal end-of-line "crlf") 'undecided-dos) + (let* ((eol (cond + ((equal end-of-line "lf") 'undecided-unix) + ((equal end-of-line "cr") 'undecided-mac) + ((equal end-of-line "crlf") 'undecided-dos) + (t 'undecided))) + (cs (cond + ((equal charset "latin1") 'iso-latin-1) + ((equal charset "utf-8") 'utf-8) + ((equal charset "utf-8-bom") 'utf-8-with-signature) + ((equal charset "utf-16be") 'utf-16be-with-signature) + ((equal charset "utf-16le") 'utf-16le-with-signature) (t 'undecided))) -(cs (cond - ((equal charset "latin1") 'iso-latin-1) - ((equal charset "utf-8") 'utf-8) - ((equal charset "utf-8-bom") 'utf-8-with-signature) - ((equal charset "utf-16be") 'utf-16be) - ((equal charset "utf-16le") 'utf-16le) - (t 'undecided -(unless (and (eq eol 'undecided) - (eq cs 'undecided)) - (set-buffer-file-coding-system (merge-coding-systems - cs - eol) - nil t + (coding-system (merge-coding-systems cs eol))) +(when (eq coding-system 'undecided) + (cl-return-from editorconfig-set-coding-system)) +(unless (file-readable-p buffer-file-name) + (set-buffer-file-coding-system coding-system) + (cl-return-from editorconfig-set-coding-system)) +(unless (eq coding-system +editorconfig--apply-coding-system-currently) + ;; Revert functions might call editorconfig-apply again + (unwind-protect + (progn +(setq editorconfig--apply-coding-system-currently + coding-system) +;; Revert without query if buffer is not modified +(let ((revert-without-query '("."))) + (revert-buffer-with-coding-system coding-system))) +(setq editorconfig--apply-coding-system-currently + nil) (defun editorconfig-set-trailing-nl (final-newline) "Set up requiring final newline by FINAL-NEWLINE.
[nongnu] scratch/editorconfig-cc 1971ac1dce 088/351: Refactor editorconfig-conf-mode
branch: scratch/editorconfig-cc commit 1971ac1dced82218835ed54f0c6646146dd61c07 Author: Hong Xu Commit: Stefan Monnier Refactor editorconfig-conf-mode --- editorconfig.el | 69 - 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 3d68ceca73..80c50294dd 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -332,31 +332,50 @@ visiting files or changing major modes if the major mode is not listed in (define-derived-mode editorconfig-conf-mode conf-mode "EditorConfig" "Major mode for editing .editorconfig files." (set-variable 'indent-line-function 'indent-relative) - (conf-mode-initialize -"#" -`( - ("^#.*\\|^;.*\\| #.*\\| ;.*" 0 font-lock-comment-face) - ("^[ \t]*\\(root\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(indent_style\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(indent_size\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(tab_width\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(end_of_line\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(charset\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(trim_trailing_whitespace\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(insert_final_newline\\)[ \t]*[=:]" 1 font-lock-builtin-face) - ("^[ \t]*\\(max_line_length\\)[ \t]*[=:]" 1 font-lock-builtin-face) - - ("[=:][ \t]*\\(true\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(false\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(lf\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(cr\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(crlf\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(space\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - ("[=:][ \t]*\\(tab\\)\\([ \t]\\|$\\)" 1 font-lock-constant-face) - - ("^[ \t]*\\[\\(.+?\\)\\]" 1 'font-lock-type-face) - ("^[ \t]*\\(.+?\\)[ \t]*[=:]" 1 'font-lock-variable-name-face) - ))) + (let ((key-property-list + '("charset" +"end_of_line" +"indent_size" +"indent_style" +"insert_final_newline" +"max_line_length" +"root" +"tab_width" +"trim_trailing_whitespace")) +(key-value-list + '("true" +"false" +"lf" +"cr" +"crlf" +"space" +"tab" +"latin1" +"utf-8" +"utf-8-bom" +"utf-16be" +"utf-16le")) +(font-lock-value + '(("^[ \t]*\\[\\(.+?\\)\\]" 1 font-lock-type-face) +("^[ \t]*\\(.+?\\)[ \t]*[=:]" 1 font-lock-variable-name-face + +;; Highlight all key values +(dolist (key-value key-value-list) + (add-to-list +'font-lock-value +`(,(format "[=:][ \t]*\\(%s\\)\\([ \t]\\|$\\)" key-value) + 1 font-lock-constant-face))) +;; Highlight all key properties +(dolist (key-property key-property-list) + (add-to-list +'font-lock-value +`(,(format "^[ \t]*\\(%s\\)[ \t]*[=:]" key-property) + 1 font-lock-builtin-face))) +;; Highlight comments +(add-to-list 'font-lock-value + '("^#.*\\|^;.*\\| #.*\\| ;.*" 0 font-lock-comment-face)) + +(conf-mode-initialize "#" font-lock-value))) ;;;###autoload (add-to-list 'auto-mode-alist
[nongnu] scratch/editorconfig-cc 3bdd68d5af 069/351: Add tcl-mode indentation support
branch: scratch/editorconfig-cc commit 3bdd68d5af98145202ddd452bd39a066442d3463 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add tcl-mode indentation support --- editorconfig.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index fc5df275f4..2f348e1a59 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -126,6 +126,8 @@ property emacs_linum to decide whether to show line numbers on the left (scala-mode scala-indent:step) (sgml-mode sgml-basic-offset) (sh-mode sh-basic-offset sh-indentation) + (tcl-mode tcl-indent-level + tcl-continued-indent-level) (web-mode (web-mode-indent-style . (lambda (size) 2)) web-mode-markup-indent-offset web-mode-css-indent-offset
[nongnu] scratch/editorconfig-cc 6f769c93b1 183/351: Stop checking numeric range separately
branch: scratch/editorconfig-cc commit 6f769c93b18c7fe1e513b1ce143e56a08d5fbe51 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Stop checking numeric range separately --- editorconfig-fnmatch.el | 37 - 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index 1d3bb12517..854741015a 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -103,21 +103,7 @@ be used: (match (string-match re name)) (num-groups-len (length num-groups)) (pattern-matched t)) -(when match - (let (num-group matched-num-str matched-num min-num max-num) -(dotimes (index num-groups-len) - (setq num-group (nth index num-groups)) - (setq matched-num-str (match-string (1+ index) - name) -min-num (car num-group) -max-num (nth 1 num-group)) - (setq matched-num (string-to-number matched-num-str)) - (when (or (= (aref matched-num-str 0) - ?0) -(< matched-num min-num) -(< max-num matched-num)) -(setq pattern-matched nil - pattern-matched))) +match)) ;;(editorconfig-fnmatch-translate "{a,{-3..3}}.js") ;;(editorconfig-fnmatch-p "1.js" "{a,{-3..3}}.js") @@ -249,12 +235,21 @@ translation is found for PATTERN." (setq num-range (string-match editorconfig-fnmatch--numeric-range-regexp pattern-sub)) (if num-range - (setq numeric-groups `(,@numeric-groups ,(mapcar 'string-to-number - (list (match-string 1 - pattern-sub) - (match-string 2 - pattern-sub - result `(,@result "\\([+-]?[0-9]+\\)")) + (let ((number-start (string-to-number (match-string 1 + pattern-sub))) + (number-end (string-to-number (match-string 2 + pattern-sub + (setq numeric-groups `(,@numeric-groups ,(mapcar 'string-to-number +(list (match-string 1 + pattern-sub) + (match-string 2 + pattern-sub + result `(,@result ,(concat "\\(?:" +(mapconcat 'number-to-string + (cl-loop for i from number-start to number-end + collect i) + "\\|") +"\\)" (let ((inner (editorconfig-fnmatch--do-translate pattern-sub t))) (setq result `(,@result ,(format "{%s}" (car inner)))
[nongnu] scratch/editorconfig-cc bc99704785 125/351: Add editorconfig-exclude-prefixes (#108)
branch: scratch/editorconfig-cc commit bc99704785df68a153faf1b5296e33ee244f4831 Author: USAMI Kenta Commit: Stefan Monnier Add editorconfig-exclude-prefixes (#108) --- editorconfig.el | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index f4ad969615..36da23ed2f 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -38,6 +38,8 @@ ;; version control systems. ;;; Code: +(require 'cl-lib) +(eval-when-compile (require 'rx)) (declare-function editorconfig-core-get-properties-hash "editorconfig-core" @@ -194,6 +196,13 @@ NOTE: Only the **buffer local** value of VARIABLE will be set." :type '(repeat (symbol :tag "Major Mode")) :group 'editorconfig) +(defcustom editorconfig-exclude-regexps + (list (eval-when-compile + (rx string-start (or "http" "https" "ftp" "sftp" "rsync") ":"))) + "List of buffer filename prefix regexp patterns not to apply properties." + :type '(repeat string) + :group 'editorconfig) + (defvar editorconfig-properties-hash nil "Hash object of EditorConfig properties for current buffer. Set by `editorconfig-apply' and nil if that is not invoked in current buffer @@ -321,7 +330,11 @@ This function do the job only when the major mode is not listed in `editorconfig-exclude-modes'." (when (and major-mode (not (memq major-mode -editorconfig-exclude-modes))) +editorconfig-exclude-modes)) + buffer-file-name + (not (cl-loop for regexp in editorconfig-exclude-regexps + if (string-match regexp buffer-file-name) return t + finally return nil))) (editorconfig-apply)))
[nongnu] scratch/editorconfig-cc c6d823b8a7 242/351: Separate tool functions
branch: scratch/editorconfig-cc commit c6d823b8a77f1fb5e3c49643f09ada6b8aeed7ae Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Separate tool functions --- editorconfig.el | 66 - 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index f2b0dfb3b8..5730239328 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -472,34 +472,6 @@ It calls `editorconfig-get-properties-from-exec' if (require 'editorconfig-core) (editorconfig-core-get-properties-hash))) -(defun editorconfig-find-current-editorconfig () - "Find the closest .editorconfig file for current file." - (interactive) - (eval-and-compile (require 'editorconfig-core)) - (let ((file (editorconfig-core-get-nearest-editorconfig - default-directory))) -(when file - (find-file file - -;;;###autoload -(defun editorconfig-display-current-properties () - "Display EditorConfig properties extracted for current buffer." - (interactive) - (if editorconfig-properties-hash - (let ( -(buf (get-buffer-create "*EditorConfig Properties*")) -(file buffer-file-name) -(props editorconfig-properties-hash)) -(with-current-buffer buf - (erase-buffer) - (insert (format "# EditorConfig for %s\n" file)) - (maphash (lambda (k v) - (insert (format "%S = %s\n" k v))) - props)) -(display-buffer buf)) -(message "Properties are not applied to current buffer yet.") -nil)) - ;;;###autoload (defun editorconfig-apply () "Apply EditorConfig properties for current buffer. @@ -553,7 +525,6 @@ in `editorconfig-exclude-modes'." finally return nil))) (editorconfig-apply))) - ;;;###autoload (define-minor-mode editorconfig-mode "Toggle EditorConfig feature. @@ -570,6 +541,43 @@ mode is not listed in `editorconfig-exclude-modes'." (add-hook hook 'editorconfig-mode-apply) (remove-hook hook 'editorconfig-mode-apply + +;; Tools +;; Some useful commands for users, not required for EditorConfig to work + +;;;###autoload +(defun editorconfig-find-current-editorconfig () + "Find the closest .editorconfig file for current file." + (interactive) + (eval-and-compile (require 'editorconfig-core)) + (let ((file (editorconfig-core-get-nearest-editorconfig + default-directory))) +(when file + (find-file file + +;;;###autoload +(defun editorconfig-display-current-properties () + "Display EditorConfig properties extracted for current buffer." + (interactive) + (if editorconfig-properties-hash + (let ( +(buf (get-buffer-create "*EditorConfig Properties*")) +(file buffer-file-name) +(props editorconfig-properties-hash)) +(with-current-buffer buf + (erase-buffer) + (insert (format "# EditorConfig for %s\n" file)) + (maphash (lambda (k v) + (insert (format "%S = %s\n" k v))) + props)) +(display-buffer buf)) +(message "Properties are not applied to current buffer yet.") +nil)) +;;;###autoload +(defalias 'describe-editorconfig-properties + 'editorconfig-display-current-properties) + + (provide 'editorconfig) ;;; editorconfig.el ends here
[nongnu] scratch/editorconfig-cc faba39ce8a 191/351: Use HTTPS link (#174)
branch: scratch/editorconfig-cc commit faba39ce8a84a419f0f47b18c1b56cae794fa0cd Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Use HTTPS link (#174) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7dc0c95540..6215eb9f89 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ fallback to it when no core executable is found. ``` Alternatively, you can find the package available on -[MELPA](http://melpa.org/#/editorconfig) and [MELPA Stable](http://stable.melpa.org/#/editorconfig) +[MELPA](https://melpa.org/#/editorconfig) and [MELPA Stable](https://stable.melpa.org/#/editorconfig) ([The Marmalade package](http://marmalade-repo.org/packages/editorconfig) is deprecated). @@ -118,6 +118,6 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. -[EditorConfig]: http://editorconfig.org +[EditorConfig]: https://editorconfig.org [EditorConfig C Core]: https://github.com/editorconfig/editorconfig-core-c -[properties]: http://editorconfig.org/#supported-properties +[properties]: https://editorconfig.org/#supported-properties
[nongnu] scratch/editorconfig-cc efffe74bbf 166/351: Remove doc/.gitignore
branch: scratch/editorconfig-cc commit efffe74bbf8afb0cc30fa10cc41bae3a4251c406 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Remove doc/.gitignore --- doc/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/.gitignore b/doc/.gitignore deleted file mode 100644 index f65a3e10b9..00 --- a/doc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.texi
[nongnu] scratch/editorconfig-cc f2c8300dba 129/351: Add Usami Kenta to the contributor list.
branch: scratch/editorconfig-cc commit f2c8300dbae076e69dd5b4bda9021afaf360d8a9 Author: Hong Xu Commit: Stefan Monnier Add Usami Kenta to the contributor list. --- CONTRIBUTORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6e525baa0e..0b5592295f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,4 +1,4 @@ -Contributors to EditorConfig Emacs plugin: +Contributors to EditorConfig Emacs plugin (chronological order): [Trey Hunner] Jonas Bernoulli @@ -7,3 +7,4 @@ Jonas Bernoulli [Steve Jordan] Hong Xu 10sr +Usami Kenta
[nongnu] scratch/editorconfig-cc 6aa944ce1e 262/351: Update core-test
branch: scratch/editorconfig-cc commit 6aa944ce1e37f67362dab3b12169552e3b70d0f6 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update core-test --- core-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-test b/core-test index c87a3019ab..48610d43b7 16 --- a/core-test +++ b/core-test @@ -1 +1 @@ -Subproject commit c87a3019abc182961bd6c4b420c4d534f006541e +Subproject commit 48610d43b7455af12195473377f93c4ceea654f5
[nongnu] scratch/editorconfig-cc f55d5f1f77 329/351: Prepare v0.10.0 (#303)
branch: scratch/editorconfig-cc commit f55d5f1f7705f40dedaa9132894870a6c70e3e81 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Prepare v0.10.0 (#303) * Update CHANGELOG * Update CHANGELOG * Update version string --- CHANGELOG.md| 40 +++- Eask| 2 +- editorconfig.el | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c08bfa6ecd..1d92276eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +### Deprecated + +### Removed + +### Fixed + +### Security + + +## [0.10.0] - 2023-05-07 + +### Added + +- Enable indentation for tree-sitter based typescript mode ([#282]) +- Add support for json-ts-mode ([#283]) +- Add support for some treesit modes ([#287]) +- Add indent variable associations for numerous tree-sitter modes ([#290]) +- Add js-ts-mode' spec to editorconfig-indentation-alist' ([#293]) +- Add bash-ts-mode to editorconfig-indentation-alist ([#296]) +- Add support for gdscript-mode ([#300]) + +### Changed + - Drop Emacs 24.x and 25.x ([#286]) ### Deprecated @@ -19,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix write-file-functions default value ([#295]) +- Check mode-class property for special modes ([#301]) +- Load subr-x when compiling ([#302]) + ### Security @@ -240,7 +267,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *Undocumented* -[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...HEAD +[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.0...HEAD +[0.10.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...v0.10.0 [0.9.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...v0.9.1 [0.9.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...v0.9.0 [0.8.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.1...v0.8.2 @@ -269,7 +297,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1 +[#302]: https://github.com/editorconfig/editorconfig-emacs/issues/302 +[#301]: https://github.com/editorconfig/editorconfig-emacs/issues/301 +[#300]: https://github.com/editorconfig/editorconfig-emacs/issues/300 +[#296]: https://github.com/editorconfig/editorconfig-emacs/issues/296 +[#295]: https://github.com/editorconfig/editorconfig-emacs/issues/295 +[#293]: https://github.com/editorconfig/editorconfig-emacs/issues/293 +[#290]: https://github.com/editorconfig/editorconfig-emacs/issues/290 +[#287]: https://github.com/editorconfig/editorconfig-emacs/issues/287 [#286]: https://github.com/editorconfig/editorconfig-emacs/issues/286 +[#283]: https://github.com/editorconfig/editorconfig-emacs/issues/283 +[#282]: https://github.com/editorconfig/editorconfig-emacs/issues/282 [#280]: https://github.com/editorconfig/editorconfig-emacs/issues/280 [#263]: https://github.com/editorconfig/editorconfig-emacs/issues/263 [#260]: https://github.com/editorconfig/editorconfig-emacs/issues/260 diff --git a/Eask b/Eask index 8d32ac56e7..79ee16b7c5 100644 --- a/Eask +++ b/Eask @@ -1,5 +1,5 @@ (package "editorconfig" - "0.9.1" + "0.10.0" "EditorConfig Emacs Plugin") (website-url "https://github.com/editorconfig/editorconfig-emacs#readme;) diff --git a/editorconfig.el b/editorconfig.el index a2fac17b3f..123eb86dcd 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2023 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.9.1 +;; Version: 0.10.0 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((emacs "26.1") (nadvice "0.3")) ;; Keywords: convenience editorconfig
[nongnu] scratch/editorconfig-cc a365955dca 202/351: Use file_type_ext for test fixtures
branch: scratch/editorconfig-cc commit a365955dca3e36a42dd1f1720bfaf9cbec58a217 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Use file_type_ext for test fixtures --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index a15267d35a..fcc3bdace4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,5 +26,5 @@ tab_width = 4 indent_style = space indent_size = 2 -[.editorconfig] -file_type_emacs = editorconfig-conf +[ert-tests/**/*.ini] +file_type_ext = editorconfig
[nongnu] scratch/editorconfig-cc b4911d662f 075/351: Already 2016 :) Happy new year!
branch: scratch/editorconfig-cc commit b4911d662fa459aad07cf599e7e586224ad5cd00 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Already 2016 :) Happy new year! --- bin/editorconfig-el | 2 +- editorconfig-core-handle.el | 2 +- editorconfig-core.el| 2 +- editorconfig-fnmatch.el | 2 +- editorconfig.el | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/editorconfig-el b/bin/editorconfig-el index f23d9ba24a..6e63e04f35 100755 --- a/bin/editorconfig-el +++ b/bin/editorconfig-el @@ -5,7 +5,7 @@ ;; editorconfig-el --- EditorConfig Core executable in Emacs Lisp -;; Copyright (C) 2011-2015 EditorConfig Team +;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.1 diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 3d7135fc28..5076f5c21c 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -1,6 +1,6 @@ ;;; editorconfig-core-handle.el --- Handle Class for EditorConfig File -;; Copyright (C) 2011-2015 EditorConfig Team +;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.1 diff --git a/editorconfig-core.el b/editorconfig-core.el index e356b54285..c00a5a0f82 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -1,6 +1,6 @@ ;;; editorconfig-core.el --- EditorConfig Core library in Emacs Lisp -;; Copyright (C) 2011-2015 EditorConfig Team +;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.1 diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index fa1b6aac93..f98363879b 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -1,6 +1,6 @@ ;;; editorconfig-fnmatch.el --- Glob pattern matching in Emacs lisp -;; Copyright (C) 2011-2015 EditorConfig Team +;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.1 diff --git a/editorconfig.el b/editorconfig.el index 3188460df8..c826c0983c 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -1,6 +1,6 @@ ;;; editorconfig.el --- EditorConfig Emacs Plugin -;; Copyright (C) 2011-2015 EditorConfig Team +;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.1
[nongnu] scratch/editorconfig-cc b719047f0d 247/351: Update plugin-tests submodule
branch: scratch/editorconfig-cc commit b719047f0de45e971afb9f903ece54c7e48c458d Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update plugin-tests submodule --- ert-tests/plugin-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ert-tests/plugin-tests b/ert-tests/plugin-tests index 3f2121e34a..cb7ae15d16 16 --- a/ert-tests/plugin-tests +++ b/ert-tests/plugin-tests @@ -1 +1 @@ -Subproject commit 3f2121e34a7baf360acbcf322c2d05f29f69cac7 +Subproject commit cb7ae15d16ab3d72a1139f7a629b11cfe16d972f
[nongnu] scratch/editorconfig-cc ecbc361c88 170/351: Add .gitignore again
branch: scratch/editorconfig-cc commit ecbc361c88849156929d60136ed730a91893f18e Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add .gitignore again --- doc/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00..2e90e7351f --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +*.body
[nongnu] scratch/editorconfig-cc 1b37f3f7fd 341/351: ci: Bump Emacs 29.x to 3 (#327)
branch: scratch/editorconfig-cc commit 1b37f3f7fdd134f68dc8f550bdbcaeb06bdf4e69 Author: Jen-Chieh Shen Commit: Stefan Monnier ci: Bump Emacs 29.x to 3 (#327) --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 54daa7ac7c..cb6c246d9c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,7 +26,7 @@ jobs: - "26.3" - "27.2" - "28.2" - - "29.1" + - "29.3" experimental: [false] include: - os: ubuntu-latest
[nongnu] scratch/editorconfig-cc 50ed9cf1a7 235/351: Update year
branch: scratch/editorconfig-cc commit 50ed9cf1a7fdaca3905e08069410f2ee996dd5e0 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update year --- bin/editorconfig-el | 2 +- editorconfig-conf-mode.el | 2 +- editorconfig-core-handle.el | 2 +- editorconfig-core.el| 2 +- editorconfig-fnmatch.el | 2 +- editorconfig.el | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/editorconfig-el b/bin/editorconfig-el index 0ac97288a5..fb3d4d41d8 100755 --- a/bin/editorconfig-el +++ b/bin/editorconfig-el @@ -5,7 +5,7 @@ ;; editorconfig-el --- EditorConfig Core executable in Emacs Lisp -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el index bf99715248..55911fe9df 100644 --- a/editorconfig-conf-mode.el +++ b/editorconfig-conf-mode.el @@ -1,6 +1,6 @@ ;;; editorconfig-conf-mode.el --- Major mode for editing .editorconfig files -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 3cfae15501..73adad6eff 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -1,6 +1,6 @@ ;;; editorconfig-core-handle.el --- Handle Class for EditorConfig File -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme diff --git a/editorconfig-core.el b/editorconfig-core.el index 3988cfe94a..77f8aff24e 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -1,6 +1,6 @@ ;;; editorconfig-core.el --- EditorConfig Core library in Emacs Lisp -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index 69a0c766dc..b8e8903d1f 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -1,6 +1,6 @@ ;;; editorconfig-fnmatch.el --- Glob pattern matching in Emacs lisp -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme diff --git a/editorconfig.el b/editorconfig.el index fbaad7fdff..357746edc4 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -1,6 +1,6 @@ ;;; editorconfig.el --- EditorConfig Emacs Plugin -;; Copyright (C) 2011-2017 EditorConfig Team +;; Copyright (C) 2011-2019 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.7.14
[nongnu] scratch/editorconfig-cc 849229726d 127/351: Massive reformatting of docstrings.
branch: scratch/editorconfig-cc commit 849229726d7edfffd2ed901dfa6f1c9f458571cb Author: Hong Xu Commit: Stefan Monnier Massive reformatting of docstrings. --- editorconfig.el | 64 + 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 92477b05c8..3291a9b923 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -48,8 +48,8 @@ (defgroup editorconfig nil "EditorConfig Emacs Plugin. -EditorConfig Helps developers define and maintain consistent coding styles -between different editors and IDEs" +EditorConfig helps developers define and maintain consistent +coding styles between different editors and IDEs." :tag "EditorConfig" :prefix "editorconfig-" :group 'tools) @@ -68,11 +68,12 @@ This executable is invoked by `editorconfig-call-editorconfig-exec'." (defcustom editorconfig-get-properties-function 'editorconfig-get-properties - "Function to get EditorConofig properties for current buffer. -This function will be called with no argument and should return a hash object -containing properties, or nil if any core program is not available. -The hash object should have symbols of property names as keys and strings of -property values as values." + "A function which gets EditorConofig properties for current buffer. + +This function will be called with no argument and should return a +hash object containing properties, or nil if any core program is +not available. The hash object should have symbols of property +names as keys and strings of property values as values." :type 'function :group 'editorconfig) (define-obsolete-variable-alias @@ -83,13 +84,14 @@ property values as values." (defcustom editorconfig-custom-hooks () "A list of custom hooks after loading common EditorConfig settings. -Each element in this list is a hook function. This hook function takes one -parameter, which is a property hash table. The value of properties can be -obtained through gethash function. +Each element in this list is a hook function. This hook function +takes one parameter, which is a property hash table. The value +of properties can be obtained through gethash function. -The hook does not have to be coding style related; you can add whatever -functionality you want. For example, the following is an example to add a new -property emacs_linum to decide whether to show line numbers on the left +The hook does not have to be coding style related; you can add +whatever functionality you want. For example, the following is +an example to add a new property emacs_linum to decide whether to +show line numbers on the left: (add-hook 'editorconfig-custom-hooks '(lambda (props) @@ -156,8 +158,8 @@ property emacs_linum to decide whether to show line numbers on the left Each element looks like (MODE . FUNCTION) or (MODE . INDENT-SPEC-LIST). -If FUNCTION is provided, it will be called when setting the indentation. The -indent size will be passed. +If FUNCTION is provided, it will be called when setting the +indentation. The indent size will be passed. If INDENT-SPEC-LIST is provided, each element of it must have one of the following forms: @@ -199,14 +201,15 @@ NOTE: Only the **buffer local** value of VARIABLE will be set." (defcustom editorconfig-exclude-regexps (list (eval-when-compile (rx string-start (or "http" "https" "ftp" "sftp" "rsync") ":"))) - "List of buffer filename prefix regexp patterns not to apply properties." + "List of buffer filename prefix regexp patterns not to apply +properties." :type '(repeat string) :group 'editorconfig) (defvar editorconfig-properties-hash nil "Hash object of EditorConfig properties for current buffer. -Set by `editorconfig-apply' and nil if that is not invoked in current buffer -yet.") +Set by `editorconfig-apply' and nil if that is not invoked in +current buffer yet.") (make-variable-buffer-local 'editorconfig-properties-hash) @@ -253,7 +256,7 @@ yet.") (defun editorconfig-set-line-length (length) - "Set the max line length (fill-column) to LENGTH." + "Set the max line length (`fill-column') to LENGTH." (when (and (editorconfig-string-integer-p length) (> (string-to-number length) 0)) (set-fill-column (string-to-number length @@ -265,7 +268,8 @@ yet.") ) (defun editorconfig-get-properties-from-exec () - "Get EditorConfig properties of current buffer by calling `editorconfig-exec-path'." + "Get EditorConfig properties of current buffer by calling +`editorconfig-exec-path'." (if (executable-find editorconfig-exec-path) (editorconfig-parse-properties (editorconfig-call-editorconfig-exec)) (error "Unable to
[nongnu] scratch/editorconfig-cc 6bdcaf89df 018/351: Add cmake-mode support.
branch: scratch/editorconfig-cc commit 6bdcaf89dff0ec33ccb82cd8c82658ae8a66c4e0 Author: Hong Xu Commit: Stefan Monnier Add cmake-mode support. --- editorconfig.el | 1 + 1 file changed, 1 insertion(+) diff --git a/editorconfig.el b/editorconfig.el index 7bd2ba34fc..a40a3922d0 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -51,6 +51,7 @@ LaTeX-indent-level size LaTeX-item-indent size TeX-brace-indent-level size + cmake-tab-width size js-indent-level size lisp-indent-offset size ruby-indent-level size
[nongnu] scratch/editorconfig-cc 246c391729 222/351: Add function to get properties from handlers as hash
branch: scratch/editorconfig-cc commit 246c39172919c89634fc8ae46ce9f5b190f0f373 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add function to get properties from handlers as hash --- editorconfig-core-handle.el | 22 ++ 1 file changed, 22 insertions(+) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index cb2cbb9b3f..ebd800e27e 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -31,6 +31,8 @@ ;;; Code: +(require 'cl-lib) + (require 'editorconfig-fnmatch) ;; For cl-defstruct @@ -45,6 +47,7 @@ ;; e.g. (("root" . "true")) (top-prop nil) + ;; TODO: Define struct for section ;; Alist of properties ;; Key: Section name ;; Value: Alist of properties for each section name @@ -105,6 +108,25 @@ If HANDLE is nil return nil." (car prop) (file-name-directory (editorconfig-core-handle-path handle (editorconfig-core-handle-prop handle) +(make-obsolete 'editorconfig-core-handle-get-properties + 'editorconfig-core-handle-get-properties-hash + "0.7.15") + + +(defun editorconfig-core-handle-get-properties-hash (handle file) + "Return hash of properties from HANDLE for FILE. + +If HANDLE is nil return nil." + (when handle +(let ((hash (make-hash-table))) + (dolist (prop (editorconfig-core-handle-prop handle)) +(when (editorconfig-core-handle--fnmatch-p file + (car prop) + (file-name-directory (editorconfig-core-handle-path + handle))) + (cl-loop for (key . value) in (cdr prop) + do (puthash (intern key) value hash + hash))) (defun editorconfig-core-handle--fnmatch-p (name pattern dir) "Return non-nil if NAME match PATTERN.
[nongnu] scratch/editorconfig-cc 14ba6ed35b 314/351: Check `filename` rather than `buffer-file-name` for consistency (#280)
branch: scratch/editorconfig-cc commit 14ba6ed35b874279787907a2bba30f202d6214d7 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Check `filename` rather than `buffer-file-name` for consistency (#280) Co-authored-by: Wade Zhang --- editorconfig.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index 9a51a3fbab..74a32e9e01 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -507,7 +507,7 @@ It calls `editorconfig-get-properties-from-exec' if `editorconfig-exec-path' is found, otherwise `editorconfig-core-get-properties-hash'." (if (and (executable-find editorconfig-exec-path) - (not (file-remote-p buffer-file-name))) + (not (file-remote-p filename))) (editorconfig-get-properties-from-exec filename) (require 'editorconfig-core) (editorconfig-core-get-properties-hash filename)))
[nongnu] scratch/editorconfig-cc 34ad61d6f8 119/351: Bump version to 0.7.7
branch: scratch/editorconfig-cc commit 34ad61d6f8b9d1124fd79349948f26166984d220 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Bump version to 0.7.7 --- editorconfig-conf-mode.el | 1 - editorconfig-core.el | 2 +- editorconfig.el | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el index 2c2b6ea73e..e7bf53e014 100644 --- a/editorconfig-conf-mode.el +++ b/editorconfig-conf-mode.el @@ -3,7 +3,6 @@ ;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.6 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; See diff --git a/editorconfig-core.el b/editorconfig-core.el index a1abb1b5a8..46204960c6 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -69,7 +69,7 @@ (defconst editorconfig-core-version - "0.7.6" + "0.7.7" "EditorConfig core version.") (defun editorconfig-core--remove-duplicate (alist) diff --git a/editorconfig.el b/editorconfig.el index 0c9d7f343c..3c8ceb08a6 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.6 +;; Version: 0.7.7 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5"))
[nongnu] scratch/editorconfig-cc 5153161a07 296/351: Add minor fixes to tests (#252)
branch: scratch/editorconfig-cc commit 5153161a07469cd17ed904b3878817ddd372fbad Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add minor fixes to tests (#252) * Update Makefile targets * Update github actions task * Fix test macros * Update README --- .github/workflows/build.yaml | 2 +- Makefile | 14 ++ README.md| 2 +- ert-tests/editorconfig-2.el | 7 --- ert-tests/editorconfig.el| 7 --- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 85d85b622d..35245b9c78 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,4 +37,4 @@ jobs: with: version: ${{ matrix.emacs_version }} - name: Run tests -run: make test +run: make check diff --git a/Makefile b/Makefile index 1fbf12d7a4..5e4c212744 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,15 @@ MAIN_SRC = editorconfig.el SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el) OBJS = $(SRCS:.el=.elc) -.PHONY: all clean test test-travis test-ert test-core test-metadata sandbox doc info +.PHONY: check \ + compile clean \ + test test-ert test-core \ + sandbox doc + +check: compile test + + +compile: $(OBJS) $(OBJS): %.elc: %.el $(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^ @@ -30,12 +38,10 @@ doc/editorconfig.texi: README.md doc/header.txt cat doc/header.txt $@.body2 >$@ rm -f $@.body $@.body2 -test: test-ert test-core test-metadata $(OBJS) +test: test-ert test-core $(EMACS) $(BATCHFLAGS) -l editorconfig.el - - # ert test test-ert: $(ERT_TESTS) $(OBJS) $(EMACS) $(BATCHFLAGS) \ diff --git a/README.md b/README.md index 7619162717..a571908f5a 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ Please feel free to submit issues if you find such modes! Make and [CMake][] must be installed to run the tests locally: -$ make test +$ make check To start a new Emacs process with current `*.el` and without loading user init file, run: diff --git a/ert-tests/editorconfig-2.el b/ert-tests/editorconfig-2.el index f06aba49f0..782bc89aa5 100644 --- a/ert-tests/editorconfig-2.el +++ b/ert-tests/editorconfig-2.el @@ -13,9 +13,10 @@ "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) `(let ((buf (find-file-noselect ,path))) - (with-current-buffer buf - ,@body) - (kill-buffer buf))) + (unwind-protect + (with-current-buffer buf + ,@body) + (kill-buffer buf ;;; interactive diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index 4d3745e98f..cb9b7dfa4a 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -11,9 +11,10 @@ "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) `(let ((buf (find-file-noselect ,path))) - (with-current-buffer buf - ,@body) - (kill-buffer buf))) + (unwind-protect + (with-current-buffer buf + ,@body) + (kill-buffer buf (defvar editorconfig-ert-dir (concat default-directory
[nongnu] scratch/editorconfig-cc 08f55b212b 264/351: Fix typos (#212)
branch: scratch/editorconfig-cc commit 08f55b212b317fab2af3d2f7938d6a6889d9bf48 Author: Damien Cassou Commit: Stefan Monnier Fix typos (#212) Typos found with codespell. --- doc/editorconfig.texi | 2 +- editorconfig.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/editorconfig.texi b/doc/editorconfig.texi index 9c83613e20..2fd8d5c3aa 100644 --- a/doc/editorconfig.texi +++ b/doc/editorconfig.texi @@ -96,7 +96,7 @@ implementing missing features warmly welcomed! Typically, you will want to tie these to native functionality, or the configuration of existing packages handling the feature. -As several packages have their own handling of, say, indention, we might +As several packages have their own handling of, say, indentation, we might not yet cover some mode you use, but we try to add the ones that show up on our radar. Similarly, we don't yet hook in to all different packages for whitespace trimming to inform them about editorconfig settings, but diff --git a/editorconfig.el b/editorconfig.el index 5f73bad10b..5a02d58214 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -422,7 +422,7 @@ FILETYPE should be s string like `\"ini\"`, if not nil or empty string." Normally `editorconfig-apply' will be hooked so that it runs when changing `major-mode', so there is a possibility that MODE is called infinitely if MODE is called naively from inside of `editorconfig-apply'. -This funcion will avoid such cases and set `major-mode' safely. +This function will avoid such cases and set `major-mode' safely. Just checking current `major-mode' value is not enough, because it can be different from MODE value (for example, `conf-mode' will set `major-mode' to
[nongnu] scratch/editorconfig-cc c48f549c3a 152/351: Fix typo
branch: scratch/editorconfig-cc commit c48f549c3a352503562b33e4cd65c1df956a3fb4 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e99f033618..7dc0c95540 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ which specifies "file types" for files. As for Emacs, it means `major-mode` can be specified: for example, when `file_type_emacs` is set to `markdown` for `a.txt`, `markdown-mode` will be enabled when opening `a.txt`. -This propertiy is experimental and its meaning might change in +This property is experimental and its meaning might change in the future updates.
[nongnu] scratch/editorconfig-cc 7035295d42 339/351: Add jsonian-mode (#320)
branch: scratch/editorconfig-cc commit 7035295d428f49a9ed98d11e572116180bf60e6e Author: USAMI Kenta Commit: Stefan Monnier Add jsonian-mode (#320) --- editorconfig.el | 1 + 1 file changed, 1 insertion(+) diff --git a/editorconfig.el b/editorconfig.el index d23bf65031..a62ecc0b41 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -214,6 +214,7 @@ This hook will be run even when there are no matching sections in (js2-mode js2-basic-offset) (js3-mode js3-indent-level) (json-mode js-indent-level) +(jsonian-mode jsonian-default-indentation) (latex-mode . editorconfig-set-indentation-latex-mode) (lisp-mode lisp-indent-offset) (livescript-mode livescript-tab-width)
[nongnu] scratch/editorconfig-cc 8cff7eda48 118/351: Avoid asking coding system when not specified (#102)
branch: scratch/editorconfig-cc commit 8cff7eda4869dda4616ea158af6b45a3712bde40 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Avoid asking coding system when not specified (#102) Why ? In short: Emacs always asks which charset to use when editorconfig-mode is enabled, .editorconfig does not exist and trying to save files with non-ascii characters. This is an annoying behavior so stop it. Calling `set-buffer-file-coding-system` sets the "explicit" flag, and it is used just before saving files. When this flag is set but the charset is `undecided`, Emacs asks users what charset to use for saving files with non-ascii characters (when this flag is not set Emacs do not ask and decide to use something automatically, `utf-8` for my environment). This typically happens when editing files in repositories without .editorconfig, and it is a bit annoying behavior. This change makes this plugin not call `set-buffer-file-coding-system` at all when neither `charset` nor `end_of_line` is provided, thus Emacs can decide charset automatically when saving files in repositories without .editorconfig files. --- editorconfig.el | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 2f8de26a2d..0c9d7f343c 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -233,10 +233,12 @@ yet.") ((equal charset "utf-16be") 'utf-16be) ((equal charset "utf-16le") 'utf-16le) (t 'undecided -(set-buffer-file-coding-system (merge-coding-systems - cs - eol) - nil t))) +(unless (and (eq eol 'undecided) + (eq cs 'undecided)) + (set-buffer-file-coding-system (merge-coding-systems + cs + eol) +nil t (defun editorconfig-set-line-length (length)
[nongnu] scratch/editorconfig-cc 656db235d9 187/351: Bump version 0.7.13
branch: scratch/editorconfig-cc commit 656db235d938f9b28775eddcec7663161f3407c1 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Bump version 0.7.13 --- editorconfig-core.el | 2 +- editorconfig.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editorconfig-core.el b/editorconfig-core.el index 3687882ff8..9d396f185d 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -71,7 +71,7 @@ (defconst editorconfig-core-version - "0.7.12" + "0.7.13" "EditorConfig core version.") (defun editorconfig-core--remove-duplicate (alist) diff --git a/editorconfig.el b/editorconfig.el index dd29aa7b1e..b085c33ec4 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2017 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.12 +;; Version: 0.7.13 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5"))
[nongnu] scratch/editorconfig-cc d5473b369e 236/351: Remove comment
branch: scratch/editorconfig-cc commit d5473b369ed585ac1db76aa59e6b600e447f1577 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Remove comment --- editorconfig-core-handle.el | 1 - 1 file changed, 1 deletion(-) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 73adad6eff..a0e1abbdc2 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -251,7 +251,6 @@ If CONF is not found return nil." ) (setq current-line-number (1+ current-line-number)) - ;; Use this code instead of goto-line for Lisp program (goto-char (point-min)) (forward-line (1- current-line-number)) )
[nongnu] scratch/editorconfig-cc 516ebfefa3 232/351: Remove useless spaces
branch: scratch/editorconfig-cc commit 516ebfefa3c70866c2a19bfb88757a17fe56909d Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Remove useless spaces --- editorconfig-core-handle.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 0156a947d2..f6120689f3 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -115,12 +115,12 @@ If HANDLE is nil return nil." file dir) when props collect (copy-alist props) - (make-obsolete 'editorconfig-core-handle-get-properties - 'editorconfig-core-handle-get-properties-hash - "0.8.0") +(make-obsolete 'editorconfig-core-handle-get-properties + 'editorconfig-core-handle-get-properties-hash + "0.8.0") -(defun editorconfig-core-handle-get-properties-hash (handle file) +(defun editorconfig-core-handle-get-properties-hash (handle file) "Return hash of properties from HANDLE for FILE. If HANDLE is nil return nil."
[nongnu] scratch/editorconfig-cc e93f45738c 049/351: Add license header to executable
branch: scratch/editorconfig-cc commit e93f45738c2519a7cd5c9ef7a37a1509fd34d293 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add license header to executable --- bin/editorconfig-el | 25 + 1 file changed, 25 insertions(+) diff --git a/bin/editorconfig-el b/bin/editorconfig-el index 975fbf2cf5..1e25e0fcb3 100755 --- a/bin/editorconfig-el +++ b/bin/editorconfig-el @@ -5,6 +5,31 @@ ;; editorconfig-el --- EditorConfig Core executable in Emacs Lisp +;; Copyright (C) 2011-2015 EditorConfig Team + +;; Author: EditorConfig Team +;; Version: 0.6 +;; URL: https://github.com/editorconfig/editorconfig-emacs#readme + +;; See +;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors +;; or the CONTRIBUTORS file for the list of contributors. + +;; This file is part of EditorConfig Emacs Plugin. + +;; EditorConfig Emacs Plugin is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or (at your +;; option) any later version. + +;; EditorConfig Emacs Plugin is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +;; Public License for more details. + +;; You should have received a copy of the GNU General Public License along with +;; EditorConfig Emacs Plugin. If not, see <https://www.gnu.org/licenses/>. + ;;; Commentary: ;; This executable is mainly for testing core feature, and not intended to be
[nongnu] scratch/editorconfig-cc faa796ffc8 101/351: Use GFM style code block
branch: scratch/editorconfig-cc commit faa796ffc8205e5ff5c03f8d9c82df8855e35e8d Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Use GFM style code block --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7fe003b7d7..f48ae40df8 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ This plugin also has a core library implemented in Emacs-Lisp, and fallback to it when no core executable is found. +```emacs-lisp (require 'editorconfig) (editorconfig-mode 1) +``` Alternatively, you can find the package available on [Marmalade](http://marmalade-repo.org/packages/editorconfig) and
[nongnu] scratch/editorconfig-cc 956c0320e2 270/351: Update hook docstrings (#215)
branch: scratch/editorconfig-cc commit 956c0320e23c245c81c5cf025972aab47ebc8b00 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update hook docstrings (#215) #214 --- editorconfig.el | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index e45c914678..9c7d2154c8 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -121,7 +121,10 @@ show line numbers on the left: '(lambda (props) (let ((show-line-num (gethash 'emacs_linum props))) (cond ((equal show-line-num \"true\") (linum-mode 1)) - ((equal show-line-num \"false\") (linum-mode 0))" + ((equal show-line-num \"false\") (linum-mode 0)) + +This hook will be run even when there are no matching sections in +\".editorconfig\", or no \".editorconfig\" file was found at all." :type 'hook :group 'editorconfig) (define-obsolete-variable-alias @@ -147,7 +150,10 @@ overwrite \"indent_style\" property when current `major-mode' is a (add-hook 'editorconfig-hack-properties-functions '(lambda (props) (when (derived-mode-p 'makefile-mode) - (puthash 'indent_style \"tab\" props" + (puthash 'indent_style \"tab\" props + +This hook will be run even when there are no matching sections in +\".editorconfig\", or no \".editorconfig\" file was found at all." :type 'hook :group 'editorconfig)
[nongnu] scratch/editorconfig-cc 92937591a3 267/351: Update README
branch: scratch/editorconfig-cc commit 92937591a3228f3a6fac8a8cd26d8af02f098a62 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update README --- README.md | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 735b3c16c0..3a4857af12 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,18 @@ To install manually, copy all `.el` files in this repository to (editorconfig-mode 1) ``` -### Install a Core Program - -This package requires a Core program. -The officially recommended one is [EditorConfig C Core][], -follow the instructions in the README and INSTALL files to install it. - -Though using C Core is recommended, but this plugin also -includes a core library implemented in Emacs Lisp. -This plugin uses this as a fallback method when no core executable -is found, so it works out-of-the-box without explicitly installing -any other core program. - +### (Optional) Install a Core Program + +This package uses a Core program. +A core implemented in Emacs Lisp is include in this plugin, +so usually you don't need to install any other core programs. + +Optionally, you can install and use other core programs. +One such example is [EditorConfig C Core][], follow the instructions +in the README and INSTALL files to install it. +To use them instead of the default elisp core, you need to configure +`editorconfig-get-properties-function` +(read the docstring for details). ## Supported properties
[nongnu] scratch/editorconfig-cc 26c875d609 269/351: Define -mode-apply as an interactive command (#216)
branch: scratch/editorconfig-cc commit 26c875d609d86327343bd1f3aa80a27b7d25410c Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Define -mode-apply as an interactive command (#216) --- editorconfig.el | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 5705cc2546..e45c914678 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -500,8 +500,10 @@ It calls `editorconfig-get-properties-from-exec' if ;;;###autoload (defun editorconfig-apply () "Get and apply EditorConfig properties to current buffer. -This function ignores `editorconfig-exclude-modes' and -`editorconfig-exclude-regexps', and always applies available properties." + +This function does not respect the values of `editorconfig-exclude-modes' and +`editorconfig-exclude-regexps' and always applies available properties. +Use `editorconfig-mode-apply' instead to make use of these variables." (interactive) (when buffer-file-name (condition-case err @@ -539,9 +541,11 @@ This function ignores `editorconfig-exclude-modes' and (defun editorconfig-mode-apply () "Get and apply EditorConfig properties to current buffer. + This function does nothing when the major mode is listed in `editorconfig-exclude-modes', or variable `buffer-file-name' matches any of regexps in `editorconfig-exclude-regexps'." + (interactive) (when (and major-mode (not (memq major-mode editorconfig-exclude-modes))
[nongnu] scratch/editorconfig-cc 9fdbf9ffdd 011/351: Set indent value for AucTeX
branch: scratch/editorconfig-cc commit 9fdbf9ffddc1758019158328eadf293f6ecb7435 Author: Hong Xu Commit: Stefan Monnier Set indent value for AucTeX --- editorconfig.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index dbae64c884..1bf4c15270 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -49,6 +49,9 @@ (defun edconf-set-indentation (style size tab_width) lisp-indent-offset size ruby-indent-level size + LaTeX-indent-level size + LaTeX-item-indent size + TeX-brace-indent-level size ) (defun edconf-set-line-ending (end-of-line)
[nongnu] scratch/editorconfig-cc 77a8af8ba4 290/351: Fix editorconfig execution for remote hosts via tramp (#249)
branch: scratch/editorconfig-cc commit 77a8af8ba4cd93da97d6a7a05b4a5cabf20d9bbf Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Fix editorconfig execution for remote hosts via tramp (#249) --- editorconfig.el | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 8e82c3af7c..d09329d504 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -443,9 +443,28 @@ If you just want to check `major-mode', use `derived-mode-p'." "Execute EditorConfig core with FILENAME and return output." (if filename (with-temp-buffer -(setq default-directory "/") +(let ((remote (file-remote-p filename)) + (remote-localname (file-remote-p filename + 'localname))) + (display-warning '(editorconfig editorconfig--execute-editorconfig-exec) + (format "filename: %S | remote: %S | remote-localname: %S" + filename + remote + remote-localname) + :debug) + (if remote + (progn +(cd (concat remote "/")) +(setq filename remote-localname)) +(cd "/"))) +(display-warning '(editorconfig editorconfig--execute-editorconfig-exec) + (format "default-directory: %S | filename: %S" + default-directory + filename + ) + :debug) (if (eq 0 -(call-process editorconfig-exec-path nil t nil filename)) +(process-file editorconfig-exec-path nil t nil filename)) (buffer-string) (editorconfig-error (buffer-string ""))
[nongnu] scratch/editorconfig-cc 1aa812505a 100/351: Update editorconfig group docstring
branch: scratch/editorconfig-cc commit 1aa812505a910dd7ef6a8f65e28d5a52544f21f7 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Update editorconfig group docstring --- editorconfig.el | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index ac5d362cdf..b49ca45f9f 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -46,8 +46,10 @@ nil) (defgroup editorconfig nil - "help developers define and maintain consistentcoding styles between different -editors and IDEs" + "EditorConfig Emacs Plugin. + +EditorConfig Helps developers define and maintain consistent coding styles +between different editors and IDEs" :group 'tools) (defcustom editorconfig-exec-path
[nongnu] scratch/editorconfig-cc 0bbf63616a 231/351: Stop using cl-defclass
branch: scratch/editorconfig-cc commit 0bbf63616a11ccef1a04b0cbdee4678c25310a70 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Stop using cl-defclass With Emacs<25 cl-defmethod cannot used for structs --- editorconfig-core-handle.el | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index e36fb69683..0156a947d2 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -46,8 +46,7 @@ ;; (KEY . VALUE) (props nil)) -(cl-defmethod editorconfig-core-handle-section-get-properties - ((section editorconfig-core-handle-section) file dir) +(defun editorconfig-core-handle-section-get-properties (section file dir) "Return properties alist when SECTION name matches FILE. DIR should be where the directory where .editorconfig which has SECTION exists. @@ -94,7 +93,7 @@ If CONF does not exist return nil." :path conf) editorconfig-core-handle--cache-hash)) -(cl-defmethod editorconfig-core-handle-root-p ((handle editorconfig-core-handle)) +(defun editorconfig-core-handle-root-p (handle) "Return non-nil if HANDLE represent root EditorConfig file. If HANDLE is nil return nil." @@ -104,7 +103,7 @@ If HANDLE is nil return nil." (editorconfig-core-handle-top-props handle))) "") -(cl-defmethod editorconfig-core-handle-get-properties ((handle editorconfig-core-handle) file) +(defun editorconfig-core-handle-get-properties (handle file) "Return list of alist of properties from HANDLE for FILE. The list returned will be ordered by the lines they appear. @@ -121,7 +120,7 @@ If HANDLE is nil return nil." "0.8.0") -(cl-defmethod editorconfig-core-handle-get-properties-hash ((handle editorconfig-core-handle) file) +(defun editorconfig-core-handle-get-properties-hash (handle file) "Return hash of properties from HANDLE for FILE. If HANDLE is nil return nil."
[nongnu] scratch/editorconfig-cc 7fb0f85010 130/351: Add php-mode to indentation-alist and add a short note
branch: scratch/editorconfig-cc commit 7fb0f85010d9aad37cb35fc1b2023bfa7a6a1ade Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add php-mode to indentation-alist and add a short note About `php-mode-coding-style'. They basically do this at mode startup: "if php-mode-coding-style is 'pear' (which it is by default), add a c-style called 'pear' and switch to it", and that style contains a c-basic-offset value. But since we're hooking later than that, we're welcome to override c-basic-offset without any risk. Also, php-mode suggests manually typing "nxml-mode" and "js2-mode" and "web-mode" and then "php-mode" etc, to switch editing styles if you have a document with multiple types of content (which is common in .php files), and every time you type php-mode, it runs that style injection again and resets c-basic-offset. However, editorconfig runs as a hook when the major mode changes, so it still re-applies the correct offset every time that happens. See #116 for more details. --- editorconfig.el | 5 + 1 file changed, 5 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index 3291a9b923..cd68c17a56 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -136,6 +136,11 @@ show line numbers on the left: (objc-mode c-basic-offset) (octave-mode octave-block-offset) (perl-mode perl-indent-level) +;; No need to change `php-mode-coding-style' value for php-mode +;; since we run editorconfig later than it resets `c-basic-offset'. +;; See https://github.com/editorconfig/editorconfig-emacs/issues/116 +;; for details. +(php-mode c-basic-offset) (pike-mode c-basic-offset) (ps-mode ps-mode-tab) (puppet-mode puppet-indent-level)
[nongnu] scratch/editorconfig-cc 312f92419c 092/351: No need to explicitly highlight the comments via font-lock in editorconfig-conf-mode
branch: scratch/editorconfig-cc commit 312f92419cd77d127a5caaea6796cb4e69c8709c Author: Hong Xu Commit: Stefan Monnier No need to explicitly highlight the comments via font-lock in editorconfig-conf-mode --- editorconfig.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 5618ea6bb9..8d701f9e83 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -378,9 +378,6 @@ visiting files or changing major modes if the major mode is not listed in 'font-lock-value `(,(format "^[ \t]*\\(%s\\)[ \t]*[=:]" key-property) 1 font-lock-builtin-face))) -;; Highlight comments -(add-to-list 'font-lock-value - '("^#.*\\|^;.*\\| #.*\\| ;.*" 0 font-lock-comment-face)) (conf-mode-initialize "#" font-lock-value)))
[nongnu] scratch/editorconfig-cc 9d1d236431 021/351: Don't set max_line_length if not specified.
branch: scratch/editorconfig-cc commit 9d1d2364313086590d0e578aab5dbaabeaf03ec9 Author: Hong Xu Commit: Stefan Monnier Don't set max_line_length if not specified. --- README.md | 4 editorconfig.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0637e7f611..2bd07efc6c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ Alternatively, you can find the package available on [Marmalade](http://marmalade-repo.org/packages/editorconfig). +## Supported properties + +* `max_line_length` + [EditorConfig]: http://editorconfig.org [EditorConfig core]: https://github.com/editorconfig/editorconfig-core [properties]: http://editorconfig.org/#supported-properties diff --git a/editorconfig.el b/editorconfig.el index c58c639826..d7266c39e6 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -67,7 +67,8 @@ (defun edconf-set-line-length (length) "set the max line length (fill-column)" - (set-fill-column (string-to-number length))) + (if length +(set-fill-column (string-to-number length (defun edconf-get-properties () )
[nongnu] scratch/editorconfig-cc 527ff0b210 051/351: Fix some warnings reported by flycheck
branch: scratch/editorconfig-cc commit 527ff0b2105e66bf85b72f742877c227bce356e5 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Fix some warnings reported by flycheck Mainly docstring fix --- editorconfig.el | 39 +-- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 840708fcc4..9f9c672e05 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -45,7 +45,9 @@ (defcustom editorconfig-exec-path "editorconfig" - "EditorConfig command" + "EditorConfig executable name. + +This executable is invoked by `editorconfig-call-editorconfig-exec'." :type 'string :group 'editorconfig) (define-obsolete-variable-alias @@ -68,23 +70,21 @@ property values as values." "0.5") (defcustom editorconfig-custom-hooks () - "A list of custom hooks after loading common EditorConfig settings + "A list of custom hooks after loading common EditorConfig settings. -Each element in this list is a hook function. This hook function takes one -parameter, which is a property hash table. The value of properties can be +Each element in this list is a hook function. This hook function takes one +parameter, which is a property hash table. The value of properties can be obtained through gethash function. The hook does not have to be coding style related; you can add whatever -functionality you want. For example, the following is an example to add a new +functionality you want. For example, the following is an example to add a new property emacs_linum to decide whether to show line numbers on the left -(add-to-list 'editorconfig-custom-hooks - '(lambda (props) - (let ((show-line-num (gethash 'emacs_linum props))) - (cond ((equal show-line-num \"true\") (linum-mode 1)) - ((equal show-line-num \"false\") (linum-mode 0)) - -" + (add-to-list 'editorconfig-custom-hooks +'(lambda (props) + (let ((show-line-num (gethash 'emacs_linum props))) + (cond ((equal show-line-num \"true\") (linum-mode 1)) + ((equal show-line-num \"false\") (linum-mode 0))" :type '(lambda (properties) (body)) :group 'editorconfig) (define-obsolete-variable-alias @@ -173,22 +173,32 @@ NOTE: Only the **buffer local** value of VARIABLE will be set." "0.5") (defun editorconfig-string-integer-p (string) - "Whether a string representing integer" + "Return non-nil if STRING represents integer." (if (stringp string) (string-match-p "\\`[0-9]+\\'" string) nil)) +(defun editorconfig-set-indentation/python-mode (size) + "Set `python-mode' indent size to SIZE." + ) + +(defun editorconfig-set-indentation/latex-mode (size) + "Set `latex-mode' indent size to SIZE." + ) + (defun editorconfig-set-indentation (style size tab_width) + "Set indentation type from STYLE, SIZE and TAB_WIDTH." (if (editorconfig-string-integer-p size) (setq size (string-to-number size)) (when (not (equal size "tab")) (setq size nil))) ) (defun editorconfig-set-line-ending (end-of-line) + "Set line ending style to CR, LF, or CRLF by END-OF-LINE." ) (defun editorconfig-set-line-length (length) - "set the max line length (fill-column)" + "Set the max line length (fill-column) to LENGTH." (when (editorconfig-string-integer-p length) (set-fill-column (string-to-number length @@ -217,6 +227,7 @@ It calls `editorconfig-get-properties-from-exec' if (editorconfig-core-get-properties-hash))) (defun editorconfig-apply () + "Apply EditorConfig properties for current buffer." (when buffer-file-name (let ((props (and (functionp editorconfig-get-properties-function) (funcall editorconfig-get-properties-function
[nongnu] scratch/editorconfig-cc 642ff1b62f 215/351: Use ws-butler when enabled and available.
branch: scratch/editorconfig-cc commit 642ff1b62f5ad4cbf78cdf7dcd5759149882dd21 Author: Terje Larsen Commit: Stefan Monnier Use ws-butler when enabled and available. When having auto-save on and you edit text the cleaning up of white-space is a bit intrusive and removes the space at the end of the line where you are writing. `ws-butler-mode` is an alternative that does take this into account. --- editorconfig.el | 18 ++ 1 file changed, 18 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index 857e34e92a..a9af423aa4 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -248,6 +248,11 @@ properties." :type '(repeat string) :group 'editorconfig) +(defcustom editorconfig-use-ws-butler nil + "Use command `ws-butler-mode' for trimming trailing whitespace." + :type 'boolean + :group 'editorconfig) + (defvar editorconfig-properties-hash nil "Hash object of EditorConfig properties for current buffer. Set by `editorconfig-apply' and nil if that is not invoked in @@ -273,6 +278,11 @@ number - `lisp-indent-offset' is not set only if indent_size is (and (stringp string) (string-match-p "\\`[0-9]+\\'" string))) +(defun editorconfig-use-ws-butler-p () + "Return non-nil if `editorconfig-use-ws-butler' is enabled and +`ws-butler' is available." + (and editorconfig-use-ws-butler (fboundp 'ws-butler-mode))) + (defun editorconfig-set-indentation/python-mode (size) "Set `python-mode' indent size to SIZE." ) @@ -322,6 +332,14 @@ number - `lisp-indent-offset' is not set only if indent_size is eol) nil t +(defun editorconfig-set-trailing-ws (trim-trailing-ws) +(if (editorconfig-use-ws-butler-p) +(ws-butler-mode 1) + ...) +(if (editorconfig-use-ws-butler-p) +(ws-butler-mode 0) + ...)) + (defun editorconfig-set-line-length (length) "Set the max line length (`fill-column') to LENGTH." (when (and (editorconfig-string-integer-p length)
[nongnu] scratch/editorconfig-cc e0bf950716 194/351: Add ert-test for file_type_emacs (#177)
branch: scratch/editorconfig-cc commit e0bf9507161f9d788c3ea1b4e972a7c5f7685c7d Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add ert-test for file_type_emacs (#177) --- ert-tests/editorconfig.el| 7 +++ ert-tests/test_files_secondary/.editorconfig | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index cd57f2e26d..b45b87b503 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -65,3 +65,10 @@ (should (not (memq 'delete-trailing-whitespace write-file-functions (editorconfig-mode -1)) + +(ert-deftest test-file-type-emacs nil + (editorconfig-mode 1) + (with-visit-file (concat editorconfig-secondary-ert-dir + "c.txt") +(should (eq major-mode 'conf-unix-mode))) + (editorconfig-mode -1)) diff --git a/ert-tests/test_files_secondary/.editorconfig b/ert-tests/test_files_secondary/.editorconfig index 5ebe4a1bdd..eeb02d621a 100644 --- a/ert-tests/test_files_secondary/.editorconfig +++ b/ert-tests/test_files_secondary/.editorconfig @@ -3,3 +3,6 @@ root = true [2_space.el] indent_size = 2 indent_style = tab + +[c.txt] +file_type_emacs = conf
[nongnu] scratch/editorconfig-cc 631e6b4ab8 199/351: Add file_type_ext to conf-mode keyword
branch: scratch/editorconfig-cc commit 631e6b4ab8cb30886f7bd083e89de04e58828fc1 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add file_type_ext to conf-mode keyword --- editorconfig-conf-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el index 5a0a7c5c58..4ae08f576f 100644 --- a/editorconfig-conf-mode.el +++ b/editorconfig-conf-mode.el @@ -46,6 +46,7 @@ '("charset" "end_of_line" "file_type_emacs" + "file_type_ext" "indent_size" "indent_style" "insert_final_newline"
[nongnu] scratch/editorconfig-cc 82af619ed5 206/351: Use derived-mode-p for major-mode check (#180)
branch: scratch/editorconfig-cc commit 82af619ed50b5159a058da472663c68fd41637df Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Use derived-mode-p for major-mode check (#180) --- editorconfig.el | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 17359095c9..08d87aa88b 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -310,14 +310,6 @@ number - `lisp-indent-offset' is not set only if indent_size is (> (string-to-number length) 0)) (setq fill-column (string-to-number length -(defun editorconfig--is-a-mode-p (current want) - "Return non-nil if major mode CURRENT is a major mode WANT." - (or (eq current - want) - (let ((parent (get current 'derived-mode-parent))) -(and parent - (editorconfig--is-a-mode-p parent want) - (defun editorconfig-set-major-mode-from-name (filetype) "Set buffer `major-mode' by FILETYPE. @@ -356,8 +348,7 @@ different from MODE value (for example, `conf-mode' will set `major-mode' to editorconfig--apply-major-mode-currently)) (not (eq mode major-mode)) - (not (editorconfig--is-a-mode-p major-mode - mode))) + (not (derived-mode-p mode))) (unwind-protect (progn (setq editorconfig--apply-major-mode-currently
[nongnu] scratch/editorconfig-cc 302afbb3e3 150/351: Add file_type_emacs to editorocnfig-conf-mode keywords
branch: scratch/editorconfig-cc commit 302afbb3e314723f76c16978a0c447d5ad365d5f Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add file_type_emacs to editorocnfig-conf-mode keywords --- editorconfig-conf-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el index cbc403241c..5a0a7c5c58 100644 --- a/editorconfig-conf-mode.el +++ b/editorconfig-conf-mode.el @@ -45,6 +45,7 @@ (let ((key-property-list '("charset" "end_of_line" + "file_type_emacs" "indent_size" "indent_style" "insert_final_newline"
[nongnu] scratch/editorconfig-cc 49b0cd1a18 263/351: Fix that "?" does not match "/"
branch: scratch/editorconfig-cc commit 49b0cd1a18e95490bb3efd16bd2d05f5d13e5030 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Fix that "?" does not match "/" --- editorconfig-fnmatch.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index 68727e5e24..da8df0a042 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -167,7 +167,7 @@ translation is found for PATTERN." (setq result `(,@result "[^/]*" (?? - (setq result `(,@result "."))) + (setq result `(,@result "[^/]"))) (?\[ (if in-brackets
[nongnu] scratch/editorconfig-cc 26e095d584 313/351: Prepare v0.9.0 (#275)
branch: scratch/editorconfig-cc commit 26e095d584e7a492e73b96969bbb29d170773137 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Prepare v0.9.0 (#275) * Update version number in el file * Update CHANGELOG for 0.9.0 * Fix CHANGELOG * Fix release date --- CHANGELOG.md| 16 +++- editorconfig.el | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c9007b000..1b487962a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Use new implementation by default (#263) - - Set `(setq editorconfig--legacy-version t)` to use previous one - - ### Deprecated ### Removed @@ -24,6 +20,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.9.0] - 2022-10-23 + +### Changed + +- Use new implementation by default ([#263]) + - Set `(setq editorconfig--legacy-version t)` to use previous one + + ## [0.8.2] - 2021-08-13 ### Added @@ -227,7 +231,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *Undocumented* -[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...HEAD +[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...HEAD +[0.9.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...v0.9.0 [0.8.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.1...v0.8.2 [0.8.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.0...v0.8.1 [0.8.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.7.14...v0.8.0 @@ -254,6 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1 +[#263]: https://github.com/editorconfig/editorconfig-emacs/issues/263 [#260]: https://github.com/editorconfig/editorconfig-emacs/issues/260 [#258]: https://github.com/editorconfig/editorconfig-emacs/issues/258 [#255]: https://github.com/editorconfig/editorconfig-emacs/issues/255 diff --git a/editorconfig.el b/editorconfig.el index 7edc29ac6f..9a51a3fbab 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2021 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.8.2 +;; Version: 0.9.0 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5") (nadvice "0.3") (emacs "24"))
[nongnu] scratch/editorconfig-cc 555c8bc80f 318/351: Add indent variable associations for numerous tree-sitter modes (#290)
branch: scratch/editorconfig-cc commit 555c8bc80f9d5cae23a73f166705cb1975e4a4fd Author: Mohsin Kaleem Commit: Stefan Monnier Add indent variable associations for numerous tree-sitter modes (#290) * Add indent variable associations for numerous tree-sitter modes * build: Correct csharp-ts-mode variable reference --- editorconfig.el | 15 +++ 1 file changed, 15 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index cde65eebb8..6ddb13503a 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -178,11 +178,19 @@ This hook will be run even when there are no matching sections in (awk-mode c-basic-offset) (bpftrace-mode c-basic-offset) (c++-mode c-basic-offset) +(c++-ts-mode c-basic-offset + c-ts-mode-indent-offset) (c-mode c-basic-offset) +(c-ts-mode c-basic-offset + c-ts-mode-indent-offset) (cmake-mode cmake-tab-width) +(cmake-ts-mode cmake-tab-width + cmake-ts-mode-indent-offset) (coffee-mode coffee-tab-width) (cperl-mode cperl-indent-level) (csharp-mode c-basic-offset) +(csharp-ts-mode c-basic-offset +csharp-ts-mode-indent-offset) (css-mode css-indent-offset) (emacs-lisp-mode lisp-indent-offset) (erlang-mode erlang-indent-level) @@ -190,11 +198,15 @@ This hook will be run even when there are no matching sections in (feature-mode feature-indent-offset feature-indent-level) (groovy-mode c-basic-offset) +(go-ts-mode go-ts-mode-indent-offset) (haskell-mode haskell-indent-spaces haskell-indent-offset shm-indent-spaces) +(html-ts-mode html-ts-mode-indent-offset) (idl-mode c-basic-offset) (java-mode c-basic-offset) +(java-ts-mode c-basic-offset + java-ts-mode-indent-offset) (js-mode js-indent-level) (js2-mode js2-basic-offset) (js3-mode js3-indent-level) @@ -218,12 +230,15 @@ This hook will be run even when there are no matching sections in (puppet-mode puppet-indent-level) (python-mode . editorconfig-set-indentation-python-mode) (ruby-mode ruby-indent-level) +(rust-ts-mode rust-indent-offset + rust-ts-mode-indent-offset) (scala-mode scala-indent:step) (scss-mode css-indent-offset) (sgml-mode sgml-basic-offset) (sh-mode sh-basic-offset sh-indentation) (tcl-mode tcl-indent-level tcl-continued-indent-level) +(toml-ts-mode toml-ts-mode-indent-offset) (verilog-mode verilog-indent-level verilog-indent-level-behavioral verilog-indent-level-declaration
[nongnu] scratch/editorconfig-cc 4e2bf3ddd6 016/351: Add the package manager installation way to README
branch: scratch/editorconfig-cc commit 4e2bf3ddd61a87ac30bdfea04d222b8643ffd337 Author: Hong Xu Commit: Stefan Monnier Add the package manager installation way to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 53fa2913eb..0637e7f611 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Alternatively, you can find the package available on [Marmalade](http://marmalade-repo.org/packages/editorconfig). + [EditorConfig]: http://editorconfig.org [EditorConfig core]: https://github.com/editorconfig/editorconfig-core [properties]: http://editorconfig.org/#supported-properties
[nongnu] scratch/editorconfig-cc ff1b4c2f65 050/351: Fix editorconfig-core commentary text
branch: scratch/editorconfig-cc commit ff1b4c2f6540f0232438c2073dd0623c5132ced6 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Fix editorconfig-core commentary text --- editorconfig-core.el | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/editorconfig-core.el b/editorconfig-core.el index 83bbd3059e..91c69ac875 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -32,23 +32,17 @@ ;; .editorconfig files and returns properties for given files. ;; This can be used in place of, for example, editorconfig-core-c. -;; This library is not an editor plugin and does not configure Emacs for editing -;; the files: this should be done with editorconfig-emacs. - ;; Use from EditorConfig Emacs Plugin -;; editorconfig-emacs (v0.5 or later) can utilize this library. -;; Add following lines to your init.el: +;; Emacs plugin (v0.5 or later) can utilize this implementation. +;; By default, the plugin first search for any EditorConfig executable, +;; 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) -;; This sexp configures editorconfig-emacs to call this library when getting -;; EditorConfig properties instead of the default function -;; editorconfig-get-properties-from-exec, which invokes external program -;; like editorconfig-core-c. - ;; Functions
[nongnu] scratch/editorconfig-cc e412454039 117/351: Load only editorconfig.el when using sandbox
branch: scratch/editorconfig-cc commit e412454039d4b5d845fd90be2040bc834f76c139 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Load only editorconfig.el when using sandbox --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ae6a6bc108..3fd94ef422 100644 --- a/Makefile +++ b/Makefile @@ -48,4 +48,4 @@ test-core: core-test/CMakeLists.txt $(OBJS) # Start Emacs that loads *.el in current directory and does not load the user # init file sandbox: - $(EMACS) -q -L $(PROJECT_ROOT_DIR) $(SRCS:%=-l "%") + $(EMACS) -q -L $(PROJECT_ROOT_DIR) $(MAIN_SRC:%=-l "%")
[nongnu] scratch/editorconfig-cc 8688e1d3bf 230/351: Revert "Add support for Emacs24.5"
branch: scratch/editorconfig-cc commit 8688e1d3bf2648a3b16aee1f58082305beb23dee Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Revert "Add support for Emacs24.5" This reverts commit 103081756d5d1de03dfa2d9d42b6e4a8581fca29. --- .travis.yml | 1 - editorconfig-core-handle.el | 2 -- editorconfig.el | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9923bb4800..87aefe8e4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ before_install: - ./.evm/bin/evm config path /tmp - ./.evm/bin/evm install emacs-$EMACS_VERSION-travis --use - ./.evm/bin/emacs --version - - if [[ "$EMACS_VERSION" == 24.5 ]]; then curl "http://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/packages/cl-generic/cl-generic.el?id=a1cdea05e8cbfe15ba075c64417db20b814e48e8; >cl-generic.el; fi script: make test EMACS=$PWD/.evm/bin/emacs diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 85ccf01c50..e36fb69683 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -32,8 +32,6 @@ ;;; Code: (require 'cl-lib) -;; Require explicit load for Emacs<25 -(require 'cl-generic) (require 'editorconfig-fnmatch) diff --git a/editorconfig.el b/editorconfig.el index 2f928daeb4..cee7392b79 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -5,7 +5,7 @@ ;; Author: EditorConfig Team ;; Version: 0.7.14 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme -;; Package-Requires: ((cl-lib "0.5") (cl-generic "0.3")) +;; Package-Requires: ((cl-lib "0.5")) ;; See ;; http://github.com/editorconfig/editorconfig-emacs/graphs/contributors
[nongnu] scratch/editorconfig-cc 5946c20180 315/351: Prepare v0.9.1 (#281)
branch: scratch/editorconfig-cc commit 5946c20180c22fc274656d229146008ce8e6451f Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Prepare v0.9.1 (#281) --- CHANGELOG.md| 11 ++- editorconfig.el | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b487962a4..e3df69d9a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.9.1] - 2022-11-07 + +### Fixed + +- Check filename rather than buffer-file-name for consistency ([#280]) + + ## [0.9.0] - 2022-10-23 ### Changed @@ -231,7 +238,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *Undocumented* -[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...HEAD +[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...HEAD +[0.9.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...v0.9.1 [0.9.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...v0.9.0 [0.8.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.1...v0.8.2 [0.8.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.0...v0.8.1 @@ -259,6 +267,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1 +[#280]: https://github.com/editorconfig/editorconfig-emacs/issues/280 [#263]: https://github.com/editorconfig/editorconfig-emacs/issues/263 [#260]: https://github.com/editorconfig/editorconfig-emacs/issues/260 [#258]: https://github.com/editorconfig/editorconfig-emacs/issues/258 diff --git a/editorconfig.el b/editorconfig.el index 74a32e9e01..d5ba245c51 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2021 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.9.0 +;; Version: 0.9.1 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5") (nadvice "0.3") (emacs "24"))
[nongnu] scratch/editorconfig-cc 8ee7d0b533 008/351: Set indent_size for lisp mode and ruby mode.
branch: scratch/editorconfig-cc commit 8ee7d0b5334da68b9147c28465529b07c5010363 Author: Hong Xu Commit: Stefan Monnier Set indent_size for lisp mode and ruby mode. --- editorconfig.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index 066c2f2c79..646c80616b 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -43,6 +43,8 @@ (defvar edconf-exec-path "editorconfig") (defun edconf-set-indentation (style size tab_width) + lisp-indent-offset size + ruby-indent-level size ) (defun edconf-set-line-ending (end-of-line)
[nongnu] scratch/editorconfig-cc 25edbde066 142/351: Add support for feature mode. (#128)
branch: scratch/editorconfig-cc commit 25edbde066b48d0b75f60f5a9462f932ebff676c Author: Jay Kamat Commit: Stefan Monnier Add support for feature mode. (#128) --- editorconfig.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index 87e5e63909..4886a4c76a 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -122,6 +122,8 @@ show line numbers on the left: (emacs-lisp-mode lisp-indent-offset) (erlang-mode erlang-indent-level) (ess-mode ess-indent-offset) +(feature-mode feature-indent-offset + feature-indent-level) (groovy-mode c-basic-offset) (haskell-mode haskell-indent-spaces haskell-indent-offset
[nongnu] scratch/editorconfig-cc 316b03ce21 196/351: Set major-mode from file_type_ext value
branch: scratch/editorconfig-cc commit 316b03ce211f5e909013e74eb884047744bdd8dd Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Set major-mode from file_type_ext value --- editorconfig.el | 61 + 1 file changed, 61 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index b085c33ec4..c87e730af9 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -243,6 +243,9 @@ number - `lisp-indent-offset' is not set only if indent_size is equal to this number. For example, if this is set to 2, `lisp-indent-offset'will not be set only if indent_size is 2.") +(defconst editorconfig-unset-value "unset" + "String used to unset properties in .editorconfig .") + (defun editorconfig-string-integer-p (string) "Return non-nil if STRING represents integer." (and (stringp string) @@ -329,6 +332,63 @@ FILETYPE should be s string like `\"ini\"`, if not nil or empty string." mode)) nil +(defvar editorconfig--apply-major-mode-currently nil + "Used internally.") +(make-variable-buffer-local 'editorconfig--apply-major-mode-currently) +(put 'editorconfig--apply-major-mode-currently + 'permanent-local + t) + +(defun editorconig-apply-major-mode-safely (mode) + "Set `major-mode' to MODE. +Normally `editorconfig-apply' will be hooked so that it runs when changing +`major-mode', so there is a possibility that MODE is called infinitely if +MODE is called naively from inside of `editorconfig-apply'. +This funcion will avoid such cases and set `major-mode' safely. + +Just checking current `major-mode' value is not enough, because it can be +different from MODE value (for example, `conf-mode' will set `major-mode' to +`conf-unix-mode' or another conf mode)." + (unless (eq mode + editorconfig--apply-major-mode-currently) +(unwind-protect +(progn + (setq editorconfig--apply-major-mode-currently +mode) + (funcall mode)) + (setq editorconfig--apply-major-mode-currently +nil + +(defun editorconfig--find-mode-from-ext (ext filename) + "Get suitable `major-mode' from EXT and FILENAME. +If FILENAME is omitted filename of current buffer is used." + (cl-assert ext) + (cl-assert (not (string= ext ""))) + (let* ((name (concat (or filename + buffer-file-name) + "." + ext))) +(assoc-default name + auto-mode-alist + 'string-match))) + +(defun editorconfig-set-major-mode-from-ext (ext) + "Set buffer `major-mode' by EXT. + +EXT should be a string like `\"ini\"`, if not nil or empty string." + (cl-assert buffer-file-name) + (when (and ext + (not (string= ext "")) + (not (string= ext editorconfig-unset-value))) + +(let ((mode (editorconfig--find-mode-from-ext ext + buffer-file-name))) + (if mode +(editorconig-apply-major-mode-safely mode) +(display-warning :error (format "Major-mode for `%s' not found" +ext)) +nil + (defun editorconfig-call-editorconfig-exec () ) @@ -401,6 +461,7 @@ applies available properties." (gethash 'charset props)) (editorconfig-set-line-length (gethash 'max_line_length props)) (editorconfig-set-major-mode (gethash 'file_type_emacs props)) + (editorconfig-set-major-mode-from-ext (gethash 'file_type_ext props)) (condition-case err (run-hook-with-args 'editorconfig-custom-hooks props) (error
[nongnu] scratch/editorconfig-cc c45e871a5d 004/351: Add properties link.
branch: scratch/editorconfig-cc commit c45e871a5d1394e6755fd2202d83cb53ad1b1e04 Author: Hong Xu Commit: Stefan Monnier Add properties link. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae24132e20..7efe102e55 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ [EditorConfig]: http://editorconfig.org +[properties]: http://editorconfig.org/#supported-properties
[nongnu] scratch/editorconfig-cc 3305825fd3 298/351: Make new impl work when changing major-mode (#255)
branch: scratch/editorconfig-cc commit 3305825fd3b6364ef7ab147027c9309ad30056eb Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Make new impl work when changing major-mode (#255) --- editorconfig.el | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 25e220038f..f3f5b43d71 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -583,6 +583,17 @@ any of regexps in `editorconfig-exclude-regexps'." (not (editorconfig--disabled-for-filename buffer-file-name))) (editorconfig-apply))) +(defun editorconfig-local-major-mode-hook () + "Function to run when major-mode has been changed." + (display-warning '(editorconfig editorconfig-local-major-mode-hook) + (format "editorconfig-mode: %S -properties-hash: %S" + editorconfig-mode + editorconfig-properties-hash) + :debug) + (when (and editorconfig-mode + editorconfig-properties-hash) +(editorconfig-set-variables editorconfig-properties-hash))) + (defvar editorconfig--cons-filename-codingsystem nil "Used interally.") @@ -665,6 +676,24 @@ F is that function, and FILENAME and ARGS are arguments passed to F." :warning))) (setq editorconfig-properties-hash props) (editorconfig-set-variables props) + +(add-hook 'prog-mode-hook + 'editorconfig-local-major-mode-hook + t t) +(add-hook 'text-mode-hook + 'editorconfig-local-major-mode-hook + t t) +(add-hook 'read-only-mode-hook + 'editorconfig-local-major-mode-hook + t t) +;; Some modes call `kill-all-local-variables' in their init +;; code, which clears some values set by editorconfig. +;; For those modes, editorconfig-apply need to be called +;; explicitly through their hooks. +(add-hook 'rpm-spec-mode-hook + 'editorconfig-local-major-mode-hook + t t) + (condition-case err (run-hook-with-args 'editorconfig-after-apply-functions props) (error @@ -694,13 +723,9 @@ To disable EditorConfig in some buffers, modify (if editorconfig-mode (progn (advice-add 'find-file-noselect :around 'editorconfig--advice-find-file-noselect) -(advice-add 'insert-file-contents :around 'editorconfig--advice-insert-file-contents) -(add-hook 'read-only-mode-hook - 'editorconfig-mode-apply)) +(advice-add 'insert-file-contents :around 'editorconfig--advice-insert-file-contents)) (advice-remove 'find-file-noselect 'editorconfig--advice-find-file-noselect) -(advice-remove 'insert-file-contents 'editorconfig--advice-insert-file-contents) -(remove-hook 'read-only-mode-hook - 'editorconfig-mode-apply)) +(advice-remove 'insert-file-contents 'editorconfig--advice-insert-file-contents)) ;; editorconfig--enable-20210221-testing is disabled ;; See https://github.com/editorconfig/editorconfig-emacs/issues/141 for why
[nongnu] scratch/editorconfig-cc 90fba8ee80 164/351: Add doc/.gitignore
branch: scratch/editorconfig-cc commit 90fba8ee8010f96683bdffbddd59543e5f738982 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add doc/.gitignore --- doc/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00..f65a3e10b9 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +*.texi
[nongnu] scratch/editorconfig-cc 332df3265f 140/351: Fix assignment to free variable warnings
branch: scratch/editorconfig-cc commit 332df3265f5b98e5516edf9ca4f65683ef739dcd Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Fix assignment to free variable warnings Fixes #127 --- editorconfig.el | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index e8a42003a3..87e5e63909 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -39,7 +39,12 @@ ;;; Code: (require 'cl-lib) -(eval-when-compile (require 'rx)) +(eval-when-compile + (require 'rx) + (defvar tex-indent-basic) + (defvar tex-indent-item) + (defvar tex-indent-arg) + (defvar evil-shift-width)) (declare-function editorconfig-core-get-properties-hash "editorconfig-core"
[nongnu] scratch/editorconfig-cc 33ab2b6485 195/351: Add ert-test for file_type_ext
branch: scratch/editorconfig-cc commit 33ab2b6485c9b718d966149b9c0c9a41998a29ae Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add ert-test for file_type_ext --- ert-tests/editorconfig.el| 20 ert-tests/test_files_secondary/.editorconfig | 7 +++ 2 files changed, 27 insertions(+) diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index b45b87b503..b9d795fd2d 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -1,3 +1,11 @@ +(defun display-warning (type message level buffer-name) + "When testing overwrite this function to throw error when called." + (error "display-warning called: %S %S %S %S" + type + message + level + buffer-name)) + (defmacro with-visit-file (path body) "Visit PATH and evaluate BODY." (declare (indent 1) (debug t)) @@ -72,3 +80,15 @@ "c.txt") (should (eq major-mode 'conf-unix-mode))) (editorconfig-mode -1)) + +(ert-deftest test-file-type-ext nil + (editorconfig-mode 1) + (with-visit-file (concat editorconfig-secondary-ert-dir + "a.txt") +(should (eq major-mode 'conf-unix-mode))) + + (with-visit-file (concat editorconfig-secondary-ert-dir + "bin/perlscript") +(should (eq major-mode 'perl-mode)) +(should (eq perl-indent-level 5))) + (editorconfig-mode -1)) diff --git a/ert-tests/test_files_secondary/.editorconfig b/ert-tests/test_files_secondary/.editorconfig index eeb02d621a..7f10833f8e 100644 --- a/ert-tests/test_files_secondary/.editorconfig +++ b/ert-tests/test_files_secondary/.editorconfig @@ -6,3 +6,10 @@ indent_style = tab [c.txt] file_type_emacs = conf + +[a.txt] +file_type_ext = ini + +[/bin/*] +file_type_ext = pl +indent_size = 5
[nongnu] scratch/editorconfig-cc ccfd1910f4 171/351: Remove unused variable
branch: scratch/editorconfig-cc commit ccfd1910f47ec770cbf31824460b077dd08a429f Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Remove unused variable --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index b68198f209..c54931985f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ EMACS = emacs PANDOC = pandoc -MAKEINFO = makeinfo PROJECT_ROOT_DIR = $(PWD) ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
[nongnu] scratch/editorconfig-cc ad79062996 179/351: Use emacs 26.1 instead of 26-pretest (#166)
branch: scratch/editorconfig-cc commit ad79062996b0fbf4258edf5b9a6e586d2241faa6 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Use emacs 26.1 instead of 26-pretest (#166) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e00e7f743..87aefe8e4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false env: matrix: -- EMACS_VERSION=26-pretest +- EMACS_VERSION=26.1 - EMACS_VERSION=25.3 - EMACS_VERSION=24.5
[nongnu] scratch/editorconfig-cc 977f54b251 105/351: Copy properties alists before using them
branch: scratch/editorconfig-cc commit 977f54b25154aee5c4685d516b311e77ff4c7b2e Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Copy properties alists before using them --- editorconfig-core-handle.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index a80223056a..0d664cbdc2 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -86,7 +86,7 @@ The list returned will be ordered by the lines they appear. If HANDLE is nil return nil." (when handle -(mapcar 'cdr +(mapcar (lambda (prop) (copy-alist (cdr prop))) (cl-remove-if-not (lambda (prop) (editorconfig-core-handle--fnmatch-p file (car prop)
[nongnu] scratch/editorconfig-cc 7dea9c4286 317/351: Drop Emacs 24.x and 25.x (#286)
branch: scratch/editorconfig-cc commit 7dea9c428607d8ed93f744a9721f519289412810 Author: Jen-Chieh Shen Commit: Stefan Monnier Drop Emacs 24.x and 25.x (#286) * Drop Emacs 24.x and 25.x * test(build.yaml): Make fail-fast to false * Update CI test * docs: Update changelog * Revert author information --- .github/workflows/build.yaml | 40 --- .gitignore| 9 +++ CHANGELOG.md | 3 + Eask | 20 ++ Makefile | 19 +++-- editorconfig-conf-mode.el | 20 ++ editorconfig-core-handle.el | 55 +-- editorconfig-core.el | 57 +-- editorconfig-fnmatch.el | 21 ++ editorconfig.el | 129 -- ert-tests/editorconfig-core-handle.el | 40 --- ert-tests/editorconfig-core.el| 39 +++--- ert-tests/editorconfig-fnmatch.el | 30 +++- ert-tests/editorconfig.el | 72 +++ ert-tests/metadata.el | 33 +++-- 15 files changed, 346 insertions(+), 241 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 30b6d53c76..8793fee6c8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,3 @@ name: build on: @@ -12,30 +11,53 @@ on: release: types: [published] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: -runs-on: ubuntu-latest +runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: +os: [ubuntu-latest, macos-latest, windows-latest] emacs_version: - - "24.5" - - "25.3" - "26.3" - "27.2" - "28.2" experimental: [false] include: - - emacs_version: snapshot + - os: ubuntu-latest +emacs_version: snapshot +experimental: true + - os: macos-latest +emacs_version: snapshot +experimental: true + - os: windows-latest +emacs_version: snapshot experimental: true continue-on-error: ${{ matrix.experimental }} + steps: - name: Checkout -uses: actions/checkout@v1 +uses: actions/checkout@v3 with: submodules: recursive + - name: Setup Emacs -uses: purcell/setup-emacs@master +uses: jcs090218/setup-emacs@master with: version: ${{ matrix.emacs_version }} - - name: Run tests -run: make check + + - uses: emacs-eask/setup-eask@master +with: + version: 'snapshot' + + - name: Run tests (Unix) +if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' +run: make check-unix + + - name: Run tests (Windows) +if: matrix.os == 'windows-latest' +run: make check-dos diff --git a/.gitignore b/.gitignore new file mode 100644 index 00..0e2d3f8b8f --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.elc + +# eask packages +.eask/ +dist/ + +# packaging +*-autoloads.el +*-pkg.el diff --git a/CHANGELOG.md b/CHANGELOG.md index e3df69d9a1..c08bfa6ecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Drop Emacs 24.x and 25.x ([#286]) + ### Deprecated ### Removed @@ -267,6 +269,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1 +[#286]: https://github.com/editorconfig/editorconfig-emacs/issues/286 [#280]: https://github.com/editorconfig/editorconfig-emacs/issues/280 [#263]: https://github.com/editorconfig/editorconfig-emacs/issues/263 [#260]: https://github.com/editorconfig/editorconfig-emacs/issues/260 diff --git a/Eask b/Eask new file mode 100644 index 00..8d32ac56e7 --- /dev/null +++ b/Eask @@ -0,0 +1,20 @@ +(package "editorconfig" + "0.9.1" + "EditorConfig Emacs Plugin") + +(website-url "https://github.com/editorconfig/editorconfig-emacs#readme;) +(keywords "convenience" "editorconfig") + +(package-file "editorconfig.el") + +(files "editorconfig-*.el") + +(script "test" "echo \"Error: no test specified\" && exit 1") + +(source "gnu") +(source "melpa") + +(depends-on "emacs" "26.1") +(depends-on "
[nongnu] scratch/editorconfig-cc 0d24b868d1 133/351: Add more plugin tests
branch: scratch/editorconfig-cc commit 0d24b868d1e5b44fec2929f7d5a4b5eb32ca0542 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add more plugin tests --- ert-tests/editorconfig.el | 27 +++ 1 file changed, 27 insertions(+) diff --git a/ert-tests/editorconfig.el b/ert-tests/editorconfig.el index e69de29bb2..11b7895c88 100644 --- a/ert-tests/editorconfig.el +++ b/ert-tests/editorconfig.el @@ -0,0 +1,27 @@ +(defmacro with-visit-file (path body) + "Visit PATH and evaluate BODY." + (declare (indent 1) (debug t)) + `(let ((buf (find-file-noselect ,path))) + (with-current-buffer buf + ,@body) + (kill-buffer buf))) + +(defvar editorconfig-ert-dir + (concat default-directory + "ert-tests/plugin-tests/test_files/")) + +(ert-deftest test-editorconfig nil + "Check if properties are applied." + (editorconfig-mode 1) + + (with-visit-file (concat editorconfig-ert-dir + "3_space.txt") +(should (eq tab-width 3)) +(should (eq indent-tabs-mode nil))) + + (with-visit-file (concat editorconfig-ert-dir + "4_space.py") +(should (eq python-indent-offset 4)) +(should (eq tab-width 8)) +(should (eq indent-tabs-mode nil))) + (editorconfig-mode -1))
[nongnu] scratch/editorconfig-cc e867da296c 124/351: Reindent using Emacs-lisp style.
branch: scratch/editorconfig-cc commit e867da296c78f7c9ba39680e1cef2c9dc25fc940 Author: Hong Xu Commit: Stefan Monnier Reindent using Emacs-lisp style. --- editorconfig.el | 194 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 3157251762..f4ad969615 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -40,8 +40,8 @@ ;;; Code: (declare-function editorconfig-core-get-properties-hash - "editorconfig-core" - nil) + "editorconfig-core" + nil) (defgroup editorconfig nil "EditorConfig Emacs Plugin. @@ -104,52 +104,52 @@ property emacs_linum to decide whether to show line numbers on the left (defcustom editorconfig-indentation-alist ;; For contributors: Sort modes in alphabetical order, please :) '((awk-mode c-basic-offset) - (c++-mode c-basic-offset) - (c-mode c-basic-offset) - (cmake-mode cmake-tab-width) - (coffee-mode coffee-tab-width) - (cperl-mode cperl-indent-level) - (css-mode css-indent-offset) - (emacs-lisp-mode lisp-indent-offset) - (erlang-mode erlang-indent-level) - (ess-mode ess-indent-offset) - (groovy-mode c-basic-offset) - (haskell-mode haskell-indent-spaces - haskell-indent-offset - shm-indent-spaces) - (idl-mode c-basic-offset) - (java-mode c-basic-offset) - (js-mode js-indent-level) - (js2-mode js2-basic-offset) - (js3-mode js3-indent-level) - (json-mode js-indent-level) - (latex-mode . editorconfig-set-indentation/latex-mode) - (lisp-mode lisp-indent-offset) - (livescript-mode livescript-tab-width) - (matlab-mode matlab-indent-level) - (mustache-mode mustache-basic-offset) - (nxml-mode nxml-child-indent (nxml-attribute-indent . 2)) - (objc-mode c-basic-offset) - (octave-mode octave-block-offset) - (perl-mode perl-indent-level) - (pike-mode c-basic-offset) - (ps-mode ps-mode-tab) - (puppet-mode puppet-indent-level) - (python-mode . editorconfig-set-indentation/python-mode) - (ruby-mode ruby-indent-level) - (scala-mode scala-indent:step) - (scss-mode css-indent-offset) - (sgml-mode sgml-basic-offset) - (sh-mode sh-basic-offset sh-indentation) - (tcl-mode tcl-indent-level - tcl-continued-indent-level) - (web-mode (web-mode-indent-style . (lambda (size) 2)) - web-mode-markup-indent-offset - web-mode-css-indent-offset - web-mode-code-indent-offset - web-mode-script-padding - web-mode-style-padding) - (yaml-mode yaml-indent-offset)) +(c++-mode c-basic-offset) +(c-mode c-basic-offset) +(cmake-mode cmake-tab-width) +(coffee-mode coffee-tab-width) +(cperl-mode cperl-indent-level) +(css-mode css-indent-offset) +(emacs-lisp-mode lisp-indent-offset) +(erlang-mode erlang-indent-level) +(ess-mode ess-indent-offset) +(groovy-mode c-basic-offset) +(haskell-mode haskell-indent-spaces + haskell-indent-offset + shm-indent-spaces) +(idl-mode c-basic-offset) +(java-mode c-basic-offset) +(js-mode js-indent-level) +(js2-mode js2-basic-offset) +(js3-mode js3-indent-level) +(json-mode js-indent-level) +(latex-mode . editorconfig-set-indentation/latex-mode) +(lisp-mode lisp-indent-offset) +(livescript-mode livescript-tab-width) +(matlab-mode matlab-indent-level) +(mustache-mode mustache-basic-offset) +(nxml-mode nxml-child-indent (nxml-attribute-indent . 2)) +(objc-mode c-basic-offset) +(octave-mode octave-block-offset) +(perl-mode perl-indent-level) +(pike-mode c-basic-offset) +(ps-mode ps-mode-tab) +(puppet-mode puppet-indent-level) +(python-mode . editorconfig-set-indentation/python-mode) +(ruby-mode ruby-indent-level) +(scala-mode scala-indent:step) +(scss-mode css-indent-offset) +(sgml-mode sgml-basic-offset) +(sh-mode sh-basic-offset sh-indentation) +(tcl-mode tcl-indent-level + tcl-continued-indent-level) +(web-mode (web-mode-indent-style . (lambda (size) 2)) + web-mode-markup-indent-offset + web-mode-css-indent-offset + web-mode-code-indent-offset + web-mode-script-padding + web-mode-style-padding) +(yaml-mode yaml-indent-offset)) "Alist of indentation setting methods by modes. Each element looks like (MODE . FUNCTION) or (MODE . INDENT-SPEC-LIST). @@ -204,7 +204,7 @@ yet.") (defun editorconfig-string-integer-p (string) "Return non-nil if STRING represents integer." (and (stringp string) -(string-match-p "\\`[0-9]+\\'" string))) + (string-match-p "\\`[0-9]+\\'" string))) (defun editorconfig-set-indentation/python-mode (size) "Set `python-mode' indent size to SIZE." @@ -217,36 +2
[nongnu] scratch/editorconfig-cc 988220a65b 189/351: Update header.txt
branch: scratch/editorconfig-cc commit 988220a65b2374c23cd50ed22de745e283af3ccc Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update header.txt --- doc/header.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/header.txt b/doc/header.txt index 84eceb02b5..8aa7143c5e 100644 --- a/doc/header.txt +++ b/doc/header.txt @@ -2,3 +2,5 @@ @direntry * EditorConfig: (editorconfig). EditorConfig Emacs Plugin. @end direntry + +@node Top
[nongnu] scratch/editorconfig-cc c71e282e4c 184/351: Remove numeric-range related vairables
branch: scratch/editorconfig-cc commit c71e282e4c3b2c5bbe33ffa0daaf352128e405cd Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Remove numeric-range related vairables --- editorconfig-fnmatch.el | 35 ++- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/editorconfig-fnmatch.el b/editorconfig-fnmatch.el index 854741015a..8126060ef6 100644 --- a/editorconfig-fnmatch.el +++ b/editorconfig-fnmatch.el @@ -54,7 +54,7 @@ (require 'cl-lib) -(defvar editorconfig-fnmatch--cache-hash +(defvar editorconfig-fnmatch--cache-hashtable (make-hash-table :test 'equal) "Cache of shell pattern and its translation.") @@ -82,8 +82,8 @@ num)) ;;;###autoload -(defun editorconfig-fnmatch-p (name pattern) - "Test whether NAME match PATTERN. +(defun editorconfig-fnmatch-p (string pattern) + "Test whether STRING match PATTERN. Matching ignores case if `case-fold-search' is non-nil. @@ -97,13 +97,8 @@ be used: [^name] Matches any single character not in name {s1,s2,s3} Matches any of the strings given (separated by commas) {min..max} Matches any number between min and max" - (let* ((translated (editorconfig-fnmatch-translate pattern)) - (re (car translated)) - (num-groups (nth 1 translated)) - (match (string-match re name)) - (num-groups-len (length num-groups)) - (pattern-matched t)) -match)) + (string-match (editorconfig-fnmatch-translate pattern) +string)) ;;(editorconfig-fnmatch-translate "{a,{-3..3}}.js") ;;(editorconfig-fnmatch-p "1.js" "{a,{-3..3}}.js") @@ -113,11 +108,11 @@ be used: Translation result will be cached, so same translation will not be done twice." (let ((cached (gethash pattern - editorconfig-fnmatch--cache-hash))) + editorconfig-fnmatch--cache-hashtable))) (or cached (puthash pattern (editorconfig-fnmatch--do-translate pattern) - editorconfig-fnmatch--cache-hash + editorconfig-fnmatch--cache-hashtable (defun editorconfig-fnmatch--do-translate (pattern nested) @@ -140,7 +135,6 @@ translation is found for PATTERN." (editorconfig-fnmatch--match-num editorconfig-fnmatch--right-brace-regexp pattern))) -(numeric-groups ()) current-char pos @@ -239,12 +233,7 @@ translation is found for PATTERN." pattern-sub))) (number-end (string-to-number (match-string 2 pattern-sub - (setq numeric-groups `(,@numeric-groups ,(mapcar 'string-to-number -(list (match-string 1 - pattern-sub) - (match-string 2 - pattern-sub - result `(,@result ,(concat "\\(?:" + (setq result `(,@result ,(concat "\\(?:" (mapconcat 'number-to-string (cl-loop for i from number-start to number-end collect i) @@ -252,8 +241,7 @@ translation is found for PATTERN." "\\)" (let ((inner (editorconfig-fnmatch--do-translate pattern-sub t))) (setq result `(,@result ,(format "{%s}" - (car inner))) - numeric-groups `(,@numeric-groups ,@(nth 1 inner) + inner) (setq index (1+ pos))) (if matching-braces (setq result `(,@result "\\(?:") @@ -294,10 +282,7 @@ translation is found for PATTERN." (setq is-escaped nil (unless nested (setq result `("^" ,@result "\\'"))) -(list (mapconcat 'identity - result - "") - numeric-groups))) +(apply 'concat result))) (provide 'editorconfig-fnmatch)
[nongnu] scratch/editorconfig-cc c9b5e73d1d 138/351: Add support for verilog-mode
branch: scratch/editorconfig-cc commit c9b5e73d1dd428f0fa261ae4b4f47d5f6bb3c1e2 Author: Jay Kamat Commit: Stefan Monnier Add support for verilog-mode --- editorconfig.el | 6 ++ 1 file changed, 6 insertions(+) diff --git a/editorconfig.el b/editorconfig.el index f5c4e44054..5370ab6510 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -152,6 +152,12 @@ show line numbers on the left: (sh-mode sh-basic-offset sh-indentation) (tcl-mode tcl-indent-level tcl-continued-indent-level) +(verilog-mode verilog-indent-level + verilog-indent-level-behavioral + verilog-indent-level-declaration + verilog-indent-level-module + verilog-cexp-indent + verilog-case-indent) (web-mode (web-mode-indent-style . (lambda (size) 2)) web-mode-markup-indent-offset web-mode-css-indent-offset
[nongnu] scratch/editorconfig-cc 2bf59e3439 162/351: Add generated info file
branch: scratch/editorconfig-cc commit 2bf59e34392a019d6b96a611b3b66139fa6462bd Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add generated info file --- docs/editorconfig.info | 283 + 1 file changed, 283 insertions(+) diff --git a/docs/editorconfig.info b/docs/editorconfig.info new file mode 100644 index 00..7afd4498d2 --- /dev/null +++ b/docs/editorconfig.info @@ -0,0 +1,283 @@ +This is docs/editorconfig.info, produced by makeinfo version 4.8 from +docs/editorconfig.info.texi. + + +File: editorconfig.info, Node: Top, Next: EditorConfig Emacs Plugin, Up: (dir) + +Top +*** + +* Menu: + +* EditorConfig Emacs Plugin:: + + +File: editorconfig.info, Node: EditorConfig Emacs Plugin, Prev: Top, Up: Top + +1 EditorConfig Emacs Plugin +*** + +This is an EditorConfig (http://editorconfig.org) plugin for Emacs +(https://www.gnu.org/software/emacs/). + +* Menu: + +* Installation:: +* Supported properties:: +* Customize:: +* Testing:: +* Submitting Bugs and Feature Requests:: +* License:: + + +File: editorconfig.info, Node: Installation, Next: Supported properties, Up: EditorConfig Emacs Plugin + +1.1 Installation + + +Download the EditorConfig C Core +(https://github.com/editorconfig/editorconfig-core-c) and follow the +instructions in the README and INSTALL files to install it. + +This plugin also has a built-in core library implemented in Emacs-Lisp, +and fallback to it when no core executable is found. + +In either case, copy `.el' files in this repository to +`~/.emacs.d/lisp' and add the following to your `~/.emacs' file: + + +(add-to-list 'load-path "~/.emacs.d/lisp") +(require 'editorconfig) +(editorconfig-mode 1) + +Alternatively, you can find the package available on MELPA +(http://melpa.org/#/editorconfig) and MELPA Stable +(http://stable.melpa.org/#/editorconfig) (The Marmalade package +(http://marmalade-repo.org/packages/editorconfig) is deprecated). + +Or if you use *use-package* +(https://www.emacswiki.org/emacs/UsePackage): + + +(use-package editorconfig + :ensure t + :config + (editorconfig-mode 1)) + + +File: editorconfig.info, Node: Supported properties, Next: Customize, Prev: Installation, Up: EditorConfig Emacs Plugin + +1.2 Supported properties + + +Current Emacs plugin coverage for EditorConfig's properties +(http://editorconfig.org/#supported-properties): + + * `indent_style' + + * `indent_size' + + * `tab_width' + + * `end_of_line' + + * `charset' + + * `trim_trailing_whitespace' + + * `insert_final_newline = true' is supported + + * `insert_final_newline = false' is not enforced (as in trailing + newlines actually being removed automagically), we just + buffer-locally override any preferences that would auto-add them + to files `.editorconfig' marks as trailing-newline-free + + * `max_line_length' + + * `file_type_emacs' (Experimental) + + * `root' (only used by EditorConfig core) + +Not yet covered properties marked with over-strike - pull requests +implementing missing features warmly welcomed! Typically, you will want +to tie these to native functionality, or the configuration of existing +packages handling the feature. + +As several packages have their own handling of, say, indention, we might +not yet cover some mode you use, but we try to add the ones that show up +on our radar. Similarly, we don't yet hook in to all different packages +for whitespace trimming to inform them about editorconfig settings, but +aim for better coverage of things like ws-trim +(ftp://ftp.lysator.liu.se/pub/emacs/ws-trim.el). + +This plugin also has an experimental support for `file_type_emacs', +which specifies "file types" for files. As for Emacs, it means +`major-mode' can be specified: for example, when `file_type_emacs' is +set to `markdown' for `a.txt', `markdown-mode' will be enabled when +opening `a.txt'. This property is experimental and its meaning might +change in the future updates. + + +File: editorconfig.info, Node: Customize, Next: Testing, Prev: Supported properties, Up: EditorConfig Emacs Plugin + +1.3 Customize += + +* Menu: + +* editorconfig-custom-hooks:: +* editorconfig-indentation-alist:: +* editorconfig-exec-path:: +* editorconfig-get-properties-function:: + + +File: editorconfig.info, Node: editorconfig-custom-hooks, Next: editorconfig-indentation-alist, Up: Customize + +1.3.1 `editorconfig-custom-hooks' +- + +A list of custom hooks after loading common EditorConfig settings, where +you can set some custom variables or overwrite existing properties. + +For example, `web-mode' has several variables for indentation offset +size and EditorConfig sets them at once by `indent_size'. You may want +to stop indenting only blocks of `web-mode': it can be achieved by +adding following to your init.el: + + +(add-hook
[nongnu] scratch/editorconfig-cc 0ebb188649 182/351: Disable delete-trailing-whitespace when buffer-read-only is nil
branch: scratch/editorconfig-cc commit 0ebb188649f3373fe4d372e49e1edc1ae07f9935 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Disable delete-trailing-whitespace when buffer-read-only is nil --- editorconfig.el | 1 - 1 file changed, 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index 45ef0bae3a..dd29aa7b1e 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -297,7 +297,6 @@ number - `lisp-indent-offset' is not set only if indent_size is eol) nil t - (defun editorconfig-set-line-length (length) "Set the max line length (`fill-column') to LENGTH." (when (and (editorconfig-string-integer-p length)
[nongnu] scratch/editorconfig-cc d776cdc5ee 020/351: Support max_line_length.
branch: scratch/editorconfig-cc commit d776cdc5eeedcac6a58fa50ea685275d6fec40e6 Author: Hong Xu Commit: Stefan Monnier Support max_line_length. --- .editorconfig | 1 + editorconfig.el | 9 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 770c115deb..9d29006ba1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,3 +3,4 @@ root = true [*.el] indent_style = space +max_line_length = 80 diff --git a/editorconfig.el b/editorconfig.el index a8d458a827..c58c639826 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -1,6 +1,6 @@ ;;; editorconfig.el --- EditorConfig Emacs extension -;; Copyright (C) 2011-2013 EditorConfig Team +;; Copyright (C) 2011-2014 EditorConfig Team ;; Author: EditorConfig Team ;; Version: 0.2 @@ -65,10 +65,17 @@ (defun edconf-set-line-ending (end-of-line) ) +(defun edconf-set-line-length (length) + "set the max line length (fill-column)" + (set-fill-column (string-to-number length))) + (defun edconf-get-properties () ) (defun edconf-parse-properties (props-string) ) +(defun edconf-find-file-hook () + (edconf-set-line-length (gethash 'max_line_length props))) + (provide 'editorconfig)
[nongnu] scratch/editorconfig-cc 384bf81c0a 333/351: Update CHANGELOG (#308)
branch: scratch/editorconfig-cc commit 384bf81c0a2c46d9035009e2900ef4dced98af3f Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update CHANGELOG (#308) --- CHANGELOG.md | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d92276eaf..01134c4b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.10.1] + +### Fixed + +- Fix when-let (again) ([#305]) +- Fix compile warning of python-mode offset ([#306]) + + ## [0.10.0] - 2023-05-07 ### Added @@ -36,18 +44,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Drop Emacs 24.x and 25.x ([#286]) -### Deprecated - -### Removed - ### Fixed - Fix write-file-functions default value ([#295]) - Check mode-class property for special modes ([#301]) - Load subr-x when compiling ([#302]) -### Security - ## [0.9.1] - 2022-11-07 @@ -267,7 +269,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *Undocumented* -[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.0...HEAD +[Unreleased]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.1...HEAD +[0.10.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.10.0...v0.10.1 [0.10.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.1...v0.10.0 [0.9.1]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.9.0...v0.9.1 [0.9.0]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.8.2...v0.9.0 @@ -297,6 +300,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.1]: https://github.com/editorconfig/editorconfig-emacs/releases/tag/v0.1 +[#306]: https://github.com/editorconfig/editorconfig-emacs/issues/306 +[#305]: https://github.com/editorconfig/editorconfig-emacs/issues/305 [#302]: https://github.com/editorconfig/editorconfig-emacs/issues/302 [#301]: https://github.com/editorconfig/editorconfig-emacs/issues/301 [#300]: https://github.com/editorconfig/editorconfig-emacs/issues/300
[nongnu] scratch/editorconfig-cc 96f8ad419e 303/351: Update debug message format (#261)
branch: scratch/editorconfig-cc commit 96f8ad419efd648cfa9ddd03e80a2b97aa533282 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update debug message format (#261) --- editorconfig.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 1b77b38947..6ead6b299a 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -392,7 +392,7 @@ This function will revert buffer when the coding-system has been changed." (let ((coding-system (editorconfig-merge-coding-systems end-of-line charset))) (display-warning '(editorconfig editorconfig-set-coding-system-revert) - (format "buffer-file-name: %S | buffer-file-coding-system: %S | coding-system: %S | apply-currently: %S" + (format "editorconfig-set-coding-system-revert: buffer-file-name: %S | buffer-file-coding-system: %S | coding-system: %S | apply-currently: %S" buffer-file-name buffer-file-coding-system coding-system @@ -462,7 +462,7 @@ If you just want to check `major-mode', use `derived-mode-p'." (remote-localname (file-remote-p filename 'localname))) (display-warning '(editorconfig editorconfig--execute-editorconfig-exec) - (format "filename: %S | remote: %S | remote-localname: %S" + (format "editorconfig--execute-editorconfig-exec: filename: %S | remote: %S | remote-localname: %S" filename remote remote-localname) @@ -473,7 +473,7 @@ If you just want to check `major-mode', use `derived-mode-p'." (setq filename remote-localname)) (cd "/"))) (display-warning '(editorconfig editorconfig--execute-editorconfig-exec) - (format "default-directory: %S | filename: %S" + (format "editorconfig--execute-editorconfig-exec: default-directory: %S | filename: %S" default-directory filename ) @@ -594,7 +594,7 @@ again. Changing major mode can reset these variables. This function also executes `editorconfig-after-apply-functions' functions." (display-warning '(editorconfig editorconfig-major-mode-hook) - (format "editorconfig-mode: %S, major-mode: %S, -properties-hash: %S" + (format "editorconfig-major-mode-hook: editorconfig-mode: %S, major-mode: %S, -properties-hash: %S" (and (boundp 'editorconfig-mode) editorconfig-mode) major-mode @@ -626,7 +626,7 @@ F is that function, and FILENAME and ARGS are arguments passed to F." ;; This function uses `editorconfig--cons-filename-codingsystem' to decide what coding-system ;; should be used, which will be set by `editorconfig--advice-find-file-noselect'. (display-warning '(editorconfig editorconfig--advice-insert-file-contents) - (format "filename: %S args: %S codingsystem: %S bufferfilename: %S" + (format "editorconfig--advice-insert-file-contents: filename: %S args: %S codingsystem: %S bufferfilename: %S" filename args editorconfig--cons-filename-codingsystem buffer-file-name)
[nongnu] scratch/editorconfig-cc df95ca5e4f 203/351: Do not call mode func when current mode is a child mode of target (#179)
branch: scratch/editorconfig-cc commit df95ca5e4fa606aa00ec083b9f9807b45968de2d Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Do not call mode func when current mode is a child mode of target (#179) --- editorconfig.el | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index ec0a78efac..b8bc2c09bb 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -323,11 +323,9 @@ FILETYPE should be s string like `\"ini\"`, if not nil or empty string." "")) (intern (concat filetype "-mode") -(when (and mode - (not (editorconfig--is-a-mode-p major-mode - mode))) +(when mode (if (fboundp mode) - (funcall mode) + (editorconig-apply-major-mode-safely mode) (display-warning :error (format "Major-mode `%S' not found" mode)) nil @@ -349,10 +347,13 @@ This funcion will avoid such cases and set `major-mode' safely. Just checking current `major-mode' value is not enough, because it can be different from MODE value (for example, `conf-mode' will set `major-mode' to `conf-unix-mode' or another conf mode)." + (cl-assert mode) (when (and (not (eq mode editorconfig--apply-major-mode-currently)) (not (eq mode - major-mode))) + major-mode)) + (not (editorconfig--is-a-mode-p major-mode + mode))) (unwind-protect (progn (setq editorconfig--apply-major-mode-currently
[nongnu] scratch/editorconfig-cc 1a52a5e72c 335/351: test: Emacs 29.1 (#311)
branch: scratch/editorconfig-cc commit 1a52a5e72c53924b8ecc21cb90c778f42c088cb8 Author: Jen-Chieh Shen Commit: Stefan Monnier test: Emacs 29.1 (#311) --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8793fee6c8..d0377d6eca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,6 +26,7 @@ jobs: - "26.3" - "27.2" - "28.2" + - "29.1" experimental: [false] include: - os: ubuntu-latest
[nongnu] scratch/editorconfig-cc a534c8ebcd 120/351: Revert "Use truename for editorconfig name" (#106)
branch: scratch/editorconfig-cc commit a534c8ebcdd6de89c5c6a7215c17ffdc022d37a5 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Revert "Use truename for editorconfig name" (#106) * Revert "Use truename for editorconfig name" This reverts commit f9edfc16bc5d7e3f795025ac6fa3d6608634e18a. Not an important thing, and caused a regression reported in #105. * Bump version to 0.7.8 --- editorconfig-core-handle.el | 1 - editorconfig-core.el| 2 +- editorconfig.el | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/editorconfig-core-handle.el b/editorconfig-core-handle.el index 84e69e8fa2..bfda7b92b8 100644 --- a/editorconfig-core-handle.el +++ b/editorconfig-core-handle.el @@ -67,7 +67,6 @@ If CONF does not exist return nil." (when (file-readable-p conf) -(setq conf (file-truename conf)) (let ((cached (gethash conf editorconfig-core-handle--cache-hash)) (mtime (nth 5 diff --git a/editorconfig-core.el b/editorconfig-core.el index 46204960c6..e3f511e5b9 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -69,7 +69,7 @@ (defconst editorconfig-core-version - "0.7.7" + "0.7.8" "EditorConfig core version.") (defun editorconfig-core--remove-duplicate (alist) diff --git a/editorconfig.el b/editorconfig.el index 3c8ceb08a6..3f535fc043 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2016 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.7.7 +;; Version: 0.7.8 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((cl-lib "0.5"))
[nongnu] scratch/editorconfig-cc dbb63191cc 276/351: Fix references in CHANGELOG (#226)
branch: scratch/editorconfig-cc commit dbb63191cc2c98fb0aeb91774af7e485926b7575 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Fix references in CHANGELOG (#226) * Fix issue references in CHANGELOG * Fix commit reference link --- CHANGELOG.md | 99 +--- 1 file changed, 68 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fe324cebe..faee5e4cdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,19 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Add rustic-mode to editorconfig-indentation-alist (#208) -- Add conf-mode abbrev-table definitions (#220) +- Add rustic-mode to editorconfig-indentation-alist ([#208]) +- Add conf-mode abbrev-table definitions ([#220]) ### Fixed -- Fix so that "?" does not match "/" (#211) -- Fix document typo (#213) -- Don't make unchanged vars buffer-local (#222) +- Fix so that "?" does not match "/" ([#211]) +- Fix document typo ([#213]) +- Don't make unchanged vars buffer-local ([#222]) ### Changed -- Define -mode-apply as an interactive command (#216) -- Use elisp core by default (#209) +- Define -mode-apply as an interactive command ([#216]) +- Use elisp core by default ([#209]) ## [0.8.1] - 2019-10-10 @@ -30,57 +30,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add indentation support - - #196 + - [#196] - enh-ruby-mode - haxor-mode - mips-mode - nasm-mode - terra-mode - kotlin-mode - - bpftrace-mode (#199) - - f90-mode (#200) -- Add explicit support for rpm-spec-mode (efc1ff4b1c3422d6e231b1c01138becab4b9eded, see #197 ) -- Add whitelist for file_type_emacs value (#204) + - bpftrace-mode ([#199]) + - f90-mode ([#200]) +- Add explicit support for rpm-spec-mode ([efc1ff4], see [#197] ) +- Add whitelist for file_type_emacs value ([#204]) ## [0.8.0] - 2019-03-26 ### Fixed -- Allow library forget properties order (#187) -- Use API to get version info (#193) +- Allow library forget properties order ([#187]) +- Use API to get version info ([#193]) - `editorconfig-version()` was added and `editorconfig-core-version` removed -- Update docs and metadata to follow MELPA guidelines (#189) -- Refactor (#188, #191) +- Update docs and metadata to follow MELPA guidelines ([#189]) +- Refactor ([#188], [#191]) ## [0.7.14] - 2018-12-25 ### Added -- Add feature to decide major-mode from file_type_ext [EXPERIMENTAL] #175 (#178) (#179) (#180) -- Add feature to hack properties before applying #182 -- Add variable editorconfig-trim-whitespaces-mode #183 +- Add feature to decide major-mode from file_type_ext [EXPERIMENTAL] [#175] ([#178]) ([#179]) ([#180]) +- Add feature to hack properties before applying [#182] +- Add variable editorconfig-trim-whitespaces-mode [#183] - Useful when you want to use non-default mode like `ws-butler` to trim spaces ### Fixed -- Make conf-mode used when a file has .editorconfig extension 01a064015ed8d00f2853f966f07d2be5b97bfe5e +- Make conf-mode used when a file has .editorconfig extension [01a0640] - Fix tests - Fix docs ### Changed -- Change hook name -custom-hooks -> -after-apply-functions bb4bc4497783e6607480cd0b761f974136784fdd +- Change hook name -custom-hooks -> -after-apply-functions [bb4bc44] ## [0.7.13] - 2018-08-23 ### Fixed -- Check editorconfig configs when read only state changes (#168) -- use CURDIR instead of PWD in Makefile (#170) -- Refactor fnmatch-p (#171) +- Check editorconfig configs when read only state changes ([#168]) +- use CURDIR instead of PWD in Makefile ([#170]) +- Refactor fnmatch-p ([#171]) - Update tests @@ -89,16 +89,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add /Fix major-mode support - - pug-mode #149 - - csharp-mode #154 -- Add variable to disable lisp-indent-offset sometimes #155 -- Add texinfo doc #159 + - pug-mode [#149] + - csharp-mode [#154] +- Add variable to disable lisp-indent-offset sometimes [#155] +- Add texinfo doc [#159] ### Fixed -- Avoid passing a non-absolute file path to editorconfig(1) #151 -- Use "-with-signature" coding systems for all UTF-16 charsets #158 -- Allow normal whitespace when reading EditorConfig settings file #162 +- Avoid passing a non-absolute file path to editorconfig(1) [#151] +- Use "-with-signature" coding systems for all UTF-16 charsets [#158] +- Allow normal whitespace when reading EditorConfig settings file [#162] - Add some fixes to tests @@ -222,3 +222,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.3]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.2...v0.3 [0.2]: https://github.com/editorconfig/editorconfig-emacs/compare/v0.1...v0.2 [0.
[nongnu] scratch/editorconfig-cc 75139b95da 059/351: Use dedicated functions to manipulate hook
branch: scratch/editorconfig-cc commit 75139b95dafd23972a3e8d92304a1af17fde66ee Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Use dedicated functions to manipulate hook --- editorconfig.el | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index b5ca482ee8..11865547c7 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -80,7 +80,7 @@ The hook does not have to be coding style related; you can add whatever functionality you want. For example, the following is an example to add a new property emacs_linum to decide whether to show line numbers on the left - (add-to-list 'editorconfig-custom-hooks + (add-hook 'editorconfig-custom-hooks '(lambda (props) (let ((show-line-num (gethash 'emacs_linum props))) (cond ((equal show-line-num \"true\") (linum-mode 1)) @@ -233,11 +233,9 @@ It calls `editorconfig-get-properties-from-exec' if (let ((props (and (functionp editorconfig-get-properties-function) (funcall editorconfig-get-properties-function (if props - (progn -(editorconfig-set-line-length (gethash 'max_line_length props)) -(dolist (hook editorconfig-custom-hooks) - - (funcall hook props))) +(progn + (editorconfig-set-line-length (gethash 'max_line_length props)) + (run-hook-with-args 'editorconfig-custom-hooks props)) (display-warning :error "EditorConfig core program is not available. Styles will not be applied.") ;;;###autoload
[nongnu] scratch/editorconfig-cc b42ae4c89c 308/351: Add doc about lsp-mode (#266)
branch: scratch/editorconfig-cc commit b42ae4c89c10154414130fed3b0398c7426506c0 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Add doc about lsp-mode (#266) * WIP Add doc about lsp-mode * Update README --- README.md | 11 +++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index ef1a603f70..0a1c73c7bd 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,16 @@ Typically it will occur when the major-mode is not defined using Please feel free to submit issues if you find such modes! +### `editorconfig-format-buffer` does not work well with lsp-mode + +By default, [lsp-mode][] configures indent-region-function so that Emacs uses +language servers' `textDocument/rangeFormatting` request to format text in +buffers. +So EditorConfig settings are ignored unless language servers +themselves support loading configs from `.editorconfig`. + +To avoid this behavior ad-hocly, set `lsp-enable-indentation` to nil. + @@ -184,3 +194,4 @@ with this program. If not, see <http://www.gnu.org/licenses/>. [EditorConfig C Core]: https://github.com/editorconfig/editorconfig-core-c [properties]: https://editorconfig.org/#supported-properties [CMake]: https://cmake.org +[lsp-mode]: https://github.com/emacs-lsp/lsp-mode
[nongnu] scratch/editorconfig-cc a9dfdc4677 186/351: Fix brackets tests (#172)
branch: scratch/editorconfig-cc commit a9dfdc4677f6e4e42fdd239900a9f74bb751149e Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Fix brackets tests (#172) --- ert-tests/editorconfig-fnmatch.el | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ert-tests/editorconfig-fnmatch.el b/ert-tests/editorconfig-fnmatch.el index 513edc7e89..40b488a435 100644 --- a/ert-tests/editorconfig-fnmatch.el +++ b/ert-tests/editorconfig-fnmatch.el @@ -28,10 +28,10 @@ ("a.js" "[a-c1-3].js") ("1.js" "[a-c1-3].js") - ("d.js" "[^abc].js") - ("db.js" "[^abc]b.js") - ("/dir/d.js" "/dir/[^abc].js") - ("d.js" "[^a-c].js") + ("d.js" "[!abc].js") + ("db.js" "[!abc]b.js") + ("/dir/d.js" "/dir/[!abc].js") + ("d.js" "[!a-c].js") ("a.js" "a.{py,js}") ("a.py" "a.{py,js}") @@ -84,12 +84,12 @@ ("d.js" "[a-c1-3].js") ("4.js" "[a-c1-3].js") - ("a.js" "[^abc].js") - ("ab.js" "[^abc]b.js") - ("/dir/a.js" "/dir/[^abc].js") - ("a.js" "[^a-c].js") - ("a.js" "[^a-c1-3].js") - ("1.js" "[^a-c1-3].js") + ("a.js" "[!abc].js") + ("ab.js" "[!abc]b.js") + ("/dir/a.js" "/dir/[!abc].js") + ("a.js" "[!a-c].js") + ("a.js" "[!a-c1-3].js") + ("1.js" "[!a-c1-3].js") ("a.el" "a.{py,js}") ("a.el" "*.{py,js}")
[nongnu] scratch/editorconfig-cc 1e084799c0 289/351: Update docstrings
branch: scratch/editorconfig-cc commit 1e084799c03102f7ea31e90dc58d14ac75285738 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update docstrings --- editorconfig.el | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 91f23bd6a8..8e82c3af7c 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -558,7 +558,9 @@ any of regexps in `editorconfig-exclude-regexps'." (defun editorconfig--advice-insert-file-contents (f filename args) "Set `coding-system-for-read'. -This function should be adviced to `insert-file-contents'" + +This function should be added as an advice function to `insert-file-contents'. +F is that function, and FILENAME and ARGS are arguments passed to F." (display-warning '(editorconfig editorconfig--advice-insert-file-contents) (format "filename: %S args: %S codingsystem: %S bufferfilename: %S" filename args @@ -582,8 +584,8 @@ This function should be adviced to `insert-file-contents'" (defun editorconfig--advice-find-file-noselect (f filename args) "Get EditorConfig properties and apply them to buffer to be visited. -This function should be adviced to `find-file-noselect'. -F is this function, and FILENAME and ARGS are arguments passed to F." +This function should be added as an advice function to `find-file-noselect'. +F is that function, and FILENAME and ARGS are arguments passed to F." (let ((props nil) (coding-system nil) (ret nil))
[nongnu] scratch/editorconfig-cc 6405aa9692 114/351: Add editorconfig-conf-mode.el (#97)
branch: scratch/editorconfig-cc commit 6405aa9692a41e7583b725bbb187acca33dbb283 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add editorconfig-conf-mode.el (#97) And moved some functions and definitions from editorconfig.el --- editorconfig-conf-mode.el | 94 +++ editorconfig.el | 60 -- 2 files changed, 94 insertions(+), 60 deletions(-) diff --git a/editorconfig-conf-mode.el b/editorconfig-conf-mode.el new file mode 100644 index 00..2c2b6ea73e --- /dev/null +++ b/editorconfig-conf-mode.el @@ -0,0 +1,94 @@ +;;; editorconfig-conf-mode.el --- Major mode for editing .editorconfig files + +;; Copyright (C) 2011-2016 EditorConfig Team + +;; Author: EditorConfig Team +;; Version: 0.7.6 +;; URL: https://github.com/editorconfig/editorconfig-emacs#readme + +;; See +;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors +;; or the CONTRIBUTORS file for the list of contributors. + +;; This file is part of EditorConfig Emacs Plugin. + +;; EditorConfig Emacs Plugin is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or (at your +;; option) any later version. + +;; EditorConfig Emacs Plugin is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +;; Public License for more details. + +;; You should have received a copy of the GNU General Public License along with +;; EditorConfig Emacs Plugin. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Major mode for editing .editorconfig files. + +;;; Code: + +(require 'conf-mode) + +(defvar editorconfig-conf-mode-syntax-table + (let ((table (make-syntax-table conf-unix-mode-syntax-table))) +(modify-syntax-entry ?\; "<" table) +table) + "Syntax table in use in `editorconfig-conf-mode' buffers.") + +;;;###autoload +(define-derived-mode editorconfig-conf-mode conf-unix-mode "EditorConfig" + "Major mode for editing .editorconfig files." + (set-variable 'indent-line-function 'indent-relative) + (let ((key-property-list + '("charset" +"end_of_line" +"indent_size" +"indent_style" +"insert_final_newline" +"max_line_length" +"root" +"tab_width" +"trim_trailing_whitespace")) +(key-value-list + '("true" +"false" +"lf" +"cr" +"crlf" +"space" +"tab" +"latin1" +"utf-8" +"utf-8-bom" +"utf-16be" +"utf-16le")) +(font-lock-value + '(("^[ \t]*\\[\\(.+?\\)\\]" 1 font-lock-type-face) +("^[ \t]*\\(.+?\\)[ \t]*[=:]" 1 font-lock-variable-name-face + +;; Highlight all key values +(dolist (key-value key-value-list) + (add-to-list +'font-lock-value +`(,(format "[=:][ \t]*\\(%s\\)\\([ \t]\\|$\\)" key-value) + 1 font-lock-constant-face))) +;; Highlight all key properties +(dolist (key-property key-property-list) + (add-to-list +'font-lock-value +`(,(format "^[ \t]*\\(%s\\)[ \t]*[=:]" key-property) + 1 font-lock-builtin-face))) + +(conf-mode-initialize "#" font-lock-value))) + +;;;###autoload +(add-to-list 'auto-mode-alist + '("/\\.editorconfig\\'" . editorconfig-conf-mode)) + +(provide 'editorconfig-conf-mode) + +;;; editorconfig-conf-mode.el ends here diff --git a/editorconfig.el b/editorconfig.el index bded6aa75f..7d3c081db1 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -39,8 +39,6 @@ ;;; Code: -(require 'conf-mode) - (declare-function editorconfig-core-get-properties-hash "editorconfig-core" nil) @@ -321,12 +319,6 @@ This function do the job only when the major mode is not listed in editorconfig-exclude-modes))) (editorconfig-apply))) -(defvar editorconfig-conf-mode-syntax-table - (let ((table (make-syntax-table conf-unix-mode-syntax-table))) -(modify-syntax-entry ?\; "<" table) -table) - "Syntax table in use in `editorconfig-conf-mode' buffers.") - ;;;###autoload (define-minor-mode editorconfig-mode @@ -341,56 +333,4 @@ visiting files or changing major modes if the major mode is not listed in (add-hook hook 'editorconfig-mode-apply) (remove-hook hook 'edit
[nongnu] scratch/editorconfig-cc 28604a2cb4 332/351: Prepare v0.10.1 (#307)
branch: scratch/editorconfig-cc commit 28604a2cb40077f507402768abdd705888b2f045 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Prepare v0.10.1 (#307) --- Eask| 2 +- editorconfig.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Eask b/Eask index 79ee16b7c5..54b22e07f1 100644 --- a/Eask +++ b/Eask @@ -1,5 +1,5 @@ (package "editorconfig" - "0.10.0" + "0.10.1" "EditorConfig Emacs Plugin") (website-url "https://github.com/editorconfig/editorconfig-emacs#readme;) diff --git a/editorconfig.el b/editorconfig.el index 3b97999079..8848d8d1c9 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2011-2023 EditorConfig Team ;; Author: EditorConfig Team -;; Version: 0.10.0 +;; Version: 0.10.1 ;; URL: https://github.com/editorconfig/editorconfig-emacs#readme ;; Package-Requires: ((emacs "26.1") (nadvice "0.3")) ;; Keywords: convenience editorconfig
[nongnu] scratch/editorconfig-cc d6632cb80b 111/351: Add a note about deprecating marmalade repository
branch: scratch/editorconfig-cc commit d6632cb80bc1028e42c2eebad0482ec7d2a915e7 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Add a note about deprecating marmalade repository --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce0fd1aa92..ebd9bcee25 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ to it when no core executable is found. ``` Alternatively, you can find the package available on -[MELPA](http://melpa.org/#/editorconfig) and [MELPA Stable](http://stable.melpa.org/#/editorconfig). +[MELPA](http://melpa.org/#/editorconfig) and [MELPA Stable](http://stable.melpa.org/#/editorconfig) +(there is also the package in [Marmalade](http://marmalade-repo.org/packages/editorconfig) +repository, but currently we do not update that). ## Supported properties
[nongnu] scratch/editorconfig-cc 9d364c8059 197/351: Update doc
branch: scratch/editorconfig-cc commit 9d364c80593d4c1a735f9ad5c945ea21a2aff4a3 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update doc --- README.md | 24 +--- doc/editorconfig.texi | 30 +++--- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6215eb9f89..71f1824503 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,25 @@ Alternatively, you can find the package available on * `charset` * `max_line_length` +* `file_type_ext` (Experimental) * `file_type_emacs` (Experimental) -This plugin also has an experimental support for `file_type_emacs`, -which specifies "file types" for files. -As for Emacs, it means `major-mode` can be specified: for example, -when `file_type_emacs` is set to `markdown` for `a.txt`, -`markdown-mode` will be enabled when opening `a.txt`. -This property is experimental and its meaning might change in -the future updates. + +### File Type + +This plugin also has experimental supports for `file_type_ext` and +`file_type_emacs`, which specify "file types" for files. +As for Emacs, it means `major-mode` can be set. + +**file_type_ext** When it is set to `md` for `a.txt`, for example, +`major-mode` will be decided as if the file name would be `a.txt.md` +(and thus `markdown-mode` is likely to be used). + +**file_type_emacs** When it is set to `markdown` for `a.txt`, +`markdown-mode` will be enabled when opening `a.txt`. + +These property are experimental and their meanings might change in the +future updates. When both are specified, `file_type_ext` takes precedence. ## Customize diff --git a/doc/editorconfig.texi b/doc/editorconfig.texi index a201279e9d..0b6817cf7e 100644 --- a/doc/editorconfig.texi +++ b/doc/editorconfig.texi @@ -84,6 +84,8 @@ trailing-newline-free @item @code{max_line_length} @item +@code{file_type_ext} (Experimental) +@item @code{file_type_emacs} (Experimental) @item @code{root} (only used by EditorConfig core) @@ -100,14 +102,28 @@ on our radar. Similarly, we don't yet hook in to all different packages for whitespace trimming to inform them about editorconfig settings, but aim for better coverage of things like @uref{ftp://ftp.lysator.liu.se/pub/emacs/ws-trim.el,ws-trim}. +@menu +* File Type:: +@end menu + +@node File Type +@subsection File Type +@anchor{#file-type} +This plugin also has experimental supports for @code{file_type_ext} and +@code{file_type_emacs}, which specify ``file types'' for files. As for +Emacs, it means @code{major-mode} can be set. + +@strong{file_type_ext} When it is set to @code{md} for @code{a.txt}, for +example, @code{major-mode} will be decided as if the file name would be +@code{a.txt.md} (and thus @code{markdown-mode} is likely to be used). + +@strong{file_type_emacs} When it is set to @code{markdown} for +@code{a.txt}, @code{markdown-mode} will be enabled when opening +@code{a.txt}. -This plugin also has an experimental support for @code{file_type_emacs}, -which specifies ``file types'' for files. As for Emacs, it means -@code{major-mode} can be specified: for example, when -@code{file_type_emacs} is set to @code{markdown} for @code{a.txt}, -@code{markdown-mode} will be enabled when opening @code{a.txt}. This -property is experimental and its meaning might change in the future -updates. +These property are experimental and their meanings might change in the +future updates. When both are specified, @code{file_type_ext} takes +precedence. @node Customize @section Customize
[nongnu] scratch/editorconfig-cc 9f8a35806d 090/351: Derive editorconfig-conf-mode from conf-unix-mode
branch: scratch/editorconfig-cc commit 9f8a35806d86999c825404394fef6e540c908227 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier Derive editorconfig-conf-mode from conf-unix-mode Should fix #83 --- editorconfig.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editorconfig.el b/editorconfig.el index 80c50294dd..17611b0abf 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -329,7 +329,7 @@ visiting files or changing major modes if the major mode is not listed in ;;;###autoload -(define-derived-mode editorconfig-conf-mode conf-mode "EditorConfig" +(define-derived-mode editorconfig-conf-mode conf-unix-mode "EditorConfig" "Major mode for editing .editorconfig files." (set-variable 'indent-line-function 'indent-relative) (let ((key-property-list
[nongnu] scratch/editorconfig-cc ee8aa8afa1 244/351: Update README
branch: scratch/editorconfig-cc commit ee8aa8afa1ba33a10e51118d344156c8308e89e9 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Update README --- README.md | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1680875a1f..901ac3f21d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Setup -This package is available on [MELPA](https://melpa.org/#/editorconfig) +This package is available from [MELPA](https://melpa.org/#/editorconfig) and [MELPA Stable](https://stable.melpa.org/#/editorconfig). Install from there and enable global minor-mode `editorconfig-mode`: @@ -12,8 +12,8 @@ Install from there and enable global minor-mode `editorconfig-mode`: ``` -To install manually copy all `.el` files in this repository to -`~/.emacs.d/lisp` and add the following to your `init.el` file: +To install manually, copy all `.el` files in this repository to +`~/.emacs.d/lisp` and add the following: ```emacs-lisp (add-to-list 'load-path "~/.emacs.d/lisp") @@ -140,14 +140,17 @@ init.el: 'ws-butler-mode) ``` -## Testing -Make and [CMake](https://cmake.org) must be installed to run the tests. -To run the tests: +### Development + +Make and [CMake](https://cmake.org) must be installed to run the tests +locally: $ make test + + ## License EditorConfig Emacs Plugin is free software: you can redistribute it
[nongnu] scratch/editorconfig-cc 99a1e77c31 342/351: Exclude some versions from test target (#329)
branch: scratch/editorconfig-cc commit 99a1e77c31a92d2447cea2210f57606b6d58d95e Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier Exclude some versions from test target (#329) nix-emacs-ci does not provide them any more. --- .github/workflows/build.yaml | 5 + 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cb6c246d9c..b21179911c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -40,6 +40,11 @@ jobs: # - os: windows-latest # emacs_version: snapshot # experimental: true +exclude: + - os: macos-latest +emacs_version: "26.3" + - os: macos-latest +emacs_version: "27.2" continue-on-error: ${{ matrix.experimental }} steps: