From f563f0f961068e5732b9770908ebfd915a93fe12 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 18 Jun 2024 01:26:41 -0400 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit a2b7d1129ba03ab7d06618d838cd3abe6852488b Author: Stefan Monnier Date: Tue Jun 18 01:23:21 2024 -0400 Move files for inclusion into Emacs commit cd4fc6f933e8679eff1754eaaac99e4361f0122f Author: Stefan Monnier Date: Sun Jun 16 13:33:55 2024 -0400 Incorporate trivial left-over changes The previous commits are the result of a `git rebase` that removed all the commits by contributors for whom we don't have paperwork. This one "smoothes" over some of the remaining diffs. commit 94c0223e888d637ae5d75fcb210fe4bf7898b3da Author: 10sr <8.slashes@gmail.com> Date: Sat Jun 8 00:52:06 2024 +0900 Fix text (#342) commit d50dfb5c5bf2dc832c9aff8f4b8603c2d504c41a Author: 10sr <8.slashes@gmail.com> Date: Tue Jun 4 15:02:56 2024 +0900 Refactor find-file advices (#340) * Add coding-system test * Refactor find-file advices * Fix test * Fix test * Update * Update commit f55bb4e691dcb63502035aa3e48f6839ae163b44 Author: 10sr <8.slashes@gmail.com> Date: Sun Jun 2 16:42:31 2024 +0900 Update CHANGELOG.md (#339) * Update CHANGELOG.md * Update CHANGELOG.md commit a85a4cafa6c8a1a80f3671658e5aaaf8faedb923 Author: 10sr <8.slashes@gmail.com> Date: Fri May 31 22:19:15 2024 +0900 Add switch not to override local variable values (#338) * Add tests * Define variables * Update --should-set * Add fixes to work * Update test and fix * Fix variables * Use defcustom for switch variables * Remove comment commit 4fbfad0591a9851a48b8ead1e4459677d3f64c58 Author: Jen-Chieh Shen Date: Sat May 11 22:38:20 2024 -0700 feat: Add Svelte support (#333) commit d2d942b4cc83fa0ba32dcaaf6c73004e6490bfc8 Author: 10sr <8.slashes@gmail.com> Date: Sat May 11 15:45:42 2024 +0900 Prepare v0.11.0 (#332) * Prepare v0.11.0 * Update CHANGLOG for v0.11.0 * 2024 commit 9ad3ed0e58bcd719d63d7b64538eff118d094767 Author: 10sr <8.slashes@gmail.com> Date: Fri May 10 00:45:15 2024 +0900 Update CHANGELOG (#331) commit 3fb9fd274d2435228a6545cd2a7553c9522b32e8 Author: 10sr <8.slashes@gmail.com> Date: Mon May 6 23:01:39 2024 +0900 Separate some utility commands to new file (#330) * Remove switch to use legacy version Remove `editorconfig--lagacy-version` variable. * Create editorconfig-tools.el and move some functions into it * Fix merge * Update commentary * Update CHANGELOG * Update text commit d73f126ddb44eba628a87df07f8fd7247c8221aa Author: 10sr <8.slashes@gmail.com> Date: Sun May 5 23:46:58 2024 +0900 Remove editorconfig-mode legacy version (#304) * Remove switch to use legacy version Remove `editorconfig--lagacy-version` variable. * Update CHANGELOG commit ea19d96a7afcd947ece8490d8d9846519ac53606 Author: 10sr <8.slashes@gmail.com> Date: Fri May 3 18:49:50 2024 +0900 Exclude some versions from test target (#329) nix-emacs-ci does not provide them any more. commit 641c8cd06abfd0cf99cc56eeca5458a03feec7c6 Author: Jen-Chieh Shen Date: Thu Mar 28 13:22:07 2024 -0700 ci: Bump Emacs 29.x to 3 (#327) commit 0eef782ae0ece28f0c446165febcf02f6207bb5e Author: Jen-Chieh Shen Date: Mon Mar 18 13:49:24 2024 -0700 feat: Add Zig support (#326) * feat: Add Zig support commit 4c7c96dee9ad7318b4df9414758cd46957cdb495 Author: USAMI Kenta Date: Tue Jan 9 12:24:11 2024 +0900 Add jsonian-mode (#320) commit 94f6fa546f85a49fea649d9c479f20613a36b9af Author: USAMI Kenta Date: Mon Dec 18 14:01:05 2023 +0900 Add php-ts-mode (#318) commit f6eba36c09840b3f1952fb8a542347741a4f3de9 Author: 10sr <8.slashes@gmail.com> Date: Thu Aug 3 00:05:49 2023 +0900 Add support for hcl-mode (#312) commit 4f0e71c9f9ae00fd6e90573c5c779da4c5f397ef Author: 10sr <8.slashes@gmail.com> Date: Wed Aug 2 23:45:29 2023 +0900 Temporarily remove test with windows-latest, emacs snapshot (#313) commit e81368ede389feb28d941c8e135c11e4bdf0160d Author: Jen-Chieh Shen Date: Wed Aug 2 07:25:26 2023 -0700 test: Emacs 29.1 (#311) commit dc571e9422a1713e252093b4ee0eb290841dc07c Author: 10sr <8.slashes@gmail.com> Date: Fri May 19 17:51:28 2023 +0900 Update CHANGELOG (#308) commit 8c1ec23fe6d9fc1d3e2ce24fe76503c88a4ebbc6 Author: 10sr <8.slashes@gmail.com> Date: Fri May 19 17:28:11 2023 +0900 Prepare v0.10.1 (#307) commit a415057ecfc5e89a903cb2e62a7d9d2596769532 Author: 10sr <8.slashes@gmail.com> Date: Fri May 19 17:07:23 2023 +0900 Fix compile warning of python-mode offset (#306) commit 94aa31702f7316db63411de8ded371f782d02baa Author: 10sr <8.slashes@gmail.com> Date: Fri May 19 16:51:48 2023 +0900 Fix when-let (again) (#305) * Fix compile of editorconfig-core * Use when-let* instead of when-let commit 3b2b213934e6648834f043623bdce2a3b816ece1 Author: 10sr <8.slashes@gmail.com> Date: Sun May 7 17:15:54 2023 +0900 Prepare v0.10.0 (#303) * Update CHANGELOG * Update CHANGELOG * Update version string commit ea22e6977eb64a38e19250b1fef3933b702d8a16 Author: 10sr <8.slashes@gmail.com> Date: Sun May 7 17:03:30 2023 +0900 Revert "Update version string" This reverts commit dfce47f4c5369711524c4da606201f33649bf894. commit 8ba886d3a64514ca6b558a19a3df7cf147f528f0 Author: 10sr <8.slashes@gmail.com> Date: Sun May 7 16:46:09 2023 +0900 Update version string commit c6769a3be9d5447bbf253681e731aa017de49872 Author: 10sr <8.slashes@gmail.com> Date: Sun May 7 16:17:58 2023 +0900 Check mode-class property for special modes (#301) In addition to checking parent mode commit 02bd633818a2db80b2bf5ebaaf3eaed76a0443ac Author: 10sr <8.slashes@gmail.com> Date: Sun May 7 15:59:34 2023 +0900 Load subr-x when compiling (#302) `when-let` depends on this. commit d7da0ea0fe118d88d032e81de65c79593c5181ea Author: Jen-Chieh Shen Date: Thu Apr 27 03:25:18 2023 +0800 Add support for gdscript-mode (#300) commit 93c418e7d385f55103d94a926b0ec051e51bceeb Author: Jen-Chieh Shen Date: Sun Apr 16 07:12:01 2023 +0800 fix: Fix compile warnings (#298) commit d21983b235c11f4a1845bd80e9d6ca25c9882f9a Author: Jen-Chieh Shen Date: Sun Apr 16 07:05:26 2023 +0800 Update copyright year (#297) commit 38f84cca9a68bca0e74bb4f50e178e6a9883c1f4 Author: Mohsin Kaleem Date: Mon Apr 10 00:46:35 2023 +0100 Add bash-ts-mode to editorconfig-indentation-alist (#296) Co-authored-by: Hong Xu commit 5f112084d762c05a6d31b9bd3c4619789614f842 Author: Simen Heggestøyl Date: Thu Mar 2 09:31:07 2023 +0100 Fix compilation warnings in Emacs 29 (#292) Fix a bunch of compilation warnings in Emacs 29 about wrong usage of unescaped single quotes in docstrings. commit 37b142e86513b2477c19defcf6798e362e5ba7bd Author: Jen-Chieh Shen Date: Wed Feb 15 23:12:21 2023 -0800 docs(README.md): Update development instructions (#291) commit 7f3c344e15e86a54390f4b3428432476b45d6c62 Author: Mohsin Kaleem Date: Sun Feb 12 06:17:01 2023 +0000 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 commit 26bc586c7e19dd00554f732f4313e07a0a18bb97 Author: Jen-Chieh Shen Date: Tue Jan 3 19:43:54 2023 +0800 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 commit d96709f3ddb7ce905e2ba1ff615ed875e26d6fdb Author: Jen-Chieh Shen Date: Thu Dec 29 05:46:11 2022 +0800 chore: Place emacs dependency to the front (#285) * chore: Place emacs dependency infront * Update copyright year commit 00913e8db3a864e7dbf8da7aa6ac355aeef3f999 Author: 10sr <8.slashes@gmail.com> Date: Mon Nov 7 12:00:26 2022 +0900 Prepare v0.9.1 (#281) commit b57c665de578b7510affa426478fadacef80f5d4 Author: 10sr <8.slashes@gmail.com> Date: Mon Oct 31 14:47:17 2022 +0900 Check `filename` rather than `buffer-file-name` for consistency (#280) Co-authored-by: Wade Zhang commit 35b360daebc6fc30723b5f361c65345dea0cc7f7 Author: 10sr <8.slashes@gmail.com> Date: Sun Oct 23 22:20:37 2022 +0900 Prepare v0.9.0 (#275) * Update version number in el file * Update CHANGELOG for 0.9.0 * Fix CHANGELOG * Fix release date commit 52d089efa733e0add922e07485cf8ac547bf9e3c Author: 10sr <8.slashes@gmail.com> Date: Sun Oct 23 22:13:13 2022 +0900 Fix package load for use-package usage (#277) commit b9c5af58e5059dad44a79a52790c2d913930d0ef Author: 10sr <8.slashes@gmail.com> Date: Sun Oct 23 20:47:55 2022 +0900 Add fixes for Emacs 29 (#276) * Fix warnings reported with Emacs29 snapshot * Disable vc feature for ert testings commit cc2fc3d25447dfa6271a9b6434478c2f140b4022 Author: Jen-Chieh Shen Date: Fri Sep 30 07:18:09 2022 +0800 tests(build.yml): Use latest minor version number (#274) commit 7e266d113ed69c487e25260527c3e39fa274662f Author: 10sr <8.slashes@gmail.com> Date: Mon Apr 18 14:41:07 2022 +0900 Add emacs 28.1 to test target (#270) commit bd35e505585a738cfed09f8d7fbcdac523f648bb Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 26 13:05:00 2022 +0900 Add doc about lsp-mode (#266) * WIP Add doc about lsp-mode * Update README commit 69582a19e4c40bbf2006c2fac6f61b8eb5c9d4e3 Author: 10sr <8.slashes@gmail.com> Date: Thu Sep 2 05:53:42 2021 +0900 Update CHANGELOG commit 3c47c18a72e98036d9ebf11350c3af9683d86c76 Author: 10sr <8.slashes@gmail.com> Date: Mon Aug 30 19:25:20 2021 +0900 Use new implementation by default (#263) * Use new implementation by default * Remove old test * Make editorconfig-hack-properties-functions deprecated commit 111a668e52f68706650d5624f16fd92c0c113f7b Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 13 22:01:38 2021 +0900 Prepare v0.8.2 (#262) * Update CHANGELOG * 2021 * Prepare v0.8.2 commit 4bcd7e2f12800d3a4566130f447533a1955a978a Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 13 21:55:02 2021 +0900 Update texi doc commit 7e71870e27d2ef23196127640ca3935cbdd4a432 Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 13 00:30:01 2021 +0900 Update debug message format (#261) commit 76fc064ee4ff6ab05db2c5004d7d4cd150b2fac1 Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 13 00:19:52 2021 +0900 Fix editorconfig-major-mode-hook (#260) commit db6ae0703c07568780c71dd92874886208536eaa Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 13 00:07:12 2021 +0900 Update README for NonGNU ELPA repository (#259) * Add NonGNU ELPA badge * Update README commit f3164820fc06a642bbc0eccadc5386ec98befb5b Author: 10sr <8.slashes@gmail.com> Date: Tue Aug 10 00:23:58 2021 +0900 Add some bug fixes to 20210221-testing (#258) * Rename internal function name * Update comment * Update -set-coding-system func name and doc * Add comment * Fix mode-hooks * Fix func name * Update -major-mode-hook function commit 5e0f23b64c822e7f2ff1d23c756e89c1c073c23c Author: 10sr <8.slashes@gmail.com> Date: Wed Apr 7 13:07:42 2021 +0900 Add fixes for compile warning commit b46c5dd667b68bfca204ff7424df8588dae12a56 Author: 10sr <8.slashes@gmail.com> Date: Wed Apr 7 12:02:07 2021 +0900 Make new impl work when changing major-mode (#255) commit 7375e7fdd21be087ffb52bf2917aefcaded3292c Author: 10sr <8.slashes@gmail.com> Date: Mon Feb 22 01:17:49 2021 +0900 Return early when expecting coding-system has been already set commit 13d8f9bb7bddf7f43091829fa361a336dbf2de61 Author: 10sr <8.slashes@gmail.com> Date: Sun Feb 21 22:41:57 2021 +0900 Add minor fixes to tests (#252) * Update Makefile targets * Update github actions task * Fix test macros * Update README commit ddce92ffcc92b79080949ad72801292fa2bafeb9 Author: 10sr <8.slashes@gmail.com> Date: Sun Feb 21 22:25:29 2021 +0900 Use flag instead of adding -2-mode for new version testing (#251) * Use flag instead of adding -2-mode * Fix test commit f18086a5b97625bcb51a4c8cb790efca80ef6d10 Author: 10sr <8.slashes@gmail.com> Date: Sun Feb 21 21:37:45 2021 +0900 Add debug message to -set-coding-system commit afe9f62ecfcba0ce92255fa18c4a1af0787ff3b0 Author: 10sr <8.slashes@gmail.com> Date: Sun Feb 21 21:06:19 2021 +0900 Move hack-properties-function run commit 2c7790d6eec32e486b448e2e40549d3f139227df Author: 10sr <8.slashes@gmail.com> Date: Sun Feb 21 20:58:40 2021 +0900 Update display-warning messages commit f8dc92d37b965370a2332e19609cebdddbbac406 Author: 10sr <8.slashes@gmail.com> Date: Sat Feb 20 01:56:22 2021 +0900 Fix for coding-system set when remote files do not exist (#250) commit 28108cc8b456cedbc2e895da1c1151a11571cd4f Author: 10sr <8.slashes@gmail.com> Date: Sat Feb 20 00:44:22 2021 +0900 Fix editorconfig execution for remote hosts via tramp (#249) commit 8086a8a45982b30a9620f723ce81994ed4ad26e1 Author: 10sr <8.slashes@gmail.com> Date: Sat Feb 20 00:14:23 2021 +0900 Update docstrings commit 69c8e3f766b2d458c5e3461c772cff69434962cd Author: 10sr <8.slashes@gmail.com> Date: Fri Feb 19 20:39:05 2021 +0900 Update debug message commit da2ede9ef13ae04ba4f1a37236052d9ce4c2e150 Author: 10sr <8.slashes@gmail.com> Date: Fri Feb 19 18:11:37 2021 +0900 Refactoring & add editorconfig-2-mode for beta test (#248) * Remove file type experimental feature temporarily * Do some refactors * Ignore failures of tests for file type feature * Make editorconfig-get-properties-function accept one argument * Implement editorconfig--advice-find-file-noselect * Define editorconfig-error * Implement advices * Update adviced function body * Update function name * Refactor exclude functions * Add more error handlings * Refactor editorconfig--advice-find-file-noselect * Add editorconfig-2-mode * Add nadvice to dependency list * Use display-warning instead of message for debug log * Update README * Fix editorconfig-2-mode for read-only-mode * Add test for editorconfig-2-mode commit d53e3da79f40ec879b1520b6f73c371f8a5cfc03 Author: 10sr <8.slashes@gmail.com> Date: Mon Feb 15 00:27:04 2021 +0900 Stop excluding remote files by default (#245) To exclude remote files again, add following to the init.el: (add-to-list 'editorconfig-exclude-regexps (eval-when-compile (rx string-start "/" (or "http" "https" "ftp" "sftp" "rsync" "ssh") ":"))) commit 968bb5fb871e0076a4779f78526e3ad91777e60c Author: 10sr <8.slashes@gmail.com> Date: Tue Jan 12 18:01:07 2021 +0900 Do not run editorconfig-apply on recentf-save-file (#241) commit a6c64cc26d5d237f6b3c53e8d637af96c428a5f7 Author: 10sr <8.slashes@gmail.com> Date: Fri Jan 8 13:28:50 2021 +0900 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 commit 9605f6bf4408e4a5025dc6862fba96de347b9332 Author: 10sr <8.slashes@gmail.com> Date: Thu Dec 24 05:26:25 2020 +0900 Remove travis.yml (#238) commit c73b0cf3fcc4dd5ff1e268d54d20ab6e88cd6b2e Author: 10sr <8.slashes@gmail.com> Date: Wed Dec 23 15:36:45 2020 +0900 Update README 2 (#225) * Update README 2 * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md commit bba5bdaef41895bf528f00923e8f1ce249a93641 Author: 10sr <8.slashes@gmail.com> Date: Wed Nov 25 15:31:14 2020 +0900 Add github actions badge commit ee39cf38f4efda519db947dd850a6522836561c5 Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 7 08:00:19 2020 +0900 Do not init submodule in Makefile commit 4def6c96944c8e704f4424d10fcd1a73076709c6 Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 7 07:21:43 2020 +0900 Add Github Actions build.yaml commit 49cf213f30d027aae34b3d499aa637cb1cca5f38 Author: Brian Leung <29217594+leungbk@users.noreply.github.com> Date: Sun Nov 22 07:42:16 2020 -0800 Silence byte-compiler warnings (#235) Move aliases before their referents Co-authored-by: 10sr <8.slashes@gmail.com> commit d4fabc95b8b2af5d7ead1b1e8065c69d5805d6b4 Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 7 07:22:32 2020 +0900 Add Emacs 27.1 to test target (#228) * Add Emacs 27.1 to travis test target * Add GitHub Actions build.yaml * Fix evm 27.1 version * Remove github actions build.yaml commit 1defe4a4cd0fa7f57c0013e6efc535bb02f827cd Author: 10sr <8.slashes@gmail.com> Date: Fri Jul 31 00:31:28 2020 +0900 Fix references in CHANGELOG (#226) * Fix issue references in CHANGELOG * Fix commit reference link commit 88efaca117ef6abd3bdee39de7b4b64628e59796 Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 30 22:37:30 2020 +0900 Update CHANGELOG commit c8c7845c73d08bd21235bc79eafa887651990a6f Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 30 22:34:36 2020 +0900 Add doc about make sandbox commit 8c551d92bacea8d6ea1b73e945ab5600f7608a78 Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 30 22:32:29 2020 +0900 Update README to help bootstrap users (#219) * Update README to help bootstrap users * Update doc * Fix doc * Update * Updat commit c0789e2d537fb609af72a1edf51e1c5e4673ab2e Author: 10sr <8.slashes@gmail.com> Date: Fri May 22 23:13:55 2020 +0900 Keep a CHANGELOG (#221) * Add empty CHANGELOG.md * Generate CHANGELOG template ```python #!/usr/bin/env python3 import subprocess def _get_tag_date(tag): git_show = subprocess.run(["git", "show", tag, "--format=%cd", ... ..."--date=short", "-s"], capture_output=True) return git_show.stdout.decode("utf-8").strip() def main(): git_tag = subprocess.run(["git", "tag"], capture_output=True) versions = list(reversed([e[1:] for e in git_tag.stdout.decode... ...("utf-8").split("\n") if e])) for version in versions: print(f"## [{version}] - {_get_tag_date('v' + version)}") print() print() print(f"[Unreleased]: https://github.com/editorconfig/... ...editorconfig-emacs/compare/v{versions[0]}...HEAD") for version, version_prev in zip(versions, versions[1:]): print(f"[{version}]: https://github.com/editorconfig/... ...editorconfig-emacs/compare/v{version_prev}...v{version}") print(f"[{versions[-1]}]: https://github.com/editorconfig/... ...editorconfig-emacs/releases/tag/v{versions[-1]}") return main() ``` * Paste release notes from github releases * Add release note for unreleased * Fix line commit 68e940e0fd312848d18aba93b49285d7a8d74182 Author: 10sr <8.slashes@gmail.com> Date: Tue May 19 20:28:23 2020 +0900 Add conf-mode abbrev-table definitions (#220) commit dc9dc966f973d9e9f2992004beb462bc5813c01c Author: 10sr <8.slashes@gmail.com> Date: Wed Feb 12 16:39:43 2020 +0900 Update hook docstrings (#215) #214 commit 5aa20f73ddbf5df60a9c66b219846d94c9d12a7d Author: 10sr <8.slashes@gmail.com> Date: Wed Feb 12 15:56:48 2020 +0900 Define -mode-apply as an interactive command (#216) commit 39175259174ba0eea3529fc4039fbd90c5990ecc Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 16 17:59:07 2020 +0900 2020 commit d29d6f1254f018cdc696cf40614e6799e2673f64 Author: 10sr <8.slashes@gmail.com> Date: Fri Dec 20 16:31:15 2019 +0900 Update README commit d24e05ccd13c44380dbbbc4756eb02ede3882b9e Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 23 13:39:46 2019 +0900 Use elisp core by default Closes #198 commit 42d9b6aebd4488d6862ff39238a284408e5e4370 Author: 10sr <8.slashes@gmail.com> Date: Fri Dec 20 16:31:40 2019 +0900 Remove a trailing whitespace commit 347e0171ad3cfcb70c0aca73b7b6fa8a5875dae6 Author: Damien Cassou Date: Wed Nov 27 06:29:43 2019 +0100 Fix typos (#212) Typos found with codespell. commit 7915da05ee67bf5c5356ddd49400e9facc15d004 Author: 10sr <8.slashes@gmail.com> Date: Fri Oct 25 16:59:30 2019 +0900 Fix that "?" does not match "/" commit 480998f061d22444571f05b6c10d190c204c227e Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 23 14:32:21 2019 +0900 Update core-test commit 63fa8f9e4bc2938e7bc02b97da79335db29bf0e0 Author: 10sr <8.slashes@gmail.com> Date: Thu Oct 10 13:44:34 2019 +0900 Bump version to v0.8.1 commit b7d3a15f606582d30590fab8bbf0202fd7351c90 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 8 13:55:05 2019 +0900 Fix support for Emacs<26 commit 19bad72db735c032e773b6201a80a5df2597c0f4 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 8 13:40:49 2019 +0900 Add editorconfig-file-type-emacs-whitelist value commit a179c9876f8f1fd343559aad13a32b96a651e86a Author: 10sr <8.slashes@gmail.com> Date: Mon Oct 7 22:34:03 2019 +0900 Disallow setting mode when it is not listed in whitelist commit cb218f4b5adc10faa2f89c4ec85bfafa7ad0600a Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 8 14:10:09 2019 +0900 Use dist: trusty commit ae5fb296026f948103ade4e7e42f3989dda44df7 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 8 14:04:41 2019 +0900 Update travis Emacs26 version commit 5e9769675fbf76566ca10f30c148f385396796ae Author: Jay Kamat Date: Mon Jun 17 06:43:54 2019 +0100 Add support for bpftrace-mode (#199) commit 875088b1c587451916accd2474d57c66d05be1c6 Author: 10sr <8.slashes@gmail.com> Date: Mon Jun 3 20:24:18 2019 +0900 Add explicit support for rpm-spec-mode commit 0faf4dc29c6c504a3026601b6035ff0735a0839b Author: 10sr <8.slashes@gmail.com> Date: Mon Jun 3 19:28:20 2019 +0900 Make editorconfig-properties-hash permanetn-local commit f511979e3c172932ba51b4b8e1172897f786c834 Author: 10sr <8.slashes@gmail.com> Date: Tue Apr 2 15:55:33 2019 +0900 Update message format for version info Update message format for version info commit efc11ec6fd100b2c19950153b1f6e64d85c36d97 Author: 10sr <8.slashes@gmail.com> Date: Tue Mar 26 23:20:10 2019 +0900 Make -version print packaging version commit c2ea49f01fbdc144e623c30cbb8b6bf4439ac6b5 Author: 10sr <8.slashes@gmail.com> Date: Tue Mar 26 20:24:31 2019 +0900 Bump version to v0.8.0 (#192) commit c6e817a36b2d901a837f373748941ff1246081f8 Author: 10sr <8.slashes@gmail.com> Date: Sat Mar 23 21:40:49 2019 +0900 Use API to get version info (#193) commit 0cf6ce9534a35823f534014ec941db2a690f9002 Author: 10sr <8.slashes@gmail.com> Date: Mon Feb 25 19:49:56 2019 +0900 Use https for melpa badge commit 695fce14c0f2cfc72520356cc9d6c46ed3fff33a Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 24 14:49:05 2019 +0900 Update plugin-tests submodule commit 1651d96aa2909d7f49c7e06a893c464e6f1fa2d9 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 24 14:48:26 2019 +0900 Do not update submodule when running tests commit ff0ed217461484a45ab8be7a8aa11c8b503f2388 Author: 10sr <8.slashes@gmail.com> Date: Tue Jan 22 13:59:50 2019 +0900 Use reference link commit 5632843e840d0e8dee819d283b8d0a2ae88b8fa8 Author: 10sr <8.slashes@gmail.com> Date: Fri Jan 18 13:17:15 2019 +0900 Update README commit 570502fdbb5e7634a43178805caae16e709ba9d7 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 17 14:10:15 2019 +0900 Update docstring commit b36f495d1510a53c63e42d6f48513b2fc3fc5b45 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 17 12:38:25 2019 +0900 Separate tool functions commit f295ca7cb2e64a8312a172b53b5eee7f06f8ac6e Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 17 11:23:49 2019 +0900 Use -*- lexical-binding: t -*- https://github.com/melpa/melpa/blob/master/... ...CONTRIBUTING.org#fixing-typical-problems commit 2d342a1dc75d800577526bd5b62e2f2e350f2447 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 17 11:16:59 2019 +0900 Fix function name commit ec5576f7a9ae86649332414995124a3355ae5c13 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 17 11:13:37 2019 +0900 Add fixes for package-lint commit bd9e60c65cd8dd1fdc0f6fe35b2684bc2c4c2d80 Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 17:09:18 2019 +0900 Update README commit 551fcd4dc2556506e95c26898d864743cfb379c8 Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 17:14:18 2019 +0900 Update commentary section commit 8352b3f1d06aefcc4f8f6b7da760ced921efe93e Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 16:52:49 2019 +0900 Remove comment commit 51d2849fb6aaf195393f37dfbd1573d0b449df9b Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 16:44:59 2019 +0900 Update year commit 9b36c88ce02325e755ce07ebbfd6622b67619d63 Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 16:43:13 2019 +0900 M-x checkdoc commit 68d488ee67e6fa06b9b596f178d445b28bab2865 Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 16 14:24:46 2019 +0900 Add struct docstring commit feddcd841a913b8f1a79251bb347a2d3b00a06ae Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 10 14:40:30 2019 +0900 Remove useless spaces commit f735659b421c5f72bc6c137fd7717a1931ce719d Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 10 14:31:53 2019 +0900 Stop using cl-defclass With Emacs<25 cl-defmethod cannot used for structs commit 56fa185bcec16e2fb97b71a4e6dee0c5ef2b6256 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 10 14:30:55 2019 +0900 Revert "Add support for Emacs24.5" This reverts commit 103081756d5d1de03dfa2d9d42b6e4a8581fca29. commit 026b21393284b9328fec956dae28c26dab1903e6 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 10 14:13:21 2019 +0900 Add support for Emacs24.5 commit 2aabf655a964a7a172de66391cfdd1d598e2e8f1 Author: 10sr <8.slashes@gmail.com> Date: Thu Jan 10 13:48:52 2019 +0900 Refactor handle lib commit d40048455064be9e090828b4cb28f86f922eae85 Author: 10sr <8.slashes@gmail.com> Date: Wed Jan 9 13:29:46 2019 +0900 Use 0.8.0 for next version commit 7a17d5ea063030313726104a3a1895bb6eb7021f Author: 10sr <8.slashes@gmail.com> Date: Tue Jan 8 16:08:04 2019 +0900 Remove unused tests commit 4f20ce1e1cbf3de1284f8de988ea12a2dcdfa690 Author: 10sr <8.slashes@gmail.com> Date: Tue Jan 8 15:58:29 2019 +0900 Get alist result from hash result commit 69768d1bd108d93d392b2d8eb5750d8b8ddca169 Author: 10sr <8.slashes@gmail.com> Date: Tue Jan 8 11:27:44 2019 +0900 Implement --hash-merge commit c36d66e3421dfbcdfa9f9221b900f3c8fbde8882 Author: 10sr <8.slashes@gmail.com> Date: Mon Jan 7 20:29:20 2019 +0900 Update get-properties-hash commit 75d0158b6c5c1723a1d21f8c4ebdc37b91aa9d1c Author: 10sr <8.slashes@gmail.com> Date: Mon Jan 7 12:21:09 2019 +0900 Add function to get properties from handlers as hash commit e8ac4bf5d3d7e70ea815f68d64933330a7ffc1d9 Author: USAMI Kenta Date: Tue Dec 25 21:05:37 2018 +0900 Use Markdown's code spans instead of Emacs style `' (#186) commit 77775d90c383c5ddd0c4f9564d022ef971c9f7c3 Author: 10sr <8.slashes@gmail.com> Date: Tue Dec 25 11:49:07 2018 +0900 Bump version to 0.7.14 (#185) commit e25ac0d49ff1e1982d58198efab35f3bd2c368d4 Author: 10sr <8.slashes@gmail.com> Date: Mon Dec 17 16:24:27 2018 +0900 Add document for editorconfig-trim-whitespaces-mode commit 29060e8494a4ee2bccae7114cdf148387bce2f47 Author: 10sr <8.slashes@gmail.com> Date: Sat Dec 15 16:46:07 2018 +0900 Add variable editorconfig-trim-whitespaces-mode commit 1327acab8d855d479d9d087129d05de671da8c76 Author: 10sr <8.slashes@gmail.com> Date: Mon Dec 3 19:41:49 2018 +0900 Use princ instead of message to write to stdout commit d22c30f408fb2447047e8413dc5ca435b062b933 Author: 10sr <8.slashes@gmail.com> Date: Mon Dec 3 18:54:25 2018 +0900 Update core-test submodule commit 88b2303a1f28a1b257fb5c205fa36428219197e7 Author: Terje Larsen Date: Sat Nov 17 23:16:12 2018 +0100 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. commit 550897776f79f4e5395fe00924bdf620982f5b47 Author: 10sr <8.slashes@gmail.com> Date: Thu Nov 15 16:09:02 2018 +0900 Fix hack-properties-functions example commit 8241f65395cd78b83a59d5cfc1c682ef1ead90cd Author: 10sr <8.slashes@gmail.com> Date: Thu Oct 25 13:21:50 2018 +0900 Fix README and texi commit dff69487901d0074b1fdad8c91e69b40e5e6543e Author: 10sr <8.slashes@gmail.com> Date: Wed Oct 24 13:41:30 2018 +0900 Update document commit 9ca51506778b486d947cba5dabd318614ebc5628 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 14:48:34 2018 +0900 Add test for -hack-properties-functions commit 07ae870dbb2fdc4ec70c440e355bd126d124dce6 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 14:27:56 2018 +0900 Call -hack-properties-functions in editorconfig-apply commit adfb8c54ba4ea5d52a558bd97221f40a5495e170 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 14:18:46 2018 +0900 Add variable -hack-properties-functions commit 28c4846e9cac199ff4c357033a80054017687b90 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 14:04:22 2018 +0900 Fix version when -custom-hooks has marked as obsolete commit 88824e7be5b7492845d914110e07328a93901e05 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 13:56:46 2018 +0900 Update texi for hook name change commit e11f186800af869897400eb2be72f7ec4c3379d2 Author: 10sr <8.slashes@gmail.com> Date: Tue Oct 23 13:51:32 2018 +0900 Use derived-mode-p for major-mode check (#180) commit 791cb6777301fb22f97538471904188deb4b05ec Author: 10sr <8.slashes@gmail.com> Date: Fri Oct 19 19:13:19 2018 +0900 Update README.md for hook name change commit 1138109d4b29c2c8e8e360f9d9314d7081e4fbb4 Author: 10sr <8.slashes@gmail.com> Date: Fri Oct 19 19:01:42 2018 +0900 Change hook name -custom-hooks -> -after-apply-functions With obsolete-variable-alias commit ff38e8046be032e0d84a5d326dd68d3f40ea449e Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 25 18:26:43 2018 +0900 Do not call mode func when current mode is a child mode of target (#179) commit 5fff8e44195d91f967b4bacc2562026c7bcfda01 Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 25 15:40:52 2018 +0900 Use file_type_ext for test fixtures commit 20f627f9caf32d65509a8a536743c5960d52a8e0 Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 25 14:19:56 2018 +0900 Do not call major-mode when already enabled (#178) commit 5a71b05195abc14e84970ba66d4ec2987627266d Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 25 11:55:59 2018 +0900 Make conf-mode used when a file has .editorconfig extension commit 46fff5b32a0a7b014dda9a970ca99ad8c35a05d3 Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 25 11:52:16 2018 +0900 Add file_type_ext to conf-mode keyword commit 1bbbf78990925bfcb426b2752dc09cfd6ae5ba22 Author: 10sr <8.slashes@gmail.com> Date: Sat Sep 22 15:25:02 2018 +0900 Rename existing function set-major-mode -> set-major-mode-from-name commit 780fc5f46ecda16c31c82b03d12ab392576db5f4 Author: 10sr <8.slashes@gmail.com> Date: Sat Sep 22 15:19:47 2018 +0900 Update doc commit 82ba59023e3df7560e24dc4a5797bf92bcbc7656 Author: 10sr <8.slashes@gmail.com> Date: Thu Sep 20 16:54:51 2018 +0900 Set major-mode from file_type_ext value commit 2fbbea8e862c80ee7c3cc463980b1a20835b0346 Author: 10sr <8.slashes@gmail.com> Date: Fri Sep 21 13:43:11 2018 +0900 Add ert-test for file_type_ext commit 7524e641cacbc570a8a4c159fc8d2ef08e753584 Author: 10sr <8.slashes@gmail.com> Date: Sat Sep 22 17:44:47 2018 +0900 Add ert-test for file_type_emacs (#177) commit aeb53c0d1c5dc1bdf854a77ac21d746571b14fa3 Author: 10sr <8.slashes@gmail.com> Date: Sat Sep 22 17:40:14 2018 +0900 Make `fixtures' a constant (#176) commit 0f5926619f0d77b0a32fbe17730a2d04d93f1e4e Author: 10sr <8.slashes@gmail.com> Date: Tue Sep 4 11:12:01 2018 +0900 Update texi for HTTPS url commit 29cc1456c06d392bff1368c935083a23f4375274 Author: 10sr <8.slashes@gmail.com> Date: Mon Sep 3 16:48:36 2018 +0900 Use HTTPS link (#174) commit 8a602e176a068bc952a685086157a0caf4025806 Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 31 14:11:41 2018 +0900 Update doc commit b61e4feedb5108e2c555f818251fcb2af3725ba6 Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 31 16:40:54 2018 +0900 Update header.txt commit 8e91d9fe91d39b4984650c487206e138c87f65ca Author: 10sr <8.slashes@gmail.com> Date: Fri Aug 31 16:13:56 2018 +0900 Update Makefile for info generation commit 75698b1b333992b1ee300c1b82e6409297b539ee Author: 10sr <8.slashes@gmail.com> Date: Thu Aug 23 13:52:57 2018 +0900 Bump version 0.7.13 commit 5a71d819a6104c9ce8ac7f448579d3380113eed5 Author: 10sr <8.slashes@gmail.com> Date: Fri Jul 27 15:49:16 2018 +0900 Fix brackets tests (#172) commit 44ff0c5adcdc6d621967b0861e720c7b16ef3543 Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 26 12:50:33 2018 +0900 Clear translate cache on file reload commit ca36030e7e1b3f7feadc8cd1788aae4f46f5adfe Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 26 12:30:09 2018 +0900 Remove numeric-range related vairables commit c687ecda080521c00ceaa8aec05a7dd8fb2be48a Author: 10sr <8.slashes@gmail.com> Date: Thu Jul 26 12:22:08 2018 +0900 Stop checking numeric range separately commit 2dd122c2bb9bf6fc09a53f32a27c84753465e747 Author: 10sr <8.slashes@gmail.com> Date: Sun Jul 8 18:00:37 2018 +0900 Disable delete-trailing-whitespace when buffer-read-only is nil commit 898a6d84041d5c7c562e11ca3ccb59b7b3bd62e8 Author: 10sr <8.slashes@gmail.com> Date: Sun Jul 8 17:53:50 2018 +0900 Check editorconfig configs when read only state changes commit e3e54b58970742f3ef40793a7f5e14850f45f00e Author: 10sr <8.slashes@gmail.com> Date: Sun Jul 8 18:10:03 2018 +0900 Add trim-trailing-ws tests With case where read-only-mode is enabled commit 1a760c97803abf8471e33c122dbd29987fddb5a5 Author: 10sr <8.slashes@gmail.com> Date: Wed Jun 20 01:26:01 2018 +0900 Use emacs 26.1 instead of 26-pretest (#166) commit 808922da89517828d6e8eddb614d3919c94b8b56 Author: 10sr <8.slashes@gmail.com> Date: Wed Jun 20 01:08:38 2018 +0900 Bump version to 0.7.12 commit ac553270b14d31d57609de3186b60c6d2b3154e6 Author: 10sr <8.slashes@gmail.com> Date: Wed May 9 13:28:47 2018 +0900 Fix info top page (#165) * Fix info top page * Parametrize texi top title commit 2a35c763422b59e2e2dcdbd6ca842843672bf155 Author: 10sr <8.slashes@gmail.com> Date: Wed May 9 11:04:46 2018 +0900 Add commented allow_failure commit 9f4640807fe33a2021c20c0bd3f3dc076f00a54b Author: 10sr <8.slashes@gmail.com> Date: Wed May 9 10:53:58 2018 +0900 Fix batch command for emacs26-pretest testing commit 8c2357c850782b84d5f90d41503c45d6a136df49 Author: 10sr <8.slashes@gmail.com> Date: Tue May 8 12:21:58 2018 +0900 Update travis config file commit e7286c67000425551b13cc80e2ede5982a6a4649 Author: 10sr <8.slashes@gmail.com> Date: Mon May 7 14:54:37 2018 +0900 Use whitespace class commit 09229ed40ef583dc9fd4d8a683d7077ba71e1b09 Author: 10sr <8.slashes@gmail.com> Date: Mon May 7 13:04:51 2018 +0900 Add test for various normal whitespace Currently core-handle fails to parse files that contain whitespaces like line breaks, horizontal space, vertical space, etc. #161 commit 87fbfa3cea902380db512b7890cda07f872b9a07 Author: 10sr <8.slashes@gmail.com> Date: Mon May 7 11:52:54 2018 +0900 Remove unused variable commit adabfa6aea82255ea603e0cd13c69c43f50fcba8 Author: 10sr <8.slashes@gmail.com> Date: Sat May 5 02:55:20 2018 +0900 Add .gitignore again commit 14fbef761792145cc715418de3baae3485d5c386 Author: 10sr <8.slashes@gmail.com> Date: Sat May 5 02:52:36 2018 +0900 Update texi commit c9aafbcb9baceb5d3e7d5300c12788d21f642da4 Author: 10sr <8.slashes@gmail.com> Date: Sat May 5 02:52:19 2018 +0900 Fix make doc command commit 61384245f0e0b2185103f2647178cda6ef5586a8 Author: 10sr <8.slashes@gmail.com> Date: Sat May 5 02:31:03 2018 +0900 Remove .info and add .texi commit f8216577840405d6ddf0649bb9f1a2cca8b18f77 Author: 10sr <8.slashes@gmail.com> Date: Sat May 5 02:30:37 2018 +0900 Remove doc/.gitignore commit b3fbb8cb2bc75b1d277a38491418704cffd72e6f Author: 10sr <8.slashes@gmail.com> Date: Fri May 4 23:27:03 2018 +0900 Fix Makefile commit 427ddeed978c6354f0ec33286da1c0bf70ad3a14 Author: 10sr <8.slashes@gmail.com> Date: Sun Apr 29 14:21:47 2018 +0900 Add doc/.gitignore commit 31709798cace8eae8c4a8bebb9c25f9f50913506 Author: 10sr <8.slashes@gmail.com> Date: Sun Apr 29 14:21:25 2018 +0900 docs -> doc commit 0ce9c9839b72edad9b4cab9ef030173f1bcd37e9 Author: 10sr <8.slashes@gmail.com> Date: Sat Apr 28 13:46:35 2018 +0900 Add generated info file commit 5db2fd4c8abce7ca169233dc5cec3c4fdefc017e Author: 10sr <8.slashes@gmail.com> Date: Sat Apr 28 13:44:22 2018 +0900 Add make info target commit 12a79fff988a8385f9762a7db5e51fac334e2135 Author: Jay Kamat Date: Thu Apr 5 19:40:58 2018 -0400 Add tests for lisp-indent-offset ignore commit 6b92956a84498ace196d58b237602e653e22693c Author: Jay Kamat Date: Thu Apr 5 19:15:04 2018 -0400 Add variable to disable indent_size when conditions are met for lisp commit 816bab2d5b6eb7508ce6811e1e116166eca8192c Author: 10sr <8.slashes@gmail.com> Date: Fri Mar 30 13:48:30 2018 +0900 Add csharp-mode support (#154) commit b405ca428e2a67dd286ae1bd8cd75ac3a5dd6179 Author: 10sr <8slashes+git@gmail.com> Date: Sun Feb 11 00:50:44 2018 +0900 Fix fnmatch for new cases commit 4336c8bde838ce991fc0f3c70dd3471b6adb268a Author: 10sr <8slashes+git@gmail.com> Date: Sun Feb 11 00:50:23 2018 +0900 Add two test cases for fnmatch commit f56964cd65075198b1173d58802666dedc434535 Author: 10sr <8slashes+git@gmail.com> Date: Sat Feb 10 23:34:10 2018 +0900 Update core-test submodule commit ffe4396e53939da21aa6c0edbaf33dfe7a1c1d26 Author: 10sr <8slashes+git@gmail.com> Date: Tue Nov 7 20:01:20 2017 +0900 Prepare v0.7.11 commit 2cc03ae806ae0d89b0cb6812cc009419656a3055 Author: Jay Kamat Date: Fri Oct 6 00:29:13 2017 -0400 Change hook editorconfig is applied on (#143) Change from `after-change-major-mode-hook' to `change-major-mode-after-body-hook' to allow dir-local variables to take precedence over editorconfig. Closes #141 commit 9c67d568df7cf2156c07fce2909484c0c68756ef Author: 10sr <8slashes+git@gmail.com> Date: Wed Aug 16 13:06:11 2017 +0900 Fix typo commit 276097b635687dd7d337de96fd74b07b199dc3b5 Author: 10sr <8slashes+git@gmail.com> Date: Wed Aug 2 18:38:19 2017 +0900 Add apache-mode support (#135) commit 2e343c46610b6097d8102cff682e6c6f024ada35 Author: 10sr <8slashes+git@gmail.com> Date: Mon Jul 24 19:03:40 2017 +0900 Add file_type_emacs to editorocnfig-conf-mode keywords commit 8dd4394ab9f3bd00467fc70061d6950461cec6bf Author: 10sr <8slashes+git@gmail.com> Date: Mon Jul 24 18:48:33 2017 +0900 Add file_type_emacs entry for .editorconfig commit 489e2e58f19fc07ad0e468c6a444341d9b6ddaa8 Author: 10sr <8slashes+git@gmail.com> Date: Mon Jul 24 18:48:03 2017 +0900 Add file_type_emacs support commit 599d3791e45fc1be2c7d96661646a5a2ff16ca14 Author: 10sr <8slashes+git@gmail.com> Date: Mon Jul 24 18:14:16 2017 +0900 Add document about file_type_emacs property commit edfd7d9819bbac50bf399713d7c71b3af39866cc Author: 10sr <8slashes+git@gmail.com> Date: Wed Jun 7 23:13:31 2017 +0900 Prepare v0.7.10 commit 12af7738a0a9e9c693e41f55a1b536e4f44030fd Author: 10sr <8slashes+git@gmail.com> Date: Wed Jun 7 23:12:30 2017 +0900 Add function to open nearest .editorconfig file (#131) commit 0aeb78198993e803217782b7c8bf6638e5a9fbdc Author: 10sr <8slashes+git@gmail.com> Date: Wed Jun 7 22:48:47 2017 +0900 Always do submodule update when test-ert commit 71fc634a96a237a9aa9e25972885e932b5e40377 Author: Simen Heggestøyl Date: Thu May 18 13:54:19 2017 +0200 Set `fill-column` directly Set `fill-column` directly instead of using `set-fill-column`. That function is useful when used interactively, but when called from Lisp it’s almost equivalent to just setting `fill-column` directly, and it avoids showing the “Fill column set to…” message. commit 4cda53e796b2d972353cc7d3da7d1d1a571aea6e Author: Jay Kamat Date: Fri May 12 09:07:21 2017 -0700 Add support for feature mode. (#128) commit a3242c35afcab0df8f3fe0a2fae4e54d157203b8 Author: 10sr <8slashes+git@gmail.com> Date: Wed Apr 26 13:55:52 2017 +0900 Update editorconfig-conf-mode lighter text commit 61911bc92d70abd66acf4d6e648945e2a2a6ec39 Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 18 13:25:36 2017 +0900 Fix assignment to free variable warnings Fixes #127 commit a3100e700498fcb694948bf26250cfd939031bf7 Author: 10sr <8slashes+git@gmail.com> Date: Fri Mar 10 13:06:57 2017 +0900 Catch error thrown from editorconfig-custom-hooks And show it as warning. commit c54fd3abe5b8d4a6997de147afbc645896b0d55c Author: Jay Kamat Date: Wed Feb 22 21:50:06 2017 -0500 Add support for verilog-mode commit 75f1f7f934fdbe6801596466f6ab176b80f2c069 Author: 10sr <8slashes+git@gmail.com> Date: Wed Feb 22 00:37:12 2017 +0900 Prepare v0.7.9 Closes #122 commit ed06e323f9953c60d9cb32d42700407ec50c7327 Author: 10sr <8slashes+git@gmail.com> Date: Wed Feb 22 00:38:08 2017 +0900 Update year in copyright commit 3e2ec93953f6666bcca3c0b4b5252524cd3d7edd Author: 10sr <8slashes+git@gmail.com> Date: Fri Jan 13 13:02:04 2017 +0900 Update README for some variables commit 399451141873347e974ee1c2cd2f13c1ee070ffc Author: 10sr <8slashes+git@gmail.com> Date: Wed Jan 4 14:24:22 2017 +0900 By default always use Emacs Lisp Core when accessing remote files (#118) commit 426699c7c7944438cfc6481fd06cd4610f5d3881 Author: 10sr <8slashes+git@gmail.com> Date: Tue Jan 3 15:17:53 2017 +0900 Add more plugin tests commit dbfe7a208ac799069e723e46b77715436ae18b33 Author: 10sr <8slashes+git@gmail.com> Date: Tue Jan 3 14:38:22 2017 +0900 Add plugin-tests submodule commit 0496bfa0e5a74062513e9af106693afefb7d17ae Author: 10sr <8slashes+git@gmail.com> Date: Tue Jan 3 14:03:45 2017 +0900 Fix indentations of ert-tests/ See #111 commit b6b64127d7f489a48f0761f4446b11b54e5f2f11 Author: 10sr <8slashes+git@gmail.com> Date: Mon Dec 12 14:44:41 2016 +0900 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. commit daa0c0f096b5bf96f4027d4a006a3e6446c4b932 Author: Hong Xu Date: Tue Nov 8 00:09:10 2016 -0800 Add Usami Kenta to the contributor list. commit 005c313b4eaba2372d31d709899a1f2c33310d0c Author: Hong Xu Date: Tue Nov 8 00:06:51 2016 -0800 Reidentation for all *.el files. commit 98a370e88960298cfbdb527d40fed3747e41da8a Author: Hong Xu Date: Tue Nov 8 00:01:16 2016 -0800 Massive reformatting of docstrings. commit afadf377f9a82a66519189088cadddda376a1c9d Author: Hong Xu Date: Mon Nov 7 23:51:08 2016 -0800 Fix a doc string. commit b540d0719fe9b1059781e6cf50b21b333b2c5433 Author: USAMI Kenta Date: Tue Nov 8 16:13:41 2016 +0900 Add editorconfig-exclude-prefixes (#108) commit c545c8842a627b1d63c00280d504247ef2658b3d Author: Hong Xu Date: Sat Nov 5 22:12:33 2016 -0700 Reindent using Emacs-lisp style. commit a0b3e7037f1bb043f281e3b08423698976950b33 Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 6 13:37:54 2016 +0900 Add one space to editorconfig-mode lighter text commit d7bba76ba52fe64840c19bef9938f09ab1f40ca2 Author: Hong Xu Date: Sat Nov 5 09:44:41 2016 -0700 Add a :lighter "EditorConfig" for editorconfig-mode. commit 4e8ed00b9afe73165dc25a222890ceb8fa03ad81 Author: USAMI Kenta Date: Mon Sep 5 06:31:28 2016 +0900 Modify defgroup tag commit 79bcc708530a7ed353aafa1e9ca07ff8758e068d Author: 10sr <8slashes+git@gmail.com> Date: Tue Aug 9 14:12:21 2016 +0900 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 commit 1c32816351644dd97f4b3c153eb4394bb7b206e7 Author: 10sr <8slashes+git@gmail.com> Date: Tue Jul 19 21:59:02 2016 +0900 Bump version to 0.7.7 commit 8a5e621265c4a5cb92876015699793f884876769 Author: 10sr <8slashes+git@gmail.com> Date: Fri Jul 8 12:12:30 2016 +0900 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. commit 4e65a21fae2c1a9a72c11dbcb73ecec42bf18af9 Author: 10sr <8slashes+git@gmail.com> Date: Wed Jul 6 12:38:00 2016 +0900 Load only editorconfig.el when using sandbox commit 3739d7316ac29fc42e2438a7a7fe9e9fc2a3c672 Author: 10sr <8slashes+git@gmail.com> Date: Fri Jun 24 15:57:46 2016 +0900 Update README.md commit 70e85e6153f311d805337302004828e016fa93c0 Author: 10sr <8slashes+git@gmail.com> Date: Fri Jun 24 12:45:38 2016 +0900 Load editorconfig-core explicitly just becore use (#100) Fix for the case where this plugin is installed with `git clone`. Additionally, When the core library is not available, it will emit a more friendly error message like: Cannot open load file" "no such file or directory" "editorconfig-core" commit 3dd8b682435e075676a47f2476a5ecb29982e313 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jun 5 13:51:45 2016 +0900 Add editorconfig-conf-mode.el (#97) And moved some functions and definitions from editorconfig.el commit d900f27638d5d4340d38a575fc93b9e2f8455fc6 Author: 10sr <8slashes+git@gmail.com> Date: Tue May 31 17:40:13 2016 +0900 Simplify definition of string-integer-p (#96) commit 663019d341fa1ec51be73aa597f378af048bfcf5 Author: 10sr <8slashes+git@gmail.com> Date: Mon May 16 23:54:24 2016 +0900 Print line number and its content on parse error (#95) commit 692503ec109764bcd7990de59dc77c44e7fc8fd6 Author: 10sr <8slashes+git@gmail.com> Date: Thu May 12 01:24:00 2016 +0900 Add a note about deprecating marmalade repository commit 55ce0fca59669ef85743879a262bfdde7b498805 Author: 10sr <8slashes+git@gmail.com> Date: Thu May 12 01:20:50 2016 +0900 Add link to Melpa stable commit 331edef26d059515fb18df3057202be24d51c639 Author: 10sr <8slashes+git@gmail.com> Date: Wed May 11 18:13:40 2016 +0900 Remove link to Marmalade package repository Recently we do not update the package in Marmalade repository. commit 7505fb780ff08cc62f41cb420723f4646ce3fe20 Author: 10sr <8slashes+git@gmail.com> Date: Thu May 5 21:43:30 2016 +0900 Bump version to 0.7.6 commit 335e70e23df617a8a2b7fe200a3015369e4b78b4 Author: 10sr <8slashes+git@gmail.com> Date: Thu May 5 21:41:30 2016 +0900 Trivial commentary fix Two spaces are required after period in Emacs documents. commit 1c2ce46d3a924c3dd72611799d868be24c8f05d7 Author: 10sr <8slashes+git@gmail.com> Date: Mon May 2 21:42:16 2016 +0900 Add examples for core-handle members commit bf8bfe5f38d33ccfcebf7ee00eae697d90c19f0f Author: 10sr <8slashes+git@gmail.com> Date: Mon May 2 20:47:02 2016 +0900 Copy properties alists before using them commit d79b9e410aa97292255622236ed2fdcba2b79b03 Author: 10sr <8slashes+git@gmail.com> Date: Mon May 2 19:32:28 2016 +0900 Use truename for editorconfig name commit a4d73a4470b4de57deaafef9fc8988355c95f462 Author: 10sr <8slashes+git@gmail.com> Date: Fri Apr 22 15:54:40 2016 +0900 Bump version to 0.7.5 commit 19e5f16ab68499a19459c638ecc6c5ed756b7111 Author: Hong Xu Date: Thu Apr 14 22:41:08 2016 -0700 Update README: add information about customize-variable. commit 8e744e00e40b956714f22880b5a747ebb61406a7 Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 12 11:23:17 2016 +0900 Use GFM style code block commit b9c1318088e07db324fed70cd8ce6eec8ca6956a Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 12 11:19:56 2016 +0900 Update editorconfig group docstring commit 787889591816ef12bd78968ae5ce25a147bb8a0e Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 12 10:48:44 2016 +0900 Make indentation of sample codes more consistent commit eba248e638e83983992f2c02f806f8cb0454f1f1 Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 12 10:45:34 2016 +0900 Fix english commit 24b4910571c042a78c14d57ecd5b1fcb11626ddc Author: 10sr <8slashes+git@gmail.com> Date: Mon Apr 11 11:16:10 2016 +0900 Add EditorConfig group definition commit b93a7964d43cf6da0d2627c41dcf8445e6109d97 Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 5 17:54:33 2016 +0900 Add a comment for contributors commit 5687b5fc35db617704e76ed06a890b5825ccbb7a Author: 10sr <8slashes+git@gmail.com> Date: Mon Apr 11 14:42:20 2016 +0900 Update instructions about core program commit 02ab02413f0e7a91969d3742bc880745402189b5 Author: 10sr <8slashes+git@gmail.com> Date: Tue Apr 5 17:51:21 2016 +0900 Add Customize section to README commit 2afc760475be59fe1105f8824fa1fb8ebdf01fc2 Author: Hong Xu Date: Wed Apr 6 00:48:17 2016 -0700 Only set fill-column if the given integer is positive. commit 73b4b61e0bad2c7c74fb46baa040f0c677b94068 Author: Hong Xu Date: Sun Apr 3 17:41:26 2016 -0700 No need to explicitly highlight the comments via font-lock in editorconfig-conf-mode commit d9ae054ccc608289654bea018a099a1e73dace12 Author: Hong Xu Date: Sun Apr 3 17:36:43 2016 -0700 Create a syntax table for editorconfig-conf-mode. Fix #83. commit 3d6df2ae193aea34f6ddd481fc17381f235b3838 Author: 10sr <8slashes+git@gmail.com> Date: Sat Apr 2 23:56:04 2016 +0900 Derive editorconfig-conf-mode from conf-unix-mode Should fix #83 commit cdcc5826d684324701ba446c1648d475ce47d5a6 Author: 10sr <8slashes+git@gmail.com> Date: Fri Apr 1 15:38:17 2016 +0900 Add make sandbox target This commit adds a new Make target `sandbox`. Issue `make sandbox` to start new Emacs that loads *.el files in current directory and does not load the user init file. commit e68384d544c14451e12c50b4bad6933b31abde24 Author: Hong Xu Date: Thu Mar 31 22:50:17 2016 -0700 Refactor editorconfig-conf-mode commit f2629b0abb5e212a015a10af460569b1dec3de29 Author: 10sr <8slashes+git@gmail.com> Date: Wed Mar 30 17:27:15 2016 +0900 Do not check metadata of files other than editorconfig.el commit 998d0e8f766dfdf92080e3f00d78e614ea136ae7 Author: 10sr <8slashes+git@gmail.com> Date: Wed Mar 30 15:41:38 2016 +0900 Bump version to 0.7.4 Only Package-Version in editoroconfig.el will be respected so remove from other files. commit 64a2a85351db22d76f1dd510469b94cf61a5ba54 Author: 10sr <8slashes+git@gmail.com> Date: Wed Mar 30 15:40:36 2016 +0900 Fix dependencies for one multifile package commit 566ab7996e373cf7747f3856b0b4e67d8c26f17d Author: Hong Xu Date: Sat Mar 26 17:04:43 2016 -0700 Bump required editorconfi-core version Fix #80 commit 0791fced08790eceb64e5e9d3e46b444b71e0753 Author: 10sr <8slashes+git@gmail.com> Date: Sun Mar 20 01:58:51 2016 +0900 Add editorconfig-exclude-modes commit 33b0716c668685e177ffbe28efb7a95011b405b1 Author: 10sr <8slashes+git@gmail.com> Date: Fri Mar 18 12:21:40 2016 +0900 Add editorocnfig-display-current-properties A function useful for debugging. commit 50df3046e5af9c0edde66d4ba2cfe662144a538b Author: 10sr <8slashes+git@gmail.com> Date: Fri Mar 18 11:55:30 2016 +0900 Add one variable editorconfig-properties-hash commit 3480bcd04e3e941d969439ed278fbb2aa7dea8ad Author: 10sr <8slashes+git@gmail.com> Date: Thu Feb 18 01:07:31 2016 +0900 Add editorconfig-conf-mode A major-mode for editing .editorconfig file. commit 914720911131a54989d3b6403a428b397466fe01 Author: 10sr <8slashes+git@gmail.com> Date: Fri Feb 12 18:06:39 2016 +0900 Bump version to v0.7.3 commit dbc25e04c487aeb7e879f4c8a3f1950e856acd8a Author: Hong Xu Date: Sat Feb 6 21:07:06 2016 -0800 Add octave-mode and matlab-mode support Close #66 commit f34c82709e2873eefa50f0c7568772b546019197 Author: Hong Xu Date: Wed Feb 3 22:12:39 2016 -0800 Add support for scss-mode commit 37d22c075078b32f8d75c2e2f0339d7a9760eeb3 Author: 10sr <8slashes+git@gmail.com> Date: Wed Jan 27 15:35:49 2016 +0900 Bump version to 0.7.2 commit f907c968c8835a980fbf0896b8e7ca81aca40d65 Author: 10sr <8slashes+git@gmail.com> Date: Wed Jan 27 15:30:28 2016 +0900 Already 2016 :) Happy new year! commit 953f4f0ab77bac932eba074cd1aab70059f3a4a1 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 24 21:51:53 2016 +0900 Bump version: 0.7.1 commit d150069fc617a3daad2d698436e51786151c78dd Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 24 18:40:36 2016 +0900 Catch error thrown from get-properties-function and display it This commit also fixes `display-warning' usage. commit 6fbb3fe14ada3e9dbf84bf29f9223a2857e55c03 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 24 17:41:25 2016 +0900 Throw error when editorconfig executable was not found commit a7ea6807e5aa2e1bae5bf482adcdfd8f9a46425a Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 24 16:29:32 2016 +0900 Add ess-mode indentation support commit 5b9a1a38d2b0c45bdd69e6d64cd4273eec95bdd9 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 24 00:23:34 2016 +0900 Add ps-mode indentation support commit 9e1b9009578934c0ec1c7721ccb0c234c93aa634 Author: 10sr <8slashes+git@gmail.com> Date: Sat Jan 23 19:23:14 2016 +0900 Add tcl-mode indentation support commit 13956895101c2935dd00aff53e10e067db1272ad Author: 10sr <8slashes+git@gmail.com> Date: Fri Jan 22 14:47:51 2016 +0900 editorocnfig-core: Throw error when parsing .editorconfig failed commit 58b060cf3413b713015b62aec847fb66402b497a Author: 10sr <8slashes+git@gmail.com> Date: Thu Jan 21 20:08:31 2016 +0900 Remove find-file-hook commit 563bebc5663b12589c713fc55080cce3fbbcd164 Author: 10sr <8slashes+git@gmail.com> Date: Thu Jan 21 02:10:27 2016 +0900 I forgot to update editorconfig-core-version const commit 466a0e4a720410d2bf13ebacecfd3ef53f8e6041 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 17 14:40:03 2016 +0900 Bump version: 0.7.0 commit adb9ba4a9d7559342934216bc1565e1ddbb4b1a7 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 17 02:49:13 2016 +0900 Update README for charset support commit d40661e532673d110dce79f40f2c3fcb9ac765a6 Author: 10sr <8slashes+git@gmail.com> Date: Sun Jan 17 02:48:36 2016 +0900 Support charset property commit ae2544b55e9c26d5479bfe16886f09a79aaa08b6 Author: 10sr <8slashes+git@gmail.com> Date: Fri Jan 15 01:38:19 2016 +0900 Bump version: 0.6.2 Also use stable version in Package-Requires: there should be no problem with this. commit fe9ed9b4cbfda2548c3fc3ca0db6e678a83f9ec7 Author: 10sr <8slashes+git@gmail.com> Date: Mon Jan 11 23:15:18 2016 +0900 Fix names of ert test cases commit cd91a226fb792b6b3cbf3aaa05951cdd1ffa091c Author: 10sr <8slashes+git@gmail.com> Date: Mon Jan 11 23:14:45 2016 +0900 Check package metadata using ert framework commit 12f18b061a562d2fabea0b4cba1b2726db7a721e Author: 10sr <8slashes+git@gmail.com> Date: Mon Jan 11 22:34:52 2016 +0900 Use dedicated functions to manipulate hook commit ae1254a7aa76f160578446dc5ead478200735b5d Author: 10sr <8slashes+git@gmail.com> Date: Thu Jan 7 19:14:51 2016 +0900 Use hook type for custom-hooks defcustom commit 58f106454036e2248cec7d4dc4ca53c8fddb71ee Author: 10sr <8slashes+git@gmail.com> Date: Sun Dec 27 22:35:38 2015 +0900 Add MELPA badges commit 9c65aa401996dd87fe054a1079885651529bd70f Author: 10sr <8slashes+git@gmail.com> Date: Thu Dec 17 19:31:43 2015 +0900 Use `require` instead of `load` in usage example commit 48f77abd9040f2eb563efd6185b366cacd8b99de Author: 10sr <8slashes+git@gmail.com> Date: Wed Dec 9 01:35:23 2015 +0900 Bump version: 0.6.1 This release is only for melpa stable and has no change since 0.6 commit ef465f0c5d0cdabbe8ae859d2cbfed018498cc94 Author: 10sr <8slashes+git@gmail.com> Date: Sat Dec 5 02:42:25 2015 +0900 Add document about running tests commit 2c3488e82410130bf811291ee07c9e208228a7a8 Author: 10sr <8slashes+git@gmail.com> Date: Sat Dec 5 01:52:40 2015 +0900 Make `editorconfig-apply' an interactive command commit d94e1f29f333bc8e70fda372a0ca906d54eed365 Author: 10sr <8slashes+git@gmail.com> Date: Fri Dec 4 01:30:24 2015 +0900 Fix some warnings reported by flycheck Mainly docstring fix commit df4dea58f13173bd1f8a2cf59b897e9429add23b Author: 10sr <8slashes+git@gmail.com> Date: Fri Dec 4 16:08:10 2015 +0900 Fix editorconfig-core commentary text commit 2f297a27107c068b802fc92dbe166d4a8fae9e44 Author: 10sr <8slashes+git@gmail.com> Date: Thu Dec 3 02:12:59 2015 +0900 Add license header to executable commit 98a42ef7e85c2af1fa84be91ccfb677449ffe9ec Author: 10sr <8slashes+git@gmail.com> Date: Tue Dec 1 02:05:08 2015 +0900 Prepare v0.6 commit 320bfe2fa53175b8854cb81d5b008a4592fe475e Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 29 00:18:38 2015 +0900 Fix all indentation according to editorconfig commit 220f04ad82d8adae6562c036d42d61eb1a01d50f Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 29 01:18:33 2015 +0900 Update README for core elisp commit 8beaa3e2fc3a3676c5a22b219e6faf80c0a23489 Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 29 00:32:53 2015 +0900 Use core in elisp as a fallback editorconfig-core-get-properties-hash will be called when editorconfig executable is not found. commit 8555cc5e7181da63c93ab41c1fadc9c8d3ae2224 Author: 10sr <8slashes+git@gmail.com> Date: Sat Nov 28 23:55:19 2015 +0900 Update Makefile to run all tests including core commit e3fe4530edab8b748415f25df5f173b82dc503f5 Author: 10sr <8slashes+git@gmail.com> Date: Sat Nov 28 23:30:57 2015 +0900 Add editorconfig-core el files commit 0b236465262048ff9143af337013becf324a3188 Author: 10sr <8slashes+git@gmail.com> Date: Wed Nov 25 12:08:39 2015 +0900 Add files used to test core functions commit cc948068c916e854561933a5857a5fbb55aeaa26 Author: 10sr <8slashes+git@gmail.com> Date: Sat Nov 28 23:35:37 2015 +0900 Update .editorconfig for Makefile and .gitmodules commit 12f49e98fa559b3055be17ab71f4092f1f078386 Author: 10sr <8slashes+git@gmail.com> Date: Tue Nov 17 16:36:15 2015 +0900 Do nothing when current buffer does not visit any file commit 1c7857782098192e8aba314bd7925814e3b4fddb Author: Hong Xu Date: Thu Nov 5 12:43:57 2015 -0800 Add 10sr to the contributor list commit d076a16e81db4697be0d8744468906ab110f8b7e Author: Hong Xu Date: Thu Nov 5 00:57:40 2015 -0800 Apply settings on major mode change commit e9da0d685d9d7367bce9dc3c572234b23293f0c3 Author: Hong Xu Date: Thu Nov 5 00:54:45 2015 -0800 Rename editorconfig-find-file-hook to editorconfig-apply commit f61c0e31151381d7dd6efc22afcbb9db20c6cf00 Author: 10sr <8slashes+git@gmail.com> Date: Mon Nov 2 01:40:55 2015 +0900 Add aliases for obsolete variables and bump version commit cfb329dabf54c1c99da3352481d7d819be9f90d7 Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 1 20:10:51 2015 +0900 Update README commit 241554e8881cdc42e8524c16a4c0a39838c2c337 Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 1 18:14:39 2015 +0900 Change symbol prefix: edconf -> editorconfig commit 0a319fab7845153a91fbd12ff1174f2808e2ed2c Author: 10sr <8slashes+git@gmail.com> Date: Sun Nov 1 18:11:03 2015 +0900 Add global minor mode commit a4b8e55bf4dea4567f165ad5f71694f659610b3d Author: 10sr <8slashes+git@gmail.com> Date: Tue Oct 27 22:15:00 2015 -0700 Make EditorConfig core function pluggable Close #41 Squashed commit of the following: commit e91aca6f38d9c42be19cc49aafc75ac086907b00 Author: 10sr <8slashes+git@gmail.com> Date: Sun Oct 25 03:19:26 2015 +0900 Fix typo in docstring commit 76ce139cd0a0ff6bc250615ca7bb94868c85c41d Author: 10sr <8slashes+git@gmail.com> Date: Tue Oct 13 13:51:13 2015 +0900 Implement edconf-get-properties-from-exec commit 23baf520c83a7cb68634cd173ce28f9a6842f593 Author: 10sr <8slashes+git@gmail.com> Date: Mon Oct 12 03:18:54 2015 +0900 Add variable edconf-get-properties-function commit 46eb2863daa2f391bda9b9f8b0db0db210922b32 Author: USAMI Kenta Date: Fri Oct 23 01:51:34 2015 +0900 Add autoload cookie commit d068ec0546938a0d02b05ac5a75c370962205ed2 Author: USAMI Kenta Date: Fri Oct 23 01:41:55 2015 +0900 Use \' instead of $ commit b45ec732a2b59f8b3404ae40a52de0f08471bcb6 Author: Hong Xu Date: Mon Mar 16 15:02:01 2015 -0700 Relicense to GPLv3+ commit 871a69ab908cb00e69fa5be0f7e4deaabcbe8b5d Author: Hong Xu Date: Mon Mar 16 14:39:06 2015 -0700 Add Hong Xu to contributor list. commit 7a7e1544c961ee4659af40e6f59c2777d12ea297 Author: Hong Xu Date: Mon Mar 16 14:38:42 2015 -0700 Update a few links in the README commit e7a0874591b23885e10dc322211ff9f77b944dae Author: Hong Xu Date: Fri Dec 19 00:33:17 2014 -0800 Add hook mechanism. commit c36ed4aeb7096abbe455fd91fd4708a413f0c16f Author: Hong Xu Date: Sat Dec 20 18:04:39 2014 -0800 Version 0.4 commit 6c18a40b51e459b44af380aa42e111870ab9334f Author: Hong Xu Date: Thu Dec 18 23:17:28 2014 -0800 Make edconf-exec-path a customizable variable. commit 480a6bba4761fe1074bd70b4dc9cb461e50fa3b4 Author: Hong Xu Date: Thu Dec 18 22:13:17 2014 -0800 Fix some issues caused by the previous commit. commit 92519a8c255cfd7d2b730842c7cb00304f992735 Author: Hong Xu Date: Thu Dec 18 21:58:11 2014 -0800 Don't set indent size if the given value makes no sense. commit 9d1d2364313086590d0e578aab5dbaabeaf03ec9 Author: Hong Xu Date: Thu Dec 18 21:11:19 2014 -0800 Don't set max_line_length if not specified. commit d776cdc5eeedcac6a58fa50ea685275d6fec40e6 Author: Hong Xu Date: Thu Dec 18 21:02:28 2014 -0800 Support max_line_length. commit 56722d34df673387597dd68e3dd2c179fb0fcb96 Author: Hong Xu Date: Mon Aug 11 09:32:49 2014 -0700 Add sh-indentation to the list of indent variable. commit 6bdcaf89dff0ec33ccb82cd8c82658ae8a66c4e0 Author: Hong Xu Date: Tue Jul 8 14:38:52 2014 -0700 Add cmake-mode support. commit 5bc887b015d0c192133109448debcb1cd0a7b575 Author: Hong Xu Date: Wed Oct 16 18:10:24 2013 -0700 Support web-mode. Fix editorconfig/editorconfig#124 commit 4e2bf3ddd61a87ac30bdfea04d222b8643ffd337 Author: Hong Xu Date: Thu Jun 6 17:50:32 2013 -0700 Add the package manager installation way to README commit ac28a9fd1d5b4bd0130fe78d3428cc1e93bbff7a Author: Hong Xu Date: Thu Jun 6 17:41:45 2013 -0700 Bump version number commit fbe97a082421acf8ea41abee76f6ce223496a628 Author: Hong Xu Date: Wed Jun 5 01:06:46 2013 -0700 Wrong way to indent html. Fixes it. commit d7a7b6af8e7af9982543df76739be3f50e2bfee9 Author: Hong Xu Date: Wed Jun 5 01:02:45 2013 -0700 Add JS and HTML indent settings. commit 5dfbeb541ec9aa652e5728e7108cedb7c12a0a9b Author: Hong Xu Date: Sun Jun 2 11:58:46 2013 -0700 Fix indentation problem in the source file. commit 9fdbf9ffddc1758019158328eadf293f6ecb7435 Author: Hong Xu Date: Sun Jun 2 11:53:48 2013 -0700 Set indent value for AucTeX commit e69ebeeaa1dd8e4769d5a40e25323db8d8672e59 Author: Hong Xu Date: Wed May 29 22:30:39 2013 -0700 Reset the indentation rule. commit ef90cfda833faeeb8b92cd528bf9523762efa94e Author: Hong Xu Date: Sun May 26 10:32:29 2013 -0700 Update package information. commit 8ee7d0b5334da68b9147c28465529b07c5010363 Author: Hong Xu Date: Sun May 26 00:56:26 2013 -0700 Set indent_size for lisp mode and ruby mode. commit 45afbe1bc96afb423d42a2f547804f0e11f89f3f Author: Hong Xu Date: Mon Mar 18 10:18:52 2013 -0700 Add a link to `editorconfig.el` in README commit 10be4fd165d39baa4394e26256f696a39ab01de3 Author: Jonas Bernoulli Date: Mon Mar 18 05:06:03 2013 +0100 provide feature, use symbol prefix, add commentary, remove url from summary commit a8ca8c46f75e76565d773c44cc9f36169beaa24c Author: Hong Xu Date: Sun Mar 4 12:37:02 2012 +0800 Update EditorConfig Core URL. commit c45e871a5d1394e6755fd2202d83cb53ad1b1e04 Author: Hong Xu Date: Wed Jan 25 10:57:55 2012 +0800 Add properties link. commit d744546fc6864c0a2a4b524804982656988526b9 Author: Hong Xu Date: Tue Jan 10 09:41:41 2012 +0800 Add root=true to the top .editorconfig. commit 68ad326706a14a707395501aeb03b579aef83777 Author: Hong Xu Date: Sat Nov 26 11:05:37 2011 +0800 Update EditorConfig url. commit 38ac90325669f2643c3205715d4b76aa3e1891ca Author: Stefan Monnier Date: Thu Jun 13 14:28:14 2024 -0400 Erase initial commit content commit 6360e7b904fcadb30678bf7fa740c998976eec75 Author: Trey Hunner Date: Fri Nov 4 21:12:11 2011 -0700 Add initial plugin --- doc/man/editorconfig.texi | 297 ++++++++++++ lisp/editorconfig-conf-mode.el | 95 ++++ lisp/editorconfig-core-handle.el | 243 ++++++++++ lisp/editorconfig-core.el | 182 ++++++++ lisp/editorconfig-fnmatch.el | 284 ++++++++++++ lisp/editorconfig-tools.el | 122 +++++ lisp/editorconfig.el | 747 +++++++++++++++++++++++++++++++ 7 files changed, 1970 insertions(+) create mode 100644 doc/man/editorconfig.texi create mode 100644 lisp/editorconfig-conf-mode.el create mode 100644 lisp/editorconfig-core-handle.el create mode 100644 lisp/editorconfig-core.el create mode 100644 lisp/editorconfig-fnmatch.el create mode 100644 lisp/editorconfig-tools.el create mode 100644 lisp/editorconfig.el diff --git a/doc/man/editorconfig.texi b/doc/man/editorconfig.texi new file mode 100644 index 00000000000..5e7d3b85552 --- /dev/null +++ b/doc/man/editorconfig.texi @@ -0,0 +1,297 @@ +@dircategory Emacs +@direntry +* EditorConfig: (editorconfig). EditorConfig Emacs Plugin. +@end direntry + +@node Top +@chapter EditorConfig Emacs Plugin +@anchor{#editorconfig-emacs-plugin} +This is an @uref{https://editorconfig.org,EditorConfig} plugin for +@uref{https://www.gnu.org/software/emacs/,Emacs}. + +@menu +* Getting Started:: +* Supported properties:: +* Customize:: +* Troubleshooting:: +* Submitting Bugs and Feature Requests:: +* License:: +@end menu + +@node Getting Started +@section Getting Started +@anchor{#getting-started} + +@menu +* packageel:: +* use-package:: +* Manual installation:: +@end menu + +@node packageel +@subsection package.el +@anchor{#package.el} +This package is available from +@uref{https://melpa.org/#/editorconfig,MELPA}, +@uref{https://stable.melpa.org/#/editorconfig,MELPA Stable} and +@uref{http://elpa.nongnu.org/nongnu/editorconfig.html,NonGNU ELPA}. +Install from these repositories and enable global minor-mode +@code{editorconfig-mode}: + +@verbatim +(editorconfig-mode 1) +@end verbatim + +Normally, enabling @code{editorconfig-mode} should be enough for this +plugin to work: all other configurations are optional. This mode sets up +hooks so that EditorConfig properties will be loaded and applied to the +new buffers automatically when visiting files. + +@node use-package +@subsection use-package +@anchor{#use-package} +If you use +@uref{https://www.emacswiki.org/emacs/UsePackage,@strong{use-package}}, +add the following to your @code{init.el} file: + +@verbatim +(use-package editorconfig + :ensure t + :config + (editorconfig-mode 1)) +@end verbatim + +@node Manual installation +@subsection Manual installation +@anchor{#manual-installation} +Copy all @code{.el} files in this repository to @code{~/.emacs.d/lisp} +and add the following: + +@verbatim +(add-to-list 'load-path "~/.emacs.d/lisp") +(require 'editorconfig) +(editorconfig-mode 1) +@end verbatim + +@node Supported properties +@section Supported properties +@anchor{#supported-properties} +Current Emacs plugin coverage for EditorConfig's +@uref{https://editorconfig.org/#supported-properties,properties}: + +@itemize +@item +@code{indent_style} +@item +@code{indent_size} +@item +@code{tab_width} +@item +@code{end_of_line} +@item +@code{charset} +@item +@code{trim_trailing_whitespace} +@item +@code{insert_final_newline = true} is supported +@item +@code{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 @code{.editorconfig} marks as +trailing-newline-free +@item +@code{max_line_length} +@item +@code{file_type_ext} (Experimental) +(See below) +@item +@code{file_type_emacs} (Experimental) +(See below) +@item +@code{root} (only used by EditorConfig core) +@end itemize + +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, indentation, we +might not yet cover some mode you use, but we try to add the ones that +show up on our radar. + +@menu +* File Type file_type_ext file_type_emacs:: +@end menu + +@node File Type file_type_ext file_type_emacs +@subsection File Type (file_type_ext, file_type_emacs) +@anchor{#file-type-file_type_ext-file_type_emacs} +File-type feature is currently disabled, because this package is now +undergoing big internal refactoring. For those who want this +functionality, please consider using +@uref{https://github.com/10sr/editorconfig-custom-majormode-el,editorconfig-custom-majormode}. + +@node Customize +@section Customize +@anchor{#customize} +@code{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]. + +@menu +* editorconfig-trim-whitespaces-mode:: +* editorconfig-after-apply-functions:: +* editorconfig-hack-properties-functions:: +@end menu + +@node editorconfig-trim-whitespaces-mode +@subsection @code{editorconfig-trim-whitespaces-mode} +@anchor{#editorconfig-trim-whitespaces-mode} +Buffer local minor-mode to use to trim trailing whitespaces. + +If set, editorconfig will enable/disable this mode in accord with +@code{trim_trailing_whitespace} property in @code{.editorconfig}. +Otherwise, use Emacs built-in @code{delete-trailing-whitespace} +function. + +One possible value is +@uref{https://github.com/lewang/ws-butler,@code{ws-butler-mode}}, with +which only lines touched get trimmed. To use it, add following to your +init.el: + +@verbatim +(setq editorconfig-trim-whitespaces-mode + 'ws-butler-mode) +@end verbatim + +@node editorconfig-after-apply-functions +@subsection @code{editorconfig-after-apply-functions} +@anchor{#editorconfig-after-apply-functions} +(Formerly @code{editorconfig-custom-hooks}) + +A list of functions which will be called after loading common +EditorConfig settings, when you can set some custom variables. + +For example, @code{web-mode} has several variables for indentation +offset size and EditorConfig sets them at once by @code{indent_size}. +You can stop indenting only blocks of @code{web-mode} by adding +following to your init.el: + +@verbatim +(add-hook 'editorconfig-after-apply-functions + (lambda (props) (setq web-mode-block-padding 0))) +@end verbatim + +@node editorconfig-hack-properties-functions +@subsection @code{editorconfig-hack-properties-functions} +@anchor{#editorconfig-hack-properties-functions} +A list of functions to alter property values before applying them. + +These functions will be run after loading ".editorconfig" files and +before applying them to current buffer, so that you can alter some +properties from ".editorconfig" before they take effect. + +For example, Makefile files always use tab characters for indentation: +you can overwrite "indent_style" property when current @code{major-mode} +is @code{makefile-mode}: + +@verbatim +(add-hook 'editorconfig-hack-properties-functions + '(lambda (props) + (when (derived-mode-p 'makefile-mode) + (puthash 'indent_style "tab" props)))) +@end verbatim + +@node Troubleshooting +@section Troubleshooting +@anchor{#troubleshooting} +Enabling @code{editorconfig-mode} should be enough for normal cases. + +When EditorConfig properties are not effective for unknown reason, we +recommend first trying +@code{M-x editorconfig-display-current-properties}. + +This command will open a new buffer and display the EditorConfig +properties loaded for current buffer. You can check if EditorConfig +properties were not read for buffers at all, or they were loaded but did +not take effect for some other reasons. + +@menu +* Indentation for new major-modes:: +* Not work at all for FOO-mode!:: +@end menu + +@node Indentation for new major-modes +@subsection Indentation for new major-modes +@anchor{#indentation-for-new-major-modes} +Because most Emacs major-modes have their own indentation settings, this +plugin requires explicit support for each major-mode for +@code{indent_size} property. + +By default this plugin ships with settings for many major-modes, but, +sorry to say, it cannot be perfect. Especially it is difficult to +support brand-new major-modes. Please feel free to submit issue or +pull-request for such major-mode! + +Supported major-modes and their indentation configs are defined in the +variable @code{editorconfig-indentation-alist}. + +@node Not work at all for FOO-mode! +@subsection Not work at all for FOO-mode! +@anchor{#not-work-at-all-for-foo-mode} +Most cases properties are loaded just after visiting files when +@code{editorconfig-mode} is enabled. But it is known that there are +major-modes that this mechanism does not work for and require explicit +call of @code{editorconfig-apply}. + +Typically it will occur when the major-mode is not defined using +@code{define-derived-mode} (@code{rpm-spec-mode} is an example for +this). Please feel free to submit issues if you find such modes! + +@node Submitting Bugs and Feature Requests +@section Submitting Bugs and Feature Requests +@anchor{#submitting-bugs-and-feature-requests} +Bugs, feature requests, and other issues should be submitted to the +issue tracker: https://github.com/editorconfig/editorconfig-emacs/issues + +@menu +* Development:: +@end menu + +@node Development +@subsection Development +@anchor{#development} +Make and @uref{https://cmake.org,CMake} must be installed to run the +tests locally: + +@verbatim +$ make check +@end verbatim + +To start a new Emacs process with current @code{*.el} and without +loading user init file, run: + +@verbatim +$ make sandbox +@end verbatim + +@node License +@section License +@anchor{#license} +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. + +This program 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 this program. If not, see @url{https://www.gnu.org/licenses/}. + +@bye diff --git a/lisp/editorconfig-conf-mode.el b/lisp/editorconfig-conf-mode.el new file mode 100644 index 00000000000..2b4ddd4410f --- /dev/null +++ b/lisp/editorconfig-conf-mode.el @@ -0,0 +1,95 @@ +;;; editorconfig-conf-mode.el --- Major mode for editing .editorconfig files -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team + +;; 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 . + +;;; 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.") + +(defvar editorconfig-conf-mode-abbrev-table nil + "Abbrev table in use in `editorconfig-conf-mode' buffers.") +(define-abbrev-table 'editorconfig-conf-mode-abbrev-table ()) + +;;;###autoload +(define-derived-mode editorconfig-conf-mode conf-unix-mode "Conf[EditorConfig]" + "Major mode for editing .editorconfig files." + (set-variable 'indent-line-function 'indent-relative) + (let ((key-property-list + '("charset" + "end_of_line" + "file_type_emacs" + "file_type_ext" + "indent_size" + "indent_style" + "insert_final_newline" + "max_line_length" + "root" + "tab_width" + "trim_trailing_whitespace")) + (key-value-list + '("unset" + "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) + (push `(,(format "[=:][ \t]*\\(%s\\)\\([ \t]\\|$\\)" key-value) + 1 font-lock-constant-face) + font-lock-value)) + ;; Highlight all key properties + (dolist (key-property key-property-list) + (push `(,(format "^[ \t]*\\(%s\\)[ \t]*[=:]" key-property) + 1 font-lock-builtin-face) + font-lock-value)) + + (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/lisp/editorconfig-core-handle.el b/lisp/editorconfig-core-handle.el new file mode 100644 index 00000000000..d225e1456ba --- /dev/null +++ b/lisp/editorconfig-core-handle.el @@ -0,0 +1,243 @@ +;;; editorconfig-core-handle.el --- Handle Class for EditorConfig File -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team + +;; 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 . + +;;; Commentary: + +;; Handle structures for EditorConfig config file. This library is used +;; internally from editorconfig-core.el . + +;;; Code: + +(require 'cl-lib) + +(require 'editorconfig-fnmatch) + +(defvar editorconfig-core-handle--cache-hash + (make-hash-table :test 'equal) + "Hash of EditorConfig filename and its `editorconfig-core-handle' instance.") + +(cl-defstruct editorconfig-core-handle-section + "Structure representing one section in a .editorconfig file. + +Slots: + +`name' + String of section name (glob string). + +`props' + Alist of properties: (KEY . VALUE)." + (name nil) + (props nil)) + +(defun editorconfig-core-handle-section-get-properties (section file dir) + "Return properties alist when SECTION name match FILE. + +DIR should be the directory where .editorconfig file which has SECTION lives. +IF not match, return nil." + (when (editorconfig-core-handle--fnmatch-p + file (editorconfig-core-handle-section-name section) dir) + (editorconfig-core-handle-section-props section))) + +(cl-defstruct editorconfig-core-handle + "Structure representing an .editorconfig file. + +Slots: +`top-props' + Alist of top properties like ((\"root\" . \"true\")) + +`sections' + List of `editorconfig-core-handle-section' structure objects. + +`mtime' + Last modified time of .editorconfig file. + +`path' + Absolute path to .editorconfig file.' +" + (top-props nil) + (sections nil) + (mtime nil) + (path nil)) + + +(defun editorconfig-core-handle (conf) + "Return EditorConfig handle for CONF, which should be a file path. + +If CONF does not exist return nil." + (when (file-readable-p conf) + (let ((cached (gethash conf editorconfig-core-handle--cache-hash)) + (mtime (nth 5 (file-attributes conf)))) + (if (and cached + (equal (editorconfig-core-handle-mtime cached) mtime)) + cached + (let ((parsed (editorconfig-core-handle--parse-file conf))) + (puthash conf + (make-editorconfig-core-handle :top-props (plist-get parsed :top-props) + :sections (plist-get parsed :sections) + :mtime mtime + :path conf) + editorconfig-core-handle--cache-hash)))))) + +(defun editorconfig-core-handle-root-p (handle) + "Return non-nil if HANDLE represent root EditorConfig file. + +If HANDLE is nil return nil." + (when handle + (string-equal "true" + (downcase (or (cdr (assoc "root" + (editorconfig-core-handle-top-props handle))) + ""))))) + +(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. + +If HANDLE is nil return nil." + (when handle + (let ((dir (file-name-directory (editorconfig-core-handle-path handle)))) + (cl-loop for section in (editorconfig-core-handle-sections handle) + for props = (editorconfig-core-handle-section-get-properties section + file + dir) + when props collect (copy-alist props))))) +(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) + "Return hash of properties from HANDLE for FILE. + +If HANDLE is nil return nil." + (when handle + (let ((hash (make-hash-table)) + (dir (file-name-directory (editorconfig-core-handle-path + handle)))) + (dolist (section (editorconfig-core-handle-sections handle)) + (cl-loop for (key . value) in (editorconfig-core-handle-section-get-properties section file dir) + do (puthash (intern key) value hash))) + hash))) + +(defun editorconfig-core-handle--fnmatch-p (name pattern dir) + "Return non-nil if NAME match PATTERN. +If pattern has slash, pattern should be relative to DIR. + +This function is a fnmatch with a few modification for EditorConfig usage." + (if (string-match-p "/" pattern) + (let ((pattern (replace-regexp-in-string "^/" "" pattern)) + (dir (file-name-as-directory dir))) + (editorconfig-fnmatch-p name (concat dir pattern))) + (editorconfig-fnmatch-p name (concat "**/" pattern)))) + +(defsubst editorconfig-core-handle--string-trim (str) + "Remove leading and trailing whitespaces from STR." + (replace-regexp-in-string "[[:space:]]+\\'" + "" + (replace-regexp-in-string "\\`[[:space:]]+" + "" + str))) + +(defun editorconfig-core-handle--parse-file (conf) + "Parse EditorConfig file CONF. + +This function returns cons of its top properties alist and +alist of patterns and its properties alist. +The list returned will be ordered by the lines they appear. + +If CONF is not found return nil." + (when (file-readable-p conf) + (with-temp-buffer + ;; NOTE: Use this instead of insert-file-contents-literally to enable + ;; code conversion + (insert-file-contents conf) + (goto-char (point-min)) + (let ((point-max (point-max)) + (sections ()) + (top-props nil) + + ;; String of current line + (line "") + ;; nil when pattern not appeared yet, "" when pattern is empty ("[]") + (pattern nil) + ;; Alist of properties for current PATTERN + (props ()) + + ;; Current line num + (current-line-number 1)) + (while (not (eq (point) point-max)) + (setq line + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))) + (setq line + (replace-regexp-in-string "\\(^\\| \\)\\(#\\|;\\).*$" + "" + (editorconfig-core-handle--string-trim line))) + + (cond + ((string-equal "" line) + nil) + + ;; Start of section + ((string-match "^\\[\\(.*\\)\\]$" + line) + (when pattern + (setq sections + `(,@sections ,(make-editorconfig-core-handle-section + :name pattern + :props props))) + (setq pattern nil) + (setq props nil)) + (setq pattern (match-string 1 line))) + + (t + (let ((idx (string-match "=\\|:" line))) + (unless idx + (error "Error while reading config file: %s:%d:\n %s\n" + conf current-line-number line)) + (let ((key (downcase (editorconfig-core-handle--string-trim + (substring line 0 idx)))) + (value (editorconfig-core-handle--string-trim + (substring line (1+ idx))))) + (when (and (< (length key) 51) + (< (length value) 256)) + (if pattern + (when (< (length pattern) 4097) + (setq props + `(,@props (,key . ,value)))) + (setq top-props + `(,@top-props (,key . ,value))))))))) + (setq current-line-number (1+ current-line-number)) + (goto-char (point-min)) + (forward-line (1- current-line-number))) + (when pattern + (setq sections + `(,@sections ,(make-editorconfig-core-handle-section + :name pattern + :props props)))) + (list :top-props top-props + :sections sections))))) + +(provide 'editorconfig-core-handle) +;;; editorconfig-core-handle.el ends here diff --git a/lisp/editorconfig-core.el b/lisp/editorconfig-core.el new file mode 100644 index 00000000000..c7b52deaafd --- /dev/null +++ b/lisp/editorconfig-core.el @@ -0,0 +1,182 @@ +;;; editorconfig-core.el --- EditorConfig Core library in Emacs Lisp -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team + +;; 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 . + +;;; Commentary: + +;; This library is one implementation of EditorConfig Core, which parses +;; .editorconfig files and returns properties for given files. +;; This can be used in place of, for example, editorconfig-core-c. + + +;; Use from EditorConfig Emacs Plugin + +;; 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) + + +;; Functions + +;; editorconfig-core-get-properties (&optional file confname confversion) + +;; Get EditorConfig properties for FILE. + +;; If FILE is not given, use currently visiting file. +;; Give CONFNAME for basename of config file other than .editorconfig. +;; If need to specify config format version, give CONFVERSION. + +;; This functions returns alist of properties. Each element will look like +;; (KEY . VALUE) . + + +;; editorconfig-core-get-properties-hash (&optional file confname confversion) + +;; Get EditorConfig properties for FILE. + +;; This function is almost same as `editorconfig-core-get-properties', but +;; returns hash object instead. + +;;; Code: + +(require 'cl-lib) + +(require 'editorconfig-core-handle) + +(eval-when-compile + (require 'subr-x)) + + +(defun editorconfig-core--get-handles (dir confname &optional result) + "Get list of EditorConfig handlers for DIR from CONFNAME. + +In the resulting list, the handle for root config file comes first, and the +nearest comes last. +The list may contains nil when no file was found for directories. +RESULT is used internally and normally should not be used." + (setq dir (expand-file-name dir)) + (let ((handle (editorconfig-core-handle (concat (file-name-as-directory dir) + confname))) + (parent (file-name-directory (directory-file-name dir)))) + (if (or (string= parent dir) + (and handle (editorconfig-core-handle-root-p handle))) + (cl-remove-if-not 'identity (cons handle result)) + (editorconfig-core--get-handles parent + confname + (cons handle result))))) + +;;;###autoload +(defun editorconfig-core-get-nearest-editorconfig (directory) + "Return path to .editorconfig file that is closest to DIRECTORY." + (when-let* ((handle (car (last + (editorconfig-core--get-handles directory + ".editorconfig"))))) + (editorconfig-core-handle-path handle))) + +;;;###autoload +(defun editorconfig-core-get-properties (&optional file confname confversion) + "Get EditorConfig properties for FILE. +If FILE is not given, use currently visiting file. +Give CONFNAME for basename of config file other than .editorconfig. +If need to specify config format version, give CONFVERSION. + +This function returns an alist of properties. Each element will +look like (KEY . VALUE)." + (let ((hash (editorconfig-core-get-properties-hash file confname confversion)) + (result nil)) + (maphash (lambda (key value) + (add-to-list 'result (cons (symbol-name key) value))) + hash) + result)) + +(defun editorconfig-core--hash-merge (into update) + "Merge two hashes INTO and UPDATE. + +This is a destructive function, hash INTO will be modified. +When the same key exists in both two hashes, values of UPDATE takes precedence." + (maphash (lambda (key value) (puthash key value into)) update) + into) + +;;;###autoload +(defun editorconfig-core-get-properties-hash (&optional file confname confversion) + "Get EditorConfig properties for FILE. +If FILE is not given, use currently visiting file. +Give CONFNAME for basename of config file other than .editorconfig. +If need to specify config format version, give CONFVERSION. + +This function is almost same as `editorconfig-core-get-properties', but returns +hash object instead." + (setq file + (expand-file-name (or file + buffer-file-name + (error "FILE is not given and `buffer-file-name' is nil")))) + (setq confname (or confname ".editorconfig")) + (setq confversion (or confversion "0.12.0")) + (let ((result (make-hash-table))) + (dolist (handle (editorconfig-core--get-handles (file-name-directory file) + confname)) + (editorconfig-core--hash-merge result + (editorconfig-core-handle-get-properties-hash handle + file))) + + ;; Downcase known boolean values + (dolist (key '( end_of_line indent_style indent_size insert_final_newline + trim_trailing_whitespace charset)) + (when-let* ((val (gethash key result))) + (puthash key (downcase val) result))) + + ;; Add indent_size property + (let ((v-indent-size (gethash 'indent_size result)) + (v-indent-style (gethash 'indent_style result))) + (when (and (not v-indent-size) + (string= v-indent-style "tab") + ;; If VERSION < 0.9.0, indent_size should have no default value + (version<= "0.9.0" + confversion)) + (puthash 'indent_size + "tab" + result))) + ;; Add tab_width property + (let ((v-indent-size (gethash 'indent_size result)) + (v-tab-width (gethash 'tab_width result))) + (when (and v-indent-size + (not v-tab-width) + (not (string= v-indent-size "tab"))) + (puthash 'tab_width v-indent-size result))) + ;; Update indent-size property + (let ((v-indent-size (gethash 'indent_size result)) + (v-tab-width (gethash 'tab_width result))) + (when (and v-indent-size + v-tab-width + (string= v-indent-size "tab")) + (puthash 'indent_size v-tab-width result))) + + result)) + +(provide 'editorconfig-core) +;;; editorconfig-core.el ends here diff --git a/lisp/editorconfig-fnmatch.el b/lisp/editorconfig-fnmatch.el new file mode 100644 index 00000000000..25a344dc2ef --- /dev/null +++ b/lisp/editorconfig-fnmatch.el @@ -0,0 +1,284 @@ +;;; editorconfig-fnmatch.el --- Glob pattern matching in Emacs lisp -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team + +;; 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 . + +;;; Commentary: + +;; editorconfig-fnmatch.el provides a fnmatch implementation with a few +;; extensions. +;; The main usage of this library is glob pattern matching for EditorConfig, but +;; it can also act solely. + +;; editorconfig-fnmatch-p (name pattern) + +;; Test whether NAME match PATTERN. + +;; PATTERN should be a shell glob pattern, and some zsh-like wildcard matchings +;; can be used: + +;; * Matches any string of characters, except path separators (/) +;; ** Matches any string of characters +;; ? Matches any single character +;; [name] Matches any single character in name +;; [^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 + + +;; This library is a port from editorconfig-core-py library. +;; https://github.com/editorconfig/editorconfig-core-py/blob/master/editorconfig/fnmatch.py + +;;; Code: + +(require 'cl-lib) + +(defvar editorconfig-fnmatch--cache-hashtable + nil + "Cache of shell pattern and its translation.") +;; Clear cache on file reload +(setq editorconfig-fnmatch--cache-hashtable + (make-hash-table :test 'equal)) + + +(defconst editorconfig-fnmatch--left-brace-regexp + "\\(^\\|[^\\]\\){" + "Regular expression for left brace ({).") + +(defconst editorconfig-fnmatch--right-brace-regexp + "\\(^\\|[^\\]\\)}" + "Regular expression for right brace (}).") + + +(defconst editorconfig-fnmatch--numeric-range-regexp + "\\([+-]?[0-9]+\\)\\.\\.\\([+-]?[0-9]+\\)" + "Regular expression for numeric range (like {-3..+3}).") + +(defun editorconfig-fnmatch--match-num (regexp string) + "Return how many times REGEXP is found in STRING." + (let ((num 0)) + ;; START arg does not work as expected in this case + (while (string-match regexp string) + (setq num (1+ num) + string (substring string (match-end 0)))) + num)) + +;;;###autoload +(defun editorconfig-fnmatch-p (string pattern) + "Test whether STRING match PATTERN. + +Matching ignores case if `case-fold-search' is non-nil. + +PATTERN should be a shell glob pattern, and some zsh-like wildcard matchings can +be used: + +* Matches any string of characters, except path separators (/) +** Matches any string of characters +? Matches any single character +[name] Matches any single character in name +[^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" + (string-match (editorconfig-fnmatch-translate pattern) + string)) + +;;(editorconfig-fnmatch-translate "{a,{-3..3}}.js") +;;(editorconfig-fnmatch-p "1.js" "{a,{-3..3}}.js") + +(defun editorconfig-fnmatch-translate (pattern) + "Translate a shell PATTERN to a regular expression. + +Translation result will be cached, so same translation will not be done twice." + (let ((cached (gethash pattern + editorconfig-fnmatch--cache-hashtable))) + (or cached + (puthash pattern + (editorconfig-fnmatch--do-translate pattern) + editorconfig-fnmatch--cache-hashtable)))) + + +(defun editorconfig-fnmatch--do-translate (pattern &optional nested) + "Translate a shell PATTERN to a regular expression. + +Set NESTED to t when this function is called from itself. + +This function is called from `editorconfig-fnmatch-translate', when no cached +translation is found for PATTERN." + (let ((index 0) + (length (length pattern)) + (brace-level 0) + (in-brackets nil) + ;; List of strings of resulting regexp + (result ()) + (is-escaped nil) + (matching-braces (= (editorconfig-fnmatch--match-num + editorconfig-fnmatch--left-brace-regexp + pattern) + (editorconfig-fnmatch--match-num + editorconfig-fnmatch--right-brace-regexp + pattern))) + + current-char + pos + has-slash + has-comma + num-range) + + (while (< index length) + (if (and (not is-escaped) + (string-match "[^]\\*?[{},/\\-]+" + ;;(string-match "[^]\\*?[{},/\\-]+" "?.a") + pattern + index) + (eq index (match-beginning 0))) + (setq result `(,@result ,(regexp-quote (match-string 0 pattern))) + index (match-end 0) + is-escaped nil) + + (setq current-char (aref pattern index) + index (1+ index)) + + (cl-case current-char + (?* + (setq pos index) + (if (and (< pos length) + (= (aref pattern pos) ?*)) + (setq result `(,@result ".*")) + (setq result `(,@result "[^/]*")))) + + (?? + (setq result `(,@result "[^/]"))) + + (?\[ + (if in-brackets + (setq result `(,@result "\\[")) + (if (= (aref pattern index) ?/) + ;; Slash after an half-open bracket + (setq result `(,@result "\\[/") + index (+ index 1)) + (setq pos index + has-slash nil) + (while (and (< pos length) + (not (= (aref pattern pos) ?\])) + (not has-slash)) + (if (and (= (aref pattern pos) ?/) + (not (= (aref pattern (- pos 1)) ?\\))) + (setq has-slash t) + (setq pos (1+ pos)))) + (if has-slash + (setq result `(,@result ,(concat "\\[" + (substring pattern + index + (1+ pos)) + "\\]")) + index (+ pos 2)) + (if (and (< index length) + (memq (aref pattern index) + '(?! ?^))) + (setq index (1+ index) + result `(,@result "[^")) + (setq result `(,@result "["))) + (setq in-brackets t))))) + + (?- + (if in-brackets + (setq result `(,@result "-")) + (setq result `(,@result "\\-")))) + + (?\] + (setq result `(,@result "]") + in-brackets nil)) + + (?{ + (setq pos index + has-comma nil) + (while (and (or (and (< pos length) + (not (= (aref pattern pos) ?}))) + is-escaped) + (not has-comma)) + (if (and (eq (aref pattern pos) ?,) + (not is-escaped)) + (setq has-comma t) + (setq is-escaped (and (eq (aref pattern pos) + ?\\) + (not is-escaped)) + pos (1+ pos)))) + (if (and (not has-comma) + (< pos length)) + (let ((pattern-sub (substring pattern index pos))) + (setq num-range (string-match editorconfig-fnmatch--numeric-range-regexp + pattern-sub)) + (if num-range + (let ((number-start (string-to-number (match-string 1 + pattern-sub))) + (number-end (string-to-number (match-string 2 + pattern-sub)))) + (setq 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}" inner))))) + (setq index (1+ pos))) + (if matching-braces + (setq result `(,@result "\\(?:") + brace-level (1+ brace-level)) + (setq result `(,@result "{"))))) + + (?, + (if (and (> brace-level 0) + (not is-escaped)) + (setq result `(,@result "\\|")) + (setq result `(,@result "\\,")))) + + (?} + (if (and (> brace-level 0) + (not is-escaped)) + (setq result `(,@result "\\)") + brace-level (- brace-level 1)) + (setq result `(,@result "}")))) + + (?/ + (if (and (<= (+ index 3) (length pattern)) + (string= (substring pattern index (+ index 3)) "**/")) + (setq result `(,@result "\\(?:/\\|/.*/\\)") + index (+ index 3)) + (setq result `(,@result "/")))) + + (t + (unless (= current-char ?\\) + (setq result `(,@result ,(regexp-quote (char-to-string current-char))))))) + + (if (= current-char ?\\) + (progn (when is-escaped + (setq result `(,@result "\\\\"))) + (setq is-escaped (not is-escaped))) + (setq is-escaped nil)))) + (unless nested + (setq result `("^" ,@result "\\'"))) + (apply #'concat result))) + +(provide 'editorconfig-fnmatch) +;;; editorconfig-fnmatch.el ends here diff --git a/lisp/editorconfig-tools.el b/lisp/editorconfig-tools.el new file mode 100644 index 00000000000..d4af1a1e5a0 --- /dev/null +++ b/lisp/editorconfig-tools.el @@ -0,0 +1,122 @@ +;;; editorconfig-tools.el --- Editorconfig tools -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team + +;; 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 . + +;;; Commentary: + +;; Some utility commands for users, not used from editorconfig-mode. + +;;; Code: + +(require 'cl-lib) + +(eval-when-compile + (require 'subr-x)) + + +(require 'editorconfig) + +;;;###autoload +(defun editorconfig-apply () + "Get and apply EditorConfig properties to current buffer. + +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 + (progn + (let ((props (editorconfig-call-get-properties-function buffer-file-name))) + (condition-case err + (run-hook-with-args 'editorconfig-hack-properties-functions props) + (error + (display-warning '(editorconfig editorconfig-hack-properties-functions) + (format "Error while running editorconfig-hack-properties-functions, abort running hook: %S" + err) + :warning))) + (setq editorconfig-properties-hash props) + (editorconfig-set-local-variables props) + (editorconfig-set-coding-system-revert + (gethash 'end_of_line props) + (gethash 'charset props)) + (condition-case err + (run-hook-with-args 'editorconfig-after-apply-functions props) + (error + (display-warning '(editorconfig editorconfig-after-apply-functions) + (format "Error while running editorconfig-after-apply-functions, abort running hook: %S" + err) + :warning))))) + (error + (display-warning '(editorconfig editorconfig-apply) + (format "Error in editorconfig-apply, styles will not be applied: %S" err) + :error))))) + +(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 (editorconfig--disabled-for-majormode major-mode)) + buffer-file-name + (not (editorconfig--disabled-for-filename buffer-file-name))) + (editorconfig-apply))) + + +;;;###autoload +(defun editorconfig-find-current-editorconfig () + "Find the closest .editorconfig file for current file." + (interactive) + (eval-and-compile (require 'editorconfig-core)) + (when-let* ((file (editorconfig-core-get-nearest-editorconfig + default-directory))) + (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-tools) +;;; editorconfig-tools.el ends here diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el new file mode 100644 index 00000000000..5ab06344047 --- /dev/null +++ b/lisp/editorconfig.el @@ -0,0 +1,747 @@ +;;; editorconfig.el --- EditorConfig Emacs Plugin -*- lexical-binding: t -*- + +;; Copyright (C) 2011-2024 EditorConfig Team + +;; Author: EditorConfig Team +;; Version: 0.11.0 +;; URL: https://github.com/editorconfig/editorconfig-emacs#readme +;; Package-Requires: ((emacs "26.1") (nadvice "0.3")) +;; Keywords: convenience editorconfig + +;; 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 . + +;;; Commentary: + +;; EditorConfig helps developers define and maintain consistent +;; coding styles between different editors and IDEs. + +;; The EditorConfig project consists of a file format for defining +;; coding styles and a collection of text editor plugins that enable +;; editors to read the file format and adhere to defined styles. +;; EditorConfig files are easily readable and they work nicely with +;; version control systems. + +;;; Code: + +(require 'cl-lib) +(require 'pcase) + +(require 'nadvice) + +(eval-when-compile + (require 'rx) + (require 'subr-x) + (defvar tex-indent-basic) + (defvar tex-indent-item) + (defvar tex-indent-arg) + (defvar evil-shift-width)) + +(require 'editorconfig-core) + +(defgroup editorconfig nil + "EditorConfig Emacs Plugin. + +EditorConfig helps developers define and maintain consistent +coding styles between different editors and IDEs." + :tag "EditorConfig" + :prefix "editorconfig-" + :group 'tools) + +(define-obsolete-variable-alias + 'edconf-exec-path + 'editorconfig-exec-path + "0.5") +(defcustom editorconfig-exec-path + "editorconfig" + "Path to EditorConfig executable. + +Used by `editorconfig--execute-editorconfig-exec'." + :type 'string + :group 'editorconfig) + +(define-obsolete-variable-alias + 'edconf-get-properties-function + 'editorconfig-get-properties-function + "0.5") +(defcustom editorconfig-get-properties-function + 'editorconfig-core-get-properties-hash + "A function which gets EditorConfig properties for specified file. + +This function will be called with one argument, full path of the target file, +and should return a hash object containing properties, or nil if any core +program is not available. Keys of this hash should be symbols of properties, +and values should be strings of their values. + + +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: + + (set-variable \\='editorconfig-get-properties-function + #\\='editorconfig-core-get-properties-hash) + +Possible known values are: + +* `editorconfig-core-get-properties-hash' (default) + * Always use built-in Emacs-Lisp implementation to get properties +* `editorconfig-get-properties' + * 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" + :type 'function + :group 'editorconfig) + +(define-obsolete-variable-alias + 'edconf-custom-hooks + 'editorconfig-after-apply-functions + "0.5") +(define-obsolete-variable-alias + 'editorconfig-custom-hooks + 'editorconfig-after-apply-functions + "0.7.14") +(defcustom editorconfig-after-apply-functions () + "A list of functions 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. + +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-after-apply-functions + \\='(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)))))) + +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) + +(defcustom editorconfig-hack-properties-functions () + "A list of function to alter property values before applying them. + +These functions will be run after loading \".editorconfig\" files and before +applying them to current buffer, so that you can alter some properties from +\".editorconfig\" before they take effect. +\(Since 2021/08/30 (v0.9.0): Buffer coding-systems are set before running +this functions, so this variable cannot be used to change coding-systems.) + +For example, Makefiles always use tab characters for indentation: you can +overwrite \"indent_style\" property when current `major-mode' is a +`makefile-mode' with following code: + + (add-hook \\='editorconfig-hack-properties-functions + \\='(lambda (props) + (when (derived-mode-p \\='makefile-mode) + (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) +(make-obsolete-variable 'editorconfig-hack-properties-functions + "Using `editorconfig-after-apply-functions' instead is recommended, + because since 2021/08/30 (v0.9.0) this variable cannot support all properties: + charset values will be referenced before running this hook." + "v0.9.0") + +(define-obsolete-variable-alias + 'edconf-indentation-alist + 'editorconfig-indentation-alist + "0.5") +(defcustom editorconfig-indentation-alist + ;; For contributors: Sort modes in alphabetical order + `((apache-mode apache-indent-level) + (bash-ts-mode sh-basic-offset + sh-indentation) + (bpftrace-mode c-basic-offset) + (c++-ts-mode c-basic-offset + c-ts-mode-indent-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) + (csharp-mode c-basic-offset) + (csharp-ts-mode c-basic-offset + csharp-ts-mode-indent-offset) + (emacs-lisp-mode lisp-indent-offset) + (ess-mode ess-indent-offset) + (feature-mode feature-indent-offset + feature-indent-level) + (gdscript-mode gdscript-indent-offset) + (go-ts-mode go-ts-mode-indent-offset) + (hcl-mode hcl-indent-level) + (html-ts-mode html-ts-mode-indent-offset) + (java-ts-mode c-basic-offset + java-ts-mode-indent-offset) + (js-mode js-indent-level) + (jsonian-mode jsonian-default-indentation) + (latex-mode . editorconfig-set-indentation-latex-mode) + (lisp-mode lisp-indent-offset) + (matlab-mode matlab-indent-level) + (octave-mode octave-block-offset) + ;; 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) + (php-ts-mode php-ts-mode-indent-offset) + (ps-mode ps-mode-tab) + (ruby-mode ruby-indent-level) + (rust-ts-mode rust-indent-offset + rust-ts-mode-indent-offset) + (scss-mode css-indent-offset) + (sgml-mode sgml-basic-offset) + (sh-mode sh-indentation) + (svelte-mode svelte-basic-offset) + (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 + 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 + web-mode-code-indent-offset) + (zig-mode zig-indent-offset) + ) + "Alist of indentation setting methods by modes." + :risky t) + +(defcustom editorconfig-exclude-modes () + "Modes in which `editorconfig-mode-apply' will not run." + :type '(repeat (symbol :tag "Major Mode")) + :group 'editorconfig) + +(defcustom editorconfig-exclude-regexps () + "List of regexp for buffer filenames `editorconfig-mode-apply' will not run. + +When variable `buffer-file-name' matches any of the regexps, then +`editorconfig-mode-apply' will not do its work." + :type '(repeat string) + :group 'editorconfig) +(with-eval-after-load 'recentf + (add-to-list 'editorconfig-exclude-regexps + (rx-to-string '(seq string-start + (eval (expand-file-name recentf-save-file))) + t))) + +(defcustom editorconfig-trim-whitespaces-mode nil + "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'." + :type 'symbol + :group 'editorconfig) + +(defvar editorconfig-properties-hash nil + "Hash object of EditorConfig properties that was enabled for current buffer. +Set by `editorconfig-apply' and nil if that is not invoked in +current buffer yet.") +(make-variable-buffer-local 'editorconfig-properties-hash) +(put 'editorconfig-properties-hash + 'permanent-local + t) + +(defvar editorconfig-lisp-use-default-indent nil + "Selectively ignore the value of indent_size for Lisp files. +Prevents `lisp-indent-offset' from being set selectively. + +nil - `lisp-indent-offset' is always set normally. +t - `lisp-indent-offset' is never set normally + (always use default indent for lisps). +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.") + +(defcustom editorconfig-override-file-local-variables t + "Non-nil means editorconfig will override file local variable values." + :type 'boolean + :group 'editorconfig) + +(defcustom editorconfig-override-dir-local-variables t + "Non-nil means editorconfig will override values defined in dir-locals.el ." + :type 'boolean + :group 'editorconfig) + +(define-error 'editorconfig-error + "Error thrown from editorconfig lib") + +(defun editorconfig-error (&rest args) + "Signal an `editorconfig-error'. +Make a message by passing ARGS to `format-message'." + (signal 'editorconfig-error (list (apply #'format-message args)))) + +(defun editorconfig--disabled-for-filename (filename) + "Return non-nil when EditorConfig is disabled for FILENAME." + (cl-assert (stringp filename)) + (cl-loop for regexp in editorconfig-exclude-regexps + if (string-match regexp filename) return t + finally return nil)) + +(defun editorconfig--disabled-for-majormode (majormode) + "Return non-nil when Editorconfig is disabled for MAJORMODE." + (cl-assert majormode) + (or (provided-mode-derived-p majormode 'special-mode) + ;; Some special modes (like `archive-mode') are not derived from + ;; `special-mode' + (eq (get majormode 'mode-class) 'special) + (memq majormode + editorconfig-exclude-modes))) + +(defun editorconfig-string-integer-p (string) + "Return non-nil if STRING represents integer." + (and (stringp string) + (string-match-p "\\`[0-9]+\\'" string))) + +(defun editorconfig-set-indentation-latex-mode (size) + "Set `latex-mode' indent size to SIZE." + (setq-local LaTeX-indent-level size) + (setq-local LaTeX-item-indent size) + (setq-local TeX-brace-indent-level size)) + +(cl-defun editorconfig--should-set (symbol &optional size) + "Determine if editorconfig should set SYMBOL. + +Optional arg SIZE is used when symbol is `lisp-indent-offset'. +See `editorconfig-lisp-use-default-indent' for details." + (display-warning '(editorconfig editorconfig--should-set) + (format "symbol: %S | size: %S" + symbol + size) + :debug) + (when (and (not editorconfig-override-file-local-variables) + (assq symbol file-local-variables-alist)) + (cl-return-from editorconfig--should-set + nil)) + + (when (and (not editorconfig-override-dir-local-variables) + (assq symbol dir-local-variables-alist)) + (cl-return-from editorconfig--should-set + nil)) + + (when (eq symbol 'lisp-indent-offset) + (cl-return-from editorconfig--should-set + (cond ((null editorconfig-lisp-use-default-indent) t) + ((eql t editorconfig-lisp-use-default-indent) nil) + ((numberp editorconfig-lisp-use-default-indent) + (not (eql size editorconfig-lisp-use-default-indent))) + (t t)))) + + t) + +(defun editorconfig-set-indentation (style &optional size tab_width) + "Set indentation type from STYLE, SIZE and TAB_WIDTH." + (setq size + (cond ((editorconfig-string-integer-p size) + (string-to-number size)) + ((equal size "tab") + "tab") + (t + nil))) + (cond ((not (editorconfig--should-set 'tab-width)) + nil) + ) + + (cond ((not (editorconfig--should-set 'indent-tabs-mode)) + nil) + ) + + (when (editorconfig--should-set 'evil-shift-width) + ) + ) + +(defvar-local editorconfig--apply-coding-system-currently nil + "Used internally.") +(put 'editorconfig--apply-coding-system-currently + 'permanent-local + t) + +(defun editorconfig-merge-coding-systems (end-of-line charset) + "Return merged coding system symbol of 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) + (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)))) + (merge-coding-systems cs eol))) + +(cl-defun editorconfig-set-coding-system-revert (end-of-line charset) + "Set buffer coding system by END-OF-LINE and CHARSET. + +This function will revert buffer when the coding-system has been changed." + ;; `editorconfig--advice-find-file-noselect' does not use this function + (let ((coding-system (editorconfig-merge-coding-systems end-of-line + charset))) + (display-warning '(editorconfig editorconfig-set-coding-system-revert) + (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 + editorconfig--apply-coding-system-currently) + :debug) + (when (eq coding-system 'undecided) + (cl-return-from editorconfig-set-coding-system-revert)) + (when (and buffer-file-coding-system + (memq buffer-file-coding-system + (coding-system-aliases (merge-coding-systems coding-system + buffer-file-coding-system)))) + (cl-return-from editorconfig-set-coding-system-revert)) + (unless (file-readable-p buffer-file-name) + (set-buffer-file-coding-system coding-system) + (cl-return-from editorconfig-set-coding-system-revert)) + (unless (memq coding-system + (coding-system-aliases 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. + +This function will set `require-final-newline' and `mode-require-final-newline' +to non-nil when FINAL-NEWLINE is true." + (pcase final-newline + ("true" + ) + ("false" + ))) + +(defun editorconfig-set-trailing-ws (trim-trailing-ws) + (if editorconfig-trim-whitespaces-mode + (funcall editorconfig-trim-whitespaces-mode 1) + ...) + (when editorconfig-trim-whitespaces-mode + (funcall editorconfig-trim-whitespaces-mode 0)) + ...) + +(defun editorconfig-set-line-length (length) + "Set the max line length (`fill-column') to LENGTH." + (when (and (editorconfig-string-integer-p length) + (> (string-to-number length) 0)) + (setq fill-column (string-to-number length)))) + + +(defun editorconfig--execute-editorconfig-exec (filename) + "Execute EditorConfig core with FILENAME and return output." + (if filename + (with-temp-buffer + (let ((remote (file-remote-p filename)) + (remote-localname (file-remote-p filename + 'localname))) + (display-warning '(editorconfig editorconfig--execute-editorconfig-exec) + (format "editorconfig--execute-editorconfig-exec: 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 "editorconfig--execute-editorconfig-exec: default-directory: %S | filename: %S" + default-directory + filename + ) + :debug) + (if (eq 0 + (process-file editorconfig-exec-path nil t nil filename)) + (buffer-string) + (editorconfig-error (buffer-string)))) + "")) + +(defun editorconfig--parse-properties (props-string) + ) + +(defun editorconfig-get-properties-from-exec (filename) + "Get EditorConfig properties of file FILENAME. + +This function uses value of `editorconfig-exec-path' to get properties." + (if (executable-find editorconfig-exec-path) + (editorconfig--parse-properties (editorconfig--execute-editorconfig-exec filename)) + (editorconfig-error "Unable to find editorconfig executable"))) + +(defun editorconfig-get-properties (filename) + "Get EditorConfig properties for file FILENAME. + +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 filename))) + (editorconfig-get-properties-from-exec filename) + (require 'editorconfig-core) + (editorconfig-core-get-properties-hash filename))) + +(defun editorconfig-call-get-properties-function (filename) + "Call `editorconfig-get-properties-function' with FILENAME and return result. + +This function also removes `unset' properties and calls +`editorconfig-hack-properties-functions'." + (unless (functionp editorconfig-get-properties-function) + (editorconfig-error "Invalid editorconfig-get-properties-function value")) + (if (stringp filename) + (setq filename (expand-file-name filename)) + (editorconfig-error "Invalid argument: %S" filename)) + (let ((props nil)) + (condition-case err + (setq props (funcall editorconfig-get-properties-function + filename)) + (error + (editorconfig-error "Error from editorconfig-get-properties-function: %S" + err))) + (cl-loop for k being the hash-keys of props using (hash-values v) + when (equal v "unset") do (remhash k props)) + props)) + +(defun editorconfig-set-local-variables (props) + "Set buffer variables according to EditorConfig PROPS." + (editorconfig-set-indentation (gethash 'indent_style props) + (gethash 'indent_size props) + (gethash 'tab_width props)) + (editorconfig-set-trailing-nl (gethash 'insert_final_newline props)) + (editorconfig-set-trailing-ws (gethash 'trim_trailing_whitespace props)) + (editorconfig-set-line-length (gethash 'max_line_length props))) + + +(defun editorconfig-major-mode-hook () + "Function to run when `major-mode' has been changed. + +This functions does not reload .editorconfig file, just sets local variables +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-major-mode-hook: editorconfig-mode: %S, major-mode: %S, -properties-hash: %S" + (and (boundp 'editorconfig-mode) + editorconfig-mode) + major-mode + editorconfig-properties-hash) + :debug) + (when (and (bound-and-true-p editorconfig-mode) + editorconfig-properties-hash) + (editorconfig-set-local-variables editorconfig-properties-hash) + (condition-case err + (run-hook-with-args 'editorconfig-after-apply-functions editorconfig-properties-hash) + (error + (display-warning '(editorconfig editorconfig-major-mode-hook) + (format "Error while running `editorconfig-after-apply-functions': %S" + err)))))) + +(defvar editorconfig--filename-codingsystem-hash (make-hash-table :test 'equal) + "Used interally. + +`editorconfig--advice-find-file-noselect' will put value to this hash, and +`editorconfig--advice-insert-file-contents' will use the value to set +`coding-system-for-read' value.") + +(defun editorconfig--advice-insert-file-contents (f filename &rest args) + "Set `coding-system-for-read'. + +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." + ;; This function uses `editorconfig--filename-codingsystem-hash' 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 "editorconfig--advice-insert-file-contents: filename: %S args: %S codingsystem: %S bufferfilename: %S" + filename args + editorconfig--filename-codingsystem-hash + buffer-file-name) + :debug) + (let ((coding-system (and (stringp filename) + (gethash (expand-file-name filename) + editorconfig--filename-codingsystem-hash)))) + (if (and coding-system + (not (eq coding-system + 'undecided))) + (let ((coding-system-for-read coding-system)) + (apply f filename args)) + (apply f filename args)))) + +(defun editorconfig--advice-find-file-noselect (f filename &rest args) + "Get EditorConfig properties and apply them to buffer to be visited. + +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)) + (condition-case err + (when (and (stringp filename) + (not (editorconfig--disabled-for-filename filename))) + (setq props (editorconfig-call-get-properties-function filename)) + (setq coding-system + (editorconfig-merge-coding-systems (gethash 'end_of_line props) + (gethash 'charset props))) + (puthash (expand-file-name filename) + coding-system + editorconfig--filename-codingsystem-hash)) + (error + (display-warning '(editorconfig editorconfig--advice-find-file-noselect) + (format "Failed to get properties, styles will not be applied: %S" + err) + :warning))) + + (setq ret (apply f filename args)) + (clrhash editorconfig--filename-codingsystem-hash) + + (condition-case err + (with-current-buffer ret + (when (and props + ;; filename has already been checked + (not (editorconfig--disabled-for-majormode major-mode))) + + ;; When file path indicates it is a remote file and it actually + ;; does not exists, `buffer-file-coding-system' will not be set. + ;; (Seems `insert-file-contents' will not be called) + ;; For this case, explicitly set this value so that saving will be done + ;; with expected coding system. + (when (and (file-remote-p filename) + (not (local-variable-p 'buffer-file-coding-system)) + (not (file-exists-p filename)) + coding-system + (not (eq coding-system + 'undecided))) + (set-buffer-file-coding-system coding-system)) + + ;; NOTE: hack-properties-functions cannot affect coding-system value, + ;; because it has to be set before initializing buffers. + (condition-case err + (run-hook-with-args 'editorconfig-hack-properties-functions props) + (error + (display-warning '(editorconfig editorconfig-hack-properties-functions) + (format "Error while running editorconfig-hack-properties-functions, abort running hook: %S" + err) + :warning))) + (setq editorconfig-properties-hash props) + ;; When initializing buffer, `editorconfig-major-mode-hook' + ;; will be called before setting `editorconfig-properties-hash', so + ;; execute this explicitly here. + (editorconfig-set-local-variables props) + + (condition-case err + (run-hook-with-args 'editorconfig-after-apply-functions props) + (error + (display-warning '(editorconfig editorconfig--advice-find-file-noselect) + (format "Error while running `editorconfig-after-apply-functions': %S" + err)))))) + (error + (display-warning '(editorconfig editorconfig--advice-find-file-noselect) + (format "Error while setting variables from EditorConfig: %S" err)))) + ret)) + + +;;;###autoload +(define-minor-mode editorconfig-mode + "Toggle EditorConfig feature. + +To disable EditorConfig in some buffers, modify +`editorconfig-exclude-modes' or `editorconfig-exclude-regexps'." + :global t + :lighter editorconfig-mode-lighter + (let ((modehooks '(prog-mode-hook + text-mode-hook + read-only-mode-hook + ;; 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. + rpm-spec-mode-hook))) + (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) + (dolist (hook modehooks) + (add-hook hook + 'editorconfig-major-mode-hook + t))) + (advice-remove 'find-file-noselect 'editorconfig--advice-find-file-noselect) + (advice-remove 'insert-file-contents 'editorconfig--advice-insert-file-contents) + (dolist (hook modehooks) + (remove-hook hook 'editorconfig-major-mode-hook))))) + + +;; (defconst editorconfig--version +;; (eval-when-compile +;; (require 'lisp-mnt) +;; (declare-function lm-version "lisp-mnt" nil) +;; (lm-version)) +;; "EditorConfig version.") + +(declare-function find-library-name "find-func" (library)) +(declare-function lm-version "lisp-mnt" nil) + +;;;###autoload +(defun editorconfig-version (&optional show-version) + "Get EditorConfig version as string. + +If called interactively or if SHOW-VERSION is non-nil, show the +version in the echo area and the messages buffer." + (interactive (list t)) + (let* ((version (with-temp-buffer + (require 'find-func) + (insert-file-contents (find-library-name "editorconfig")) + (require 'lisp-mnt) + (lm-version))) + (pkg (and (eval-and-compile (require 'package nil t)) + (cadr (assq 'editorconfig + package-alist)))) + (pkg-version (and pkg + (package-version-join (package-desc-version pkg)))) + (version-full (if (and pkg-version + (not (string= version pkg-version))) + (concat version "-" pkg-version) + version))) + (when show-version + (message "EditorConfig Emacs v%s" version-full)) + version-full)) + +(provide 'editorconfig) +;;; editorconfig.el ends here + +;; Local Variables: +;; sentence-end-double-space: t +;; End: