pax_global_header 0000666 0000000 0000000 00000000064 13547533462 0014526 g ustar 00root root 0000000 0000000 52 comment=0b65d5316bcab4d76b5823ea6ecf8f5880f460d2
editorconfig-emacs-0.8.1/ 0000775 0000000 0000000 00000000000 13547533462 0015276 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/.editorconfig 0000664 0000000 0000000 00000000523 13547533462 0017753 0 ustar 00root root 0000000 0000000 root = true
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.el]
indent_style = space
max_line_length = 80
[Makefile]
indent_style = tab
tab_width = 4
[.gitmodules]
indent_style = tab
tab_width = 4
[*.yml]
indent_style = space
indent_size = 2
[ert-tests/**/*.ini]
file_type_ext = editorconfig
editorconfig-emacs-0.8.1/.gitignore 0000664 0000000 0000000 00000000035 13547533462 0017264 0 ustar 00root root 0000000 0000000 *.elc
*~
\#*
.\#*
*.autosave
editorconfig-emacs-0.8.1/.gitmodules 0000664 0000000 0000000 00000000405 13547533462 0017452 0 ustar 00root root 0000000 0000000 [submodule "editorconfig-core-test"]
path = core-test
url = https://github.com/editorconfig/editorconfig-core-test.git
[submodule "editorconfig-plugin-tests"]
path = ert-tests/plugin-tests
url = https://github.com/editorconfig/editorconfig-plugin-tests.git
editorconfig-emacs-0.8.1/.travis.yml 0000664 0000000 0000000 00000000700 13547533462 0017404 0 ustar 00root root 0000000 0000000 language: generic
dist: trusty
env:
matrix:
- EMACS_VERSION=26.3
- EMACS_VERSION=25.3
- EMACS_VERSION=24.5
# matrix:
# allow_failures:
# - env: EMACS_VERSION=26-pretest
before_install:
- git clone --depth=1 https://github.com/rejeep/evm.git ./.evm
- ./.evm/bin/evm config path /tmp
- ./.evm/bin/evm install emacs-$EMACS_VERSION-travis --use
- ./.evm/bin/emacs --version
script:
make test EMACS=$PWD/.evm/bin/emacs
editorconfig-emacs-0.8.1/CONTRIBUTORS 0000664 0000000 0000000 00000000273 13547533462 0017160 0 ustar 00root root 0000000 0000000 Contributors to EditorConfig Emacs plugin (chronological order):
Trey Hunner
Jonas Bernoulli
Johan Sundström
Desmond O. Chang
Steve Jordan
Hong Xu
10sr
Usami Kenta
Izaak "Zaak" Beekman
editorconfig-emacs-0.8.1/LICENSE 0000664 0000000 0000000 00000104517 13547533462 0016313 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program 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 .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
editorconfig-emacs-0.8.1/Makefile 0000664 0000000 0000000 00000003570 13547533462 0016743 0 ustar 00root root 0000000 0000000 # -*- Makefile -*-
TEXI_CHAPTER := EditorConfig Emacs Plugin
EMACS = emacs
PANDOC = pandoc
AWK = awk
PROJECT_ROOT_DIR = $(CURDIR)
ERT_TESTS = $(wildcard $(PROJECT_ROOT_DIR)/ert-tests/*.el)
TRAVIS_FILE = .travis.yml
# Compile with noninteractive and relatively clean environment.
BATCHFLAGS = -batch -q --no-site-file -L $(PROJECT_ROOT_DIR)
MAIN_SRC = editorconfig.el
SRCS = $(wildcard $(PROJECT_ROOT_DIR)/*.el)
OBJS = $(SRCS:.el=.elc)
$(OBJS): %.elc: %.el
$(EMACS) $(BATCHFLAGS) -f batch-byte-compile $^
.PHONY: all clean test test-travis test-ert test-core test-metadata sandbox doc info
all: $(OBJS)
clean:
-rm -f $(OBJS)
doc: doc/editorconfig.texi
doc/editorconfig.texi: README.md doc/header.txt
mkdir -p doc
tail -n +4 $< | $(PANDOC) -s -f markdown -t texinfo -o $@.body
$(AWK) 'f{print} /^@chapter $(TEXI_CHAPTER)/{f=1;print}' $@.body >$@.body2
cat doc/header.txt $@.body2 >$@
rm -f $@.body $@.body2
test: test-ert test-core test-metadata $(OBJS)
$(EMACS) $(BATCHFLAGS) -l editorconfig.el
test-travis:
@if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi
# ert test
test-ert: $(ERT_TESTS) $(OBJS)
git submodule init
$(EMACS) $(BATCHFLAGS) \
--eval "(setq debug-on-error t)" \
--eval "(require 'ert)" \
--eval "(setq metadata-el-files '($(MAIN_SRC:%=\"%\")))" \
$(ERT_TESTS:%=-l "%") \
-f ert-run-tests-batch-and-exit
# Core test
core-test/CMakeLists.txt:
git submodule init
test-core: core-test/CMakeLists.txt $(OBJS)
cd $(PROJECT_ROOT_DIR)/core-test && \
cmake -DEDITORCONFIG_CMD="$(PROJECT_ROOT_DIR)/bin/editorconfig-el" .
cd $(PROJECT_ROOT_DIR)/core-test && \
EMACS_BIN=$(EMACS) EDITORCONFIG_CORE_LIBRARY_PATH="$(PROJECT_ROOT_DIR)" \
ctest --output-on-failure .
# Start Emacs that loads *.el in current directory and does not load the user
# init file
sandbox:
$(EMACS) -q -L $(PROJECT_ROOT_DIR) $(MAIN_SRC:%=-l "%")
editorconfig-emacs-0.8.1/README.md 0000664 0000000 0000000 00000016047 13547533462 0016565 0 ustar 00root root 0000000 0000000 [](https://travis-ci.org/editorconfig/editorconfig-emacs)
[](http://melpa.org/#/editorconfig)
[](https://stable.melpa.org/#/editorconfig)
# EditorConfig Emacs Plugin
This is an [EditorConfig][] plugin for [Emacs][].
## Setup
This package is available from [MELPA][] and [MELPA Stable][].
Install from there and enable global minor-mode `editorconfig-mode`:
```emacs-lisp
(editorconfig-mode 1)
```
If you use [**use-package**][use-package], add the following to your
`init.el` file:
```emacs-lisp
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
```
To install manually, copy all `.el` files in this repository to
`~/.emacs.d/lisp` and add the following:
```emacs-lisp
(add-to-list 'load-path "~/.emacs.d/lisp")
(require 'editorconfig)
(editorconfig-mode 1)
```
### Install a Core Program
This package requires a Core program.
The officially recommended one is [EditorConfig C Core][],
follow the instructions in the README and INSTALL files to install it.
Though using C Core is recommended, but this plugin also
includes a core library implemented in Emacs Lisp.
This plugin uses this as a fallback method when no core executable
is found, so it works out-of-the-box without explicitly installing
any other core program.
## Supported properties
Current Emacs plugin coverage for EditorConfig's [properties][]:
* `indent_style`
* `indent_size`
* `tab_width`
* `end_of_line`
* `charset`
* `trim_trailing_whitespace`
* `insert_final_newline = true` is supported
* `insert_final_newline = false` is not enforced
(as in trailing newlines actually being removed automagically),
we just buffer-locally override any preferences that would auto-add them
to files `.editorconfig` marks as trailing-newline-free
* `max_line_length`
* `file_type_ext` (Experimental)
* `file_type_emacs` (Experimental)
* `root` (only used by EditorConfig core)
Not yet covered properties marked with over-strike
– pull requests implementing missing features warmly welcomed!
Typically, you will want to tie these to native functionality,
or the configuration of existing packages handling the feature.
As several packages have their own handling of, say, indention,
we might not yet cover some mode you use, but we try to add the
ones that show up on our radar. Similarly, we don't yet hook
in to all different packages for whitespace trimming to inform
them about editorconfig settings, but aim for better coverage
of things like
[ws-trim](ftp://ftp.lysator.liu.se/pub/emacs/ws-trim.el).
### File Type
This plugin has experimental supports for `file_type_ext` and
`file_type_emacs`, which specify "file types" for files.
As for Emacs, it means `major-mode` can be set.
**file_type_ext** When it is set to `md` for `a.txt`, for example,
`major-mode` will be decided as if the file name would be `a.txt.md`
(and thus `markdown-mode` is likely to be used).
**file_type_emacs** When it is set to `markdown` for `a.txt`,
`markdown-mode` will be enabled when opening `a.txt`.
These property are experimental and their meanings might change in the
future updates. When both are specified, `file_type_ext` takes precedence.
## Customize
`editorconfig-emacs` provides some customize variables.
Here are some of these variables: for the full list of available variables,
type M-x customize-group [RET] editorconfig [RET].
### `editorconfig-after-apply-functions`
(Formerly `editorconfig-custom-hooks`)
A list of functions after loading common EditorConfig settings, where you can
set some custom variables or overwrite existing properties.
For example, `web-mode` has several variables for indentation offset size and
EditorConfig sets them at once by `indent_size`. You may want to stop indenting
only blocks of `web-mode`: it can be achieved by adding following to your init.el:
```emacs-lisp
(add-hook 'editorconfig-after-apply-functions
(lambda (props) (setq web-mode-block-padding 0)))
```
You can also define your own custom properties and enable them here.
### `editorconfig-hack-properties-functions`
A list of function to alter property values before applying them.
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, Makefiles always use tab characters for indentation: you can
overwrite \"indent_style\" property when current `major-mode` is a
`makefile-mode` with following code:
``` emacs-lisp
(add-hook 'editorconfig-hack-properties-functions
'(lambda (props)
(when (derived-mode-p 'makefile-mode)
(puthash 'indent_style "tab" props))))
```
### `editorconfig-indentation-alist`
Alist of indentation setting methods by modes.
For the easiest case to add a new support for a major-mode, you just need to
add a pair of major-mode symbol and its indentation variables:
```emacs-lisp
(add-to-list 'editorconfig-indentation-alist
;; Just an example, of course EditorConfig has already included this setting!
'(c-mode c-basic-offset))
```
### `editorconfig-trim-whitespaces-mode`
Buffer local minor-mode to use to trim trailing whitespaces.
If set, enable/disable that mode in accord with `trim_trailing_whitespace`
property in `.editorconfig`.
Otherwise, use Emacs built-in `delete-trailing-whitespace` function.
One possible value is
[`ws-butler-mode`](https://github.com/lewang/ws-butler), with which
only lines touched get trimmed. To use it, add following to your
init.el:
``` emacs-lisp
(setq editorconfig-trim-whitespaces-mode
'ws-butler-mode)
```
## 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
### Development
Make and [CMake][] must be installed to run the tests
locally:
$ make test
## 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 .
[Emacs]: https://www.gnu.org/software/emacs/
[MELPA]: https://melpa.org/#/editorconfig
[MELPA Stable]: https://stable.melpa.org/#/editorconfig
[use-package]: https://www.emacswiki.org/emacs/UsePackage
[EditorConfig]: https://editorconfig.org
[EditorConfig C Core]: https://github.com/editorconfig/editorconfig-core-c
[properties]: https://editorconfig.org/#supported-properties
[CMake]: https://cmake.org
editorconfig-emacs-0.8.1/bin/ 0000775 0000000 0000000 00000000000 13547533462 0016046 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/bin/editorconfig-el 0000775 0000000 0000000 00000010502 13547533462 0021044 0 ustar 00root root 0000000 0000000 #!/bin/sh
:;#-*-Emacs-Lisp-*-
:;test -n "$EMACS_BIN" || EMACS_BIN=emacs
:;exec "$EMACS_BIN" -batch -Q --eval '(setq debug-on-error t)' -l "$0" -- "$@"
;; editorconfig-el --- EditorConfig Core executable in Emacs Lisp
;; Copyright (C) 2011-2019 EditorConfig Team
;; Author: EditorConfig Team
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; See
;; https://github.com/editorconfig/editorconfig-emacs/graphs/contributors
;; or the CONTRIBUTORS file for the list of contributors.
;; This file is part of EditorConfig Emacs Plugin.
;; EditorConfig Emacs Plugin is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at your
;; option) any later version.
;; EditorConfig Emacs Plugin is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
;; Public License for more details.
;; You should have received a copy of the GNU General Public License along with
;; EditorConfig Emacs Plugin. If not, see .
;;; Commentary:
;; This executable is mainly for testing core feature, and not intended to be
;; used by users.
;;; Code:
(when (getenv "EDITORCONFIG_CORE_LIBRARY_PATH")
(setq load-path
(append (split-string (getenv "EDITORCONFIG_CORE_LIBRARY_PATH")
":")
load-path)))
(require 'cl-lib)
(require 'editorconfig) ; For `editorconfig-version'
(require 'editorconfig-core)
(defconst editorconfig-bin-help-message
"Usage: editorconfig [-f ] [-b ] [-h|--help]
[-v|--version] [ ...]
Options:
-f Specify config filename other than \".editorconfig\"
-b Specify config format version
-h|--help Print this help message
-v|--version Display version information
... File paths to get EditorConfig properties"
"Help message of EditorConfig executable.")
(defun editorconfig-bin-parse-args
(argv &optional confname version)
"Parse arguments and return list.
List returned will be looked like (FILES CONFNAME VERSION).
If either -v, --version, -h or --help option apprears, exit emacs immediately
with required output."
(unless argv
(message editorconfig-bin-help-message)
(kill-emacs 0))
(cl-case (intern (car argv))
(-f
(editorconfig-bin-parse-args (cddr argv)
(cadr argv)
version))
(-b
(editorconfig-bin-parse-args (cddr argv)
confname
(cadr argv)))
((-h --help)
(message editorconfig-bin-help-message)
(kill-emacs 0))
((-v --version)
(princ (format "EditorConfig-EmacsLisp Version %s\n"
(editorconfig-version)))
(kill-emacs 0))
(otherwise
(when (and argv
(string-match-p "^-"
(car argv)))
(error "Invalid option: %s"
(car argv)))
(list argv
confname
version))
))
(defun main (argv)
;; TODO: Read file list from stdin if - is given as FILENAME
(let ((parsed (editorconfig-bin-parse-args argv)))
(cl-case (length (car parsed))
(0
nil)
(1
(dolist (p (editorconfig-core-get-properties (caar parsed)
(nth 1 parsed)
(nth 2 parsed)))
(princ (format "%s=%s\n"
(car p)
(cdr p)))))
(otherwise
(dolist (file (car parsed))
(princ (format "[%s]\n"
file))
(dolist (p (editorconfig-core-get-properties file
(nth 1 parsed)
(nth 2 parsed)))
(princ (format "%s=%s\n"
(car p)
(cdr p))))))))
0)
;; car of command-line-args-left is "--"
(kill-emacs (main (cdr command-line-args-left)))
;;; editorconfig-el ends here
editorconfig-emacs-0.8.1/core-test/ 0000775 0000000 0000000 00000000000 13547533462 0017203 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/doc/ 0000775 0000000 0000000 00000000000 13547533462 0016043 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/doc/.gitignore 0000664 0000000 0000000 00000000007 13547533462 0020030 0 ustar 00root root 0000000 0000000 *.body
editorconfig-emacs-0.8.1/doc/editorconfig.texi 0000664 0000000 0000000 00000021043 13547533462 0021412 0 ustar 00root root 0000000 0000000 @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
* Installation::
* Supported properties::
* Customize::
* Testing::
* Submitting Bugs and Feature Requests::
* License::
@end menu
@node Installation
@section Installation
@anchor{#installation}
Download the
@uref{https://github.com/editorconfig/editorconfig-core-c,EditorConfig C
Core} and follow the instructions in the README and INSTALL files to
install it.
This plugin also has a built-in core library implemented in Emacs-Lisp,
and fallback to it when no core executable is found.
In either case, copy @code{.el} files in this repository to
@code{~/.emacs.d/lisp} and add the following to your @code{~/.emacs}
file:
@verbatim
(add-to-list 'load-path "~/.emacs.d/lisp")
(require 'editorconfig)
(editorconfig-mode 1)
@end verbatim
Alternatively, you can find the package available on
@uref{https://melpa.org/#/editorconfig,MELPA} and
@uref{https://stable.melpa.org/#/editorconfig,MELPA Stable}
(@uref{http://marmalade-repo.org/packages/editorconfig,The Marmalade
package} is deprecated).
Or if you use
@uref{https://www.emacswiki.org/emacs/UsePackage,@strong{use-package}}:
@verbatim
(use-package editorconfig
:ensure t
:config
(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)
@item
@code{file_type_emacs} (Experimental)
@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, indention, we might
not yet cover some mode you use, but we try to add the ones that show up
on our radar. Similarly, we don't yet hook in to all different packages
for whitespace trimming to inform them about editorconfig settings, but
aim for better coverage of things like
@uref{ftp://ftp.lysator.liu.se/pub/emacs/ws-trim.el,ws-trim}.
@menu
* File Type::
@end menu
@node File Type
@subsection File Type
@anchor{#file-type}
This plugin has experimental supports for @code{file_type_ext} and
@code{file_type_emacs}, which specify ``file types'' for files. As for
Emacs, it means @code{major-mode} can be set.
@strong{file_type_ext} When it is set to @code{md} for @code{a.txt}, for
example, @code{major-mode} will be decided as if the file name would be
@code{a.txt.md} (and thus @code{markdown-mode} is likely to be used).
@strong{file_type_emacs} When it is set to @code{markdown} for
@code{a.txt}, @code{markdown-mode} will be enabled when opening
@code{a.txt}.
These property are experimental and their meanings might change in the
future updates. When both are specified, @code{file_type_ext} takes
precedence.
@node Customize
@section Customize
@anchor{#customize}
@menu
* editorconfig-after-apply-functions::
* editorconfig-hack-properties-functions::
* editorconfig-indentation-alist::
* editorconfig-exec-path::
* editorconfig-get-properties-function::
@end menu
@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 after loading common EditorConfig settings, where
you can set some custom variables or overwrite existing properties.
For example, @code{web-mode} has several variables for indentation
offset size and EditorConfig sets them at once by @code{indent_size}.
You may want to stop indenting only blocks of @code{web-mode}: it can be
achieved by adding following to your init.el:
@verbatim
(add-hook 'editorconfig-after-apply-functions
(lambda (hash) (setq web-mode-block-padding 0)))
@end verbatim
You can also define your own custom properties and enable them here.
@node editorconfig-hack-properties-functions
@subsection @code{editorconfig-hack-properties-functions}
@anchor{#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.
For example, Makefiles always use tab characters for indentation: you
can overwrite "indent_style" property when current @code{major-mode} is
a @code{makefile-mode} with following code:
@verbatim
(add-hook 'editorconfig-hack-properties-functions
'(lambda (props)
(when (derived-mode-p 'makefile-mode)
(puthash 'indent_style "tab" props))))
@end verbatim
@node editorconfig-indentation-alist
@subsection @code{editorconfig-indentation-alist}
@anchor{#editorconfig-indentation-alist}
Alist of indentation setting methods by modes.
For the easiest case to add a new support for a major-mode, you just
need to add a pair of major-mode symbol and its indentation variables:
@verbatim
(add-to-list 'editorconfig-indentation-alist
;; Just an example, of course EditorConfig has already included this setting!
'(c-mode c-basic-offset))
@end verbatim
You can also modify this variable with the command M-x
customize-variable [RET] editorconfig-indentation-alist [RET]. For a bit
more complicated cases please take a look at the docstring of this
variable.
@node editorconfig-exec-path
@subsection @code{editorconfig-exec-path}
@anchor{#editorconfig-exec-path}
String of @code{editorconfig} executable name (command name or full path
to the executable).
@node editorconfig-get-properties-function
@subsection @code{editorconfig-get-properties-function}
@anchor{#editorconfig-get-properties-function}
Function to use to get EditorConfig properties.
For example, if you always want to use built-in core library instead of
any EditorConfig executable to get properties, add following to your
init.el:
@verbatim
(set-variable 'editorconfig-get-properties-function
#'editorconfig-core-get-properties-hash)
@end verbatim
Possible known values are:
@itemize
@item
@code{editorconfig-get-properties} (default)
@itemize
@item
Use @code{editorconfig-get-properties-from-exec} when
@code{editorconfig-exec-path} executable is found, otherwise use
@code{editorconfig-core-get-properties-hash}
@end itemize
@item
@code{editorconfig-get-properties-from-exec}
@itemize
@item
Get properties by executing EditorConfig executable specified in
@code{editorconfig-exec-path}
@end itemize
@item
@code{editorconfig-core-get-properties-hash}
@itemize
@item
Always use built-in Emacs-Lisp implementation to get properties
@end itemize
@end itemize
@node Testing
@section Testing
@anchor{#testing}
Make and @uref{https://cmake.org,CMake} must be installed to run the
tests.
To run the tests:
@verbatim
$ make test
@end verbatim
@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
@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
editorconfig-emacs-0.8.1/doc/header.txt 0000664 0000000 0000000 00000000161 13547533462 0020032 0 ustar 00root root 0000000 0000000 @dircategory Emacs
@direntry
* EditorConfig: (editorconfig). EditorConfig Emacs Plugin.
@end direntry
@node Top
editorconfig-emacs-0.8.1/editorconfig-conf-mode.el 0000664 0000000 0000000 00000005741 13547533462 0022150 0 ustar 00root root 0000000 0000000 ;;; editorconfig-conf-mode.el --- Major mode for editing .editorconfig files -*- lexical-binding: t -*-
;; Copyright (C) 2011-2019 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.")
;;;###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
editorconfig-emacs-0.8.1/editorconfig-core-handle.el 0000664 0000000 0000000 00000023114 13547533462 0022454 0 ustar 00root root 0000000 0000000 ;;; editorconfig-core-handle.el --- Handle Class for EditorConfig File -*- lexical-binding: t -*-
;; Copyright (C) 2011-2019 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 propetties like ((\"root\" . \"true\"))
`sections'
List of `editorconfig-core-hadnle-section' strucure object.
`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 (point-at-bol)
(point-at-eol)))
(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
editorconfig-emacs-0.8.1/editorconfig-core.el 0000664 0000000 0000000 00000016734 13547533462 0021235 0 ustar 00root root 0000000 0000000 ;;; editorconfig-core.el --- EditorConfig Core library in Emacs Lisp -*- lexical-binding: t -*-
;; Copyright (C) 2011-2019 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)
(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."
(let ((handle (car (last (editorconfig-core--get-handles directory
".editorconfig")))))
(when handle
(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 functions returns 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 to 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
))
(let ((val (gethash key
result)))
(when val
(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
editorconfig-emacs-0.8.1/editorconfig-fnmatch.el 0000664 0000000 0000000 00000025623 13547533462 0021722 0 ustar 00root root 0000000 0000000 ;;; editorconfig-fnmatch.el --- Glob pattern matching in Emacs lisp -*- lexical-binding: t -*-
;; Copyright (C) 2011-2019 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 numaric 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
editorconfig-emacs-0.8.1/editorconfig.el 0000664 0000000 0000000 00000075721 13547533462 0020310 0 ustar 00root root 0000000 0000000 ;;; editorconfig.el --- EditorConfig Emacs Plugin -*- lexical-binding: t -*-
;; Copyright (C) 2011-2019 EditorConfig Team
;; Author: EditorConfig Team
;; Version: 0.8.1
;; URL: https://github.com/editorconfig/editorconfig-emacs#readme
;; Package-Requires: ((cl-lib "0.5") (emacs "24"))
;; 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)
(eval-when-compile
(require 'rx)
(defvar tex-indent-basic)
(defvar tex-indent-item)
(defvar tex-indent-arg)
(defvar evil-shift-width))
(declare-function editorconfig-core-get-properties-hash
"editorconfig-core"
nil)
(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)
(defcustom editorconfig-exec-path
"editorconfig"
"Path to EditorConfig executable.
Used by `editorconfig-call-editorconfig-exec'."
:type 'string
:group 'editorconfig)
(define-obsolete-variable-alias
'edconf-exec-path
'editorconfig-exec-path
"0.5")
(defcustom editorconfig-get-properties-function
'editorconfig-get-properties
"A function which gets EditorConofig properties for current buffer.
This function will be called with no argument and should return a
hash object containing properties, or nil if any core program is
not available. 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-get-properties' (default)
* Use `editorconfig-get-properties-from-exec' when
`editorconfig-exec-path' executable executable is found, otherwise
use `editorconfig-core-get-properties-hash'
* `editorconfig-get-properties-from-exec'
* Get properties by executing EditorConfig executable
* `editorconfig-core-get-properties-hash'
* Always use built-in Emacs-Lisp implementation to get properties"
:type 'function
:group 'editorconfig)
(define-obsolete-variable-alias
'edconf-get-properties-function
'editorconfig-get-properties-function
"0.5")
(defcustom editorconfig-mode-lighter " EditorConfig"
"`editorconfig-mode' lighter string."
:type 'string
:group 'editorconfig)
(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))))))"
:type 'hook
: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-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.
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))))"
:type 'hook
:group 'editorconfig)
(defcustom editorconfig-indentation-alist
;; For contributors: Sort modes in alphabetical order
'((apache-mode apache-indent-level)
(awk-mode c-basic-offset)
(bpftrace-mode c-basic-offset)
(c++-mode c-basic-offset)
(c-mode c-basic-offset)
(cmake-mode cmake-tab-width)
(coffee-mode coffee-tab-width)
(cperl-mode cperl-indent-level)
(crystal-mode crystal-indent-level)
(csharp-mode c-basic-offset)
(css-mode css-indent-offset)
(emacs-lisp-mode lisp-indent-offset)
(enh-ruby-mode enh-ruby-indent-level)
(erlang-mode erlang-indent-level)
(ess-mode ess-indent-offset)
(f90-mode f90-associate-indent
f90-continuation-indent
f90-critical-indent
f90-do-indent
f90-if-indent
f90-program-indent
f90-type-indent)
(feature-mode feature-indent-offset
feature-indent-level)
(fsharp-mode fsharp-continuation-offset
fsharp-indent-level
fsharp-indent-offset)
(groovy-mode groovy-indent-offset)
(haskell-mode haskell-indent-spaces
haskell-indent-offset
haskell-indentation-layout-offset
haskell-indentation-left-offset
haskell-indentation-starter-offset
haskell-indentation-where-post-offset
haskell-indentation-where-pre-offset
shm-indent-spaces)
(haxor-mode haxor-tab-width)
(idl-mode c-basic-offset)
(jade-mode jade-tab-width)
(java-mode c-basic-offset)
(js-mode js-indent-level)
(js-jsx-mode js-indent-level sgml-basic-offset)
(js2-mode js2-basic-offset)
(js2-jsx-mode js2-basic-offset sgml-basic-offset)
(js3-mode js3-indent-level)
(json-mode js-indent-level)
(julia-mode julia-indent-offset)
(kotlin-mode kotlin-tab-width)
(latex-mode . editorconfig-set-indentation-latex-mode)
(lisp-mode lisp-indent-offset)
(livescript-mode livescript-tab-width)
(lua-mode lua-indent-level)
(matlab-mode matlab-indent-level)
(mips-mode mips-tab-width)
(mustache-mode mustache-basic-offset)
(nasm-mode nasm-basic-offset)
(nginx-mode nginx-indent-level)
(nxml-mode nxml-child-indent (nxml-attribute-indent . 2))
(objc-mode c-basic-offset)
(octave-mode octave-block-offset)
(perl-mode perl-indent-level)
;; No need to change `php-mode-coding-style' value for php-mode
;; since we run editorconfig later than it resets `c-basic-offset'.
;; See https://github.com/editorconfig/editorconfig-emacs/issues/116
;; for details.
(php-mode c-basic-offset)
(pike-mode c-basic-offset)
(ps-mode ps-mode-tab)
(pug-mode pug-tab-width)
(puppet-mode puppet-indent-level)
(python-mode . editorconfig-set-indentation-python-mode)
(ruby-mode ruby-indent-level)
(rust-mode rust-indent-offset)
(scala-mode scala-indent:step)
(scss-mode css-indent-offset)
(sgml-mode sgml-basic-offset)
(sh-mode sh-basic-offset sh-indentation)
(slim-mode slim-indent-offset)
(tcl-mode tcl-indent-level
tcl-continued-indent-level)
(terra-mode terra-indent-level)
(typescript-mode typescript-indent-level)
(verilog-mode verilog-indent-level
verilog-indent-level-behavioral
verilog-indent-level-declaration
verilog-indent-level-module
verilog-cexp-indent
verilog-case-indent)
(web-mode (web-mode-indent-style . (lambda (size) 2))
web-mode-attr-indent-offset
web-mode-attr-value-indent-offset
web-mode-code-indent-offset
web-mode-css-indent-offset
web-mode-markup-indent-offset
web-mode-sql-indent-offset
web-mode-block-padding
web-mode-script-padding
web-mode-style-padding)
(yaml-mode yaml-indent-offset))
"Alist of indentation setting methods by modes.
Each element looks like (MODE . FUNCTION) or (MODE . INDENT-SPEC-LIST).
If FUNCTION is provided, it will be called when setting the
indentation. The indent size will be passed.
If INDENT-SPEC-LIST is provided, each element of it must have one of the
following forms:
1. VARIABLE
It means (VARIABLE . 1).
2. (VARIABLE . SPEC)
Setting VARIABLE according to the type of SPEC:
- Integer
The value is (* SPEC INDENT-SIZE);
- Function
The value is (funcall SPEC INDENT-SIZE);
- Any other type.
The value is SPEC.
NOTE: Only the **buffer local** value of VARIABLE will be set."
:type '(alist :key-type symbol :value-type sexp)
:risky t
:group 'editorconfig)
(define-obsolete-variable-alias
'edconf-indentation-alist
'editorconfig-indentation-alist
"0.5")
(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 (eval-when-compile
(rx string-start (or "http" "https" "ftp" "sftp" "rsync") ":")))
"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)
(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_sizefor 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.")
(defconst editorconfig-unset-value "unset"
"String of value used to unset properties in .editorconfig .")
(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-python-mode (size)
"Set `python-mode' indent size to SIZE."
(set (make-local-variable (if (or (> emacs-major-version 24)
(and (= emacs-major-version 24)
(>= emacs-minor-version 3)))
'python-indent-offset
'python-indent))
size)
;; For https://launchpad.net/python-mode
(when (boundp 'py-indent-offset)
(set (make-local-variable 'py-indent-offset) size)))
(defun editorconfig-set-indentation-latex-mode (size)
"Set `latex-mode' indent size to SIZE."
(set (make-local-variable 'tex-indent-basic) size)
(set (make-local-variable 'tex-indent-item) size)
(set (make-local-variable 'tex-indent-arg) (* 2 size))
;; For AUCTeX
(when (boundp 'TeX-brace-indent-level)
(set (make-local-variable 'TeX-brace-indent-level) size))
(when (boundp 'LaTeX-indent-level)
(set (make-local-variable 'LaTeX-indent-level) size))
(when (boundp 'LaTeX-item-indent)
(set (make-local-variable 'LaTeX-item-indent) (- size))))
(defun editorconfig--should-set (size symbol)
"Determines if editorconfig should set SYMBOL using SIZE."
(if (eq symbol 'lisp-indent-offset)
(cond
((eql nil 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."
(make-local-variable 'indent-tabs-mode)
(make-local-variable 'tab-width)
(if (editorconfig-string-integer-p size)
(setq size (string-to-number size))
(when (not (equal size "tab")) (setq size nil)))
(setq tab-width (cond (tab_width (string-to-number tab_width))
((numberp size) size)
(t tab-width)))
(when (equal size "tab")
(setq size tab-width))
(cond ((equal style "space")
(setq indent-tabs-mode nil))
((equal style "tab")
(setq indent-tabs-mode t)))
(when size
(when (featurep 'evil)
(set (make-local-variable 'evil-shift-width) size))
(let ((parent major-mode)
entry)
;; Find the closet parent mode of `major-mode' in
;; `editorconfig-indentation-alist'.
(while (and (not (setq entry (assoc parent editorconfig-indentation-alist)))
(setq parent (get parent 'derived-mode-parent))))
(when entry
(let ((fn-or-list (cdr entry)))
(cond ((functionp fn-or-list) (funcall fn-or-list size))
((listp fn-or-list)
(dolist (elem fn-or-list)
(cond ((and (symbolp elem)
(editorconfig--should-set size elem))
(set (make-local-variable elem) size))
((and (consp elem)
(editorconfig--should-set size (car elem)))
(let ((spec (cdr elem)))
(set (make-local-variable (car elem))
(cond ((functionp spec) (funcall spec size))
((integerp spec) (* spec size))
(t spec))))))))))))))
(defun editorconfig-set-coding-system (end-of-line charset)
"Set buffer coding system by END-OF-LINE and CHARSET."
(let ((eol (cond
((equal end-of-line "lf") 'undecided-unix)
((equal end-of-line "cr") 'undecided-mac)
((equal end-of-line "crlf") 'undecided-dos)
(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))))
(unless (and (eq eol 'undecided)
(eq cs 'undecided))
(set-buffer-file-coding-system (merge-coding-systems
cs
eol)
nil t))))
(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."
(cond
((equal final-newline "true")
;; keep prefs around how/when the nl is added, if set - otherwise add on save
(set (make-local-variable 'require-final-newline) (or require-final-newline t))
(set (make-local-variable 'mode-require-final-newline) (or mode-require-final-newline t)))
((equal final-newline "false")
;; FIXME: Add functionality for actually REMOVING any trailing newlines here!
;; (rather than just making sure we don't automagically ADD a new one)
(set (make-local-variable 'require-final-newline) nil)
(set (make-local-variable 'mode-require-final-newline) nil))))
(defun editorconfig-set-trailing-ws (trim-trailing-ws)
"Set up trimming of trailing whitespace at end of lines by TRIM-TRAILING-WS."
(make-local-variable 'write-file-functions) ;; just current buffer
(when (and (equal trim-trailing-ws "true")
(not buffer-read-only))
;; when true we push delete-trailing-whitespace (emacs > 21)
;; to write-file-functions
(if editorconfig-trim-whitespaces-mode
(funcall editorconfig-trim-whitespaces-mode 1)
(add-to-list
'write-file-functions
'delete-trailing-whitespace)))
(when (or (equal trim-trailing-ws "false")
buffer-read-only)
;; when false we remove every delete-trailing-whitespace
;; from write-file-functions
(when editorconfig-trim-whitespaces-mode
(funcall editorconfig-trim-whitespaces-mode 0))
(setq
write-file-functions
(delete
'delete-trailing-whitespace
write-file-functions))))
(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))))
(defvar editorconfig-file-type-emacs-whitelist
(append (mapcar 'car
editorconfig-indentation-alist)
'(conf-mode))
"List of known `major-mode' that can be used for file_type_emacs value.")
;; Emacs<26 does not have provided-mode-derived-p
(defun editorconfig--provided-mode-derived-p (mode &rest modes)
"Non-nil if MODE is derived from one of MODES.
Uses the `derived-mode-parent' property of the symbol to trace backwards.
If you just want to check `major-mode', use `derived-mode-p'."
(if (fboundp 'provided-mode-derived-p)
(apply 'provided-mode-derived-p mode modes)
(while (and (not (memq mode modes))
(setq mode (get mode 'derived-mode-parent))))
mode))
(defun editorconfig-set-major-mode-from-name (filetype)
"Set buffer `major-mode' by FILETYPE.
FILETYPE should be s string like `\"ini\"`, if not nil or empty string."
(let ((mode (and filetype
(not (string= filetype
""))
(intern (concat filetype
"-mode")))))
(when mode
(if (fboundp mode)
(if (apply 'editorconfig--provided-mode-derived-p mode
editorconfig-file-type-emacs-whitelist)
(editorconfig-apply-major-mode-safely mode)
(display-warning :error (format "Major-mode `%S' is not listed in `%S'"
mode
'editorconfig-file-type-emacs-whitelist)))
(display-warning :error (format "Major-mode `%S' not found"
mode))
nil))))
(defvar editorconfig--apply-major-mode-currently nil
"Used internally.")
(make-variable-buffer-local 'editorconfig--apply-major-mode-currently)
(put 'editorconfig--apply-major-mode-currently
'permanent-local
t)
(defun editorconfig-apply-major-mode-safely (mode)
"Set `major-mode' to MODE.
Normally `editorconfig-apply' will be hooked so that it runs when changing
`major-mode', so there is a possibility that MODE is called infinitely if
MODE is called naively from inside of `editorconfig-apply'.
This funcion will avoid such cases and set `major-mode' safely.
Just checking current `major-mode' value is not enough, because it can be
different from MODE value (for example, `conf-mode' will set `major-mode' to
`conf-unix-mode' or another conf mode)."
(cl-assert mode)
(when (and (not (eq mode
editorconfig--apply-major-mode-currently))
(not (eq mode
major-mode))
(not (derived-mode-p mode)))
(unwind-protect
(progn
(setq editorconfig--apply-major-mode-currently
mode)
(funcall mode))
(setq editorconfig--apply-major-mode-currently
nil))))
(defun editorconfig--find-mode-from-ext (ext &optional filename)
"Get suitable `major-mode' from EXT and FILENAME.
If FILENAME is omitted filename of current buffer is used."
(cl-assert ext)
(cl-assert (not (string= ext "")))
(let* ((name (concat (or filename
buffer-file-name)
"."
ext)))
(assoc-default name
auto-mode-alist
'string-match)))
(defun editorconfig-set-major-mode-from-ext (ext)
"Set buffer `major-mode' by EXT.
EXT should be a string like `\"ini\"`, if not nil or empty string."
(cl-assert buffer-file-name)
(when (and ext
(not (string= ext ""))
(not (string= ext editorconfig-unset-value)))
(let ((mode (editorconfig--find-mode-from-ext ext
buffer-file-name)))
(if mode
(editorconfig-apply-major-mode-safely mode)
(display-warning :error (format "Major-mode for `%s' not found"
ext))
nil))))
(defun editorconfig-call-editorconfig-exec ()
"Call EditorConfig core and return output."
(let* ((filename (buffer-file-name))
(filename (and filename (expand-file-name filename))))
(if filename
(with-temp-buffer
(setq default-directory "/")
(if (eq 0
(call-process editorconfig-exec-path nil t nil filename))
(buffer-string)
(error (buffer-string))))
"")))
(defun editorconfig-parse-properties (props-string)
"Create properties hash table from PROPS-STRING."
(let (props-list properties)
(setq props-list (split-string props-string "\n")
properties (make-hash-table :test 'equal))
(dolist (prop props-list properties)
(let ((key-val (split-string prop " *= *")))
(when (> (length key-val) 1)
(let ((key (intern (car key-val)))
(val (mapconcat 'identity (cdr key-val) "")))
(puthash key val properties)))))))
(defun editorconfig-get-properties-from-exec ()
"Get EditorConfig properties of current buffer.
This function uses value of `editorconfig-exec-path' to get properties."
(if (executable-find editorconfig-exec-path)
(editorconfig-parse-properties (editorconfig-call-editorconfig-exec))
(error "Unable to find editorconfig executable")))
(defun editorconfig-get-properties ()
"Get EditorConfig properties of current buffer.
It calls `editorconfig-get-properties-from-exec' if
`editorconfig-exec-path' is found, otherwise
`editorconfig-core-get-properties-hash'."
(if (and (executable-find editorconfig-exec-path)
(not (file-remote-p buffer-file-name)))
(editorconfig-get-properties-from-exec)
(require 'editorconfig-core)
(editorconfig-core-get-properties-hash)))
;;;###autoload
(defun editorconfig-apply ()
"Get and apply EditorConfig properties to current buffer.
This function ignores `editorconfig-exclude-modes' and
`editorconfig-exclude-regexps', and always applies available properties."
(interactive)
(when buffer-file-name
(condition-case err
(progn
(unless (functionp editorconfig-get-properties-function)
(error "Invalid editorconfig-get-properties-function value"))
(let ((props (funcall editorconfig-get-properties-function)))
(progn
(condition-case err
(run-hook-with-args 'editorconfig-hack-properties-functions props)
(error
(display-warning 'editorconfig-hack-properties-functions
(concat (error-message-string err)
". Abort running hook.")
:warning)))
(setq editorconfig-properties-hash props)
(editorconfig-set-indentation (gethash 'indent_style props)
(gethash 'indent_size props)
(gethash 'tab_width props))
(editorconfig-set-coding-system
(gethash 'end_of_line props)
(gethash 'charset 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))
(editorconfig-set-major-mode-from-name (gethash 'file_type_emacs props))
(editorconfig-set-major-mode-from-ext (gethash 'file_type_ext props))
(condition-case err
(run-hook-with-args 'editorconfig-after-apply-functions props)
(error
(display-warning 'editorconfig-after-apply-functions
(concat (error-message-string err)
". Stop running hook.")
:warning))))))
(error
(display-warning 'editorconfig
(concat (error-message-string err)
". Styles will not be applied.")
: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'."
(when (and major-mode
(not (memq major-mode
editorconfig-exclude-modes))
buffer-file-name
(not (cl-loop for regexp in editorconfig-exclude-regexps
if (string-match regexp buffer-file-name) return t
finally return nil)))
(editorconfig-apply)))
;;;###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
;; See https://github.com/editorconfig/editorconfig-emacs/issues/141 for why
;; not `after-change-major-mode-hook'
(dolist (hook '(change-major-mode-after-body-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
(add-hook hook 'editorconfig-mode-apply)
(remove-hook hook 'editorconfig-mode-apply))))
;; Tools
;; Some useful commands for users, not required for EditorConfig to work
;;;###autoload
(defun editorconfig-find-current-editorconfig ()
"Find the closest .editorconfig file for current file."
(interactive)
(eval-and-compile (require 'editorconfig-core))
(let ((file (editorconfig-core-get-nearest-editorconfig
default-directory)))
(when file
(find-file file))))
;;;###autoload
(defun editorconfig-display-current-properties ()
"Display EditorConfig properties extracted for current buffer."
(interactive)
(if editorconfig-properties-hash
(let (
(buf (get-buffer-create "*EditorConfig Properties*"))
(file buffer-file-name)
(props editorconfig-properties-hash))
(with-current-buffer buf
(erase-buffer)
(insert (format "# EditorConfig for %s\n" file))
(maphash (lambda (k v)
(insert (format "%S = %s\n" k v)))
props))
(display-buffer buf))
(message "Properties are not applied to current buffer yet.")
nil))
;;;###autoload
(defalias 'describe-editorconfig-properties
'editorconfig-display-current-properties)
;;;###autoload
(defun editorconfig-format-buffer()
"Format buffer according to .editorconfig indent_style and indent_width."
(interactive)
(if (string= (gethash 'indent_style editorconfig-properties-hash) "tab")
(tabify (point-min) (point-max)))
(if (string= (gethash 'indent_style editorconfig-properties-hash) "space")
(untabify (point-min) (point-max)))
(indent-region (point-min) (point-max)))
;; (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 (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:
editorconfig-emacs-0.8.1/ert-tests/ 0000775 0000000 0000000 00000000000 13547533462 0017230 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/editorconfig-core-handle.el 0000664 0000000 0000000 00000005255 13547533462 0024414 0 ustar 00root root 0000000 0000000 (require 'editorconfig-core-handle)
(defconst fixtures (concat (file-name-directory load-file-name)
"fixtures/"))
(ert-deftest test-editorconfig-core-handle ()
;; handle.ini
(let* ((conf (concat fixtures
"handle.ini"))
(handle (editorconfig-core-handle conf)))
(should (editorconfig-core-handle-root-p handle))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"b.js"))
'((("key2" . "value2")))))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"a.js"))
'((("key1" . "value1")) (("key2" . "value2"))))))
;; Test twice for checking cache
(let* ((conf (concat fixtures
"handle.ini"))
(handle (editorconfig-core-handle conf)))
(should (editorconfig-core-handle-root-p handle))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"b.js"))
'((("key2" . "value2")))))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"a.js"))
'((("key1" . "value1")) (("key2" . "value2"))))))
;; handle2.ini
(let* ((conf (concat fixtures
"handle2.ini"))
(handle (editorconfig-core-handle conf)))
(should-not (editorconfig-core-handle-root-p handle))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"b.js"))
nil))
(should (equal (editorconfig-core-handle-get-properties handle
(concat fixtures
"a.js"))
'((("key" . "value"))))))
;; For checking various normal whitespace (line breaks, horizontal space, vertical space, etc.)
(let* ((conf (concat default-directory
"ert-tests/whitespaces/example-editorconfig.txt"))
(handle (editorconfig-core-handle conf)))
(should (editorconfig-core-handle-p handle)))
)
editorconfig-emacs-0.8.1/ert-tests/editorconfig-core.el 0000664 0000000 0000000 00000001055 13547533462 0023155 0 ustar 00root root 0000000 0000000 (require 'editorconfig-core)
(ert-deftest test-editorconfig-core--get-handles ()
(let* ((fixtures (concat default-directory
"/ert-tests/fixtures/"))
(dir (concat fixtures
"dir1"))
(confname "parent.ini")
(handles (editorconfig-core--get-handles dir
confname)))
(should (= 2
(length handles)))
(should (editorconfig-core-handle-p (car handles)))
(should (editorconfig-core-handle-p (cadr handles)))))
editorconfig-emacs-0.8.1/ert-tests/editorconfig-fnmatch.el 0000664 0000000 0000000 00000016530 13547533462 0023651 0 ustar 00root root 0000000 0000000 (require 'editorconfig-fnmatch)
(ert-deftest test-editorconfig-fnmatch-p ()
(let ((cases-t
'(("a.js" "a.js")
("/dir/a.js" "/dir/a.js")
("a.js" "*.js")
("a.js" "**.js")
("/dir/a.js" "/dir/*.js")
("/dir/a.js" "/dir/*")
("/dir/sub/a.js" "**.js")
("/dir/sub/a.py" "/dir/**.py")
("a.js" "?.js")
("abc.js" "a?c.js")
("/dir/a.js" "/dir/?.js")
("a.js" "[abc].js")
("b.js" "[abc].js")
("ab.js" "[abc]b.js")
("/dir/a.js" "/dir/[abc].js")
("ab[e/]cd.i" "ab[e/]cd.i")
("a.js" "[a-c].js")
("1.js" "[1-3].js")
("a.js" "[a-c1-3].js")
("1.js" "[a-c1-3].js")
("d.js" "[!abc].js")
("db.js" "[!abc]b.js")
("/dir/d.js" "/dir/[!abc].js")
("d.js" "[!a-c].js")
("a.js" "a.{py,js}")
("a.py" "a.{py,js}")
("/dir/a.py" "/dir/a.{py,js}")
("/dir/a.py" "/dir/a.{py,js}")
("a.js" "*.{py,js}")
("a.py" "*.{py,js}")
("/dir/a.js" "/dir/*.{py,js}")
("/dir/a.py" "/dir/*.{py,js}")
("/dir/sub/a.py" "**.{py,js}")
("/dir/sub/a.py" "/dir/**.{py,js}")
("{single}.b" "{single}.b")
("{.f" "{.f")
("}.f" "}.f")
("a.js" "{a,[0-9]}.js")
("1.js" "{a,[0-9]}.js")
("-3.py" "{-3..3}.{js,py}")
("1.js" "{0..3}.js")
("1.js" "{0..+3}.js")
("-1.js" "{-3..3}.js")
("-1.js" "{-3..3}.js")
("test3" "{test3,test0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003}")
("ab[e/]cd.i" "ab[e/]cd.i")
("ab[/c" "ab[/c")
))
(cases-nil
'(("a.js" "b.js")
("a.js" "*.py")
("/dir/a.js" "/dir/*.py")
("/dir/sub/a.js" "/dir/*.js")
("/dir/a.js" "/sub/**.js")
("/dir/sub/a.js" "/sub/**.js")
("ab.js" "?.js")
("ab.js" "?a.js")
("/dir/ab.js" "/dir/?.js")
("/dir/ab.js" "/dir/?a.js")
("d.js" "[abc].js")
("db.js" "[abc]b.js")
("/dir/d.js" "/dir/[abc].js")
("d.js" "[a-c].js")
("4.js" "[1-3].js")
("d.js" "[a-c1-3].js")
("4.js" "[a-c1-3].js")
("a.js" "[!abc].js")
("ab.js" "[!abc]b.js")
("/dir/a.js" "/dir/[!abc].js")
("a.js" "[!a-c].js")
("a.js" "[!a-c1-3].js")
("1.js" "[!a-c1-3].js")
("a.el" "a.{py,js}")
("a.el" "*.{py,js}")
("/dir/a.el" "/dir/a.{py,js}")
("/dir/a.el" "/dir/*.{py,js}")
("/dir/a.el" "**.{py,js}")
("1.js" "{3..6}.js")
("-1.js" "{0..3}.js")
("-1.js" "{3..-3}.js")
)))
(dolist (args cases-t)
(message "-> t: %S"
`(editorconfig-fnmatch-p ,@args))
(message " Elapsed: %S"
(car (benchmark-run 3 (should (apply 'editorconfig-fnmatch-p
args))))))
(dolist (args cases-nil)
(message "-> nil: %S"
`(editorconfig-fnmatch-p ,@args))
(message " Elapsed: %S"
(car (benchmark-run 3 (should-not (apply 'editorconfig-fnmatch-p
args)))))))
)
editorconfig-emacs-0.8.1/ert-tests/editorconfig.el 0000664 0000000 0000000 00000007414 13547533462 0022234 0 ustar 00root root 0000000 0000000 (require 'editorconfig)
(defun display-warning (type message &optional level buffer-name)
"When testing overwrite this function to throw error when called."
(error "display-warning called: %S %S %S %S"
type
message
level
buffer-name))
(defmacro with-visit-file (path &rest body)
"Visit PATH and evaluate BODY."
(declare (indent 1) (debug t))
`(let ((buf (find-file-noselect ,path)))
(with-current-buffer buf
,@body)
(kill-buffer buf)))
;;; interactive
(ert-deftest interactive-test-01 nil
"This test should not run on Travis"
:tags '(:interactive)
(should t))
;;; noninteractive, will run on Travis
(ert-deftest has-feature-01 nil
"minimally working - provides 'editorconfig"
(should (featurep 'editorconfig)))
(defvar editorconfig-ert-dir
(concat default-directory
"ert-tests/plugin-tests/test_files/"))
(defvar editorconfig-secondary-ert-dir
(concat default-directory
"ert-tests/test_files_secondary/"))
(ert-deftest test-editorconfig nil
"Check if properties are applied."
(editorconfig-mode 1)
(with-visit-file (concat editorconfig-ert-dir
"3_space.txt")
(should (eq tab-width 3))
(should (eq indent-tabs-mode nil)))
(with-visit-file (concat editorconfig-ert-dir
"4_space.py")
(should (eq python-indent-offset 4))
(should (eq tab-width 8))
(should (eq indent-tabs-mode nil)))
(editorconfig-mode -1))
(ert-deftest test-lisp-use-default-indent nil
(editorconfig-mode 1)
(with-visit-file (concat editorconfig-secondary-ert-dir
"2_space.el")
(should (eq lisp-indent-offset 2)))
(let ((editorconfig-lisp-use-default-indent t))
(with-visit-file (concat editorconfig-secondary-ert-dir
"2_space.el")
(should (eq lisp-indent-offset nil))))
(let ((editorconfig-lisp-use-default-indent 2))
(with-visit-file (concat editorconfig-secondary-ert-dir
"2_space.el")
(should (eq lisp-indent-offset nil))))
(let ((editorconfig-lisp-use-default-indent 4))
(with-visit-file (concat editorconfig-secondary-ert-dir
"2_space.el")
(should (eq lisp-indent-offset 2))))
(editorconfig-mode -1))
(ert-deftest test-trim-trailing-ws nil
(editorconfig-mode 1)
(with-visit-file (concat editorconfig-ert-dir
"trim.txt")
(should (memq 'delete-trailing-whitespace
write-file-functions)))
(with-visit-file (concat editorconfig-ert-dir
"trim.txt")
(read-only-mode 1)
(should (not (memq 'delete-trailing-whitespace
write-file-functions))))
(editorconfig-mode -1))
(ert-deftest test-file-type-emacs nil
(editorconfig-mode 1)
(with-visit-file (concat editorconfig-secondary-ert-dir
"c.txt")
(should (eq major-mode 'conf-unix-mode)))
(editorconfig-mode -1))
(ert-deftest test-file-type-ext nil
(editorconfig-mode 1)
(with-visit-file (concat editorconfig-secondary-ert-dir
"a.txt")
(should (eq major-mode 'conf-unix-mode)))
(with-visit-file (concat editorconfig-secondary-ert-dir
"bin/perlscript")
(should (eq major-mode 'perl-mode))
(should (eq perl-indent-level 5)))
(editorconfig-mode -1))
(ert-deftest test-hack-properties-functions nil
(editorconfig-mode 1)
(add-hook 'editorconfig-hack-properties-functions
(lambda (props)
(puthash 'indent_size "5" props)))
(with-visit-file (concat editorconfig-ert-dir
"4_space.py")
(should (eq python-indent-offset 5)))
(setq editorconfig-hack-properties-functions nil)
(editorconfig-mode -1))
editorconfig-emacs-0.8.1/ert-tests/fixtures/ 0000775 0000000 0000000 00000000000 13547533462 0021101 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/fixtures/dir1/ 0000775 0000000 0000000 00000000000 13547533462 0021740 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/fixtures/dir1/parent.ini 0000664 0000000 0000000 00000000020 13547533462 0023722 0 ustar 00root root 0000000 0000000 [a.js]
key=none
editorconfig-emacs-0.8.1/ert-tests/fixtures/handle.ini 0000664 0000000 0000000 00000000110 13547533462 0023025 0 ustar 00root root 0000000 0000000 root = true
[a.js]
key1=value1
[*.js]
key2=value2
[*.py]
key3=value3
editorconfig-emacs-0.8.1/ert-tests/fixtures/handle2.ini 0000664 0000000 0000000 00000000024 13547533462 0023113 0 ustar 00root root 0000000 0000000 [a.js]
key = value
editorconfig-emacs-0.8.1/ert-tests/fixtures/parent.ini 0000664 0000000 0000000 00000000035 13547533462 0023071 0 ustar 00root root 0000000 0000000 root=true
[a.js]
key=value1
editorconfig-emacs-0.8.1/ert-tests/metadata.el 0000664 0000000 0000000 00000000427 13547533462 0021335 0 ustar 00root root 0000000 0000000 (require 'package)
(defvar metadata-el-files nil)
(ert-deftest test-metadata ()
(dolist (el metadata-el-files)
(message "Loading info: %s"
el)
(with-temp-buffer
(insert-file-contents el)
(message "%S"
(package-buffer-info)))))
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/ 0000775 0000000 0000000 00000000000 13547533462 0021666 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/test_files_secondary/ 0000775 0000000 0000000 00000000000 13547533462 0023440 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/test_files_secondary/.editorconfig 0000664 0000000 0000000 00000000247 13547533462 0026120 0 ustar 00root root 0000000 0000000 root = true
[2_space.el]
indent_size = 2
indent_style = tab
[c.txt]
file_type_emacs = conf
[a.txt]
file_type_ext = ini
[/bin/*]
file_type_ext = pl
indent_size = 5
editorconfig-emacs-0.8.1/ert-tests/test_files_secondary/2_space.el 0000664 0000000 0000000 00000000026 13547533462 0025274 0 ustar 00root root 0000000 0000000 (print "hello world")
editorconfig-emacs-0.8.1/ert-tests/whitespaces/ 0000775 0000000 0000000 00000000000 13547533462 0021547 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/whitespaces/example-editorconfig.txt 0000664 0000000 0000000 00000000220 13547533462 0026407 0 ustar 00root root 0000000 0000000 root = true
[*]
# Text encoding name.
charset = utf-8
# Page Break
# Remove trailing whitespace on lines?
trim_trailing_whitespace = true
pax_global_header 0000666 0000000 0000000 00000000064 13375332260 0014516 g ustar 00root root 0000000 0000000 52 comment=c87a3019abc182961bd6c4b420c4d534f006541e
editorconfig-emacs-0.8.1/core-test/ 0000775 0000000 0000000 00000000000 13375332260 0017173 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/.editorconfig 0000664 0000000 0000000 00000000254 13375332260 0021651 0 ustar 00root root 0000000 0000000 [CMakeLists.txt]
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.in]
trim_trailing_whitespace = false
[*.md]
indent_style = space
indent_size = 4
editorconfig-emacs-0.8.1/core-test/.gitignore 0000664 0000000 0000000 00000000250 13375332260 0021160 0 ustar 00root root 0000000 0000000 # Generated by CMake
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
# Generated by CTest
/Testing
CTestTestfile.cmake
# Eclipse
.project
editorconfig-emacs-0.8.1/core-test/CMakeLists.txt 0000664 0000000 0000000 00000010022 13375332260 0021726 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Don't check any language compiler. This project is for EditorConfig Core
# testing only.
project(editorconfig-core-test NONE)
# Where this file lives
set(tests_cmakelists_dir "${CMAKE_CURRENT_LIST_DIR}")
#message(STATUS "Tests are in ${tests_cmakelists_dir}")
# Only when we are using editorconfig-core-test independently should we check
# cmake version, set EDITORCONFIG_CMD as cache string, and enable_testing()
# here.
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
cmake_minimum_required(VERSION 3.5)
set(EDITORCONFIG_CMD "editorconfig" CACHE STRING "editorconfig command.")
enable_testing()
endif()
# The most common test function
function(new_ec_test name ec_file src_file regex)
add_test(${name} ${EDITORCONFIG_CMD} -f ${ec_file}
"${CMAKE_CURRENT_SOURCE_DIR}/${src_file}")
set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
endfunction()
# The tests that requires version specified
function(new_ec_test_version name ec_file src_file regex version)
add_test(${name} ${EDITORCONFIG_CMD} -b ${version} -f ${ec_file}
"${CMAKE_CURRENT_SOURCE_DIR}/${src_file}")
set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
endfunction()
# The tests that requires the full path EditorConfig files
function(new_ec_test_full_ec_file_path name ec_file src_file regex)
add_test(${name} ${EDITORCONFIG_CMD} -f ${ec_file} "${src_file}")
set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
endfunction()
# A test that returns multiple lines of output. CAUTION: filenames used in
# these tests may not contain semicolons.
function(new_ec_test_multiline name ec_file src_file regex)
#message(STATUS "Building multiline test ${name} with tests_cmakelists_dir ${tests_cmakelists_dir}")
#message(STATUS "List dir ${CMAKE_CURRENT_LIST_DIR}, source dir ${CMAKE_CURRENT_SOURCE_DIR}")
add_test(${name} "cmake"
"-D" "EDITORCONFIG_CMD=${EDITORCONFIG_CMD}"
# Since variables aren't autpmatically passed to the inner cmake
"-D" "ECARGS:LIST=-f;${ec_file};${CMAKE_CURRENT_SOURCE_DIR}/${src_file}"
# Note: the semicolons separate list elements.
"-P" "${tests_cmakelists_dir}/cmake/ec_sort.cmake")
set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION
"^[\n]*${regex}$")
# Permit leading \n's because I can't always get rid of them using
# only CMake-provided facilities.
endfunction()
# First, make sure the test harness works.
add_subdirectory(meta)
# Then test the core.
add_subdirectory(glob)
add_subdirectory(properties)
add_subdirectory(parser)
add_subdirectory(filetree)
add_subdirectory(cli)
editorconfig-emacs-0.8.1/core-test/LICENSE.txt 0000664 0000000 0000000 00000002435 13375332260 0021022 0 ustar 00root root 0000000 0000000 Copyright (c) 2011-2018 EditorConfig Team
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
editorconfig-emacs-0.8.1/core-test/README.md 0000664 0000000 0000000 00000002330 13375332260 0020450 0 ustar 00root root 0000000 0000000 This project is a series of testing for [EditorConfig Core][editorconfig]. Please have
[cmake][] installed before using this project.
### Use editorconfig-core-test independently
After installing cmake, switch to the root dir of this project, and execute:
cmake -DEDITORCONFIG_CMD=the_editorconfig_core_cmd_you_want_to_test .
After that, if testing files are generated successfully, execute `ctest .` to
start testings.
### Use editorconfig-core-test in your project as a git submodule
If you are using [git][] and cmake to manage your project, this method should
be suitable for you.
Suppose that you will add editorconfig-core-test repo as a
submodule in your root directory. First add editorconfig-core-test as a
gitsubmodule in your repo by execute:
git submodule add git://github.com/editorconfig/editorconfig-core-test.git tests
Then add the following lines to your project root `CMakeLists.txt`:
```cmake
enable_testing()
set(EDITORCONFIG_CMD the_editorconfig_core_path)
add_subdirectory(tests)
```
Now after executing `cmake .` in you project root dir, you should be able to
run the testings by executing `ctest .`.
[cmake]: http://www.cmake.org
[editorconfig]: http://editorconfig.org
[git]: http://git-scm.com
editorconfig-emacs-0.8.1/core-test/cli/ 0000775 0000000 0000000 00000000000 13375332260 0017742 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/cli/CMakeLists.txt 0000664 0000000 0000000 00000005316 13375332260 0022507 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Tests for version switches
# test --version option returns version information
add_test(test_long_version_switch ${EDITORCONFIG_CMD} --version)
set_tests_properties(test_long_version_switch PROPERTIES
PASS_REGULAR_EXPRESSION
"^EditorConfig.* Version [0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+)?[ \t\n\r]$")
# test -v option returns version information
add_test(test_short_version_switch ${EDITORCONFIG_CMD} -v)
set_tests_properties(test_short_version_switch PROPERTIES
PASS_REGULAR_EXPRESSION
"^EditorConfig.* Version [0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+)?[ \t\n\r]$")
# Test for multiple input files
# when files are specified on command line. The files can appear in either
# order in the output, but each file's output line must be grouped with its
# file header. Handle this by listing both possibilities manually in the regex.
add_test(multiple_files_on_command_line ${EDITORCONFIG_CMD} -f cli.in
"${CMAKE_CURRENT_SOURCE_DIR}/file1.c"
"${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp")
set_tests_properties(multiple_files_on_command_line PROPERTIES
PASS_REGULAR_EXPRESSION
"^(\\[${CMAKE_CURRENT_SOURCE_DIR}/file1.c\\][ \t]*[\n\r]+key1=value1[ \t]*[\n\r]+\\[${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp\\][ \t]*[\n\r]+key2=value2)|(\\[${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp\\][ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+\\[${CMAKE_CURRENT_SOURCE_DIR}/file1.c\\][ \t]*[\n\r]+key1=value1)[ \t\n\r]*$"
)
editorconfig-emacs-0.8.1/core-test/cli/cli.in 0000664 0000000 0000000 00000000070 13375332260 0021036 0 ustar 00root root 0000000 0000000 root = true
[*.c]
key1 = value1
[*.cpp]
key2 = value2
editorconfig-emacs-0.8.1/core-test/cmake/ 0000775 0000000 0000000 00000000000 13375332260 0020253 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/cmake/almostcat.cmake 0000775 0000000 0000000 00000003776 13375332260 0023264 0 ustar 00root root 0000000 0000000 # almostcat.cmake: print the file named in ${WHICH} to **stderr**. Puts an
# extra space at the beginning to suppress CMake's word wrapping. May add
# an extra \n at the end because that's what message() does.
# BSD-2-Clause
# Copyright 2018 Christopher White (cxw42 at GitHub; http://devwrench.com)
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.5)
if("${WHICH}" STREQUAL "")
message(FATAL_ERROR "No WHICH parameter specified")
return()
endif()
#message(FATAL_ERROR " Reading ${WHICH}") # Uncomment for debugging
file(READ "${WHICH}" contents)
# message() will give us an extra \n, so trim one if we can.
string(REGEX REPLACE "(\r\n|\r|\n)$" "" lines "${lines}")
# Print, with a leading space as noted above.
message(" ${contents}")
editorconfig-emacs-0.8.1/core-test/cmake/ec_sort.cmake 0000775 0000000 0000000 00000005577 13375332260 0022734 0 ustar 00root root 0000000 0000000 # ec_sort.cmake: Run editorconfig and sort its output
# For use in editorconfig; see
# https://github.com/editorconfig/editorconfig/issues/375 .
# Call as, e.g.:
# cmake -D EDITORCONFIG_CMD="../editorconfig" -D ECARGS:LIST="-f;.editorconfig;foo" -P cmake/ec_sort.cmake
# EDITORCONFIG_CMD may also be list-valued. EDITORCONFIG_CMD and ECARGS
# are put together on the command line, in that order, and split by CMake.
# BSD-2-Clause
# Copyright 2018 Christopher White (cxw42 at GitHub; http://devwrench.com)
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.5)
# See documentation links at https://stackoverflow.com/q/12802377/2877364
set(tests_cmake_ec_sort_dir "${CMAKE_CURRENT_LIST_DIR}")
list(APPEND CMAKE_MODULE_PATH "${tests_cmake_ec_sort_dir}/../cmake")
include(runandsort)
# Required parameters are in variables: EDITORCONFIG_CMD and ECARGS
if("${EDITORCONFIG_CMD}" STREQUAL "")
message(FATAL_ERROR "No EDITORCONFIG_CMD parameter specified")
return()
endif()
if("${ECARGS}" STREQUAL "")
message(FATAL_ERROR "No ECARGS parameter specified")
return()
endif()
# Uncomment for debugging
#message(FATAL_ERROR " Running ${EDITORCONFIG_CMD} with ${ECARGS}")
run_and_sort(RETVAL lines RETVAL_FAILURE did_fail
CMDLINE ${EDITORCONFIG_CMD} ${ECARGS}
)
if(${did_fail})
message(FATAL_ERROR "${EDITORCONFIG_CMD} ${ECARGS} returned a nonzero exit code")
return()
endif()
# message() will give us an extra \n, so trim one if we can.
string(REGEX REPLACE "(\r\n|\r|\n)$" "" lines "${lines}")
# Output **to stderr**. If we used message(STATUS...), it would print to
# stdout but also emit a leading "--".
message("${lines}")
editorconfig-emacs-0.8.1/core-test/cmake/runandsort.cmake 0000775 0000000 0000000 00000012112 13375332260 0023454 0 ustar 00root root 0000000 0000000 # runandsort.cmake: Run a program and sort its output
# For use in editorconfig; see
# https://github.com/editorconfig/editorconfig/issues/375 .
# BSD-2-Clause
# Copyright 2018 Christopher White (cxw42 at GitHub; http://devwrench.com)
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.5)
# Conventions:
# - "P_*" are parameters parsed using cmake_parse_arguments
# - Any parameter called "RETVAL", "RETVAL_*", or "*_NAME" should be given
# the name of a variable in the caller's scope into which to
# store results.
# Run a program with the given arguments, and return its sorted output as
# a string.
# CAUTION 1: May not produce correct output if any output line includes
# a semicolon, because that is a list separator in CMake.
# CAUTION 2: Depends on sort order of CMake; see discussion at
# https://gitlab.kitware.com/cmake/cmake/issues/18551
#
# Limitations:
# Any \x01 in the string will be corrupted - this routine uses those to work
# around CMake limitations.
# Arguments:
# RETVAL . . . . . . . The name of the variable to store the result in
# CMDLINE . . . . . . . The program to run, and any arguments
# RETVAL_FAILURE . . . . If present, a variable that will be set to TRUE
# if PGM returns a non-zero exit code.
# CAPTURE_STDERR . . . . If present, capture stderr instead of stdout
# TRIM_INITIAL_LEADING_SPACE If present, remove initial spaces from the
# first line. This is to work around a hack
# in almostcat.cmake.
#
# Returns:
# The sorted stdout of PGM, or the FAILURE string if PGM failed.
# PGM's stderr is ignored.
function(run_and_sort)
# Argument parsing
set(option_keywords CAPTURE_STDERR TRIM_INITIAL_LEADING_SPACE)
set(one_value_keywords RETVAL RETVAL_FAILURE)
set(multi_value_keywords CMDLINE ARGS)
cmake_parse_arguments(P "${option_keywords}" "${one_value_keywords}"
"${multi_value_keywords}" ${ARGN})
#message(STATUS "Running ${P_CMDLINE}")
execute_process(COMMAND ${P_CMDLINE}
RESULT_VARIABLE ep_retval
OUTPUT_VARIABLE ep_stdout
ERROR_VARIABLE ep_stderr
)
# Which one are we processing?
if(${P_CAPTURE_STDERR})
set(ep_out "${ep_stderr}")
else()
set(ep_out "${ep_stdout}")
endif()
#message(STATUS "Got stdout =${ep_stdout}=")
#message(STATUS "Got stderr =${ep_stderr}=")
# Early bail on failure
if(NOT("${ep_retval}" EQUAL "0"))
set(${P_RETVAL} "" PARENT_SCOPE)
if("${P_RETVAL_FAILURE}" MATCHES ".") # if we got a name
set(${P_RETVAL_FAILURE} TRUE PARENT_SCOPE)
endif()
return()
endif()
# Trim hack
if(${P_TRIM_INITIAL_LEADING_SPACE})
string(REGEX REPLACE "^[ ]+" "" ep_out "${ep_out}")
endif()
# Change all the semicolons in the output to \x01
string(ASCII 1 ONE)
string(REPLACE ";" "${ONE}" ep_out "${ep_out}")
#message(STATUS "After escaping =${ep_out}=")
# Normalize line endings, just in case
string(REGEX REPLACE "\r|\n|\r\n" "\n" ep_out "${ep_out}")
#message(STATUS "After line-endings =${ep_out}=")
# Turn the string into a list
string(REPLACE "\n" ";" ep_out "${ep_out}")
#message(STATUS "After listifying =${ep_out}=")
# Sort the list
list(SORT ep_out)
# Back to individual lines
string(REPLACE ";" "\n" ep_out "${ep_out}")
#message(STATUS "After back to lines =${ep_out}=")
# And back to semicolons. Note: I am not trying to reverse line endings.
string(REPLACE "${ONE}" ";" ep_out "${ep_out}")
#message(STATUS "After unescaping =${ep_out}=")
# Out to the caller
set(${P_RETVAL} "${ep_out}" PARENT_SCOPE)
#message(STATUS "Returned =${ep_out}=")
endfunction(run_and_sort)
editorconfig-emacs-0.8.1/core-test/filetree/ 0000775 0000000 0000000 00000000000 13375332260 0020772 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/CMakeLists.txt 0000664 0000000 0000000 00000012347 13375332260 0023541 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
cmake_minimum_required(VERSION 3.5)
# Test for EditorConfig file in parent directory
new_ec_test(parent_directory parent_directory.in parent_directory/test.a "^key=value[ \t\n\r]*$")
# Test for EditorConfig file in parent directory and current directory
new_ec_test_multiline(parent_and_current_dir_ML
parent_directory.in parent_directory/test.b
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# Test for file in parent directory and overloaded by file in current directory
new_ec_test(parent_dir_overload parent_directory.in parent_directory/test.c "^key=valueB[ \t\n\r]*$")
# Test for file in parent directory and overloaded by file in current directory and repeated in current directory
new_ec_test(parent_dir_overload_repeat parent_directory.in parent_directory/test.d "^key=value_c[ \t\n\r]*$")
# Test for file in parent directory and overloaded by file in current directory and repeated in current directory, with different patterns
new_ec_test(parent_dir_overload_repeat2 parent_directory.in parent_directory/test.e "^key=value_g[ \t\n\r]*$")
# Test that search stops at root EditorConfig file
new_ec_test(root_file root_file.in root_file/test.a "^[ \t\n\r]*$")
# Test that search stops at root EditorConfig file
new_ec_test(root_file_mixed_case root_file.in root_mixed/test.a "^child=true[ \t\n\r]*$")
# Test that search stops at root EditorConfig file
new_ec_test(root_pattern root_file.in root "^name=root[ \t\n\r]*$")
# Tests path separator match
new_ec_test(path_separator path_separator.in path/separator "^key1=value1[ \t\n\r]*$")
# Windows style path separator in the command line should work on Windows, but
# should not work on other systems (including Cygwin)
if(WIN32)
set(path_separator_backslash_in_cmd_line_regex "^key1=value1[ \t\n\r]*$")
else(WIN32)
set(path_separator_backslash_in_cmd_line_regex "^[ \t\n\r]*$")
endif(WIN32)
new_ec_test_full_ec_file_path(path_separator_backslash_in_cmd_line
path_separator.in "${CMAKE_CURRENT_SOURCE_DIR}\\\\path\\\\separator"
${path_separator_backslash_in_cmd_line_regex})
# Tests path separator match below top of path
new_ec_test(nested_path_separator path_separator.in nested/path/separator "^[ \t\n\r]*$")
# Tests path separator match top of path only
new_ec_test(top_level_path_separator path_separator.in top/of/path "^key2=value2[ \t\n\r]*$")
# Tests path separator match top of path only
new_ec_test(top_level_path_separator_neg path_separator.in not/top/of/path "^[ \t\n\r]*$")
# Test Windows-style path separator (backslash) does not work
new_ec_test(windows_separator path_separator.in windows/separator "^[ \t\n\r]*$")
# Test again that Windows-style path separator (backslash) does not work
new_ec_test(windows_separator2 path_separator.in windows/separator2 "^[ \t\n\r]*$")
# Globs with backslash in it but should be considered as file name on Non-Windows system
if((NOT WIN32) AND (NOT CYGWIN))
new_ec_test(backslash_not_on_windows path_separator.in "windows\\\\separator2" "^key4=value4[ \t\n\r]*$")
endif()
new_ec_test(path_with_special_chars path_with_special_chars.in "path_with_special_[chars/test.a" "^key=value[ \t\n\r]*$")
## " <-- resync the syntax highlighter
# Test the unset value with various common properties
new_ec_test(unset_charset unset.in unset/charset.txt "^charset=unset[ \t\n\r]*$")
new_ec_test(unset_end_of_line unset.in unset/end_of_line.txt "^end_of_line=unset[ \t\n\r]*$")
new_ec_test_multiline(unset_indent_size_ML unset.in unset/indent_size.txt
"indent_size=unset[ \t\n\r]*tab_width=unset[ \t\n\r]*")
new_ec_test(unset_indent_style unset.in unset/indent_style.txt "^indent_style=unset[ \t\n\r]*$")
new_ec_test(unset_insert_final_newline unset.in unset/insert_final_newline.txt "^insert_final_newline=unset[ \t\n\r]*$")
new_ec_test(unset_tab_width unset.in unset/tab_width.txt "^tab_width=unset[ \t\n\r]*$")
new_ec_test(unset_trim_trailing_whitespace unset.in unset/trim_trailing_whitespace.txt "^trim_trailing_whitespace=unset[ \t\n\r]*$")
editorconfig-emacs-0.8.1/core-test/filetree/parent_directory.in 0000664 0000000 0000000 00000000167 13375332260 0024703 0 ustar 00root root 0000000 0000000 root = true
[test.a]
key=value
[test.b]
key1=value1
[test.c]
key=valueA
[test.d]
key=value_a
[test.e]
key=value_e
editorconfig-emacs-0.8.1/core-test/filetree/parent_directory/ 0000775 0000000 0000000 00000000000 13375332260 0024347 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/parent_directory/parent_directory.in 0000664 0000000 0000000 00000000177 13375332260 0030261 0 ustar 00root root 0000000 0000000 [test.b]
key2=value2
[test.c]
key=valueB
[test.d]
key=value_b
[test.d]
key=value_c
[test.e]
key=value_f
[*.e]
key=value_g
editorconfig-emacs-0.8.1/core-test/filetree/path_separator.in 0000664 0000000 0000000 00000000243 13375332260 0024335 0 ustar 00root root 0000000 0000000 ; test for path separator
root=true
[path/separator]
key1=value1
[/top/of/path]
key2=value2
[windows\separator]
key3=value3
[windows\\separator2]
key4=value4
editorconfig-emacs-0.8.1/core-test/filetree/path_with_special_[chars/ 0000775 0000000 0000000 00000000000 13375332260 0025774 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/path_with_special_[chars/path_with_special_chars.in 0000664 0000000 0000000 00000000040 13375332260 0033165 0 ustar 00root root 0000000 0000000 root = true
[test.a]
key=value
editorconfig-emacs-0.8.1/core-test/filetree/root_file.in 0000664 0000000 0000000 00000000062 13375332260 0023302 0 ustar 00root root 0000000 0000000 root = true
[test.a]
key=value
[root]
name=root
editorconfig-emacs-0.8.1/core-test/filetree/root_file/ 0000775 0000000 0000000 00000000000 13375332260 0022754 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/root_file/root_file.in 0000664 0000000 0000000 00000000014 13375332260 0025261 0 ustar 00root root 0000000 0000000 root = true
editorconfig-emacs-0.8.1/core-test/filetree/root_mixed/ 0000775 0000000 0000000 00000000000 13375332260 0023143 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/root_mixed/root_file.in 0000664 0000000 0000000 00000000055 13375332260 0025455 0 ustar 00root root 0000000 0000000 root = TrUe
ignore = false
[*.a]
child=true
editorconfig-emacs-0.8.1/core-test/filetree/unset.in 0000664 0000000 0000000 00000000444 13375332260 0022462 0 ustar 00root root 0000000 0000000 root = true
[charset.txt]
charset=utf-8
[end_of_line.txt]
end_of_line=lf
[indent_size.txt]
indent_size=2
[indent_style.txt]
indent_style=space
[insert_final_newline.txt]
insert_final_newline=true
[tab_width.txt]
tab_width=4
[trim_trailing_whitespace.txt]
trim_trailing_whitespace=true
editorconfig-emacs-0.8.1/core-test/filetree/unset/ 0000775 0000000 0000000 00000000000 13375332260 0022130 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/filetree/unset/unset.in 0000664 0000000 0000000 00000000445 13375332260 0023621 0 ustar 00root root 0000000 0000000
[charset.txt]
charset=unset
[end_of_line.txt]
end_of_line=unset
[indent_size.txt]
indent_size=unset
[indent_style.txt]
indent_style=unset
[insert_final_newline.txt]
insert_final_newline=unset
[tab_width.txt]
tab_width=unset
[trim_trailing_whitespace.txt]
trim_trailing_whitespace=unset
editorconfig-emacs-0.8.1/core-test/glob/ 0000775 0000000 0000000 00000000000 13375332260 0020116 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/glob/CMakeLists.txt 0000664 0000000 0000000 00000026645 13375332260 0022673 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Tests for *
# matches a single characters
new_ec_test_multiline(star_single_ML star.in ace.c "key=value[ \t\n\r]+keyc=valuec[ \t\n\r]*")
# matches zero characters
new_ec_test_multiline(star_zero_ML star.in ae.c "key=value[ \t\n\r]+keyc=valuec[ \t\n\r]*")
# matches multiple characters
new_ec_test_multiline(star_multiple_ML star.in abcde.c "key=value[ \t\n\r]+keyc=valuec[ \t\n\r]*")
# does not match path separator
new_ec_test(star_over_slash star.in a/e.c "^[ \t\n\r]*keyc=valuec[ \t\n\r]*$")
# star after a slash
new_ec_test_multiline(star_after_slash_ML star.in Bar/foo.txt "keyb=valueb[ \t\n\r]+keyc=valuec[ \t\n\r]*")
# star matches a dot file after slash
new_ec_test_multiline(star_matches_dot_file_after_slash_ML star.in Bar/.editorconfig "keyb=valueb[ \t\n\r]+keyc=valuec[ \t\n\r]*")
# star matches a dot file
new_ec_test(star_matches_dot_file star.in .editorconfig "^keyc=valuec[ \t\n\r]*$")
# Tests for ?
# matches a single character
new_ec_test(question_single question.in some.c "^key=value[ \t\n\r]*$")
# does not match zero characters
new_ec_test(question_zero question.in som.c "^[ \t\n\r]*$")
# does not match multiple characters
new_ec_test(question_multiple question.in something.c "^[ \t\n\r]*$")
# Tests for [ and ]
# close bracket inside
new_ec_test(brackets_close_inside brackets.in ].g "^close_inside=true[ \t\n\r]*$")
# close bracket outside
new_ec_test(brackets_close_outside brackets.in b].g "^close_outside=true[ \t\n\r]*$")
# negative close bracket inside
new_ec_test(brackets_nclose_inside brackets.in c.g "^close_inside=false[ \t\n\r]*$")
# negative close bracket outside
new_ec_test(brackets_nclose_outside brackets.in c].g "^close_outside=false[ \t\n\r]*$")
# character choice
new_ec_test(brackets_choice brackets.in a.a "^choice=true[ \t\n\r]*$")
# character choice 2
new_ec_test(brackets_choice2 brackets.in c.a "^[ \t\n\r]*$")
# negative character choice
new_ec_test(brackets_nchoice brackets.in c.b "^choice=false[ \t\n\r]*$")
# negative character choice 2
new_ec_test(brackets_nchoice2 brackets.in a.b "^[ \t\n\r]*$")
# character range
new_ec_test(brackets_range brackets.in f.c "^range=true[ \t\n\r]*$")
# character range 2
new_ec_test(brackets_range2 brackets.in h.c "^[ \t\n\r]*$")
# negative character range
new_ec_test(brackets_nrange brackets.in h.d "^range=false[ \t\n\r]*$")
# negative character range 2
new_ec_test(brackets_nrange2 brackets.in f.d "^[ \t\n\r]*$")
# range and choice
new_ec_test(brackets_range_and_choice brackets.in e.e
"^range_and_choice=true[ \t\n\r]*$")
# character choice with a dash
new_ec_test(brackets_choice_with_dash brackets.in -.f
"^choice_with_dash=true[ \t\n\r]*$")
# slash inside brackets
new_ec_test(brackets_slash_inside1 brackets.in ab/cd.i
"^[ \t\n\r]*$")
new_ec_test(brackets_slash_inside2 brackets.in abecd.i
"^[ \t\n\r]*$")
new_ec_test(brackets_slash_inside3 brackets.in ab[e/]cd.i
"^slash_inside=true[ \t\n\r]*$")
new_ec_test(brackets_slash_inside4 brackets.in ab[/c
"^slash_half_open=true[ \t\n\r]*$")
# Tests for { and }
# word choice
new_ec_test(braces_word_choice1 braces.in test.py "^choice=true[ \t\n\r]*$")
new_ec_test(braces_word_choice2 braces.in test.js "^choice=true[ \t\n\r]*$")
new_ec_test(braces_word_choice3 braces.in test.html "^choice=true[ \t\n\r]*$")
new_ec_test(braces_word_choice4 braces.in test.pyc "^[ \t\n\r]*$")
# single choice
new_ec_test(braces_single_choice braces.in {single}.b "^choice=single[ \t\n\r]*$")
new_ec_test(braces_single_choice_negative braces.in .b "^[ \t\n\r]*$")
# empty choice
new_ec_test(braces_empty_choice braces.in {}.c "^empty=all[ \t\n\r]*$")
new_ec_test(braces_empty_choice_negative braces.in .c "^[ \t\n\r]*$")
# choice with empty word
new_ec_test(braces_empty_word1 braces.in a.d "^empty=word[ \t\n\r]*$")
new_ec_test(braces_empty_word2 braces.in ab.d "^empty=word[ \t\n\r]*$")
new_ec_test(braces_empty_word3 braces.in ac.d "^empty=word[ \t\n\r]*$")
new_ec_test(braces_empty_word4 braces.in a,.d "^[ \t\n\r]*$")
# choice with empty words
new_ec_test(braces_empty_words1 braces.in a.e "^empty=words[ \t\n\r]*$")
new_ec_test(braces_empty_words2 braces.in ab.e "^empty=words[ \t\n\r]*$")
new_ec_test(braces_empty_words3 braces.in ac.e "^empty=words[ \t\n\r]*$")
new_ec_test(braces_empty_words4 braces.in a,.e "^[ \t\n\r]*$")
# no closing brace
new_ec_test(braces_no_closing braces.in {.f "^closing=false[ \t\n\r]*$")
new_ec_test(braces_no_closing_negative braces.in .f "^[ \t\n\r]*$")
# nested braces
new_ec_test(braces_nested1 braces.in word,this}.g "^[ \t\n\r]*$")
new_ec_test(braces_nested2 braces.in {also,this}.g "^[ \t\n\r]*$")
new_ec_test(braces_nested3 braces.in word.g "^nested=true[ \t\n\r]*$")
new_ec_test(braces_nested4 braces.in {also}.g "^nested=true[ \t\n\r]*$")
new_ec_test(braces_nested5 braces.in this.g "^nested=true[ \t\n\r]*$")
# closing inside beginning
new_ec_test(braces_closing_in_beginning braces.in {},b}.h "^closing=inside[ \t\n\r]*$")
# missing closing braces
new_ec_test(braces_unmatched1 braces.in {{,b,c{d}.i "^unmatched=true[ \t\n\r]*$")
new_ec_test(braces_unmatched2 braces.in {.i "^[ \t\n\r]*$")
new_ec_test(braces_unmatched3 braces.in b.i "^[ \t\n\r]*$")
new_ec_test(braces_unmatched4 braces.in c{d.i "^[ \t\n\r]*$")
new_ec_test(braces_unmatched5 braces.in .i "^[ \t\n\r]*$")
# escaped comma
new_ec_test(braces_escaped_comma1 braces.in a,b.txt "^comma=yes[ \t\n\r]*$")
new_ec_test(braces_escaped_comma2 braces.in a.txt "^[ \t\n\r]*$")
new_ec_test(braces_escaped_comma3 braces.in cd.txt "^comma=yes[ \t\n\r]*$")
# escaped closing brace
new_ec_test(braces_escaped_brace1 braces.in e.txt "^closing=yes[ \t\n\r]*$")
new_ec_test(braces_escaped_brace2 braces.in }.txt "^closing=yes[ \t\n\r]*$")
new_ec_test(braces_escaped_brace3 braces.in f.txt "^closing=yes[ \t\n\r]*$")
# escaped backslash
new_ec_test(braces_escaped_backslash1 braces.in g.txt "^backslash=yes[ \t\n\r]*$")
if((NOT WIN32) AND (NOT CYGWIN)) # this case is impossible on Windows.
new_ec_test(braces_escaped_backslash2 braces.in \\\\.txt "^backslash=yes[ \t\n\r]*$")
endif()
new_ec_test(braces_escaped_backslash3 braces.in i.txt "^backslash=yes[ \t\n\r]*$")
# patterns nested in braces
new_ec_test(braces_patterns_nested1 braces.in some.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested2 braces.in abe.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested3 braces.in abf.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested4 braces.in abg.j "^[ \t\n\r]*$")
new_ec_test(braces_patterns_nested5 braces.in ace.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested6 braces.in acf.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested7 braces.in acg.j "^[ \t\n\r]*$")
new_ec_test(braces_patterns_nested8 braces.in abce.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested9 braces.in abcf.j "^patterns=nested[ \t\n\r]*$")
new_ec_test(braces_patterns_nested10 braces.in abcg.j "^[ \t\n\r]*$")
new_ec_test(braces_patterns_nested11 braces.in ae.j "^[ \t\n\r]*$")
new_ec_test(braces_patterns_nested12 braces.in .j "^[ \t\n\r]*$")
# numeric brace range
new_ec_test(braces_numeric_range1 braces.in 1 "^[ \t\n\r]*$")
new_ec_test(braces_numeric_range2 braces.in 3 "^number=true[ \t\n\r]*$")
new_ec_test(braces_numeric_range3 braces.in 15 "^number=true[ \t\n\r]*$")
new_ec_test(braces_numeric_range4 braces.in 60 "^number=true[ \t\n\r]*$")
new_ec_test(braces_numeric_range5 braces.in 5a "^[ \t\n\r]*$")
new_ec_test(braces_numeric_range6 braces.in 120 "^number=true[ \t\n\r]*$")
new_ec_test(braces_numeric_range7 braces.in 121 "^[ \t\n\r]*$")
new_ec_test(braces_numeric_range8 braces.in 060 "^[ \t\n\r]*$")
# alphabetical brace range: letters should not be considered for ranges
new_ec_test(braces_alpha_range1 braces.in {aardvark..antelope} "^words=a[ \t\n\r]*$")
new_ec_test(braces_alpha_range2 braces.in a "^[ \t\n\r]*$")
new_ec_test(braces_alpha_range3 braces.in aardvark "^[ \t\n\r]*$")
new_ec_test(braces_alpha_range4 braces.in agreement "^[ \t\n\r]*$")
new_ec_test(braces_alpha_range5 braces.in antelope "^[ \t\n\r]*$")
new_ec_test(braces_alpha_range6 braces.in antimatter "^[ \t\n\r]*$")
# Tests for **
# test EditorConfig files with UTF-8 characters larger than 127
new_ec_test(utf_8_char utf8char.in "中文.txt" "^key=value[ \t\n\r]*$")
# matches over path separator
new_ec_test(star_star_over_separator1 star_star.in a/z.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator2 star_star.in amnz.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator3 star_star.in am/nz.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator4 star_star.in a/mnz.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator5 star_star.in amn/z.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator6 star_star.in a/mn/z.c "^key1=value1[ \t\n\r]*$")
new_ec_test(star_star_over_separator7 star_star.in b/z.c "^key2=value2[ \t\n\r]*$")
new_ec_test(star_star_over_separator8 star_star.in b/mnz.c "^key2=value2[ \t\n\r]*$")
new_ec_test(star_star_over_separator9 star_star.in b/mn/z.c "^key2=value2[ \t\n\r]*$")
new_ec_test(star_star_over_separator10 star_star.in bmnz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator11 star_star.in bm/nz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator12 star_star.in bmn/z.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator13 star_star.in c/z.c "^key3=value3[ \t\n\r]*$")
new_ec_test(star_star_over_separator14 star_star.in cmn/z.c "^key3=value3[ \t\n\r]*$")
new_ec_test(star_star_over_separator15 star_star.in c/mn/z.c "^key3=value3[ \t\n\r]*$")
new_ec_test(star_star_over_separator16 star_star.in cmnz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator17 star_star.in cm/nz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator18 star_star.in c/mnz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator19 star_star.in d/z.c "^key4=value4[ \t\n\r]*$")
new_ec_test(star_star_over_separator20 star_star.in d/mn/z.c "^key4=value4[ \t\n\r]*$")
new_ec_test(star_star_over_separator21 star_star.in dmnz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator22 star_star.in dm/nz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator23 star_star.in d/mnz.c "^[ \t\n\r]*$")
new_ec_test(star_star_over_separator24 star_star.in dmn/z.c "^[ \t\n\r]*$")
editorconfig-emacs-0.8.1/core-test/glob/braces.in 0000664 0000000 0000000 00000001360 13375332260 0021705 0 ustar 00root root 0000000 0000000 ; test { and }
root=true
; word choice
[*.{py,js,html}]
choice=true
; single choice
[{single}.b]
choice=single
; empty choice
[{}.c]
empty=all
; choice with empty word
[a{b,c,}.d]
empty=word
; choice with empty words
[a{,b,,c,}.e]
empty=words
; no closing brace
[{.f]
closing=false
; nested braces
[{word,{also},this}.g]
nested=true
; closing inside beginning
[{},b}.h]
closing=inside
; opening inside beginning
[{{,b,c{d}.i]
unmatched=true
; escaped comma
[{a\,b,cd}.txt]
comma=yes
; escaped closing brace
[{e,\},f}.txt]
closing=yes
; escaped backslash
[{g,\\,i}.txt]
backslash=yes
; patterns nested in braces
[{some,a{*c,b}[ef]}.j]
patterns=nested
; numeric braces
[{3..120}]
number=true
; alphabetical
[{aardvark..antelope}]
words=a
editorconfig-emacs-0.8.1/core-test/glob/brackets.in 0000664 0000000 0000000 00000001242 13375332260 0022243 0 ustar 00root root 0000000 0000000 ; test [ and ]
root=true
; Character choice
[[ab].a]
choice=true
; Negative character choice
[[!ab].b]
choice=false
; Character range
[[d-g].c]
range=true
; Negative character range
[[!d-g].d]
range=false
; Range and choice
[[abd-g].e]
range_and_choice=true
; Choice with dash
[[-ab].f]
choice_with_dash=true
; Close bracket inside
[[\]ab].g]
close_inside=true
; Close bracket outside
[[ab]].g]
close_outside=true
; Negative close bracket inside
[[!\]ab].g]
close_inside=false
; Negative¬close bracket outside
[[!ab]].g]
close_outside=false
; Slash inside brackets
[ab[e/]cd.i]
slash_inside=true
; Slash after an half-open bracket
[ab[/c]
slash_half_open=true
editorconfig-emacs-0.8.1/core-test/glob/question.in 0000664 0000000 0000000 00000000051 13375332260 0022311 0 ustar 00root root 0000000 0000000 ; test ?
root=true
[som?.c]
key=value
editorconfig-emacs-0.8.1/core-test/glob/star.in 0000664 0000000 0000000 00000000115 13375332260 0021414 0 ustar 00root root 0000000 0000000 ; test *
root=true
[a*e.c]
key=value
[Bar/*]
keyb=valueb
[*]
keyc=valuec
editorconfig-emacs-0.8.1/core-test/glob/star_star.in 0000664 0000000 0000000 00000000161 13375332260 0022446 0 ustar 00root root 0000000 0000000 ; test **
root=true
[a**z.c]
key1=value1
[b/**z.c]
key2=value2
[c**/z.c]
key3=value3
[d/**/z.c]
key4=value4
editorconfig-emacs-0.8.1/core-test/glob/utf8char.in 0000664 0000000 0000000 00000000147 13375332260 0022174 0 ustar 00root root 0000000 0000000 ; test EditorConfig files with UTF-8 characters larger than 127
root = true
[中文.txt]
key = value
editorconfig-emacs-0.8.1/core-test/meta/ 0000775 0000000 0000000 00000000000 13375332260 0020121 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/meta/CMakeLists.txt 0000775 0000000 0000000 00000004120 13375332260 0022661 0 ustar 00root root 0000000 0000000 # tests/meta/CMakeLists.txt: Test of the test harness for editorconfig.
# BSD-2-Clause
# Copyright 2018 Christopher White (cxw42 at GitHub; http://devwrench.com)
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.5)
set(tests_meta_cmakelists_dir "${CMAKE_CURRENT_LIST_DIR}")
# Line separator regex, for convenience
set(L "[ \t\n\r]+")
message(STATUS "meta: Using editorconfig ${EDITORCONFIG_CMD}")
# Test run_and_sort()
add_test(meta_runandsort cmake -P "${tests_meta_cmakelists_dir}/sample.cmake")
set_tests_properties(meta_runandsort PROPERTIES PASS_REGULAR_EXPRESSION
"^[\n]*0${L}a;b${L}b;c${L}b;e${L}b;f${L}c;b;a${L}d${L}$")
# Have to permit leading \n's - I don't know how to get rid of them
# Test the new multiline macro on a simple case
new_ec_test_multiline(meta_multiline meta.in meta.c
"^[\n]*answer=42${L}$")
editorconfig-emacs-0.8.1/core-test/meta/meta.in 0000775 0000000 0000000 00000000023 13375332260 0021375 0 ustar 00root root 0000000 0000000 [meta.c]
answer=42
editorconfig-emacs-0.8.1/core-test/meta/sample.cmake 0000664 0000000 0000000 00000002317 13375332260 0022407 0 ustar 00root root 0000000 0000000 # sample.cmake: Tests run_and_sort to make sure it's working.
cmake_minimum_required(VERSION 3.5)
# See documentation links at https://stackoverflow.com/q/12802377/2877364
set( tests_meta_sample_dir "${CMAKE_CURRENT_LIST_DIR}" )
list( APPEND CMAKE_MODULE_PATH "${tests_meta_sample_dir}/../cmake" )
include( runandsort )
run_and_sort( RETVAL lines RETVAL_FAILURE did_fail
CAPTURE_STDERR TRIM_INITIAL_LEADING_SPACE # since we're using almostcat
CMDLINE "cmake" "-DWHICH:STRING=${tests_meta_sample_dir}/sample.txt"
"-P" "${tests_meta_sample_dir}/../cmake/almostcat.cmake"
) # Don't use cat(1) since we might be running on Windows
if( ${did_fail} )
message( FATAL_ERROR "Program returned a nonzero exit code" )
return()
endif()
# message() will give us an extra \n, so trim one if we can.
string( REGEX REPLACE "(\r\n|\r|\n)$" "" lines "${lines}" )
message( "${lines}" )
# This outputs to stderr, and prints nothing extra except for a \n at the end
# Note that message( STATUS "${lines}" ) doesn't work because it outputs a "--"
# before the actual content.
# You could also use execute_process( COMMAND "echo" "${lines}" )
# or cmake -E echo, but I think the message() call is good enough.
editorconfig-emacs-0.8.1/core-test/meta/sample.txt 0000775 0000000 0000000 00000000032 13375332260 0022141 0 ustar 00root root 0000000 0000000 b;f
b;c
b;e
a;b
c;b;a
d
0
editorconfig-emacs-0.8.1/core-test/parser/ 0000775 0000000 0000000 00000000000 13375332260 0020467 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/parser/CMakeLists.txt 0000664 0000000 0000000 00000015355 13375332260 0023240 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Basic parser tests
# test repeat sections
new_ec_test_multiline(repeat_sections_ML basic.in a.a "option1=value1[ \t]*[\n\r]+option2=value2[ \t\n\r]*")
new_ec_test_multiline(basic_cascade_ML basic.in b.b "option1=c[ \t]*[\n\r]+option2=b[ \t\n\r]*")
# Tests for whitespace parsing
# test no whitespaces in property assignment
new_ec_test(no_whitespace whitespace.in test1.c "^key=value[ \t\n\r]*$")
# test single spaces around equals sign
new_ec_test(single_spaces_around_equals whitespace.in test2.c
"^key=value[ \t\n\r]*$")
# test multiple spaces around equals sign
new_ec_test(multiple_spaces_around_equals whitespace.in test3.c
"^key=value[ \t\n\r]*$")
# test spaces before property name
new_ec_test(spaces_before_property_name whitespace.in test4.c
"^key=value[ \t\n\r]*$")
# test spaces before after property value
new_ec_test(spaces_after_property_value whitespace.in test5.c
"^key=value[ \t\n\r]*$")
# test blank lines between properties
new_ec_test_multiline(blank_lines_between_properties_ML whitespace.in test6.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test spaces in section name
new_ec_test(spaces_in_section_name whitespace.in " test 7 "
"^key=value[ \t\n\r]*$")
# test spaces before section name are ignored
new_ec_test(spaces_before_section_name whitespace.in test8.c
"^key=value[ \t\n\r]*$")
# test spaces after section name
new_ec_test(spaces_after_section_name whitespace.in test9.c "^key=value[ \t\n\r]*$")
# test spaces at beginning of line between properties
new_ec_test_multiline(spaces_before_middle_property_ML whitespace.in test10.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+key3=value3[ \t\n\r]*")
# test colon seperator with no whitespaces in property assignment
new_ec_test(colon_sep_no_whitespace whitespace.in test1.d "^key=value[ \t\n\r]*$")
# test colon seperator with single spaces around equals sign
new_ec_test(colon_sep_single_spaces_around_equals whitespace.in test2.d
"^key=value[ \t\n\r]*$")
# test colon seperator with multiple spaces around equals sign
new_ec_test(colon_sep_multiple_spaces_around_equals whitespace.in test3.d
"^key=value[ \t\n\r]*$")
# test colon seperator with spaces before property name
new_ec_test(colon_sep_spaces_before_property_name whitespace.in test4.d
"^key=value[ \t\n\r]*$")
# test colon seperator with spaces before after property value
new_ec_test(colon_sep_spaces_after_property_value whitespace.in test5.d
"^key=value[ \t\n\r]*$")
# Tests for comment parsing
# test comments ignored after property name
new_ec_test(comments_after_property comments.in test1.c
"^key=value[ \t\n\r]*$")
# test comments ignored after section name
new_ec_test(comments_after_section comments.in test2.c
"^key=value[ \t\n\r]*$")
# test comments ignored before properties
new_ec_test(comment_before_props comments.in test3.c
"^key=value[ \t\n\r]*$")
# test comments ignored between properties
new_ec_test_multiline(comment_between_props_ML comments.in test4.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test semicolons at end of property value are included in value
new_ec_test(semicolon_in_property comments.in test5.c
"^key=value; not comment[ \t\n\r]*$")
# test escaped semicolons are included in property value
new_ec_test(escaped_semicolon_in_property comments.in test6.c
"^key=value ; not comment[ \t\n\r]*$")
# test escaped semicolons are included in section names
new_ec_test(escaped_semicolon_in_section comments.in "test;.c"
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored after property name
new_ec_test(octothorpe_comments_after_property comments.in test7.c
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored after section name
new_ec_test(octothorpe_comments_after_section comments.in test8.c
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored before properties
new_ec_test(octothorpe_comment_before_props comments.in test9.c
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored between properties
new_ec_test_multiline(octothorpe_comment_between_props_ML comments.in test10.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test octothorpe at end of property value are included in value
new_ec_test(octothorpe_in_property comments.in test11.c
"^key=value; not comment[ \t\n\r]*$")
# test escaped octothorpes are included in property value
new_ec_test(escaped_octothorpe_in_property comments.in test12.c
"^key=value ; not comment[ \t\n\r]*$")
# test escaped octothorpes are included in section names
new_ec_test(escaped_octothorpe_in_section comments.in "test\#.c"
"^key=value[ \t\n\r]*$")
# test EditorConfig files with BOM at the head
new_ec_test(bom_at_head bom.in "a.c" "^key=value[ \t\n\r]*$")
# test EditorConfig files with CRLF line separators
new_ec_test(crlf_linesep crlf.in "a.c" "^key=value[ \t\n\r]*$")
# Test max property name and values
new_ec_test(max_property_name limits.in test1
"^00000000000000000000000000000000000000000000000001=50[ \t\n\r]*$")
new_ec_test(max_property_value limits.in test2
"^k255=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001[ \t\n\r]*$")
# Test max section names
new_ec_test(max_section_name_ok limits.in test3 "^key=value[ \t\n\r]*$")
new_ec_test(max_section_name_ignore limits.in test4 "^[ \t\n\r]*$")
editorconfig-emacs-0.8.1/core-test/parser/basic.in 0000664 0000000 0000000 00000000201 13375332260 0022071 0 ustar 00root root 0000000 0000000 [*.a]
option1=value1
; repeat section
[*.a]
option2=value2
[*.b]
option1 = a
option2 = a
[b.b]
option2 = b
[*.b]
option1 = c
editorconfig-emacs-0.8.1/core-test/parser/bom.in 0000664 0000000 0000000 00000000104 13375332260 0021567 0 ustar 00root root 0000000 0000000 ; test EditorConfig files with BOM
root = true
[*]
key = value
editorconfig-emacs-0.8.1/core-test/parser/comments.in 0000664 0000000 0000000 00000001657 13375332260 0022655 0 ustar 00root root 0000000 0000000 ; test comments
root = true
[test1.c]
key=value ; Comment after property is ignored
[test2.c] ; Comment ignored, even with ] character
key=value
[test3.c]
; Comment before properties ignored
key=value
[test4.c]
key1=value1
; Comment between properties ignored
key2=value2
; Semicolon at end of value read as part of value
[test5.c]
key=value; not comment
; Escaped semicolon in value
[test6.c]
key=value \; not comment
; Escaped semicolon in section name
[test\;.c]
key=value
[test7.c]
key=value # Comment after property is ignored
[test8.c] # Comment ignored, even with ] character
key=value
[test9.c]
# Comment before properties ignored
key=value
[test10.c]
key1=value1
# Comment between properties ignored
key2=value2
# Semicolon at end of value read as part of value
[test11.c]
key=value# not comment
# Escaped semicolon in value
[test12.c]
key=value \# not comment
# Escaped semicolon in section name
[test\#.c]
key=value
editorconfig-emacs-0.8.1/core-test/parser/crlf.in 0000664 0000000 0000000 00000000130 13375332260 0021737 0 ustar 00root root 0000000 0000000 ; test EditorConfig files with CRLF line separators
root = true
[*]
key = value
editorconfig-emacs-0.8.1/core-test/parser/limits.in 0000664 0000000 0000000 00000021263 13375332260 0022324 0 ustar 00root root 0000000 0000000 root = true
[test1]
00000000000000000000000000000000000000000000000001=50
000000000000000000000000000000000000000000000000002=51
[test2]
k255=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
k256=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
[{test3,test0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003}]
key=value
[{test4,test00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004}]
key=value
editorconfig-emacs-0.8.1/core-test/parser/whitespace.in 0000664 0000000 0000000 00000001601 13375332260 0023151 0 ustar 00root root 0000000 0000000 ; test whitespace usage
root = true
; no whitespace
[test1.c]
key=value
; spaces around equals
[test2.c]
key = value
; lots of space after equals
[test3.c]
key = value
; spaces before property name
[test4.c]
key=value
; spaces after property value
[test5.c]
key=value
; blank lines between properties
[test6.c]
key1=value1
key2=value2
; spaces in section name
[ test 7 ]
key=value
; spaces before section name
[test8.c]
key=value
; spaces after section name
[test9.c]
key=value
; spacing before middle property
[test10.c]
key1=value1
key2=value2
key3=value3
; colon separator with no spaces
[test1.d]
key:value
; colon separator with space after
[test2.d]
key: value
; colon separator with space before and after
[test3.d]
key : value
; colon separator with spaces befor
[test4.d]
key:value
; colon seperator with spaces after property value
[test5.d]
key:value
editorconfig-emacs-0.8.1/core-test/properties/ 0000775 0000000 0000000 00000000000 13375332260 0021367 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/core-test/properties/CMakeLists.txt 0000664 0000000 0000000 00000006675 13375332260 0024145 0 ustar 00root root 0000000 0000000 #
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# test tab_width default
new_ec_test_multiline(tab_width_default_ML tab_width_default.in test.c
"indent_size=4[ \t]*[\n\r]+indent_style=space[ \t]*[\n\r]+tab_width=4[\t\n\r]*")
# Tab_width should not be set to any value if indent_size is "tab" and
# tab_width is not set
new_ec_test_multiline(tab_width_default_indent_size_tab_ML tab_width_default.in test2.c
"indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*")
# Test indent_size default. When indent_style is "tab", indent_size defaults to
# "tab".
new_ec_test_multiline(indent_size_default_ML indent_size_default.in test.c
"indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*")
# Test indent_size default. When indent_style is "tab", indent_size should have
# no default value for version prior than 0.9.0.
new_ec_test_version(indent_size_default_pre_0_9_0 indent_size_default.in test.c
"^indent_style=tab[ \t\n\r]*$" 0.8.0)
# Test indent_size default. When indent_style is "space", indent_size has no
# default value.
new_ec_test(indent_size_default_space indent_size_default.in test2.c
"^indent_style=space[ \t\n\r]*$")
# Test indent_size default. When indent_style is "tab" and tab_width is set,
# indent_size should default to tab_width
new_ec_test_multiline(indent_size_default_with_tab_width_ML
indent_size_default.in test3.c
"indent_size=2[ \t]*[\n\r]+indent_style=tab[ \t]*[\n\r]+tab_width=2[ \t\n\r]*")
# test that same property values are lowercased (v0.9.0 properties)
new_ec_test_multiline(lowercase_values1_ML lowercase_values.in test1.c
"end_of_line=crlf[ \t]*[\n\r]+indent_style=space[ \t\n\r]*")
# test that same property values are lowercased (v0.9.0 properties)
new_ec_test_multiline(lowercase_values2_ML lowercase_values.in test2.c
"charset=utf-8[ \t]*[\n\r]+insert_final_newline=true[ \t]*[\n\r]+trim_trailing_whitespace=false[ \t\n\r]*$")
# test that same property values are not lowercased
new_ec_test(lowercase_values3 lowercase_values.in test3.c
"^test_property=TestValue[ \t\n\r]*$")
# test that all property names are lowercased
new_ec_test(lowercase_names lowercase_names.in test.c
"^testproperty=testvalue[ \t\n\r]*$")
editorconfig-emacs-0.8.1/core-test/properties/indent_size_default.in 0000664 0000000 0000000 00000000165 13375332260 0025740 0 ustar 00root root 0000000 0000000 root = true
[test.c]
indent_style = tab
[test2.c]
indent_style = space
[test3.c]
indent_style = tab
tab_width = 2
editorconfig-emacs-0.8.1/core-test/properties/lowercase_names.in 0000664 0000000 0000000 00000000132 13375332260 0025062 0 ustar 00root root 0000000 0000000 ; test that property names are lowercased
root = true
[test.c]
TestProperty = testvalue
editorconfig-emacs-0.8.1/core-test/properties/lowercase_values.in 0000664 0000000 0000000 00000000336 13375332260 0025264 0 ustar 00root root 0000000 0000000 ; test property name lowercasing
root = true
[test1.c]
indent_style = Space
end_of_line = CRLF
[test2.c]
insert_final_newline = TRUE
trim_trailing_whitespace = False
charset = UTF-8
[test3.c]
test_property = TestValue
editorconfig-emacs-0.8.1/core-test/properties/tab_width_default.in 0000664 0000000 0000000 00000000153 13375332260 0025367 0 ustar 00root root 0000000 0000000 root = true
[test.c]
indent_style = space
indent_size = 4
[test2.c]
indent_style = tab
indent_size = tab
pax_global_header 0000666 0000000 0000000 00000000064 13326625047 0014522 g ustar 00root root 0000000 0000000 52 comment=cb7ae15d16ab3d72a1139f7a629b11cfe16d972f
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/ 0000775 0000000 0000000 00000000000 13326625047 0021662 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/plugin-tests/.editorconfig 0000664 0000000 0000000 00000000313 13326625047 0024334 0 ustar 00root root 0000000 0000000 ; EditorConfig is awesome: http://EditorConfig.org
root = true
[*.rst]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/.gitignore 0000664 0000000 0000000 00000000274 13326625047 0023655 0 ustar 00root root 0000000 0000000 test_files/lf.txt
test_files/crlf.txt
test_files/cr.txt
test_files/utf-16be.txt
test_files/utf-16le.txt
test_files/utf-8-bom.txt
test_files/with_newline.txt
test_files/without_newline.txt
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/LICENSE 0000664 0000000 0000000 00000044353 13326625047 0022700 0 ustar 00root root 0000000 0000000 Creative Commons Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/README.rst 0000664 0000000 0000000 00000002154 13326625047 0023353 0 ustar 00root root 0000000 0000000 Tests for EditorConfig Plugins
==============================
There is currently no way to automate tests for EditorConfig plugins like there
is for the EditorConfig core libraries. This repository contains instructions
to help developers manually test their EditorConfig plugins.
Running Tests
-------------
The ``tests`` directory contains instructions for testing various EditorConfig
properties. The ``test_files`` directory contains the test files referenced in
these instructions.
Tests should be run by opening up each relevant file in the ``tests``
directory, running through the tests in the file and verifying that the
expected behavior is observed.
After running each test the files in the git repository should be reverted and
any newly created files should be deleted. To revert files in the git
repository use:
git checkout -- test_files/
License
-------
This work is licensed under the Creative Commons Attribution 4.0 International
License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/templates/ 0000775 0000000 0000000 00000000000 13326625047 0023660 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/plugin-tests/templates/linux.editorconfig 0000664 0000000 0000000 00000000243 13326625047 0027414 0 ustar 00root root 0000000 0000000 ; This file is the EditorConfig template file for Linux style.
[*]
indent_style = tab
tab_width = 8
charset = utf-8
insert_final_newline = true
end_of_line = lf
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/ 0000775 0000000 0000000 00000000000 13326625047 0024023 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/.editorconfig 0000664 0000000 0000000 00000001444 13326625047 0026503 0 ustar 00root root 0000000 0000000 root = true
[3_space.txt]
indent_style = space
indent_size = 3
tab_width = 3
[4_space.py]
indent_style = space
indent_size = 4
tab_width = 8
[space.txt]
indent_style = space
indent_size = tab
[tab.txt]
indent_style = tab
[4_tab.txt]
indent_style = tab
indent_size = 4
tab_width = 4
[4_tab_width_of_8.txt]
indent_style = tab
indent_size = 4
tab_width = 8
[lf.txt]
end_of_line = lf
[crlf.txt]
end_of_line = crlf
[cr.txt]
end_of_line = cr
[utf-8.txt]
charset = utf-8
[utf-8-bom.txt]
charset = utf-8-bom
[utf-16be.txt]
charset = utf-16be
[utf-16le.txt]
charset = utf-16le
[latin1.txt]
charset = latin1
[with_newline.txt]
insert_final_newline = true
[without_newline.txt]
insert_final_newline = false
[trim.txt]
trim_trailing_whitespace = true
[no_trim.txt]
trim_trailing_whitespace = false
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/3_space.txt 0000664 0000000 0000000 00000000127 13326625047 0026101 0 ustar 00root root 0000000 0000000 this line is indented 6 characters
123456789
this line is indented 3 characters
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/4_space.py 0000664 0000000 0000000 00000000167 13326625047 0025717 0 ustar 00root root 0000000 0000000 def main():
if True:
print "single 8 column tab for indentation"
print "this lines up with previous line"
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/4_tab.txt 0000664 0000000 0000000 00000000013 13326625047 0025547 0 ustar 00root root 0000000 0000000 0123456789
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/4_tab_width_of_8.txt 0000664 0000000 0000000 00000000013 13326625047 0027661 0 ustar 00root root 0000000 0000000 unindented
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/latin1.txt 0000664 0000000 0000000 00000000026 13326625047 0025752 0 ustar 00root root 0000000 0000000 This is a Latin1 file
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/no_trim.txt 0000664 0000000 0000000 00000000120 13326625047 0026224 0 ustar 00root root 0000000 0000000 This line ends in whitespace
So does this one
And this one
But not this one
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/space.txt 0000664 0000000 0000000 00000000021 13326625047 0025650 0 ustar 00root root 0000000 0000000 tab indentation
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/tab.txt 0000664 0000000 0000000 00000000000 13326625047 0025320 0 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/trim.txt 0000664 0000000 0000000 00000000120 13326625047 0025530 0 ustar 00root root 0000000 0000000 This line ends in whitespace
So does this one
And this one
But not this one
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/test_files/utf-8.txt 0000664 0000000 0000000 00000000025 13326625047 0025524 0 ustar 00root root 0000000 0000000 This is a UTF-8 file
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/ 0000775 0000000 0000000 00000000000 13326625047 0023024 5 ustar 00root root 0000000 0000000 editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/charset.rst 0000664 0000000 0000000 00000004612 13326625047 0025212 0 ustar 00root root 0000000 0000000 Tests for Character Set Property
==============================
The following tests are for the ``charset`` EditorConfig property.
Verifying Character Set
-----------------------
In general the character set used in a file may not be conclusively verified,
but it can often be verified with reasonable accuracy. The ``file`` command
can be used to guess the character set used.
Verifying LF newlines:
``file test_files/latin1.txt`` should return something like:
test_files/utf-8.txt: ASCII text
``file test_files/utf-8.txt`` should return something like:
test_files/utf-8.txt: UTF-8 Unicode text
``file test_files/utf-8-bom.txt`` should return something like:
test_files/utf-8-bom.txt: UTF-8 Unicode (with BOM) text
``file test_files/utf-16be.txt`` should return something like:
test_files/utf-16be.txt: Big-endian UTF-16 Unicode text
``file test_files/utf-16le.txt`` should return something like:
test_files/utf-16le.txt: Little-endian UTF-16 Unicode text, with no line terminators
Note that UTF-8 files without any unicode characters are indistinguishable from
Latin1 files.
Tests for Newlines
------------------
To ensure that the newlines added to files are not affected by the newlines
already present in the files, new files should be created.
Latin1 Character Set
~~~~~~~~~~~~~~~~~~~~
1. Open file ``latin1.txt``.
2. Add a line without unicode characters to the file and save it.
3. Confirm that the file is an ASCII file.
Latin1 Character Set with Unicode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open file ``latin1.txt``.
1. Add this line to the file: "Here is a unicode character: ★" and save it
2. Confirm that either:
a. an error was raised
b. the file was saved as UTF-8 without BOM
UTF-8 Character Set
~~~~~~~~~~~~~~~~~~~
1. Open file ``utf-8.txt``.
2. Add this line to the file: "Here is a unicode character: ★" and save it
3. Confirm that the file was saved as UTF-8 (without BOM)
UTF-8 with BOM Character Set
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Create file ``utf-8-bom.txt``.
2. Add a line to the file and save it
3. Confirm that the file was saved as UTF-8 with BOM
UTF-16BE Character Set
~~~~~~~~~~~~~~~~~~~~~~
1. Create file ``utf-16be.txt``.
2. Add a line to the file and save it
3. Confirm that the file was saved as UTF-16BE
UTF-16LE Character Set
~~~~~~~~~~~~~~~~~~~~~~
1. Create file ``utf-16le.txt``.
2. Add a line to the file and save it
3. Confirm that the file was saved as UTF-16LE
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/end_of_line.rst 0000664 0000000 0000000 00000002334 13326625047 0026021 0 ustar 00root root 0000000 0000000 Tests for End of Line Property
==============================
The following tests are for the ``end_of_line`` EditorConfig property.
Verifying Newline Style
-----------------------
The style of newlines in a file can be verified with the ``file`` command.
Verifying LF newlines:
``file test_files/lf.txt`` should return something like:
test_files/lf.txt: ASCII text
``file test_files/crlf.txt`` should return something like:
test_files/crlf.txt: ASCII text, with CRLF line terminators
``file test_files/cr.txt`` should return something like:
test_files/cr.txt: ASCII text, with CR line terminators
Tests for Newlines
------------------
To ensure that the newlines added to files are not affected by the newlines
already present in the files, new files should be created.
Unix-style Newlines
~~~~~~~~~~~~~~~~~~~
1. Create file ``lf.txt``.
2. Add two lines to the the file and save it.
3. Confirm that new lines use LF
Windows-style Newlines
~~~~~~~~~~~~~~~~~~~~~~
1. Open ``crlf.txt``.
2. Add a new line to the end of the file and save it.
3. Confirm that new lines use CRLF
Old Mac-style Newlines
~~~~~~~~~~~~~~~~~~~~~~
1. Open ``cr.txt``.
2. Add a new line to the end of the file and save it.
3. Confirm that new lines use CR
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/indentation.rst 0000664 0000000 0000000 00000005067 13326625047 0026102 0 ustar 00root root 0000000 0000000 Tests for Indentation Properties
================================
The following tests are for ``indent_style``, ``indent_size``, and
``tab_width`` EditorConfig properties.
Space-based indentation
-----------------------
The following tests are for space-based indentation (``indent_style = space``).
3-space indentation
~~~~~~~~~~~~~~~~~~~
1. Open ``3_space.txt``.
2. Add a new line to the end of the file and indent it twice.
3. Confirm that new line is indented 6 spaces.
4. Confirm that mixed indentation on first line of file is indented 6 columns.
4-space indentation with tab width of 8
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open ``4_space.py``.
2. Add a new line of code to the end of the file and indent it once.
3. Confirm that new last line is indented with 4 spaces.
4. Add a second new line of code to the end of the file and indent it twice.
5. Confirm that new last line is indented with 8 spaces.
6. Confirm that indentation on third line of file uses a single 8 column tab.
Space-based indentation with no size specified
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open ``space.txt``.
2. Confirm that no errors occur and EditorConfig file is read properly.
3. Add a new line of text to the end of the file and indent it once.
4. Confirm that new last line is indented with spaces.
5. Confirm that new last line indentation is the same size as the first line.
Tab-based indentation
-----------------------
The following tests are for tab-based indentation (``indent_style = tab``).
Tab-based indentation with no size specified
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open ``tab.txt``.
2. Confirm that no errors occur and EditorConfig file is read properly.
3. Add a new line of text to the end of the file and indent it once.
4. Confirm that new last line is indented with a single tab.
Tab-based indentation with size of 4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open ``4_tab.txt``.
2. Confirm that no errors occur and EditorConfig file is read properly.
3. Add a new line of text to the end of the file and indent it once.
4. Confirm that new last line is indented with a single tab.
Tab-based indentation with size of 4 and tab width of 8
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Open ``4_tab_width_of_8.txt``.
2. Confirm that no errors occur and EditorConfig file is read properly.
3. Add a new line of text to the end of the file and indent it once.
4. Confirm that new last line is indented with 4 spaces.
5. Add a second new line of text to the end of the file and indent it twice.
6. Confirm that new last line is indented with a single tab.
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/insert_final_newline.rst 0000664 0000000 0000000 00000001627 13326625047 0027762 0 ustar 00root root 0000000 0000000 Insert Final Newline Property
=============================
The following tests are for the ``insert_final_newline`` EditorConfig property.
Checking for Final Newline
--------------------------
Files can be tested for a newline at the end with the ``file`` command.
``file test_files/with_newline.txt`` should return something like:
test_files/with_newline.txt: ASCII text
``file test_files/without_newline.txt`` should return something like:
test_files/without_newline.txt: ASCII text, with no line terminators
Tests for Newline at end of File
--------------------------------
Test for Newline
~~~~~~~~~~~~~~~~
1. Create file with_newline.txt
2. Add a single line to the file and save the file
3. Confirm that file ends in a newline
Test for No Newline
~~~~~~~~~~~~~~~~~~~
1. Create file without_newline.txt
2. Add a single line to the file and save the file
3. Confirm that file does not end in a newline
editorconfig-emacs-0.8.1/ert-tests/plugin-tests/tests/trim_trailing_whitespace.rst 0000664 0000000 0000000 00000001203 13326625047 0030632 0 ustar 00root root 0000000 0000000 Trim Trailing Whitespace Property
=================================
The following tests are for the ``trim_trailing_whitespace`` EditorConfig
property.
Finding Trailing Whitespace
---------------------------
The following command can be used to locate lines with trailing whitespace in a
file named file.txt:
grep "[ \t]$" file.txt
Trimming Whitespace
-------------------
1. Open trim.txt
2. Add a line to the file and save the file
3. Confirm that no lines end with whitespace
Not Trimming Whitespace
-----------------------
1. Open no_trim.txt
2. Add a line to the file and save the file
3. Confirm that some lines end with whitespace