emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/drupal-mode 996081be40 157/308: Merge branch 'release/0.3.


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 996081be40 157/308: Merge branch 'release/0.3.0'
Date: Tue, 25 Jan 2022 10:59:42 -0500 (EST)

branch: elpa/drupal-mode
commit 996081be40390ea1f78a95fce931c2a0272f4394
Merge: 24bae05adf 36a8caff76
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Merge branch 'release/0.3.0'
---
 .gitignore              |   4 +
 CONTRIBUTING.md         |   2 +
 COPYING                 | 674 ++++++++++++++++++++++++++++++++++++++++++++++++
 Cask                    |   3 +
 Makefile                |  64 +++--
 README                  | 162 ------------
 README.md               |  50 ++--
 drupal-mode-pkg.el      |   3 -
 drupal-mode.el          | 511 ++++++++++++++++++++++++++++++------
 drupal-mode.info        | 310 ----------------------
 drupal-tests.el         |  54 ++++
 drupal/autoinsert.el    | 102 ++++++++
 drupal/emacs-drush.el   |  67 +++++
 drupal/etags.el         |  54 +++-
 drupal/flycheck.el      |  76 ++++++
 drupal/flymake-phpcs.el |  59 ++++-
 drupal/gtags.el         |  54 +++-
 drupal/ispell.el        |  25 +-
 drupal/pcomplete.el     |  65 +++++
 drupal/phpcs.el         |  69 +++++
 drupal/webjump.el       |  35 +++
 drush-make-mode.el      |  66 +++++
 22 files changed, 1892 insertions(+), 617 deletions(-)

diff --git a/.gitignore b/.gitignore
index c749fdf253..31457856c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,6 @@
 *.elc
+drupal-mode.info
 drupal-mode-*.tar
+drupal-mode-pkg.el
+README
+.cask
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..7b94d9e576
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,2 @@
+Feature requests, ideas, bug reports, and pull request are more than
+welcome!
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000000..94a9ed024d
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ 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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 <http://www.gnu.org/licenses/>.
+
+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:
+
+    <program>  Copyright (C) <year>  <name of author>
+    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
+<http://www.gnu.org/licenses/>.
+
+  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
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Cask b/Cask
new file mode 100644
index 0000000000..efad37c367
--- /dev/null
+++ b/Cask
@@ -0,0 +1,3 @@
+(package-file "drupal-mode.el")
+
+(source marmalade)
diff --git a/Makefile b/Makefile
index 00202591c2..fa4603b339 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,56 @@
-.PHONY: all elpa-package elpa-install
+# This file is part of Drupal mode.
 
-VERSION=0.2.0
+# Copyright (C) 2012, 2013 Arne Jørgensen
 
-all: drupal-mode.info README
+# Author: Arne Jørgensen <arne@arnested.dk>
 
-drupal-mode.info: README.md
-       pandoc -t texinfo $^ | makeinfo -o $@
+# Drupal mode 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.
+
+# Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+.PHONY: all test clean install
+
+CASK?=cask
+EMACS?=emacs
+TAR?=bsdtar
+PANDOC?=pandoc --atx-headers
+
+VERSION?=$(shell $(CASK) version)
+
+ARCHIVE_NAME=drupal-mode
+PACKAGE_NAME=$(ARCHIVE_NAME)-$(VERSION)
+
+all: $(PACKAGE_NAME).tar
+
+test:
+       $(CASK) install
+       $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch -L $(PWD) 
-l drupal-tests -f ert-run-tests-batch-and-exit
+
+$(ARCHIVE_NAME).info: README.md
+       $(PANDOC) -t texinfo $^ | makeinfo -o $@
 
 README: README.md
-       pandoc --atx-headers -t plain -o $@ $^
+       $(PANDOC) -t plain -o $@ $^
+
+$(ARCHIVE_NAME)-pkg.el: $(ARCHIVE_NAME).el
+       $(CASK) package
 
 # create a tar ball in package.el format for uploading to 
http://marmalade-repo.org
-elpa-package: README drupal-mode.el drupal-mode-pkg.el drupal-mode.info dir 
drupal/*.el
-       tar -c -s "@^@drupal-mode-${VERSION}/@" -f drupal-mode-${VERSION}.tar $^
-
-elpa-install: elpa-package
-       emacs --batch --eval "(progn \
-               (require 'package)\
-               (add-to-list 'package-archives '(\"marmalade\" . 
\"http://marmalade-repo.org/packages/\";))\
-               (package-initialize)\
-               (package-install-file \"`pwd`/drupal-mode-${VERSION}.tar\"))"
+$(PACKAGE_NAME).tar: README $(ARCHIVE_NAME).el $(ARCHIVE_NAME)-pkg.el 
$(ARCHIVE_NAME).info dir drupal/*.el drupal-tests.el drush-make-mode.el
+       COPYFILE_DISABLE=1 $(TAR) -c -s "@^@$(PACKAGE_NAME)/@" -f 
$(PACKAGE_NAME).tar $^
+
+install: $(PACKAGE_NAME).tar
+       $(EMACS) --batch -l package -f package-initialize --eval 
"(package-install-file \"$(PWD)/$(PACKAGE_NAME).tar\")"
+
+clean:
+       $(RM) $(ARCHIVE_NAME).info $(ARCHIVE_NAME)-*.tar $(ARCHIVE_NAME)-pkg.el 
README
+       $(RM) -r .cask
diff --git a/README b/README
deleted file mode 100644
index 46891b8adb..0000000000
--- a/README
+++ /dev/null
@@ -1,162 +0,0 @@
-Drupal mode
-
-Drupal mode is an advanced minor mode for developing in Drupal.
-
-The approach taken is somewhat different from other attempts at creating
-a Drupal mode.
-
-This mode is a minor mode and can be applied to all files in a Drupal
-project no matter what major mode they use - whether it be php-mode or
-something else.
-
-Besides giving access to general functionality in all modes (i.e.
-clearing cache through Drush) it will also adapt it self to the major
-mode to enable functionality only for that particular major mode (i.e.
-adhering to Drupals PHP coding standards only in php-mode).
-
-Drupal mode will try not to enforce specific ways of working with Emacs
-on to you. Emacs can be extended in a million different ways and you
-should use the parts and extensions that fit you and your working
-habits.
-
-If Drupal mode recognizes you using an extension that it knows about it
-will adapt the extension to be useful in Drupal mode and with Drupal.
-I.e. it will recognize if you have loaded etags support and setup your
-buffers to use the TAGS file in your DRUPAL_ROOT folder.
-
-Drupal mode won't embed other libraries but will suggest some (see
-below) and depend on a few through the packaging system (i.e. php-mode).
-
-Installation
-
-The easiest way to install Drupal mode is probably to install it via the
-ELPA archive at Marmalade.
-
-ELPA (package.el) is part of Emacs 24. For Emacs 23 see Marmalade for
-installation instructions.
-
-Features of Drupal mode
-
-Drupal Coding Standards
-
-Drupal mode will make you write code that adheres to Drupals coding
-standards.
-
-It does this by:
-
-Indentation
-
-In php-mode code will be indented according to Drupals coding standards.
-If not it is considered a bug!
-
-Fixing line endings
-
-If your files are not written with unix style line endings Drupal mode
-will ask your to convert them to unix style line endings on saving
-buffers.
-
-This behavior can be customized be the variable
-drupal-convert-line-ending.
-
-The default is to ask if you want the file to be converted. By asking
-you we hopefully won't trick you into making a commit in your version
-control system consisting of a bunch of functionality changes with every
-line also changed by a new line ending. If you have ever read 1000 of
-commits/diffs you will appreciate this.
-
-Delete trailing white space
-
-In Drupal mode buffers we will enable Emacs' delete-trailing-whitespace.
-
-This behavior can be customized be the variable
-drupal-delete-trailing-whitespace.
-
-Search documentation
-
-You can search Drupal documentation for the symbol at point by issuing
-C-c d f or M-x drupal-search-documentation or from the Drupal menu
-entry.
-
-Files that are part of a Drupal project will try to identify the used
-version of Drupal core and look up the documentation for the
-corresponding version at http://api.drupal.org.
-
-If the symbol at point is believed to be a drush command the
-documentation will be looked up at http://api.drush.org instead. If
-Drush is installed it will identify the version of Drush and look up the
-documentation for that version.
-
-You can change where to search for documentation be customizing
-drupal-search-url (besides api.drupal.org it also has a predefined
-setting for api.drupalcontrib.org) and drupal-drush-search-url.
-
-Clearing all caches
-
-If Drush is installed you can issue a drush cc all from within Emacs by
-issuing C-c d c or M-x drupal-drush-cache-clear or from the Drupal menu
-entry.
-
-Drush editing minor mode
-
-If the buffer you visit is believe to be a Drush command (we think it is
-its name or path contains "drush") we will also enter a Drush minor
-mode.
-
-There is currently no functionality connected to drupal-drush-mode.
-
-Emacs modes and extensions that Drupal mode will enhance
-
-etags
-
-If you have generated a TAGS file in your DRUPAL_ROOT folder Drupal mode
-will setup all buffers running drupal-mode to set tags-file-name to
-point to that TAGS file.
-
-Etags is a builtin part of Emacs.
-
-GNU Globals / gtags
-
-If you load GNU Globals / gtags support in Emacs then Drupal mode will
-set gtags-rootdir to your DRUPAL_ROOT.
-
-ispell
-
-If ispell.el is loaded in Emacs then Drupal mode will set the language
-of your Drupal mode buffers to american as stated in Drupals coding
-standards.
-
-ispell.el is a builtin part of Emacs. A external program must be
-installed to run the actual spell checking, i.e. ispell, aspell, or
-hunspell.
-
-flymake-phpcs
-
-If support for flymake-phpcs.el is loaded in emacs and you have
-installed Drupal Code Sniffer rules then Drupal mode will enable
-flymake-phpcs under php-mode.
-
-For this to work you need:
-
--   PHP CodeSniffer
--   flymake-phpcs.el
--   Drupal Code Sniffer rules
-
-Making all of them work together can be a bit of a puzzle. Especially
-notice the need to run phpcs through a wrapper you get with
-flymake-phpcs.el.
-
-Other takes on a Drupal mode
-
-There are quite a few attempts at writing a Drupal mode out in the wild:
-
--   Search Github for drupal-mode
--   At drupal.org:
-    -   http://drupal.org/sandbox/bartlantz/1405156
-    -   http://drupal.org/project/emacs
-
-All of them more or less based on Configuring Emacs.
-
-Development of Drupal mode
-
-Drupal mode is actively developed at GitHub. Feature requests, ideas,
-bug reports, and pull request are more that welcome!
diff --git a/README.md b/README.md
index 8ef6ccc904..e1f24806d0 100644
--- a/README.md
+++ b/README.md
@@ -14,13 +14,13 @@ Besides giving access to general functionality in all modes
 major mode to enable functionality only for that particular major mode
 (i.e. adhering to Drupals PHP coding standards only in php-mode).
 
-Drupal mode will try not to enforce specific ways of working with
+Drupal mode will not try to enforce specific ways of working with
 Emacs on to you. Emacs can be extended in a million different ways and
 you should use the parts and extensions that fit *you* and *your*
 working habits.
 
-If Drupal mode recognizes you using an extension that it knows about
-it will adapt the extension to be useful in Drupal mode and with
+If Drupal mode recognizes you are using an extension that it knows
+about it will adapt the extension to be useful in Drupal mode and with
 Drupal. I.e. it will recognize if you have loaded etags support and
 setup your buffers to use the TAGS file in your DRUPAL_ROOT folder.
 
@@ -57,8 +57,8 @@ it is considered a bug!
 
 #### Fixing line endings
 
-If your files are not written with unix style line endings Drupal mode
-will ask your to convert them to unix style line endings on saving
+If your files are not written with Unix style line endings Drupal mode
+will ask your to convert them to Unix style line endings on saving
 buffers.
 
 This behavior can be customized be the variable
@@ -83,19 +83,19 @@ This behavior can be customized be the variable
 ### Search documentation
 
 You can search Drupal documentation for the symbol at point by issuing
-`C-c d f` or `M-x drupal-search-documentation` or from the Drupal
+`C-c C-v C-d` or `M-x drupal-search-documentation` or from the Drupal
 menu entry.
 
 Files that are part of a Drupal project will try to identify the used
 version of Drupal core and look up the documentation for the
 corresponding version at http://api.drupal.org.
 
-If the symbol at point is believed to be a drush command the
+If the symbol at point is believed to be a Drush command the
 documentation will be looked up at http://api.drush.org instead. If
 Drush is installed it will identify the version of Drush and look up
-the documentation for that version.
+the documentation for the installed version of Drush.
 
-You can change where to search for documentation be customizing
+You can change where to search for documentation by customizing
 `drupal-search-url` (besides api.drupal.org it also has a predefined
 setting for api.drupalcontrib.org) and `drupal-drush-search-url`.
 
@@ -103,15 +103,15 @@ setting for api.drupalcontrib.org) and 
`drupal-drush-search-url`.
 ### Clearing all caches
 
 If Drush is installed you can issue a `drush cc all` from within Emacs
-by issuing `C-c d c` or `M-x drupal-drush-cache-clear` or from the
+by issuing `C-c C-v C-c` or `M-x drupal-drush-cache-clear` or from the
 Drupal menu entry.
 
 
 ### Drush editing minor mode
 
-If the buffer you visit is believe to be a Drush command (we think it
-is its name or path contains "drush") we will also enter a Drush minor
-mode.
+If the buffer you visit is believed to be a Drush command (we think it
+is if its file name or path contains "drush") we will also enter a
+Drush minor mode.
 
 There is currently no functionality connected to `drupal-drush-mode`.
 
@@ -123,7 +123,7 @@ If you have generated a TAGS file in your DRUPAL_ROOT 
folder Drupal
 mode will setup all buffers running drupal-mode to set
 `tags-file-name` to point to that TAGS file.
 
-Etags is a builtin part of Emacs.
+Etags is a built-in part of Emacs.
 
 
 ### GNU Globals / gtags
@@ -133,13 +133,21 @@ support in Emacs then Drupal mode will set 
`gtags-rootdir` to your
 DRUPAL_ROOT.
 
 
+### Drush utilities for Emacs users
+
+If
+[Drush utilities for Emacs users](http://drupal.org/project/emacs_drush)
+is installed Drupal mode will update existing tag files in your
+DRUPAL_ROOT after saving a buffer.
+
+
 ### ispell
 
 If ispell.el is loaded in Emacs then Drupal mode will set the language
 of your Drupal mode buffers to `american` as stated in [Drupals coding
 standards](http://drupal.org/coding-standards).
 
-ispell.el is a builtin part of Emacs. A external program must be
+ispell.el is a built-in part of Emacs. An external program must be
 installed to run the actual spell checking,
 i.e. [ispell](http://www.gnu.org/software/ispell/),
 [aspell](http://aspell.net/), or
@@ -150,27 +158,23 @@ i.e. [ispell](http://www.gnu.org/software/ispell/),
 
 If support for
 [flymake-phpcs.el](https://github.com/illusori/emacs-flymake-phpcs) is
-loaded in emacs and you have installed
+loaded in Emacs and you have installed
 [Drupal Code Sniffer](http://drupal.org/project/drupalcs) rules then
 Drupal mode will enable flymake-phpcs under php-mode.
 
 For this to work you need:
 
 *    [PHP CodeSniffer](http://pear.php.net/package/PHP_CodeSniffer)
-*    [flymake-phpcs.el](https://github.com/illusori/emacs-flymake-phpcs)
+*    [flymake-phpcs.el](http://marmalade-repo.org/packages/flymake-phpcs)
 *    [Drupal Code Sniffer](http://drupal.org/project/drupalcs) rules
 
-Making all of them work together can be a bit of a puzzle. Especially
-notice the need to run `phpcs` through a wrapper you get with
-flymake-phpcs.el.
-
 
 ## Other takes on a Drupal mode
 
 There are quite a few attempts at writing a Drupal mode out in the
 wild:
 
-*    [Search Github for 
drupal-mode](https://github.com/search?type=Repositories&q=drupal-mode)
+*    [Search Github for 
drupal-mode](https://github.com/search?type=Repositories&q="drupal-mode";)
 *     At drupal.org:
        * http://drupal.org/sandbox/bartlantz/1405156
        * http://drupal.org/project/emacs
@@ -183,4 +187,4 @@ All of them more or less based on
 
 Drupal mode is actively developed at
 [GitHub](https://github.com/arnested/drupal-mode).  Feature requests,
-ideas, bug reports, and pull request are more that welcome!
+ideas, bug reports, and pull request are more than welcome!
diff --git a/drupal-mode-pkg.el b/drupal-mode-pkg.el
deleted file mode 100644
index 4b09fae582..0000000000
--- a/drupal-mode-pkg.el
+++ /dev/null
@@ -1,3 +0,0 @@
-(define-package "drupal-mode" "0.2.0"
-  "Advanced minor mode for Drupal development"
-  '((php-mode "1.5.0")))
diff --git a/drupal-mode.el b/drupal-mode.el
index 91a79a6cfb..72e07e8891 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -1,28 +1,28 @@
 ;;; drupal-mode.el --- Advanced minor mode for Drupal development
 
-;; Copyright (C) 2012 Arne Jørgensen
+;; Copyright (C) 2012, 2013 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 ;; URL: https://github.com/arnested/drupal-mode
 ;; Created: January 17, 2012
-;; Version: 0.2.0
+;; Version: 0.3.0
 ;; Package-Requires: ((php-mode "1.5.0"))
 ;; Keywords: programming, php, drupal
 
-;; This file is NOT part of GNU Emacs.
+;; This file is part of Drupal mode.
 
-;; GNU Emacs 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.
+;; Drupal mode 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.
 
-;; GNU Emacs 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.
+;; Drupal mode 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+;; along with Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -36,6 +36,9 @@
 (require 'php-mode)
 (require 'format-spec)
 
+(eval-when-compile 
+  (require 'css-mode))
+
 
 
 ;; Customization
@@ -64,7 +67,7 @@ a single newline (\\n)."
           (const :tag "Always" t)
           (const :tag "Never" nil)
           (const :tag "Ask" ask))
-  :link '(url-link :tag "drupal.org" 
"http://drupal.org/coding-standards#indenting";)
+  :link '(url-link :tag "drupal.org" 
"https://drupal.org/coding-standards#indenting";)
   :group 'drupal)
 
 
@@ -85,7 +88,7 @@ whitespace at the end."
           (const :tag "Always" always)
           (const :tag "Default" default)
           (const :tag "Never" never))
-  :link '(url-link :tag "drupal.org" 
"http://drupal.org/coding-standards#indenting";)
+  :link '(url-link :tag "drupal.org" 
"https://drupal.org/coding-standards#indenting";)
   :group 'drupal)
 
 
@@ -100,6 +103,9 @@ whitespace at the end."
   :link '(url-link :tag "api.drupal.org" "http://api.drupal.org";)
   :group 'drupal)
 
+;;;###autoload
+(put 'drupal-search-url 'safe-local-variable 'string-or-null-p)
+
 
 (defcustom drupal-drush-search-url "http://api.drush.org/api/search/%v/%s";
   "The URL to search the Drush API.
@@ -108,14 +114,16 @@ whitespace at the end."
   :type '(choice (const :tag "Api.drush.org" 
"http://api.drush.org/api/search/%v/%s";)
                  (string :tag "Other" "http://example.com/api/search/%v/%s";))
   :link '(url-link :tag "api.drush.org" "http://api.drush.org";)
+  :safe 'string-or-null-p
   :group 'drupal-drush)
 
 
+;;;###autoload
 (defcustom drupal-drush-program (executable-find "drush")
   "Name of the Drush executable.
 Include path to the executable if it is not in your $PATH."
   :type 'file
-  :link '(url-link :tag "Drush" "http://drupal.org/project/drush";)
+  :link '(url-link :tag "Drush" "https://github.com/drush-ops/drush";)
   :group 'drupal-drush)
 
 
@@ -124,12 +132,36 @@ Include path to the executable if it is not in your 
$PATH."
                                    "[\n\r]" ""
                                    (with-output-to-string
                                      (with-current-buffer standard-output
-                                       (call-process drupal-drush-program nil 
(list t nil) nil "--version" "--pipe")))))
+                                       (call-process drupal-drush-program nil 
(list t nil) nil "core-status" "drush-version" "--pipe" "--format=list" 
"--strict=0")))))
   "Version number of the installed version Drush."
   :type 'string
   :link '(variable-link drupal-drush-program)
   :group 'drupal-drush)
 
+;;;###autoload
+(defcustom drupal-php-modes (list 'php-mode 'php+-mode 'web-mode)
+  "Major modes to consider PHP in Drupal mode."
+  :type '(repeat symbol)
+  :group 'drupal)
+
+;;;###autoload
+(defcustom drupal-css-modes (list 'css-mode)
+  "Major modes to consider CSS in Drupal mode."
+  :type '(repeat symbol)
+  :group 'drupal)
+
+;;;###autoload
+(defcustom drupal-js-modes (list 'javascript-mode 'js-mode 'js2-mode)
+  "Major modes to consider JavaScript in Drupal mode."
+  :type '(repeat symbol)
+  :group 'drupal)
+
+;;;###autoload
+(defcustom drupal-info-modes (list 'conf-windows-mode)
+  "Major modes to consider info files in Drupal mode."
+  :type '(repeat symbol)
+  :group 'drupal)
+
 
 
 (defvar drupal-version nil "Drupal version as auto detected.")
@@ -140,17 +172,51 @@ Include path to the executable if it is not in your 
$PATH."
 (make-variable-buffer-local 'drupal-rootdir)
 (put 'drupal-rootdir 'safe-local-variable 'string-or-null-p)
 
+(defvar drupal-module nil "Drupal module short name if auto detected.")
+(make-variable-buffer-local 'drupal-module)
+(put 'drupal-module 'safe-local-variable 'string-or-null-p)
+
+(defvar drupal-module-name nil "Drupal module name if auto detected.")
+(make-variable-buffer-local 'drupal-module-name)
+(put 'drupal-module-name 'safe-local-variable 'string-or-null-p)
+
+(defvar drupal-module-version nil "Drupal module version if auto detected.")
+(make-variable-buffer-local 'drupal-module-version)
+(put 'drupal-module-version 'safe-local-variable 'string-or-null-p)
+
+(defvar drupal-project nil "Drupal project name if auto detected.")
+(make-variable-buffer-local 'drupal-project)
+(put 'drupal-project 'safe-local-variable 'string-or-null-p)
+
 (defvar drupal-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\C-cdf" 'drupal-search-documentation)
-    (define-key map "\C-cdc" 'drupal-drush-cache-clear)
+    (define-key map [(control c) (control v) (control d)] 
#'drupal-search-documentation)
+    (define-key map [(control c) (control v) (control c)] 
#'drupal-drush-cache-clear)
+    (define-key map [(control c) (control v) (control h)] #'drupal-insert-hook)
+    (define-key map [(control c) (control v) (control f)] 
#'drupal-insert-function)
+    (define-key map [(control c) (control v) (control m)] #'drupal-module-name)
+    (define-key map [(control c) (control v) (control t)] 
#'drupal-wrap-string-in-t-function)
+    (define-key map [(control a)] #'drupal-mode-beginning-of-line)
     map)
   "Keymap for `drupal-mode'")
 
-(defvar drupal-drush-mode-map
-  (let ((map (make-sparse-keymap)))
-    map)
-  "Keymap for `drupal-drush-mode'")
+(defvar drupal-symbol-collection nil
+  "A collection or a function returning a collection of Drupal symbols.
+Used by `drupal-insert-hook' to provide completions on hooks.")
+(make-variable-buffer-local 'drupal-symbol-collection)
+
+(defvar drupal-get-function-args nil
+  "A function returning the function arguments for a Drupal function.
+Used by `drupal-insert-hook' to fill in arguments on hooks.
+
+The specified function should take two arguments: the function to
+find arguments for and the drupal major version.
+
+See `drupal-get-function-args' (slow)
+`drupal/etags-get-function-args' and
+`drupal/gtags-get-function-args' for functions returning Drupal
+function arguments.")
+(make-variable-buffer-local 'drupal-get-function-args)
 
 
 
@@ -167,28 +233,37 @@ Include path to the executable if it is not in your 
$PATH."
 
   ;; Delete trailing white space.
   (when (eq drupal-delete-trailing-whitespace 'always)
-    (add-hook 'before-save-hook 'delete-trailing-whitespace nil t))
+    (add-hook 'before-save-hook #'delete-trailing-whitespace nil t))
   (when (eq drupal-delete-trailing-whitespace 'never)
-    (remove-hook 'before-save-hook 'delete-trailing-whitespace t))
+    (remove-hook 'before-save-hook #'delete-trailing-whitespace t))
 
   ;; Handle line ending and trailing white space.
-  (add-hook 'before-save-hook 'drupal-convert-line-ending nil t)
+  (add-hook 'before-save-hook #'drupal-convert-line-ending nil t)
 
-  ;; Stuff special for php-mode buffers.
-  (when (eq major-mode 'php-mode)
-    (c-add-language 'drupal-mode 'c-mode)
-    (c-set-style "drupal")))
+  ;; Stuff special for css-mode buffers.
+  (when (apply 'derived-mode-p drupal-css-modes)
+    (when (derived-mode-p 'css-mode)
+      (set (make-local-variable 'css-indent-level) 2)))
 
-;;;###autoload
-(define-minor-mode drupal-drush-mode
-  "Advanced minor mode for Drupal Drush 
development.\n\n\\{drupal-drush-mode-map}"
-  :group 'drupal-drush
-  :init-value nil
-  :lighter " Drush"
-  :keymap drupal-drush-mode-map
-
-  ;; Currently only enables drupal-mode.
-  (drupal-mode 1))
+  ;; Stuff special for php-mode buffers.
+  (when (apply 'derived-mode-p drupal-php-modes)
+    ;; Show function arguments from GNU GLOBAL for function at point
+    ;; after a short delay of idle time.
+    (when (and drupal-get-function-args
+               (fboundp 'eldoc-mode))
+      (set (make-local-variable 'eldoc-documentation-function)
+           #'drupal-eldoc-documentation-function)
+      (eldoc-mode 1))
+
+    ;; Set correct comment style for inline comments.
+    (setq comment-start "//")
+    (setq comment-padding " ")
+    (setq comment-end "")
+
+    ;; Setup cc-mode style stuff.
+    (when (derived-mode-p 'c-mode)
+      (c-add-language 'drupal-mode 'c-mode)
+      (c-set-style "drupal"))))
 
 
 
@@ -209,8 +284,8 @@ Include path to the executable if it is not in your $PATH."
     (c-special-indent-hook . c-gnu-impose-minimum)
     )
   "Drupal coding style.
-According to http://drupal.org/coding-standards#indenting.";
-  :link '(url-link :tag "drupal.org" 
"http://drupal.org/coding-standards#indenting";)
+According to https://drupal.org/coding-standards#indenting.";
+  :link '(url-link :tag "drupal.org" 
"https://drupal.org/coding-standards#indenting";)
   :group 'drupal)
 
 (c-add-style "drupal" drupal-style)
@@ -249,6 +324,17 @@ of the project)."
   (cons "Drupal" (make-sparse-keymap "Drupal")))
 
 ;; Define specific subcommands in this menu.
+(define-key drupal-mode-map
+  [menu-bar drupal github]
+  '("Drupal Mode on GitHub" . (lambda () (interactive) (browse-url 
"https://github.com/arnested/drupal-mode";))))
+(define-key drupal-mode-map
+  [menu-bar drupal separator]
+  '("--"))
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project]
+  `(menu-item (concat "Module: " (or drupal-module-name drupal-module)) 
,(make-sparse-keymap)
+              :visible drupal-module
+              :enable drupal-project))
 (define-key drupal-mode-map
   [menu-bar drupal customize]
   '("Customize Drupal Mode" . (lambda () (interactive) (customize-group 
'drupal))))
@@ -257,19 +343,37 @@ of the project)."
   '("Drupal Mode manual" . drupal-mode-manual))
 (define-key drupal-mode-map
   [menu-bar drupal search-documentation]
-  '("Search documentation" . drupal-search-documentation))
+  '(menu-item "Search documentation" drupal-search-documentation
+              :enable (apply 'derived-mode-p drupal-php-modes)))
 (define-key drupal-mode-map
   [menu-bar drupal cache-clear]
   '(menu-item "Clear all caches" drupal-drush-cache-clear
               :enable (and drupal-rootdir drupal-drush-program)))
 
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project drupal-project-bugs]
+  '(menu-item "Bug reports" (lambda () (interactive) (browse-url (concat 
"https://drupal.org/project/issues/"; drupal-project "?categories=bug")))))
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project drupal-project-issues]
+  '(menu-item "Issues" (lambda () (interactive) (browse-url (concat 
"https://drupal.org/project/issues/"; drupal-project "?categories=All")))))
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project drupal-project-home]
+  '(menu-item "Project page" (lambda () (interactive) (browse-url (concat 
"https://drupal.org/project/"; drupal-project)))))
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project drupal-project-separator]
+  '("--"))
+(define-key drupal-mode-map
+  [menu-bar drupal drupal-project drupal-project-nameversion]
+  '(menu-item (concat (or drupal-module-name drupal-module) " " 
drupal-module-version) nil
+              :enable nil))
+
 
 
 ;; utility functions
 
 (defun drupal-convert-line-ending ()
   "Convert to unix style line ending.
-According to http://drupal.org/coding-standards#indenting you
+According to https://drupal.org/coding-standards#indenting you
 should save your files with unix style end of line."
   (when (and drupal-mode
              drupal-convert-line-ending
@@ -287,14 +391,160 @@ should save your files with unix style end of line."
   (interactive)
   (let ((symbol (symbol-at-point)))
     (when symbol
-      (if (and drupal-drush-program
-               (string-match "drush" (symbol-name symbol)))
-          (browse-url
-           (format-spec drupal-drush-search-url `((?v . 
,(replace-regexp-in-string ".*-dev" "master" (replace-regexp-in-string 
"\.[0-9]+\\'" ".x" drupal-drush-version)))
-                                                  (?s . ,symbol))))
+      (cond
+       ((and (boundp 'php-extras-function-arguments)
+             (hash-table-p 'php-extras-function-arguments)
+             (gethash (symbol-name symbol) php-extras-function-arguments))
+        (php-search-documentation))
+       ((and drupal-drush-program (string-match "drush" (symbol-name symbol)))
         (browse-url
-         (format-spec drupal-search-url `((?v . ,(drupal-major-version 
drupal-version))
-                                          (?s . ,symbol))))))))
+         (format-spec drupal-drush-search-url `((?v . 
,(replace-regexp-in-string "\\([0-9]+\.\\).*\\'" "\\1x" 
(replace-regexp-in-string ".*-dev" "master" drupal-drush-version)))
+                                                (?s . ,symbol)))))
+       (t (browse-url
+           (format-spec drupal-search-url `((?v . ,(drupal-major-version 
drupal-version))
+                                            (?s . ,symbol)))))))))
+
+(defun drupal-tail-drupal-debug-txt ()
+  "Tail drupal_debug.txt.
+If a drupal_debug.txt exists in the sites temporary directory
+visit it and enable `auto-revert-tail-mode' in the visiting
+buffer."
+  (interactive)
+  (when drupal-drush-program
+    (let* ((tmp (ignore-errors
+                  (replace-regexp-in-string
+                   "[\n\r]" ""
+                   (with-output-to-string
+                     (with-current-buffer standard-output
+                       (call-process drupal-drush-program nil (list t nil) nil 
"core-status" "temp" "--pipe" "--format=list" "--strict=0"))))))
+           (dd (concat tmp "/drupal_debug.txt")))
+      (when (file-readable-p dd)
+        (find-file-other-window dd)
+        (auto-revert-tail-mode 1)))))
+
+(defun drupal-wrap-string-in-t-function ()
+  "If point is inside a string wrap the string in the t() function."
+  (interactive)
+  (when (eq (get-text-property (point) 'face) 'font-lock-string-face)
+    (save-excursion
+      (atomic-change-group
+        (search-backward-regexp "\\(\"\\|'\\)")
+        (insert "t(")
+        (forward-char)
+        (search-forward-regexp "\\(\"\\|'\\)")
+        (insert ")")))))
+
+
+
+(defvar drupal-form-id-history nil
+  "History of form_id's entered in `drupal-insert-hook'.")
+
+(define-skeleton drupal-insert-hook
+  "Insert Drupal hook function skeleton."
+  nil
+  '(setq v1 (completing-read "Hook: "
+                             (if (functionp drupal-symbol-collection)
+                                 (funcall drupal-symbol-collection)
+                               drupal-symbol-collection)
+                             nil nil "hook_"))
+  '(setq str v1)
+  '(setq v2 (let ((hook v1)
+                  case-fold-search form-id form-id-placeholder)
+              (if (string-match "\\([A-Z][A-Z_]*[A-Z]\\)" hook)
+                  (progn
+                    (setq form-id-placeholder (match-string 1 hook))
+                    (setq form-id (read-string
+                                   (concat "Implements " hook "() for (default 
" form-id-placeholder "): ")
+                                   nil 'drupal-form-id-history 
form-id-placeholder))
+                    (setq str (concat hook "() for " form-id))
+                    (replace-regexp-in-string (regexp-quote 
form-id-placeholder) form-id hook t))
+                hook)))
+  (drupal-ensure-newline)
+  "/**\n"
+  " * Implements " str "().\n"
+  " */\n"
+  "function " (replace-regexp-in-string "^hook" (drupal-module-name) v2) "(" 
(when drupal-get-function-args (funcall drupal-get-function-args v1 
(drupal-major-version))) ") {\n"
+  "  " @ _ "\n"
+  "}\n")
+
+(define-skeleton drupal-insert-function
+  "Insert Drupal function skeleton."
+  nil
+  (drupal-ensure-newline)
+  "/**\n"
+  " * " @ "\n"
+  " */\n"
+  "function " (drupal-module-name) "_" @ - "(" @ ") {\n"
+  "  " @ _ "\n"
+  "}\n")
+
+(defun drupal-ensure-newline (&optional num)
+  "Ensure (NUM) blank lines before point.
+Ensures there is NUM blank lines before point - if not it will insert them.
+Defaults to one blank line if optional argument NUM is not specified."
+  (unless num
+    (setq num 1))
+  (let ((result 0)
+        (num (+ 2 num)))
+    (newline (- num (dotimes (var num result)
+                      (when (looking-back (concat "
+\\{" (number-to-string var) "\\}") (line-beginning-position (- var)))
+                        (setq result (+ 1 result))))))))
+
+(defun drupal-get-function-args (symbol &optional version)
+  "Get function arguments from `drupal-search-url'.
+It is really slow to download `drupal-search-url'. You should
+probably not use this. Have a look at using GNU GLOBAL / Gtags
+instead."
+  (unless version
+    (setq version (drupal-detect-drupal-version)))
+  (with-temp-buffer
+    (ignore-errors
+      (url-insert-file-contents (format-spec drupal-search-url `((?v . 
,version)
+                                                                 (?s . 
,symbol))))
+      (search-forward "<tr class=\"active\">" nil t)
+      (search-forward-regexp (concat symbol "(\\(.*\\))") nil t)
+      (match-string-no-properties 1))))
+
+(defun drupal-eldoc-documentation-function ()
+  "Show function arguments for function at point."
+  (when drupal-get-function-args
+    (let* ((symbol (php-get-pattern))
+           (args (when symbol (funcall drupal-get-function-args symbol))))
+      (cond
+       (args
+        (format "%s (%s)" symbol args))
+       ((fboundp 'php-extras-eldoc-documentation-function)
+        (php-extras-eldoc-documentation-function))))))
+
+(defun drupal-mode-beginning-of-line (&optional n)
+  "Move point to beginning of property value or to beginning of line.
+The prefix argument N is passed directly to `beginning-of-line'.
+
+This command is identical to `beginning-of-line' if not in a mode
+derived from `conf-mode'.
+
+If point is on a (non-continued) property line, move point to the
+beginning of the property value or the beginning of line,
+whichever is closer.  If point is already at beginning of line,
+move point to beginning of property value.  Therefore, repeated
+calls will toggle point between beginning of property value and
+beginning of line.
+
+Heavily based on `message-beginning-of-line' from Gnus."
+  (interactive "p")
+  (let ((zrs 'zmacs-region-stays))
+    (when (and (featurep 'xemacs) (interactive-p) (boundp zrs))
+      (set zrs t)))
+  (if (derived-mode-p 'conf-mode)
+      (let* ((here (point))
+            (bol (progn (beginning-of-line n) (point)))
+            (eol (point-at-eol))
+            (eoh (re-search-forward "= *" eol t)))
+       (goto-char
+        (if (and eoh (or (< eoh here) (= bol here)))
+            eoh bol)))
+    (beginning-of-line n)))
 
 
 
@@ -304,34 +554,133 @@ should save your files with unix style end of line."
 If part of a Drupal project also detect the version of Drupal and
 the location of DRUPAL_ROOT."
   (interactive)
-  (if drupal-version
-      drupal-version
-    (dolist (file '("modules/system/system.module" "includes/bootstrap.inc" 
"core/includes/bootstrap.inc"))
-      (let ((here (or buffer-file-name dired-directory)))
+  (hack-local-variables)
+  (when (or (not drupal-version)
+            (not drupal-rootdir))
+    (dolist (file '("modules/system/system.module" "includes/bootstrap.inc" 
"core/lib/Drupal.php"))
+      (let ((here (or buffer-file-name default-directory)))
         (when here
           (let ((dir (locate-dominating-file here file)))
             (when dir
               (with-current-buffer (find-file-noselect (concat dir file) t)
                 (save-excursion
+                  (widen)
                   (goto-char (point-min))
                   (when (re-search-forward "\\(define('VERSION',\\|const 
VERSION =\\) +'\\(.+\\)'" nil t)
-                    (dir-locals-set-class-variables 'drupal-class `((nil . 
((drupal-version . ,(match-string-no-properties 2))
-                                                                            
(drupal-rootdir . ,dir)))))
-                    (dir-locals-set-directory-class dir 'drupal-class)))
-                (setq drupal-version (match-string-no-properties 2))
-                )))
-          (hack-local-variables)
-          drupal-version)))))
+                    (dir-locals-set-class-variables 'drupal-site `((nil . 
((drupal-version . ,(match-string-no-properties 2))
+                                                                           
(drupal-rootdir . ,dir)))))
+                    (dir-locals-set-directory-class dir 'drupal-site)))
+                (setq drupal-version (match-string-no-properties 2))))))))
+    (hack-local-variables))
+  (let ((module (drupal-locate-dominating-module (or buffer-file-name 
default-directory) t))
+        (version drupal-version)
+        (module-name nil)
+        (module-version nil)
+        (project nil))
+    (when module
+      (with-current-buffer (find-file-noselect module t)
+        (save-excursion
+          (widen)
+          (goto-char (point-min))
+          (when (and (not drupal-version)
+                     (re-search-forward "^core *=" nil t))
+            (re-search-forward " *\"?\\([^\"]+\\)\"?" (point-at-eol) t)
+            (setq version (match-string-no-properties 1)))
+          (goto-char (point-min))
+          (when (re-search-forward "^name *=" nil t)
+            (re-search-forward " *\"?\\([^\"]+\\)\"?" (point-at-eol) t)
+            (setq module-name (match-string-no-properties 1)))
+          (goto-char (point-min))
+          (when (re-search-forward "^version *=" nil t)
+            (re-search-forward " *\"?\\([^\"]+\\)\"?" (point-at-eol) t)
+            (setq module-version (match-string-no-properties 1)))
+          (goto-char (point-min))
+          (when (re-search-forward "^project *=" nil t)
+            (re-search-forward " *\"?\\([^\"]+\\)\"?" (point-at-eol) t)
+            (setq project (match-string-no-properties 1)))
+          (when (and (string= project "drupal")
+                     (string= module-version "VERSION"))
+            (setq module-version version))))
+      (dir-locals-set-class-variables 'drupal-module `((nil . ((drupal-module 
. ,(file-name-nondirectory
+                                                                               
   (file-name-sans-extension module)))
+                                                               (drupal-version 
. ,version)
+                                                               
(drupal-module-name . ,module-name)
+                                                               
(drupal-module-version . ,module-version)
+                                                               (drupal-project 
. ,project)))))
+      (dir-locals-set-directory-class (file-name-directory module) 
'drupal-module)))
+  (hack-local-variables)
+  drupal-version)
+
+(defun drupal-locate-dominating-module (file &optional info-file-location)
+  "Look up the directory hierarchy from FILE for a Drupal module root.
+Stop at the first parent where a matching module is found and
+return the directory.
+
+We believe to have found a module if we discover two files in a
+directory with same file name sans extension and extensions .info
+and .module.
+
+If optional parameter `info-file-location' is t return file-name
+of the modules .info file including path.
+
+The implementation of this function is vary much based on an
+older implementation of `locate-dominating-file'."
+  (catch 'found
+    ;; `user' is not initialized yet because `file' may not exist, so we may
+    ;; have to walk up part of the hierarchy before we find the "initial UID".
+    (let ((user nil)
+          ;; Abbreviate, so as to stop when we cross ~/.
+          (dir (abbreviate-file-name (file-name-as-directory file)))
+          files)
+      (while (and dir
+                  ;; As a heuristic, we stop looking up the hierarchy of
+                  ;; directories as soon as we find a directory belonging to
+                  ;; another user.  This should save us from looking in
+                  ;; things like /net and /afs.  This assumes that all the
+                  ;; files inside a project belong to the same user.
+                  (let ((prev-user user))
+                    (setq user (nth 2 (file-attributes dir)))
+                    (or (null prev-user) (equal user prev-user))))
+        (if (and (setq files (condition-case nil
+                                 (directory-files dir 'full 
"\\(.+\\)\\.info\\'" 'nosort)
+                               (error nil)))
+                 (file-exists-p (concat (file-name-sans-extension (car files)) 
".module")))
+            (if info-file-location
+                (throw 'found (car files))
+              (throw 'found (file-name-nondirectory (file-name-sans-extension 
(car files)))))
+          (if (equal dir
+                     (setq dir (file-name-directory
+                                (directory-file-name dir))))
+              (setq dir nil))))
+      nil)))
+
+(defun drupal-module-name ()
+  "Return Drupal module name suitable for function names.
+This will return the best guess at the name of the Drupal module
+and encoded suitable for use as function name prefixes.
+
+Used in `drupal-insert-hook' and `drupal-insert-function'."
+  (interactive)
+  (let ((name (subst-char-in-string ?- ?_
+                                    (if drupal-module
+                                        drupal-module
+                                      ;; Otherwise fall back to a very naive
+                                      ;; way of guessing the module name.
+                                      (file-name-nondirectory 
(file-name-sans-extension (buffer-file-name)))))))
+    (if (called-interactively-p 'any)
+        (insert name)
+      name)))
 
 (defun drupal-major-version (&optional version)
   "Return major version number of version string.
 If major version number is 4 - return both major and minor."
   (unless version
     (setq version (drupal-detect-drupal-version)))
-  (let ((version-list (split-string version "\\.")))
-    (if (= (string-to-number (car version-list)) 4)
-        (format "%s.%s" (car version-list) (cadr version-list))
-      (car version-list))))
+  (when version
+    (let ((version-list (split-string version "\\.")))
+      (if (= (string-to-number (car version-list)) 4)
+          (format "%s.%s" (car version-list) (car (cdr version-list)))
+        (car version-list)))))
 
 ;;;###autoload
 (defun drupal-mode-bootstrap ()
@@ -341,32 +690,38 @@ is a mode supported by `drupal-mode' (currently only
 `php-mode').
 
 The function is suitable for adding to the supported major modes
-mode-hook, i.e.
-
-(eval-after-load 'php-mode
-  '(add-hook 'php-mode-hook 'drupal-mode-bootstrap))"
-  (when (eq major-mode 'php-mode)
+mode-hook."
+  (when (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes drupal-info-modes))
     (drupal-detect-drupal-version)
-    (when drupal-version
-      (drupal-mode 1))
-    (when (string-match "drush" buffer-file-name)
-      (drupal-drush-mode 1))))
+    (when (or drupal-version
+              (string-match "drush" (or buffer-file-name default-directory)))
+      (drupal-mode 1))))
 
 ;;;###autoload
-(eval-after-load 'php-mode
-  '(add-hook 'php-mode-hook 'drupal-mode-bootstrap))
+(dolist (mode (append drupal-php-modes drupal-css-modes drupal-js-modes 
drupal-info-modes))
+  (when (intern (concat (symbol-name mode) "-hook"))
+    (add-hook (intern (concat (symbol-name mode) "-hook")) 
#'drupal-mode-bootstrap)))
 
 ;;;###autoload
 (progn
-  (add-to-list 'auto-mode-alist 
'("\\.\\(module\\|test\\|install\\|theme\\|tpl\\.php\\)$" . php-mode))
-  (add-to-list 'auto-mode-alist '("\\.info$" . conf-windows-mode)))
+  (add-to-list 'auto-mode-alist 
'("[^/]\\.\\(module\\|test\\|install\\|profile\\|tpl\\.php\\|theme\\|inc\\)\\'" 
. php-mode))
+  (add-to-list 'auto-mode-alist '("[^/]\\.info\\'" . conf-windows-mode)))
 
 
 ;; Load support for various Emacs features if necessary.
+(eval-after-load 'autoinsert '(require 'drupal/autoinsert))
 (eval-after-load 'etags '(require 'drupal/etags))
 (eval-after-load 'gtags '(require 'drupal/gtags))
 (eval-after-load 'ispell '(require 'drupal/ispell))
 (eval-after-load 'flymake-phpcs '(require 'drupal/flymake-phpcs))
+(eval-after-load 'flycheck '(require 'drupal/flycheck))
+;;;###autoload
+(eval-after-load 'pcomplete '(require 'drupal/pcomplete))
+;;;###autoload
+(eval-after-load 'webjump '(require 'drupal/webjump))
+
+(eval-after-load 'drupal/etags '(require 'drupal/emacs-drush))
+(eval-after-load 'drupal/gtags '(require 'drupal/emacs-drush))
 
 
 
diff --git a/drupal-mode.info b/drupal-mode.info
deleted file mode 100644
index d6cd62f599..0000000000
--- a/drupal-mode.info
+++ /dev/null
@@ -1,310 +0,0 @@
-Dette er drupal-mode.info, produceret med makeinfo version 4.8 ud fra
-stdin.
-
-
-File: drupal-mode.info,  Node: Top,  Up: (dir)
-
-Top
-***
-
-* Menu:
-
-* Drupal mode::
-
-
-File: drupal-mode.info,  Node: Drupal mode,  Prev: Top,  Up: Top
-
-1 Drupal mode
-*************
-
-Drupal mode is an advanced minor mode for developing in Drupal.
-
-   The approach taken is somewhat different from other attempts at
-creating a Drupal mode.
-
-   This mode is a minor mode and can be applied to all files in a
-Drupal project no matter what major mode they use - whether it be
-php-mode or something else.
-
-   Besides giving access to general functionality in all modes (i.e.
-clearing cache through Drush) it will also adapt it self to the major
-mode to enable functionality only for that particular major mode (i.e.
-adhering to Drupals PHP coding standards only in php-mode).
-
-   Drupal mode will try not to enforce specific ways of working with
-Emacs on to you. Emacs can be extended in a million different ways and
-you should use the parts and extensions that fit _you_ and _your_
-working habits.
-
-   If Drupal mode recognizes you using an extension that it knows about
-it will adapt the extension to be useful in Drupal mode and with
-Drupal. I.e. it will recognize if you have loaded etags support and
-setup your buffers to use the TAGS file in your DRUPAL_ROOT folder.
-
-   Drupal mode won't embed other libraries but will suggest some (see
-below) and depend on a few through the packaging system (i.e. php-mode).
-
-* Menu:
-
-* Installation::
-* Features of Drupal mode::
-* Emacs modes and extensions that Drupal mode will enhance::
-* Other takes on a Drupal mode::
-* Development of Drupal mode::
-
-
-File: drupal-mode.info,  Node: Installation,  Next: Features of Drupal mode,  
Up: Drupal mode
-
-1.1 Installation
-================
-
-The easiest way to install Drupal mode is probably to install it via
-the ELPA archive at Marmalade
-(http://marmalade-repo.org/packages/drupal-mode).
-
-   ELPA (package.el) is part of Emacs 24. For Emacs 23 see Marmalade
-(http://marmalade-repo.org) for installation instructions.
-
-
-File: drupal-mode.info,  Node: Features of Drupal mode,  Next: Emacs modes and 
extensions that Drupal mode will enhance,  Prev: Installation,  Up: Drupal mode
-
-1.2 Features of Drupal mode
-===========================
-
-* Menu:
-
-* Drupal Coding Standards::
-* Search documentation::
-* Clearing all caches::
-* Drush editing minor mode::
-
-
-File: drupal-mode.info,  Node: Drupal Coding Standards,  Next: Search 
documentation,  Up: Features of Drupal mode
-
-1.2.1 Drupal Coding Standards
------------------------------
-
-Drupal mode will make you write code that adheres to Drupals coding
-standards (http://drupal.org/coding-standards#indenting).
-
-   It does this by:
-
-* Menu:
-
-* Indentation::
-* Fixing line endings::
-* Delete trailing white space::
-
-
-File: drupal-mode.info,  Node: Indentation,  Next: Fixing line endings,  Up: 
Drupal Coding Standards
-
-1.2.1.1 Indentation
-...................
-
-In php-mode code will be indented according to Drupals coding standards
-(http://drupal.org/coding-standards#indenting). If not it is considered
-a bug!
-
-
-File: drupal-mode.info,  Node: Fixing line endings,  Next: Delete trailing 
white space,  Prev: Indentation,  Up: Drupal Coding Standards
-
-1.2.1.2 Fixing line endings
-...........................
-
-If your files are not written with unix style line endings Drupal mode
-will ask your to convert them to unix style line endings on saving
-buffers.
-
-   This behavior can be customized be the variable
-`drupal-convert-line-ending'.
-
-   The default is to ask if you want the file to be converted. By
-asking you we hopefully won't trick you into making a commit in your
-version control system consisting of a bunch of functionality changes
-with every line also changed by a new line ending. If you have ever
-read 1000 of commits/diffs you will appreciate this.
-
-
-File: drupal-mode.info,  Node: Delete trailing white space,  Prev: Fixing line 
endings,  Up: Drupal Coding Standards
-
-1.2.1.3 Delete trailing white space
-...................................
-
-In Drupal mode buffers we will enable Emacs'
-`delete-trailing-whitespace'.
-
-   This behavior can be customized be the variable
-`drupal-delete-trailing-whitespace'.
-
-
-File: drupal-mode.info,  Node: Search documentation,  Next: Clearing all 
caches,  Prev: Drupal Coding Standards,  Up: Features of Drupal mode
-
-1.2.2 Search documentation
---------------------------
-
-You can search Drupal documentation for the symbol at point by issuing
-`C-c d f' or `M-x drupal-search-documentation' or from the Drupal menu
-entry.
-
-   Files that are part of a Drupal project will try to identify the
-used version of Drupal core and look up the documentation for the
-corresponding version at http://api.drupal.org.
-
-   If the symbol at point is believed to be a drush command the
-documentation will be looked up at http://api.drush.org instead. If
-Drush is installed it will identify the version of Drush and look up
-the documentation for that version.
-
-   You can change where to search for documentation be customizing
-`drupal-search-url' (besides api.drupal.org it also has a predefined
-setting for api.drupalcontrib.org) and `drupal-drush-search-url'.
-
-
-File: drupal-mode.info,  Node: Clearing all caches,  Next: Drush editing minor 
mode,  Prev: Search documentation,  Up: Features of Drupal mode
-
-1.2.3 Clearing all caches
--------------------------
-
-If Drush is installed you can issue a `drush cc all' from within Emacs
-by issuing `C-c d c' or `M-x drupal-drush-cache-clear' or from the
-Drupal menu entry.
-
-
-File: drupal-mode.info,  Node: Drush editing minor mode,  Prev: Clearing all 
caches,  Up: Features of Drupal mode
-
-1.2.4 Drush editing minor mode
-------------------------------
-
-If the buffer you visit is believe to be a Drush command (we think it
-is its name or path contains "drush") we will also enter a Drush minor
-mode.
-
-   There is currently no functionality connected to `drupal-drush-mode'.
-
-
-File: drupal-mode.info,  Node: Emacs modes and extensions that Drupal mode 
will enhance,  Next: Other takes on a Drupal mode,  Prev: Features of Drupal 
mode,  Up: Drupal mode
-
-1.3 Emacs modes and extensions that Drupal mode will enhance
-============================================================
-
-* Menu:
-
-* etags::
-* GNU Globals / gtags::
-* ispell::
-* flymake-phpcs::
-
-
-File: drupal-mode.info,  Node: etags,  Next: GNU Globals / gtags,  Up: Emacs 
modes and extensions that Drupal mode will enhance
-
-1.3.1 etags
------------
-
-If you have generated a TAGS file in your DRUPAL_ROOT folder Drupal
-mode will setup all buffers running drupal-mode to set `tags-file-name'
-to point to that TAGS file.
-
-   Etags is a builtin part of Emacs.
-
-
-File: drupal-mode.info,  Node: GNU Globals / gtags,  Next: ispell,  Prev: 
etags,  Up: Emacs modes and extensions that Drupal mode will enhance
-
-1.3.2 GNU Globals / gtags
--------------------------
-
-If you load GNU Globals / gtags (http://www.gnu.org/software/global/)
-support in Emacs then Drupal mode will set `gtags-rootdir' to your
-DRUPAL_ROOT.
-
-
-File: drupal-mode.info,  Node: ispell,  Next: flymake-phpcs,  Prev: GNU 
Globals / gtags,  Up: Emacs modes and extensions that Drupal mode will enhance
-
-1.3.3 ispell
-------------
-
-If ispell.el is loaded in Emacs then Drupal mode will set the language
-of your Drupal mode buffers to `american' as stated in Drupals coding
-standards (http://drupal.org/coding-standards).
-
-   ispell.el is a builtin part of Emacs. A external program must be
-installed to run the actual spell checking, i.e. ispell
-(http://www.gnu.org/software/ispell/), aspell (http://aspell.net/), or
-hunspell (http://hunspell.sourceforge.net/).
-
-
-File: drupal-mode.info,  Node: flymake-phpcs,  Prev: ispell,  Up: Emacs modes 
and extensions that Drupal mode will enhance
-
-1.3.4 flymake-phpcs
--------------------
-
-If support for flymake-phpcs.el
-(https://github.com/illusori/emacs-flymake-phpcs) is loaded in emacs
-and you have installed Drupal Code Sniffer
-(http://drupal.org/project/drupalcs) rules then Drupal mode will enable
-flymake-phpcs under php-mode.
-
-   For this to work you need:
-
-   * PHP CodeSniffer (http://pear.php.net/package/PHP_CodeSniffer)
-
-   * flymake-phpcs.el (https://github.com/illusori/emacs-flymake-phpcs)
-
-   * Drupal Code Sniffer (http://drupal.org/project/drupalcs) rules
-
-   Making all of them work together can be a bit of a puzzle.
-Especially notice the need to run `phpcs' through a wrapper you get
-with flymake-phpcs.el.
-
-
-File: drupal-mode.info,  Node: Other takes on a Drupal mode,  Next: 
Development of Drupal mode,  Prev: Emacs modes and extensions that Drupal mode 
will enhance,  Up: Drupal mode
-
-1.4 Other takes on a Drupal mode
-================================
-
-There are quite a few attempts at writing a Drupal mode out in the wild:
-
-   * Search Github for drupal-mode
-     (https://github.com/search?type=Repositories&q=drupal-mode)
-
-   * At drupal.org:
-        * http://drupal.org/sandbox/bartlantz/1405156
-
-        * http://drupal.org/project/emacs
-
-
-   All of them more or less based on Configuring Emacs
-(http://drupal.org/node/59868).
-
-
-File: drupal-mode.info,  Node: Development of Drupal mode,  Prev: Other takes 
on a Drupal mode,  Up: Drupal mode
-
-1.5 Development of Drupal mode
-==============================
-
-Drupal mode is actively developed at GitHub
-(https://github.com/arnested/drupal-mode). Feature requests, ideas, bug
-reports, and pull request are more that welcome!
-
-
-
-Tag Table:
-Node: Top78
-Node: Drupal mode163
-Node: Installation1670
-Node: Features of Drupal mode2081
-Node: Drupal Coding Standards2416
-Node: Indentation2824
-Node: Fixing line endings3121
-Node: Delete trailing white space3875
-Node: Search documentation4233
-Node: Clearing all caches5207
-Node: Drush editing minor mode5564
-Node: Emacs modes and extensions that Drupal mode will enhance5966
-Node: etags6340
-Node: GNU Globals / gtags6703
-Node: ispell7053
-Node: flymake-phpcs7665
-Node: Other takes on a Drupal mode8474
-Node: Development of Drupal mode9104
-
-End Tag Table
diff --git a/drupal-tests.el b/drupal-tests.el
new file mode 100644
index 0000000000..2db847a2e0
--- /dev/null
+++ b/drupal-tests.el
@@ -0,0 +1,54 @@
+;;; drupal-tests.el --- ert tests for drupal-mode
+
+;; Copyright (C) 2012 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Drupal mode is an advanced minor mode for developing in Drupal.
+
+;;; Code:
+
+(require 'drupal-mode)
+(require 'ert)
+
+
+
+(defun drupal-tests ()
+  "Run drupal-mode ERT test cases."
+  (interactive)
+  (ert "drupal-.*"))
+
+
+
+(ert-deftest drupal-major-version-test ()
+  "Test `drupal-major-version'."
+  (should (equal (drupal-major-version "7.12") "7"))
+  (should (equal (drupal-major-version "6.1") "6"))
+  (should (equal (drupal-major-version "4.5.2") "4.5")))
+
+
+
+(provide 'drupal-tests)
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
+;;; drupal-tests.el ends here
diff --git a/drupal/autoinsert.el b/drupal/autoinsert.el
new file mode 100644
index 0000000000..751bbdcaa6
--- /dev/null
+++ b/drupal/autoinsert.el
@@ -0,0 +1,102 @@
+;;; drupal/autoinsert.el --- Drupal-mode support for `auto-insert-mode'
+
+;; Copyright (C) 2012, 2013  Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+;; Keywords: 
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Enable drupal-mode support for `auto-insert-mode'.
+
+;;; Code:
+
+(define-auto-insert '("\\.info" . "Drupal info file") 
'drupal/autoinsert-insert-info-skeleton)
+(define-auto-insert '("\\.module" . "Drupal module file") 
'drupal/autoinsert-insert-module-skeleton)
+(define-auto-insert '("\\.install" . "Drupal install file") 
'drupal/autoinsert-insert-install-skeleton)
+(define-auto-insert '("\\.test" . "Drupal test file") 
'drupal/autoinsert-insert-test-skeleton)
+
+(define-skeleton drupal/autoinsert-insert-info-skeleton
+  "Drupal info file skeleton."
+  nil
+  '(setq v1 (file-name-nondirectory (file-name-sans-extension 
(buffer-file-name))))
+  '(setq v2 (if (drupal-major-version) (>= (string-to-number 
(drupal-major-version)) 7) t))
+  "name = " @ - (upcase-initials (replace-regexp-in-string "[-_\\.]+" " " v1)) 
\n
+  "description = " @ \n
+  "core = " @ (drupal-major-version) & ".x" "\n"
+  (when v2 "; stylesheets[all][] = ") & @ (when v2 "css/") & v1 & ".base.css\n"
+  (when v2 "; scripts[] = ") & @ (when v2 "scripts/") & v1 & ".js\n"
+  (when v2 "; files[] = ") & @ (when v2 v1) & ".test\n"
+  "; dependencies" (when v2 "[]") " = " @ "\n"
+  "; package = " @ "\n"
+  "; php = " @ "\n"
+  (when v2 "; configure = ") & @ (when v2 "admin/config/something/") & v1 & 
"\n"
+  (when v2 "; required = ") & @ (when v2 "TRUE\n")
+  (when v2 "; hidden = ") & @ (when v2 "TRUE\n"))
+
+(define-skeleton drupal/autoinsert-insert-module-skeleton
+  "Drupal module file skeleton."
+  nil
+  "<?php\n"
+  "\n"
+  "/**\n"
+  " * @file\n"
+  " * " @ - "\n"
+  " */\n"
+  @ "\n")
+
+(define-skeleton drupal/autoinsert-insert-install-skeleton
+  "Drupal install file skeleton."
+  nil
+  "<?php\n"
+  "\n"
+  "/**\n"
+  " * @file\n"
+  " * Install, update and uninstall functions for the " (drupal-module-name) " 
module.\n"
+  " */\n"
+  @ - "\n")
+
+(define-skeleton drupal/autoinsert-insert-test-skeleton
+  "Drupal test file skeleton."
+  nil
+  "<?php\n"
+  "\n"
+  "/**\n"
+  " * @file\n"
+  " * Tests for " (drupal-module-name) ".module.\n"
+  " */\n"
+  "\n"
+  "/**\n"
+  " * Helper class for module test cases.\n"
+  " */\n"
+  "class " (remove ?_ (capitalize (drupal-module-name))) "WebTestCase extends 
DrupalWebTestCase {\n"
+  @ - "\n"
+  "}\n"
+  "\n"
+  "/**\n"
+  " * Helper class for module test cases.\n"
+  " */\n"
+  "class " (remove ?_ (capitalize (drupal-module-name))) "UnitTestCase extends 
DrupalUnitTestCase {\n"
+  @ - "\n"
+  "}\n")
+
+
+
+(provide 'drupal/autoinsert)
+
+;;; drupal/autoinsert.el ends here
diff --git a/drupal/emacs-drush.el b/drupal/emacs-drush.el
new file mode 100644
index 0000000000..bc6245278c
--- /dev/null
+++ b/drupal/emacs-drush.el
@@ -0,0 +1,67 @@
+;;; drupal/emacs-drush.el --- Drupal-mode support for Drush utilities for 
Emacs users
+
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; You need to install `Drush utilities for Emacs users'
+;; <https://drupal.org/project/emacs_drush> for this to work.
+
+;; If `Drush utilities for Emacs users' is installed it will run
+;; `drush etags' on `after-save-hook' if a TAGS file is present in
+;; DRUPAL_ROOT and it will run `drush gtags' on `after-save-hook' if a
+;; GTAGS file is present in DRUPAL_ROOT.
+
+;;; Code:
+
+(defcustom drupal/emacs-drush-update-tags-after-save
+  (and drupal-drush-program
+       (zerop (call-process drupal-drush-program nil nil nil "help" "etags")))
+  "Use `Drush utilities for Emacs users' to run etags/gtags after save.
+On `after-save-hook' run `drush etags' or `drush gtags'.
+
+Requires `Drush utilities for Emacs users' to be installed."
+  :type `(choice 
+          (const :tag "Yes" t)
+          (const :tag "No" nil))
+  :link '(url-link :tag "Drush utilities for Emacs users" 
"https://drupal.org/project/emacs_drush";)
+  :group 'drupal)
+
+(defun drupal/emacs-drush-run-after-save ()
+  "Run drush etags/gtags on after-save-hook."
+  (when (and drupal/emacs-drush-update-tags-after-save
+             drupal-drush-program)
+    (when (and (boundp 'drupal/etags-rootdir)
+               (file-exists-p (concat drupal/etags-rootdir "TAGS")))
+      (call-process drupal-drush-program nil 0 nil "etags"))
+    (when (and (boundp 'gtags-rootdir)
+               (file-exists-p (concat gtags-rootdir "GTAGS")))
+      (call-process drupal-drush-program nil 0 nil "gtags"))))
+
+(defun drupal/emacs-drush-enable ()
+  (add-hook 'after-save-hook #'drupal/emacs-drush-run-after-save nil t))
+
+(add-hook 'drupal-mode-hook #'drupal/emacs-drush-enable)
+
+
+
+(provide 'drupal/emacs-drush)
+
+;;; drupal/emacs-drush.el ends here
diff --git a/drupal/etags.el b/drupal/etags.el
index c816ddb7a0..ee2251154a 100644
--- a/drupal/etags.el
+++ b/drupal/etags.el
@@ -1,18 +1,60 @@
 ;;; drupal/etags.el --- Drupal-mode support for etags
 
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
 ;;; Commentary:
 
 ;; Enable drupal-mode support for etags.
 
 ;;; Code:
 
-(defun drupal/etags-enable ()
-  "Setup TAGS file for etags if it exists in DRUPAL_ROOT."
-  (when (and (boundp 'drupal-rootdir)
-            (file-exists-p (concat drupal-rootdir "TAGS")))
-    (setq tags-file-name (concat drupal-rootdir "TAGS"))))
+(defvar drupal/etags-rootdir nil "Root directory where etags TAGS file is 
present.")
 
-(add-hook 'drupal-mode-hook 'drupal/etags-enable)
+(defun drupal/etags-enable ()
+  "Setup TAGS file for etags if it exists."
+  (let ((dir (locate-dominating-file (buffer-file-name) "TAGS")))
+    (when dir
+      (set (make-local-variable 'drupal/etags-rootdir) dir)
+
+      ;; Set `tags-file-name' to the TAGS file located in
+      ;; `drupal-rootdir'.
+      (setq tags-file-name (concat drupal/etags-rootdir "TAGS"))
+      (tags-completion-table)
+
+      ;; Set `drupal-symbol-collection' to `tags-completion-table' so
+      ;; that inserting hooks will do completion based on etags.
+      (setq drupal-get-function-args #'drupal/etags-get-function-args)
+      (setq drupal-symbol-collection #'tags-completion-table))))
+
+(defun drupal/etags-get-function-args (symbol &optional version)
+  "Get function arguments from etags TAGS."
+  (when (and (boundp 'drupal/etags-rootdir)
+             (file-exists-p (concat drupal/etags-rootdir "TAGS")))
+    (with-current-buffer (find-tag-noselect symbol nil nil)
+      (goto-char (point-min))
+      (when (re-search-forward
+             (format "function\\s-+%s\\s-*(\\([^{]*\\))" symbol)
+             nil t)
+        (match-string-no-properties 1)))))
+
+(add-hook 'drupal-mode-hook #'drupal/etags-enable)
 
 
 
diff --git a/drupal/flycheck.el b/drupal/flycheck.el
new file mode 100644
index 0000000000..1aef618e9e
--- /dev/null
+++ b/drupal/flycheck.el
@@ -0,0 +1,76 @@
+;;; drupal/flycheck.el --- Drupal-mode support for flycheck and phpcs
+
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Thomas Fini Hansen <xen@xen.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Enable drupal-mode support for flycheck and phpcs.
+
+;;; Code:
+
+(require 'drupal/phpcs)
+
+(defcustom drupal/flycheck-phpcs-js-and-css t
+  "When Non-nil, override Flycheck to use PHPCS for checking CSS and 
JavaScript files instead of the checkers configured for css-mode and js-mode."
+  :type `(choice
+          (const :tag "Yes" t)
+          (const :tag "No" nil))
+  :group 'drupal)
+
+(defun drupal/flycheck-hook ()
+  "Enable drupal-mode support for flycheck."
+  (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes))
+             drupal/phpcs-standard)
+    ;; Set the coding standard to "Drupal" (we checked that it is
+    ;; supported above.
+    (setq flycheck-phpcs-standard drupal/phpcs-standard)
+
+    ;; Flycheck will also highlight trailing whitespace as an
+    ;; error so no need to highlight it twice.
+    (drupal/phpcs-dont-show-trailing-whitespace)))
+
+(add-hook 'drupal-mode-hook #'drupal/flycheck-hook)
+
+(flycheck-declare-checker css-js-phpcs
+  "Check CSS and JavaScript  using PHP_CodeSniffer.
+
+PHP_CodeSniffer can be used to check non-PHP files, as exemplified by the
+Drupal code sniffer.
+
+See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
+  :command '("phpcs" "--report=emacs"
+             (option "--standard=" flycheck-phpcs-standard)
+             source)
+  ;; Though phpcs supports Checkstyle output which we could feed to
+  ;; `flycheck-parse-checkstyle', we are still using error patterns here,
+  ;; because PHP has notoriously unstable output habits.  See URL
+  ;; `https://github.com/lunaryorn/flycheck/issues/78' and URL
+  ;; `https://github.com/lunaryorn/flycheck/issues/118'
+  :error-patterns
+  '(("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): error - \\(?4:.*\\)" error)
+    ("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): warning - \\(?4:.*\\)" 
warning))
+  :modes '(css-mode js-mode)
+  :predicate (lambda ()
+               (and drupal/flycheck-phpcs-js-and-css (apply 'derived-mode-p 
(append drupal-php-modes drupal-css-modes drupal-js-modes)))))
+(add-to-list 'flycheck-checkers 'css-js-phpcs)
+
+
+(provide 'drupal/flycheck)
+;;; drupal/flycheck.el ends here
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 6eaee99b2d..671e3a172d 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -1,28 +1,59 @@
 ;;; drupal/flymake-phpcs.el --- Drupal-mode support for flymake-phpcs
 
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
 ;;; Commentary:
 
 ;; Enable drupal-mode support for flymake-phpcs.
 
 ;;; Code:
 
+(require 'flymake)
+(require 'flymake-phpcs)
+
+(define-obsolete-variable-alias 'drupal/flymake-phpcs-standard 
'drupal/phpcs-standard)
+(define-obsolete-variable-alias 
'drupal/flymake-phpcs-dont-show-trailing-whitespace 
'drupal/phpcs-dont-show-trailing-whitespace)
+(require 'drupal/phpcs)
+
 (defun drupal/flymake-phpcs-enable ()
   "Enable drupal-mode support for flymake-phpcs."
-  (when (and (eq major-mode 'php-mode)
+  (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes))
              (executable-find flymake-phpcs-command)
-             (ignore-errors
-               (string-match
-                "Drupal"
-                (with-output-to-string
-                  (with-current-buffer standard-output
-                    (call-process (executable-find flymake-phpcs-command) nil 
(list t nil) nil "-i"))))))
-    (set (make-local-variable 'flymake-phpcs-standard) "Drupal")
-    ;; We have probably set `flymake-phpcs-standard' after a syntax
-    ;; check was initiated - so kill it and start syntax check again.
-    (flymake-stop-all-syntax-checks)
-    (flymake-start-syntax-check)))
-
-(add-hook 'drupal-mode-hook 'drupal/flymake-phpcs-enable)
+             drupal/phpcs-standard)
+    ;; Set the coding standard to "Drupal" (we checked that it is
+    ;; supported above.
+    (set (make-local-variable 'flymake-phpcs-standard) drupal/phpcs-standard)
+
+    ;; Flymake-phpcs will also highlight trailing whitespace as an
+    ;; error so no need to highlight it twice.
+    (drupal/phpcs-dont-show-trailing-whitespace)
+
+    ;; This is a php-mode file so add the extension to a buffer locale
+    ;; version of `flymake-allowed-file-name-masks' and make
+    ;; flymake-phpcs initialize.
+    (make-local-variable 'flymake-allowed-file-name-masks)
+    (add-to-list 'flymake-allowed-file-name-masks
+                 `(,(concat "\\." (file-name-extension (or buffer-file-name 
(buffer-name))) "\\'") flymake-phpcs-init))
+    (flymake-mode 1)))
+
+(add-hook 'drupal-mode-hook #'drupal/flymake-phpcs-enable)
 
 
 
diff --git a/drupal/gtags.el b/drupal/gtags.el
index 6d55af4126..ee48eb6484 100644
--- a/drupal/gtags.el
+++ b/drupal/gtags.el
@@ -1,17 +1,63 @@
 ;;; drupal/gtags.el --- Drupal-mode support for gtags
 
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
 ;;; Commentary:
 
 ;; Enable drupal-mode support for gtags.
 
 ;;; Code:
 
+(require 'gtags)
+
+(defvar drupal/gtags-global-command (if (boundp 'gtags-global-command)
+                                        gtags-global-command
+                                      (executable-find "global"))
+  "Name of the GNU GLOBAL `global' executable.
+Include path to the executable if it is not in your $PATH.")
+
 (defun drupal/gtags-enable ()
-  "Setup rootdir for gtags to be DRUPAL_ROOT."
-  (when (boundp 'drupal-rootdir)
-    (setq gtags-rootdir drupal-rootdir)))
+  "Setup rootdir for gtags."
+  (let ((dir (locate-dominating-file (buffer-file-name) "GTAGS")))
+    (when dir
+      (set (make-local-variable 'gtags-rootdir) dir)
+
+      ;; Set `drupal-symbol-collection' to a call to
+      ;; `gtags-completing-gtags' so that inserting hooks will do
+      ;; completion based on gtags.
+      (setq drupal-symbol-collection #'(lambda() (gtags-completing-gtags "" 
nil t)))
+      (setq drupal-get-function-args #'drupal/gtags-get-function-args)
+      (gtags-mode 1))))
+
+(defun drupal/gtags-get-function-args (symbol &optional version)
+  "Get function arguments from GNU GLOBAL."
+  (when (and (boundp 'gtags-rootdir)
+             (file-exists-p (concat gtags-rootdir "GTAGS")))
+    (with-temp-buffer
+      (ignore-errors
+        (call-process drupal/gtags-global-command nil t nil "-x" symbol)
+        (goto-char (point-min))
+        (search-forward-regexp "[^(]*(\\(.*\\))[^)]*" nil t)
+        (match-string-no-properties 1)))))
 
-(add-hook 'drupal-mode-hook 'drupal/gtags-enable)
+(add-hook 'drupal-mode-hook #'drupal/gtags-enable)
 
 
 
diff --git a/drupal/ispell.el b/drupal/ispell.el
index 703404f13c..7f7ea05cca 100644
--- a/drupal/ispell.el
+++ b/drupal/ispell.el
@@ -1,19 +1,40 @@
 ;;; drupal/ispell.el --- Drupal-mode support for ispell
 
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
 ;;; Commentary:
 
 ;; Enable drupal-mode support for ispell.
 
 ;;; Code:
 
+(require 'ispell)
+
 (defun drupal/ispell-enable ()
   "Set `ispell-local-dictionary' to `american'.
 Comments and names should use US English spelling (e.g., `color'
-not `colour') according to http://drupal.org/coding-standards.";
+not `colour') according to https://drupal.org/coding-standards.";
   (when (member "american" (ispell-valid-dictionary-list))
     (setq ispell-local-dictionary "american")))
 
-(add-hook 'drupal-mode-hook 'drupal/ispell-enable)
+(add-hook 'drupal-mode-hook #'drupal/ispell-enable)
 
 
 
diff --git a/drupal/pcomplete.el b/drupal/pcomplete.el
new file mode 100644
index 0000000000..a1ffca21cc
--- /dev/null
+++ b/drupal/pcomplete.el
@@ -0,0 +1,65 @@
+;;; drupal/pcomplete.el --- Drush support for pcomplete.el
+
+;; Copyright (C) 2013 Damon Haley
+
+;; Author: Damon Haley <dkh@member.fsf.org>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Enable drush support for pcomplete.el.
+
+;;; Code:
+
+(require 'pcomplete)
+
+(defun drupal/pcomplete-drush-commands ()
+  "Return the most common drush commands by parsing the drush output."
+  (when drupal-drush-program
+    (with-temp-buffer
+      (call-process drupal-drush-program nil t nil
+                    "--early=includes/complete.inc")
+      (goto-char 0)
+      (let (commands)
+        (while (re-search-forward
+                "^[[:blank:]]*\\([@]?[[:word:]-.]+\\)"
+                nil t)
+          (push (match-string-no-properties 1) commands))
+        (sort commands #'string<)))))
+
+(defvar drupal/pcomplete-drush-commands (drupal/pcomplete-drush-commands)
+  "List of `drush' commands.")
+
+(defun drupal/pcomplete-drush-completion ()
+  "Completion for `drush'."
+  ;; Completion for the command argument.
+  (let ((pcomplete-try-first-hook (remove 'eshell-complete-host-reference
+                                        pcomplete-try-first-hook)))
+    (pcomplete-here* drupal/pcomplete-drush-commands)
+  (cond
+   ((pcomplete-match "help" 1)
+    (pcomplete-here* drupal/pcomplete-drush-commands))
+   (t
+    (while (pcomplete-here (pcomplete-entries)))))))
+
+(defalias 'pcomplete/drush 'drupal/pcomplete-drush-completion)
+
+
+
+(provide 'drupal/pcomplete)
+
+;;; drupal/pcomplete.el ends here
diff --git a/drupal/phpcs.el b/drupal/phpcs.el
new file mode 100644
index 0000000000..c9fd848df8
--- /dev/null
+++ b/drupal/phpcs.el
@@ -0,0 +1,69 @@
+;;; drupal/phpcs.el --- Drupal-mode common support for flymake-phpcs and 
flycheck
+
+;; Copyright (C) 2012, 2013 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Enable drupal-mode common support for flymake-phpcs and flycheck.
+
+;;; Code:
+
+(defcustom drupal/phpcs-standard
+  (ignore-errors
+    (let ((standards (with-output-to-string
+                       (with-current-buffer standard-output
+                         ;; Flymake uses flymake-phpcs-command, while
+                         ;; flycheck just uses the phpcs
+                         ;; command. Check for both.
+                         (call-process (or (and (boundp 
'flymake-phpcs-command) (executable-find flymake-phpcs-command)) 
(executable-find "phpcs")) nil (list t nil) nil "-i")))))
+      (when (string-match
+             "\\(Drupal[^, 
+]*\\)"
+             standards)
+        (match-string-no-properties 1 standards))))
+  "Name of Drupal coding standard rules for PHP CodeSniffer.
+This can either be the name of an installed standard (to see
+installed standards run `phpcs -i') or it can be the file name of
+a standard. Adding file name requires PHP CodeSniffer version
+1.3.4 or newer."
+  :link '(url-link :tag "Drupal Coder Sniffer" 
"https://drupal.org/node/1419980";)
+  :group 'drupal)
+
+
+
+(defcustom drupal/phpcs-dont-show-trailing-whitespace t
+  "Non-nil means don't highlight trailing whitespace when Drupal Coder Sniffer 
is in use.
+Phpcs will also highlight trailing whitespace as an error so no
+need to highlight it twice."
+  :type `(choice
+          (const :tag "Yes" t)
+          (const :tag "No" nil))
+  :group 'drupal)
+
+(defun drupal/phpcs-dont-show-trailing-whitespace ()
+  "Turn of various trailing white space highlighting."
+  (when drupal/phpcs-dont-show-trailing-whitespace
+    (when (boundp 'whitespace-style)
+      (set (make-local-variable 'whitespace-style) (remove 'trailing 
whitespace-style)))
+    (setq show-trailing-whitespace nil)))
+
+(provide 'drupal/phpcs)
+
+;;; drupal/phpcs.el ends here
diff --git a/drupal/webjump.el b/drupal/webjump.el
new file mode 100644
index 0000000000..4fc10dd9f5
--- /dev/null
+++ b/drupal/webjump.el
@@ -0,0 +1,35 @@
+;;; drupal/webjump.el --- Drupal projects as webjump sites
+
+;; Copyright (C) 2012, 2013  Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see
+;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provide Drupal projects as webjump sites.
+
+;;; Code:
+
+(require 'webjump)
+
+(add-to-list 'webjump-sites '("Drupal" . [simple-query "drupal.org" 
"https://drupal.org/project/"; ""]))
+
+
+
+(provide 'drupal/webjump)
+
+;;; drupal/webjump.el ends here
diff --git a/drush-make-mode.el b/drush-make-mode.el
new file mode 100644
index 0000000000..2ccf22d8cd
--- /dev/null
+++ b/drush-make-mode.el
@@ -0,0 +1,66 @@
+;;; drush-make-mode.el --- Major mode for drush make files
+
+;; Copyright (C) 2013  Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+;; Keywords: languages, tools, extensions
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode 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.
+
+;; Drupal mode 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 Drupal mode.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; A major mode for editing drush make files.
+
+;;; Code:
+
+(require 'bug-reference)
+
+;;;###autoload
+(define-derived-mode drush-make-mode conf-windows-mode "Drush Make"
+  "A major mode for editing drush make files.\n\n\\{drush-make-mode-map}"
+  :group 'drupal
+
+  ;; Use `bug-reference-mode' for linking issues and patches.
+  (set (make-local-variable 'bug-reference-url-format) 
"http://drupal.org/node/%s";)
+  (set (make-local-variable 'bug-reference-bug-regexp) 
"\\(?:\\#\\(?2:[0-9]+\\)\\|\\[['\"]?\\(?2:[0-9]+\\)\\(['\"]?\\]\\)\\)")
+  (bug-reference-mode)
+
+  ;; Use `goto-address-mode' for link highlighting.
+  (goto-address-mode)
+
+  ;; Setup and use `imenu' for building an index.
+  (setq imenu-generic-expression
+        '(("Libraries" "^libraries\\[\\([^]]+\\)\\]\\[download\\]\\[type\\] 
*=" 1)
+          ("Themes" "^projects\\[\\([^]]+\\)\\]\\[type\\] *= *theme" 1)
+          ("Modules" "^projects\\[\\([^]]+\\)\\]\\[type\\] *= *module" 1)
+          ("Profiles" "^projects\\[\\([^]]+\\)\\]\\[type\\] *= *profile" 1)
+          ("Sections" "^;;; \\(.*\\)" 1)))
+  (setq imenu-sort-function #'imenu--sort-by-name)
+  (imenu-add-menubar-index)
+
+  ;; Enable general `drupal-mode'.
+  (drupal-mode))
+
+
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("[^/]\\.make\\'" . drush-make-mode))
+
+
+
+(provide 'drush-make-mode)
+
+;;; drush-make-mode.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]