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

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

[elpa] master da7e3c6 76/76: Add 'packages/enwc/' from commit 'a3c59cce3


From: Ian Dunn
Subject: [elpa] master da7e3c6 76/76: Add 'packages/enwc/' from commit 'a3c59cce3482babc7c0518e7ff9da246158b9420'
Date: Thu, 23 Feb 2017 19:42:57 -0500 (EST)

branch: master
commit da7e3c6fb9b38d8034d7ae3db1d73d0d03dd39b9
Merge: 710001f a3c59cc
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Add 'packages/enwc/' from commit 'a3c59cce3482babc7c0518e7ff9da246158b9420'
    
    git-subtree-dir: packages/enwc
    git-subtree-mainline: 710001fa8b17192533e5e3c6a008a9fc2d1315ac
    git-subtree-split: a3c59cce3482babc7c0518e7ff9da246158b9420
---
 packages/enwc/.bzrignore       |   1 +
 packages/enwc/.hgignore        |   4 +
 packages/enwc/.hgtags          |   7 +
 packages/enwc/COPYING          | 674 +++++++++++++++++++++++++++++++++++++
 packages/enwc/Makefile         |  59 ++++
 packages/enwc/doc/enwc.texi    |  78 +++++
 packages/enwc/doc/fdl.texi     | 505 ++++++++++++++++++++++++++++
 packages/enwc/doc/version.texi |   4 +
 packages/enwc/enwc-backend.el  | 157 +++++++++
 packages/enwc/enwc-cm.el       | 368 ++++++++++++++++++++
 packages/enwc/enwc-edit.el     | 434 ++++++++++++++++++++++++
 packages/enwc/enwc-nm.el       | 738 +++++++++++++++++++++++++++++++++++++++++
 packages/enwc/enwc-wicd.el     | 473 ++++++++++++++++++++++++++
 packages/enwc/enwc.el          | 709 +++++++++++++++++++++++++++++++++++++++
 14 files changed, 4211 insertions(+)

diff --git a/packages/enwc/.bzrignore b/packages/enwc/.bzrignore
new file mode 100644
index 0000000..c531d98
--- /dev/null
+++ b/packages/enwc/.bzrignore
@@ -0,0 +1 @@
+*.elc
diff --git a/packages/enwc/.hgignore b/packages/enwc/.hgignore
new file mode 100644
index 0000000..e1b6cde
--- /dev/null
+++ b/packages/enwc/.hgignore
@@ -0,0 +1,4 @@
+syntax: glob
+
+*.elc
+enwc-autoloads.el
\ No newline at end of file
diff --git a/packages/enwc/.hgtags b/packages/enwc/.hgtags
new file mode 100644
index 0000000..39afd88
--- /dev/null
+++ b/packages/enwc/.hgtags
@@ -0,0 +1,7 @@
+3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
+3e2cab525cbc1c8664207fe9c01978335911b0a3 2.0
+0000000000000000000000000000000000000000 2.0
+0000000000000000000000000000000000000000 2.0
+cc2f7aa4ed369769e4aec5cdc4a6b1a2d28375b3 2.0
+cc2f7aa4ed369769e4aec5cdc4a6b1a2d28375b3 2.0
+0000000000000000000000000000000000000000 2.0
diff --git a/packages/enwc/COPYING b/packages/enwc/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/packages/enwc/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/packages/enwc/Makefile b/packages/enwc/Makefile
new file mode 100644
index 0000000..eba3a7d
--- /dev/null
+++ b/packages/enwc/Makefile
@@ -0,0 +1,59 @@
+# This is part of ENWC
+#
+#  Copyright (C) 2012-2017 Ian Dunn.
+#
+#  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/>.
+
+DOCDIR=doc/
+
+PREFIX=/usr/local
+INFODIR=$(PREFIX)/info
+SITELISP=$(PREFIX)/share/emacs/site-lisp/enwc
+
+EMACS=emacs --batch
+ALLSRC= enwc-backend.el enwc.el enwc-wicd.el enwc-nm.el
+ALLELC=$(wildcard *.elc)
+
+SOURCE=$(ALLSRC)
+TARGET=$(patsubst %.el,%.elc,$(SOURCE))
+
+.PHONY: all install lisp clean
+.PRECIOUS: %.elc
+all: lisp
+
+lisp: $(ALLELC)
+
+%.elc: %.el
+       @$(EMACS) \
+       -L "." \
+       -f batch-byte-compile $<
+
+autoloads: enwc-autoloads.el
+
+enwc-autoloads.el: $(SOURCE)
+       @$(EMACS) \
+       --eval "(require 'package)" \
+       --eval "(setq inhibit-message t)" \
+       --eval "(package-generate-autoloads \"enwc\" \"$$(pwd)\")"
+
+clean:
+       -rm -f *.elc
+
+install:
+       install -m 644 $(ALLELC) $(SITELISP)
+       install -m 644 $(ALLSRC) $(SITELISP)
+
+uninstall:
+       -rm -f $(SITELISP)/*.elc
+       -rm -f $(SITELISP)/*.el
diff --git a/packages/enwc/doc/enwc.texi b/packages/enwc/doc/enwc.texi
new file mode 100644
index 0000000..dddb66d
--- /dev/null
+++ b/packages/enwc/doc/enwc.texi
@@ -0,0 +1,78 @@
+\input texinfo @c -*-texinfo-*-
address@hidden %**start of header
address@hidden enwc.info
address@hidden ENWC Manual
address@hidden %**end of header
+
address@hidden version.texi
address@hidden fdl.texi
+
address@hidden Emacs
address@hidden
+* ENWC: (enwc).         The Emacs Network Client.
address@hidden direntry
+
address@hidden
+This manual is for ENWC, the Emacs Network Client.
+
+Copyright (C) 2012,2013,2014 Ian Dunn
+
address@hidden
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts.  A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
address@hidden quotation
address@hidden copying
+
address@hidden
address@hidden  ENWC
address@hidden Edition @value{EDITION}, for @code{enwc} version @value{VERSION}
address@hidden @value{UPDATED}
address@hidden by Ian Dunn
+
address@hidden
address@hidden 0pt plus 1filll
address@hidden
address@hidden titlepage
+
address@hidden
+
address@hidden
address@hidden Top
address@hidden ENWC
+
address@hidden
+
+This manual is for ENWC, the Emacs Network Client.
+
+This is edition @value{EDITION}, for @code{enwc} version @value{VERSION}
address@hidden ifnottex
+
address@hidden
+* Introduction::        Overview of ENWC.
+* Setup::               Getting ready to use ENWC.
+* Configuration::       All of the configuration options.
+* Commands::            The commands that ENWC uses.
address@hidden menu
+
address@hidden Introduction
address@hidden Introduction
+
+ENWC is the Emacs Network Client.  It uses several backends to allow the user 
to control network connections through GNU Emacs, while still allowing control 
to remain with the actual network manager.  ENWC makes uses of the D-Bus 
interfaces provided by these network managers.
+
address@hidden Setup
address@hidden Setup
+
+First, the path to ENWC must be added to the @var{load-path} variable.  Then, 
in the @file{.emacs} file, the following must be added:
+
address@hidden
+(require 'enwc-setup)
+(enwc-setup)
address@hidden lisp
+
+Now, simply press @kbd{M+x}, and type @kbd{ENWC}, and press @kbd{RET}.  ENWC 
will begin scanning for networks on the wireless interface, and display them in 
its buffer.
+
address@hidden
diff --git a/packages/enwc/doc/fdl.texi b/packages/enwc/doc/fdl.texi
new file mode 100644
index 0000000..cb71f05
--- /dev/null
+++ b/packages/enwc/doc/fdl.texi
@@ -0,0 +1,505 @@
address@hidden The GNU Free Documentation License.
address@hidden Version 1.3, 3 November 2008
+
address@hidden This file is intended to be included within another document,
address@hidden hence no sectioning command or @node.
+
address@hidden
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, 
Inc.
address@hidden://fsf.org/}
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
address@hidden display
+
address@hidden 0
address@hidden
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
address@hidden
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License.  Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein.  The ``Document'', below,
+refers to any such manual or work.  Any member of the public is a
+licensee, and is addressed as ``you''.  You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject.  (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.  If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant.  The Document may contain zero
+Invariant Sections.  If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.  A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text.  A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, address@hidden input
+format, SGML or XML using a publicly available
+DTD, and standard-conforming simple HTML,
+PostScript or PDF designed for human modification.  Examples
+of transparent image formats include PNG, XCF and
+JPG.  Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, SGML or
+XML for which the DTD and/or processing tools are
+not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page.  For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+The ``publisher'' means any person or entity that distributes copies
+of the Document to the public.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language.  (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.)  To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document.  These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
address@hidden
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License.  You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute.  However, you may accept
+compensation in exchange for copies.  If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
address@hidden
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover.  Both covers must also clearly and legibly identify
+you as the publisher of these copies.  The front cover must present
+the full title with all words of the title equally prominent and
+visible.  You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
address@hidden
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it.  In addition, you must do these things in the Modified Version:
+
address@hidden A
address@hidden
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document).  You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
address@hidden
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
address@hidden
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
address@hidden
+Preserve all the copyright notices of the Document.
+
address@hidden
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
address@hidden
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
address@hidden
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
address@hidden
+Include an unaltered copy of this License.
+
address@hidden
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page.  If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
address@hidden
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on.  These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
address@hidden
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
address@hidden
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles.  Section numbers
+or the equivalent are not considered part of the section titles.
+
address@hidden
+Delete any section Entitled ``Endorsements''.  Such a section
+may not be included in the Modified Version.
+
address@hidden
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
address@hidden
+Preserve any Warranty Disclaimers.
address@hidden enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant.  To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version.  Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity.  If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
address@hidden
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy.  If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''.  You must delete all
+sections Entitled ``Endorsements.''
+
address@hidden
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
address@hidden
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
address@hidden
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections.  You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers.  In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
address@hidden
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+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, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
address@hidden
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation 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.  See
address@hidden://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation.  If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.  If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
address@hidden
+RELICENSING
+
+``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works.  A
+public wiki that anybody can edit is an example of such a server.  A
+``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+
+``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+``Incorporate'' means to publish or republish a Document, in whole or
+in part, as part of another Document.
+
+An MMC is ``eligible for relicensing'' if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
address@hidden enumerate
+
address@hidden
address@hidden ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
address@hidden
address@hidden
+  Copyright (C)  @var{year}  @var{your name}.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.3
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
address@hidden group
address@hidden smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the address@hidden''@: line with this:
+
address@hidden
address@hidden
+    with the Invariant Sections being @var{list their titles}, with
+    the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+    being @var{list}.
address@hidden group
address@hidden smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
address@hidden Local Variables:
address@hidden ispell-local-pdict: "ispell-dict"
address@hidden End:
diff --git a/packages/enwc/doc/version.texi b/packages/enwc/doc/version.texi
new file mode 100644
index 0000000..f910a9b
--- /dev/null
+++ b/packages/enwc/doc/version.texi
@@ -0,0 +1,4 @@
address@hidden UPDATED 15 December 2012
address@hidden UPDATED-MONTH December 2012
address@hidden EDITION 1.0
address@hidden VERSION 1.0
diff --git a/packages/enwc/enwc-backend.el b/packages/enwc/enwc-backend.el
new file mode 100644
index 0000000..312066e
--- /dev/null
+++ b/packages/enwc/enwc-backend.el
@@ -0,0 +1,157 @@
+;;; enwc-backend.el --- Back-end functions for ENWC.
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'map)
+
+(cl-defstruct enwc-backend
+  key  ;; The symbol that identifies this backend.
+  ;; Loading/unloading functions
+  can-load-p
+  load
+  unload
+  ;; Scan interface
+  network-ids
+  scan
+  wireless-nw-props
+  ;; Connect/disconnect
+  connect
+  disconnect
+  ;; Maintenance
+  current-nw-id
+  is-connecting-p
+  is-wired-p
+  ;; get-profile-info
+  ;; save-nw-settings
+  )
+
+(defvar enwc-registered-backend-alist nil
+  "Alist of registered ENWC backends.
+
+Each entry in this list is of the form
+
+    (KEY . DEFINITION)
+
+Where KEY is a symbol identifying the backend, and DEFINITION is
+an enwc-backend struct.")
+
+(defcustom enwc-default-backend nil
+  "Key of the default backend to use."
+  :type 'symbol
+  :group 'enwc)
+
+(defcustom enwc-force-backend-loading nil
+  "Non-nil if backends should be loaded even if they claim they cannot."
+  :type 'boolean
+  :group 'enwc)
+
+(defvar enwc--current-backend nil)
+
+;;;###autoload
+(defun enwc-register-backend (definition &optional forcep)
+  "Register the backend KEY with DEFINITION.
+
+Signals an error if a backend with KEY already exists and FORCEP is nil."
+  (cl-check-type definition enwc-backend)
+  (let ((key (enwc-backend-key definition)))
+    (when (and (map-contains-key enwc-registered-backend-alist key) (not 
forcep))
+      (error "An ENWC backend with key '%s' has already been registered." key))
+    (map-put enwc-registered-backend-alist key definition)))
+
+;; Convenience functions to work with backends
+
+(defun enwc--can-load-p (backend)
+  (funcall (enwc-backend-can-load-p backend)))
+
+(defun enwc--load (backend)
+  (funcall (enwc-backend-load backend)))
+
+(defun enwc--unload (backend)
+  (funcall (enwc-backend-unload backend)))
+
+(defun enwc--scan (backend)
+  (funcall (enwc-backend-scan backend)))
+
+(defun enwc--network-ids (backend)
+  (funcall (enwc-backend-network-ids backend)))
+
+(defun enwc--wireless-nw-props (backend id)
+  (funcall (enwc-backend-wireless-nw-props backend) id))
+
+(defun enwc--connect (backend id &optional wired-p)
+  (funcall (enwc-backend-connect backend) id wired-p))
+
+(defun enwc--disconnect (backend &optional wired-p)
+  (funcall (enwc-backend-disconnect backend) wired-p))
+
+(defun enwc--current-nw-id (backend &optional wired-p)
+  (funcall (enwc-backend-current-nw-id backend) wired-p))
+
+(defun enwc--is-connecting-p (backend)
+  (funcall (enwc-backend-is-connecting-p backend)))
+
+(defun enwc--is-wired-p (backend)
+  (funcall (enwc-backend-is-wired-p backend)))
+
+;; Handle loading/unloading
+
+(defun enwc-load-backend (backend &optional force)
+  "Load BACKEND, which is a symbol denoting the backend to use."
+  (interactive
+   (list
+    (intern (completing-read "Backend: " enwc-registered-backend-alist nil t))
+    current-prefix-arg))
+  (when (and enwc--current-backend
+             (not (eq (enwc-backend-key enwc--current-backend) backend)))
+    (enwc-unload-current-backend))
+
+  (unless (require (intern (format "enwc-%s" backend)) nil t)
+    (error "Cannot find enwc feature for backend %s" backend))
+
+  (let ((new-backend (map-elt enwc-registered-backend-alist backend)))
+    (unless new-backend
+      (error "No registered backend %s" backend))
+
+    (if (not (or force (enwc--can-load-p new-backend)))
+      (warn "Backend %s is not usable." backend)
+    (enwc--load new-backend)
+    (setq enwc--current-backend new-backend))))
+
+(defun enwc-load-default-backend (&optional force)
+  (enwc-load-backend enwc-default-backend force))
+
+(defun enwc-unload-current-backend ()
+  "Unload the current backend."
+  (when enwc--current-backend
+    (enwc--unload enwc--current-backend)
+    (setq enwc--current-backend nil)))
+
+(provide 'enwc-backend)
+
+;;; enwc-backend.el ends here
diff --git a/packages/enwc/enwc-cm.el b/packages/enwc/enwc-cm.el
new file mode 100644
index 0000000..0ba0470
--- /dev/null
+++ b/packages/enwc/enwc-cm.el
@@ -0,0 +1,368 @@
+;; enwc-cm.el --- The ConnMan back-end to ENWC.
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; ConnMan support is still experimental.
+
+;;; Code:
+
+(require 'enwc)
+
+(defgroup enwc-cm nil
+  "*ConnMan variables for ENWC"
+  :prefix "enwc-cm-"
+  :group 'enwc)
+
+(defcustom enwc-cm-dbus-service "net.connman"
+  "ConnMan D-Bus service."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
+  "ConnMan D-Bus Manager interface."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-service-interface "net.connman.Service"
+  "ConnMan D-Bus Service interface."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-technology-interface "net.connman.Technology"
+  "ConnMan D-Bus Technology Interface"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-technology-path "/net/connman/technology/"
+  "ConnMan D-Bus Technology Path"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-service-path "/net/connman/service"
+  "ConnMan D-Bus Service Path"
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-service "org.gnu.enwc.agent"
+  "The service for the ConnMan Agent for ENWC to use."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-path "/org/gnu/enwc/agent"
+  "The path to the Agent for ENWC to use for ConnMan security."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-agent-interface "org.gnu.enwc.agent"
+  "The interface for the ConnMan Agent for ENWC to use."
+  :group 'enwc-cm
+  :type 'string)
+
+(defvar enwc-cm-details-list
+  '("Name" "Ethernet/Address" "Strength" "Security" "mode" "channel"))
+
+(defun enwc-cm-get-wifi-tech-path ()
+  "Return the ConnMan Wifi Technology path."
+  (concat enwc-cm-dbus-technology-path "wifi"))
+
+(defun enwc-cm-get-wired-tech-path ()
+  "Return the ConnMan Ethernet Technology path."
+  (concat enwc-cm-dbus-technology-path "ethernet"))
+
+(defun enwc-cm-get-network (id)
+  (nth id (enwc-cm-get-services)))
+
+;; connect
+(defun enwc-cm-connect (wired id)
+  (let ((path (concat enwc-cm-dbus-service-path (number-to-string id))))
+    (dbus-call-method :system
+                      enwc-cm-dbus-service
+                      path
+                      enwc-cm-dbus-service-interface
+                      "Connect")))
+
+;; disconnect
+(defun enwc-cm-disconnect (wired)
+  (dbus-call-method :system
+                    enwc-cm-dbus-service
+                    "/net/connman/service/CONNECTED-SERVICE"
+                    enwc-cm-dbus-service-interface
+                    "Disconnect"))
+
+;; scan
+(defun enwc-cm-scan (wired)
+  (let ((path (if wired
+                  (enwc-cm-get-wired-tech-path)
+                (enwc-cm-get-wifi-tech-path))))
+    (dbus-call-method-asynchronously :system
+                                     path
+                                     enwc-cm-dbus-technology-interface
+                                     "Scan"
+                                     'enwc-process-scan
+                                     :timeout 6000)))
+
+;; (defun enwc-cm-scan (wired)
+;;   (dbus-call-method :system
+;;                  enwc-cm-dbus-service
+;;                  "/net/connman/technology/(ethernet|wifi)"
+;;                  "net.connman.Technology"
+;;                  "Scan"))
+
+;; get-network-props
+;; Might combine this with enwc-nm-get-dbus-dict-entry
+(defun enwc-cm-dict-assoc (dict prop)
+  (let ((path-list (split-string prop "/"))
+        (cur-list dict))
+    (while (and path-list cur-list)
+      (let ((cur-path (pop path-list)))
+        (setq cur-list
+              (when (assoc cur-path cur-list)
+                (caadr (assoc cur-path cur-list))))))
+    (if (and cur-list (consp cur-list)) (car cur-list) cur-list)))
+
+(defun enwc-cm-get-nw-prop (id prop)
+  (let ((network (enwc-cm-get-network id)))
+    (car (cadr (assoc prop (cadr network))))))
+
+(defun enwc-cm-get-network-props (id wired)
+  (let ((network (enwc-cm-get-network id))
+        props)
+    ;; network should be a pair, (path . props)
+    (unless network
+      (error "Invalid Network Id %d" id))
+    (setq props (cadr network))
+    (mapcar
+     (lambda (det)
+       (enwc-cm-dict-assoc props det))
+     enwc-cm-details-list)))
+
+(defun enwc-cm-get-wireless-network-property (id prop)
+  (enwc-cm-get-nw-prop id prop))
+
+;; get-profile-props
+(defun enwc-cm-get-profile-props (prof wired)
+  (let ((network (enwc-cm-get-network prof))
+        props
+        ipv4-settings
+        dns-settings)
+    (unless network
+      (error "Invalid Network Id %d" id))
+    (setq props (cadr network))
+    (setq ipv4-settings (enwc-cm-dict-assoc "IPv4/Configuration" props)
+          dns-settings  (enwc-cm-dict-assoc "Domains/Configuration" props))
+    `((addr    . ,(cadr (assoc "Address" ipv4-settings)))
+      (netmask . ,(cadr (assoc "Netmask" ipv4-settings)))
+      (gateway . ,(cadr (assoc "Gateway" ipv4-settings)))
+      (dns1    . ,(nth 0 dns-settings))
+      (dns2    . ,(nth 1 dns-settings)))))
+
+;; get-current-nw-id
+(defun enwc-cm-is-disconnected-p (service)
+  (member (enwc-cm-dict-assoc (cadr service) "State")
+          '("idle" "disconnect")))
+
+(defun enwc-cm-is-connecting-p (service)
+  (member (enwc-cm-dict-assoc (cadr service) "State")
+          '("association" "configuration")))
+
+(defun enwc-cm-is-connected-p (service)
+  (member (enwc-cm-dict-assoc (cadr service) "State")
+          '("ready" "online")))
+
+(defun enwc-cm--find-connected-service (services num)
+  (if services
+      (if (enwc-cm-is-connected-p (car services))
+          num
+        (enwc-cm--find-connected-service (cdr services) (1+ num)))
+    -1))
+
+(defun enwc-cm-get-current-nw-id ()
+  "Get the current network id."
+  (let* ((services (enwc-cm-get-services)))
+    (enwc-cm--find-connected-service services 0)))
+
+;; save-profile
+(defun enwc-cm-set-nw-prop (nw prop val &optional wired)
+  (dbus-call-method :system
+                    enwc-cm-dbus-service
+                    (car nw)
+                    enwc-cm-dbus-service-interface
+                    "SetProperty"
+                    :string prop
+                    val))
+
+(defun enwc-cm-save-profile (prof settings wired)
+  (let ((network (enwc-cm-get-network prof))
+        props
+        ipv4-settings
+        dns-settings)
+    (unless network
+      (error "Invalid Network Id %d" id))
+    (setq props (cadr network))
+    (setq ipv4-settings
+          `((("Method" ("manual"))
+             ("Address" (,(alist-get 'addr settings "")))
+             ("Netmask" (,(alist-get 'netmask settings "")))
+             ("Gateway" (,(alist-get 'gateway settings ""))))))
+    (setq dns-settings
+          `((,(alist-get 'dns1 settings ""))
+            (,(alist-get 'dns2 settings ""))))
+    (enwc-cm-set-nw-prop prof "IPv4.Configuration" ipv4-settings wired)
+    (enwc-cm-set-nw-prop prof "Domains.Configuration" dns-settings wired)))
+
+;; check-connecting-p
+(defun enwc-cm--find-connecting-service (services)
+  (when services
+    (or (enwc-cm-is-connecting-p (car services))
+        (enwc-cm--find-connecting-service (cdr services)))))
+
+(defun enwc-cm-check-connecting-p ()
+  (let ((services (enwc-cm-get-services)))
+    (enwc-cm--find-connecting-service services)))
+
+;; get-networks
+(defun enwc-cm-get-services ()
+  (dbus-call-method :system
+                    enwc-cm-dbus-service
+                    "/"
+                    enwc-cm-dbus-manager-interface
+                    "GetServices"))
+
+(defun enwc-cm-get-networks ()
+  (let ((services (enwc-cm-get-services)))
+    (mapcar 'car services)))
+
+;; Agent
+;; ConnMan requires that an agent is registered, so we create one here.
+
+(defun enwc-cm-agent-release (&rest args)
+  )
+
+(defun enwc-cm-agent-report-error (service err)
+  )
+
+(defun enwc-cm-agent-report-peer-error (peer err))
+
+(defun enwc-cm-agent-request-browser (service url)
+  (browse-url url))
+
+(defun enwc-cm-agent-request-input (service fields)
+  "Called when a user requests input.
+SERVICE is the current service.
+FIELDS is an associative list of requested fields."
+  ;; Obtain the information from somewhere.
+  )
+
+(defun enwc-cm-agent-request-peer-authorization (peer fields))
+
+(defun enwc-cm-agent-cancel ())
+
+(defun enwc-cm-method-to-defun (method)
+  (let ((case-fold-search nil))
+    (combine-and-quote-strings
+     (mapcar 'downcase
+             (cdr (split-string
+                   (replace-regexp-in-string "\\([[:upper:]]\\)" " \\1" method)
+                   " ")))
+     "-")))
+
+(defmacro enwc-cm-agent-register-method (method)
+  "Register a method METHOD with D-Bus.
+METHOD is assumed to be the camel-case D-Bus method."
+  `((dbus-register-method :session
+                          enwc-cm-dbus-agent-service
+                          enwc-cm-dbus-agent-path
+                          enwc-cm-dbus-agent-interface
+                          ,method
+                          (quote ,(car (read-from-string
+                                        (concat
+                                         "enwc-cm-agent-"
+                                         (enwc-cm-method-to-defun 
method))))))))
+
+;; Run during setup.
+(defun enwc-cm-setup ()
+
+  ;; Setup the agent.
+  (dbus-register-service :session enwc-cm-dbus-agent-service)
+
+  (enwc-cm-agent-register-method "Release")
+  (enwc-cm-agent-register-method "ReportError")
+  (enwc-cm-agent-register-method "ReportPeerError")
+  (enwc-cm-agent-register-method "RequestBrowser")
+  (enwc-cm-agent-register-method "RequestInput")
+  (enwc-cm-agent-register-method "RequestPeerAuthorization")
+  (enwc-cm-agent-register-method "Cancel")
+
+  (dbus-call-method :system
+                    enwc-cm-dbus-manager-service
+                    enwc-cm-dbus-manager-path
+                    enwc-cm-dbus-manager-interface
+                    "RegisterAgent"
+                    :string enwc-cm-dbus-agent-path))
+
+
+;; (defun enwc-cm-get-encryption-type (id)
+;;   (enwc-cm-get-nw-prop id "Security"))
+
+;; (defun enwc-cm-get-ip-addr (wired id)
+;;   (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+;;     (car (cadr (assoc "Address" ipv4-config)))))
+
+;; (defun enwc-cm-get-netmask (wired id)
+;;   (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+;;     (car (cadr (assoc "Netmask" ipv4-config)))))
+
+;; (defun enwc-cm-get-gateway (wired id)
+;;   (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+;;     (car (cadr (assoc "Gateway" ipv4-config)))))
+
+;; (defun enwc-cm-get-dns (wired id)
+;;   (enwc-cm-get-nw-prop id "Nameservers.Configuration"))
+
+;; (defun enwc-cm-save-nw-settings (wired id settings)
+;;   (let* ((ipv4 (enwc-cm-get-nw-prop id "IPv4.Configuration"))
+;;          (method (car (cadr (assoc "Method" ipv4))))
+;;          (ip-addr (cdr (assoc "addr" settings)))
+;;          (netmask (cdr (assoc "netmask" settings)))
+;;          (gateway (cdr (assoc "gateway" settings)))
+;;          new-ipv4-config new-dns-config)
+;;     (setq new-ipv4-config
+;;           (list (list (cons "Method" (cons (cons method nil) nil))
+;;                       (cons "Address" (cons (cons ip-addr nil) nil))
+;;                       (cons "Netmask" (cons (cons netmask nil) nil))
+;;                       (cons "Gateway" (cons (cons gateway nil) nil)))))
+;;     (setq new-dns-config
+;;           (list (list (cdr (assoc "dns1" settings))
+;;                       (cdr (assoc "dns2" settings)))))
+;;     (enwc-cm-set-nw-prop wired id "IPv4.Configuration"
+;;                          new-ipv4-config)
+;;     (enwc-cm-set-nw-prop wired id "Nameservers.Configuration"
+;;                          new-dns-config)))
+
+(provide 'enwc-cm)
+
+;;; enwc-cm.el ends here
diff --git a/packages/enwc/enwc-edit.el b/packages/enwc/enwc-edit.el
new file mode 100644
index 0000000..7aee28b
--- /dev/null
+++ b/packages/enwc/enwc-edit.el
@@ -0,0 +1,434 @@
+;;; enwc-edit.el --- Support for editing wireless network profiles
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; THIS IS EXPERIMENTAL
+
+;;; Code:
+
+(require 'wid-edit)
+
+(eval-when-compile
+  (defun enwc--break-by-words (str)
+    "Break up string STR into a list of words."
+    (cl-check-type str string)
+    (split-string str "-\\|_\\| "))
+
+  (defun enwc--sym-to-str (sym &optional seps)
+    "Create a string from symbol SYM.
+SEPS is a string specifying the separator to use to combine the words,
+or \" \" if not specified."
+    (cl-check-type sym symbol)
+    (unless seps
+      (setq seps " "))
+    (cl-check-type seps string)
+    (combine-and-quote-strings (enwc--break-by-words (symbol-name sym)) seps))
+
+  (defun enwc--str-to-sym (str &optional seps)
+    "Create a symbol from the string STR.
+This will break STR into words, and then put it back together separating
+each word by SEPS, which defaults to \"-\"."
+    (cl-check-type str string)
+    (unless seps
+      (setq seps "-"))
+    (cl-check-type seps string)
+    (intern (combine-and-quote-strings (enwc--break-by-words str) seps))))
+
+(defun enwc--int-to-byte-list (n)
+  "Convert 32-bit integer N into a byte list."
+  (cl-check-type n integer)
+  (let (ret)
+    (dotimes (x 4 ret)
+      (push (logand n 255) ret)
+      (setq n (lsh n -8)))))
+
+(defun enwc--byte-list-to-int (bl)
+  "Convert byte list BL into a 32-bit integer."
+  (cl-check-type bl list)
+  (let ((ret 0))
+    (dolist (x bl ret)
+      (setq ret (logior (lsh ret 8) x)))))
+
+(defun enwc--htonl (n)
+  "Convert 32-bit integer N from hardware to network byte order."
+  (cl-check-type n integer)
+  (enwc--byte-list-to-int (nreverse (enwc--int-to-byte-list n))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;
+;; Profile Properties ;;
+;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Settings for access point AP
+;;
+;; IPv4 Settings:
+;;   Address =
+;;   Netmask =
+;;   Gateway =
+;;
+;;   DNS 1   =
+;;   DNS 2   =
+;;
+;; Security:
+;;   Type    =
+;;
+
+(defun enwc-edit-view-entry ()
+  "View the text of the entry at point.
+This is mostly useful to view the text of the hidden entries."
+  (interactive)
+  (unless (get-buffer "*ENWC Edit*")
+    (error "Not editing a network entry."))
+  (unless (eq (current-buffer) (get-buffer "*ENWC Edit*"))
+    (switch-to-buffer "*ENWC Edit*"))
+  (unless (widget-at)
+    (error "No widget at point"))
+  (message (widget-field-value-get (widget-at))))
+
+(define-widget 'enwc-profile-props-widget 'group
+  "ENWC edit widget."
+  :convert-widget 'identity
+  :format "IPv4 Settings:\n %v"
+  :value-to-internal 'enwc-profile-props-to-widget
+  :value-to-external 'enwc-widget-to-profile-props
+  :match #'(lambda nil t)
+  :indent 1
+  :args '((string :tag "Address")
+          (string :tag "Netmask")
+          (string :tag "Gateway")
+          (string :tag "DNS1")
+          (string :tag "DNS2")))
+
+(defun enwc-profile-props-to-widget (widget props)
+  "Create a profile props widget."
+  (list
+   (alist-get 'addr props "")
+   (alist-get 'netmask props "")
+   (alist-get 'gateway props "")
+   (alist-get 'dns1 props "")
+   (alist-get 'dns2 props "")))
+
+(defun enwc-widget-to-profile-props (widget vals)
+  "Convert widget values to a profile properties alist.
+WIDGET is unused.
+VALS is the list of widget values."
+  (let ((addr (nth 0 vals))
+        (netmask (nth 1 vals))
+        (gateway (nth 2 vals))
+        (dns1 (nth 3 vals))
+        (dns2 (nth 4 vals)))
+    `((addr . ,addr)
+      (netmask . ,netmask)
+      (gateway . ,gateway)
+      (dns1 . ,dns1)
+      (dns2 . ,dns2))))
+
+;;;;;;;;;;;;;;
+;; Security ;;
+;;;;;;;;;;;;;;
+
+(eval-when-compile
+  (defmacro enwc--make-supplicant-multi (key &rest args)
+    `(cons (quote ,key)
+           (quote (checklist :tag ,(capitalize (enwc--sym-to-str key))
+                             :format "%{%t%}: %v"
+                             :sample-face bold
+                             :indent ,(+ 4 (length (enwc--sym-to-str key)))
+                             :args ,(mapcar
+                                     (lambda (arg)
+                                       `(item :tag ,(upcase arg) :value 
,(downcase arg)))
+                                     args)))))
+
+  (defmacro enwc--make-supplicant-choice (key &rest args)
+    `(cons (quote ,key)
+           (quote (menu-choice :tag ,(capitalize (enwc--sym-to-str key))
+                               :format "%[%t%]: %v"
+                               :sample-face bold
+                               :args
+                               ,(mapcar
+                                 (lambda (arg)
+                                   `(item :tag ,(upcase arg) :value (downcase 
,arg)))
+                                 args)))))
+
+  (defmacro enwc--make-supplicant-secret (key)
+    `(cons (quote ,key)
+           (quote (editable-field :tag ,(capitalize (enwc--sym-to-str key))
+                                  :format "%{%t%}: %v"
+                                  :sample-face bold
+                                  :keymap enwc-edit-field-map
+                                  :secret ?*))))
+
+  (defmacro enwc--make-supplicant-entry (key)
+    `(cons (quote ,key)
+           (quote (editable-field :tag ,(capitalize (enwc--sym-to-str key))
+                                  :sample-face bold
+                                  :format "%{%t%}: %v"))))
+
+  (defmacro enwc--make-supplicant-file (key)
+    `(cons (quote ,key)
+           (quote (file :tag ,(capitalize (enwc--sym-to-str key))
+                        :format "%{%t%}: %v"
+                        :sample-face bold
+                        :must-match t))))
+
+  (defmacro enwc--make-supplicant-list (key &rest args)
+    `(cons (quote ,key)
+           (quote (list :tag ,(capitalize (enwc--sym-to-str key))
+                        :format "%{%t%}: %v"
+                        :sample-face bold
+                        :indent ,(length (enwc--sym-to-str key))
+                        :args ,(mapcar (lambda (x) (cdr (eval x))) args))))))
+
+(defconst enwc-supplicant-alist
+  (list
+   (enwc--make-supplicant-multi proto "WPA" "RSN")
+   (enwc--make-supplicant-multi key-mgmt "None" "WPA-PSK" "WPA-EAP" 
"IEEE8021X")
+   (enwc--make-supplicant-choice auth-alg "OPEN" "SHARED" "LEAP")
+   (enwc--make-supplicant-multi pairwise "CCMP" "TKIP" "NONE")
+   (enwc--make-supplicant-multi group "CCMP" "TKIP" "WEP104" "WEP40")
+   (enwc--make-supplicant-secret psk)
+   (enwc--make-supplicant-secret wep-key0)
+   (enwc--make-supplicant-secret wep-key1)
+   (enwc--make-supplicant-secret wep-key2)
+   (enwc--make-supplicant-secret wep-key3)
+   (enwc--make-supplicant-choice wep-tx-keyidx "0" "1" "2" "3")
+   (enwc--make-supplicant-choice eap "TLS" "PEAP" "TTLS" "LEAP" "FAST")
+   (enwc--make-supplicant-entry identity)
+   (enwc--make-supplicant-entry anonymous-identity)
+   (enwc--make-supplicant-secret password)
+   (enwc--make-supplicant-file ca-cert)
+   (enwc--make-supplicant-file client-cert)
+   (enwc--make-supplicant-file private-key)
+   (enwc--make-supplicant-secret private-key-passwd)
+   (enwc--make-supplicant-file pac-file)
+   (enwc--make-supplicant-list phase1
+                               (enwc--make-supplicant-choice peapver "" "0" 
"1")
+                               (enwc--make-supplicant-choice peaplabel "" "0" 
"1")
+                               (enwc--make-supplicant-choice fast-provisioning 
"" "0" "1" "2" "3"))
+   (enwc--make-supplicant-list phase2
+                               (enwc--make-supplicant-choice auth "" "MD5" 
"MSCHAPV2" "OTP" "GTC" "TLS")
+                               (enwc--make-supplicant-choice autheap "" "MD5" 
"MSCHAPV2" "OTP" "GTC" "TLS")
+                               (enwc--make-supplicant-file ca-cert)
+                               (enwc--make-supplicant-file client-cert)
+                               (enwc--make-supplicant-file private-key)
+                               (enwc--make-supplicant-secret 
private-key-passwd)))
+  "An alist that maps supplicant entries to a widget type.
+
+For more information, see the documentation for wpa_supplicant.")
+
+(defcustom enwc-supplicant-template-alist
+  `((wep . ((key-mgmt . ("none"))
+            (wep-key0 . req)
+            (wep-tx-keyidx . "0")))
+    (wpa2 . ((proto . ("wpa" "rsn"))
+             (key-mgmt . ("wpa-psk"))
+             (pairwise . ("ccmp" "tkip"))
+             (group . ("ccmp" "tkip"))
+             (psk . req)))
+    (leap . ((eap . "leap")
+             (key-mgmt . ("ieee8021x"))
+             (auth-alg . "leap")
+             (identity . req)
+             (password . req)))
+    (eap-fast . ((proto . ("rsn" "wpa"))
+                 (pairwise . ("ccmp" "tkip"))
+                 (group . ("ccmp" "tkip"))
+                 (key-mgmt . ("wpa-eap"))
+                 (eap . "fast")
+                 (identity . req)
+                 (password . req)
+                 (phase1 . ((fast-provisioning . "1")))
+                 (pac-file . opt)))
+    (eap-tls . ((key-mgmt . ("wpa-eap"))
+                (pairwise . ("tkip"))
+                (group . ("tkip"))
+                (eap . "tls")
+                (identity . req)
+                (ca-cert . opt)
+                (client-cert . opt)
+                (private-key . req)
+                (private-key-passwd . req)))
+    (peap . ((proto . ("rsn"))
+             (key-mgmt . ("wpa-eap"))
+             (pairwise . ("ccmp"))
+             (eap . "peap")
+             (identity . req)
+             (password . req)))
+    (peap-tkip . ((proto . ("wpa"))
+                  (key-mgmt . ("wpa-eap"))
+                  (pairwise . ("tkip"))
+                  (group . ("tkip"))
+                  (eap . "peap")
+                  (identity . req)
+                  (password . req)
+                  (ca-cert . opt)
+                  (phase1 . ((peaplabel . "0")))
+                  (phase2 . ((auth . "mschapv2"))))))
+  "The alist of templates for security.
+This should be an alist of the form (KEY . ((SUPPLICANT-KEY . INITIAL-INPUT) 
...))
+Each SUPPLICANT-KEY should be a key from `enwc-supplicant-alist', and 
INITIAL-INPUT
+should be an acceptable value for SUPPLICANT-KEY.
+
+If INITIAL-INPUT is the symbol req, then this option is required.
+The value opt means that the option is optional."
+  :group 'enwc
+  :type '(alist :key-type symbol :value-type (alist :key-type symbol)))
+
+(defun enwc--get-supplicant-entry (ent &optional sec-info)
+  "Create a widget definition from ENT.
+
+If optional parameter SEC-INFO is non-nil, then use it
+for security information."
+  (let ((init (cdr ent))
+        (wid (assq (car ent) enwc-supplicant-alist))
+        fin)
+    (unless wid
+      (error "Unknown supplicant type %s" (car ent)))
+    ;; Set the initial value for the widget.
+    (when (eq (cadr wid) 'list)
+      (let (act-init)
+        (dolist (arg (widget-get (cdr wid) :args))
+          (push (alist-get (enwc--str-to-sym (downcase (widget-get arg :tag))) 
init "")
+                act-init))
+        (setq init (nreverse act-init))))
+    (cons (cadr wid)
+          (append (pcase init
+                    (`req `(:required t :value ,(alist-get (car ent) sec-info 
"")))
+                    (`opt `(:value ,(alist-get (car ent) sec-info "")))
+                    (_ `(:value ,init)))
+                  (cddr wid)))))
+
+(defun enwc-create-template-menu (&optional sec-info)
+  "Create the widget declaration for the menu of templates.
+
+If specified, SEC-INFO is passed to the templates to initialize them."
+  `(menu-choice
+    :tag "Security"
+    :indent 2
+    ,@(mapcar
+       (lambda (tm)
+         `(list
+           :tag ,(symbol-name (car tm))
+           :menu-tag ,(symbol-name (car tm))
+           ,@(mapcar
+              (lambda (ent)
+                (enwc--get-supplicant-entry ent sec-info))
+              (cdr tm))))
+       enwc-supplicant-template-alist)))
+
+(defun enwc-display-sec-widget (&optional sec-info)
+  "Create the menu of security templates.
+If specified, SEC-INFO is passed to the templates to initialize them."
+  (widget-create (enwc-create-template-menu sec-info)))
+
+(defun enwc-sec-widget-data (widget)
+  "Get the data from a security widget WIDGET."
+  (let* ((type (widget-get (widget-get widget :choice) :tag))
+         (values (widget-value widget))
+         (template (assq (intern type) enwc-supplicant-template-alist)))
+    (unless template
+      (error "Unrecognized security template \"%s\"." type))
+    (setq template (cdr template))
+    (cons
+     `(sec-type . ,(intern type))
+     (cl-mapcar
+      (lambda (val v)
+        (let ((vl v))
+          (when (or (eq (car val) 'phase1)
+                    (eq (car val) 'phase2))
+            (let ((subs
+                   (mapcar
+                    (lambda (arg)
+                      (enwc--str-to-sym (downcase (widget-get arg :tag))))
+                    (widget-get (alist-get (car val) enwc-supplicant-alist) 
:args))))
+              (setq vl (cl-mapcar 'cons subs v))))
+          (print vl)
+          (cons (car val) vl)))
+      template values))))
+
+(defvar enwc-network-edit-widget nil
+  "The network information widget used in the edit buffer.")
+
+(defvar enwc-security-edit-widget nil
+  "The security widget used in the edit buffer.")
+
+(defun enwc-setup-edit-buffer ()
+  "Setup the edit buffer.  This removes the old one if neccessary,
+and redisplays the settings from the network profile
+ with id `enwc-edit-id', which is set in `enwc-edit-entry-at-point'."
+  (when (get-buffer "*ENWC Edit*")
+    (kill-buffer "*ENWC Edit*"))
+  (with-current-buffer (get-buffer-create "*ENWC Edit*")
+    (let ((nw-info (enwc-get-profile-info enwc-edit-id)))
+
+      (widget-insert (concat "Settings for access point "
+                             (enwc-value-from-scan 'essid enwc-edit-id)
+                             "\n"))
+      (widget-insert "\n")
+      (setq enwc-network-edit-widget
+            (widget-create 'enwc-profile-props-widget :value nw-info))
+
+      (widget-insert "\n")
+      (setq enwc-security-edit-widget (enwc-display-sec-widget nw-info))
+
+      (use-local-map enwc-edit-map)
+      (widget-setup)))
+
+  (switch-to-buffer "*ENWC Edit*"))
+
+(defun enwc-edit-save ()
+  "Save the network settings from the edit buffer."
+  (interactive)
+  (unless (get-buffer "*ENWC Edit*")
+    (error "Not editing a network entry"))
+  (unless (eq (current-buffer) (get-buffer "*ENWC Edit*"))
+    (switch-to-buffer "*ENWC Edit*"))
+
+  (enwc-save-nw-settings
+   enwc-edit-id
+   (append (widget-value enwc-network-edit-widget)
+           (enwc-sec-widget-data enwc-security-edit-widget))))
+
+(defun enwc-edit-entry-at-point ()
+  "Edit the current network entry."
+  (interactive)
+  (setq enwc-edit-id (tabulated-list-get-id))
+  ;; TODO: Use pop-to-buffer
+  (enwc-setup-edit-buffer))
+
+(defvar enwc-edit-map
+  (let ((map (copy-keymap widget-keymap)))
+    (define-key map (kbd "C-x C-s") 'enwc-edit-save)
+    map)
+  "The keymap for editing network profiles with ENWC.")
+
+(defvar enwc-edit-field-map
+  (let ((map (copy-keymap widget-field-keymap)))
+    (define-key map (kbd "C-x C-a") 'enwc-edit-view-entry)
+    map)
+  "The keymap for editable fields within the ENWC edit buffer.")
+
+;;; enwc-edit.el ends here
diff --git a/packages/enwc/enwc-nm.el b/packages/enwc/enwc-nm.el
new file mode 100644
index 0000000..b3275e0
--- /dev/null
+++ b/packages/enwc/enwc-nm.el
@@ -0,0 +1,738 @@
+;;; enwc-nm.el - The NetworkManager backend to ENWC
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+;;
+;;   This requires NetworkManager >= 0.9.6
+;;
+
+(require 'enwc-backend)
+(require 'enwc)
+(require 'dbus)
+(require 'subr-x)
+
+(defgroup enwc-nm nil
+  "*NetworkManager variables for ENWC"
+  :prefix "enwc-nm-"
+  :group 'enwc)
+
+(defcustom enwc-nm-dbus-service "org.freedesktop.NetworkManager"
+  "NetworkManager D-Bus service."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-path "/org/freedesktop/NetworkManager"
+  "The default D-Bus path for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-settings-path 
"/org/freedesktop/NetworkManager/Settings"
+  "The settings D-Bus path for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-interface "org.freedesktop.NetworkManager"
+  "The default D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-wireless-interface 
"org.freedesktop.NetworkManager.Device.Wireless"
+  "The wireless D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-wired-interface 
"org.freedesktop.NetworkManager.Device.Wired"
+  "The wired D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-device-interface 
"org.freedesktop.NetworkManager.Device"
+  "The device D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-accesspoint-interface 
"org.freedesktop.NetworkManager.AccessPoint"
+  "The access point D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-settings-interface 
"org.freedesktop.NetworkManager.Settings"
+  "The settings D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-connections-interface 
"org.freedesktop.NetworkManager.Settings.Connection"
+  "The connections D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-active-interface 
"org.freedesktop.NetworkManager.Connection.Active"
+  "The active connection D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+;;TODO: Make this customizable.
+(defconst enwc-nm-dbus-settings-groups
+  '(("802-11-wireless-security" . ("name"
+                                   "key-mgmt"
+                                   "wep-tx-keyidx"
+                                   "auth-alg"
+                                   "proto"
+                                   "pairwise"
+                                   "group"
+                                   "leap-username"
+                                   "wep-key0"
+                                   "wep-key1"
+                                   "wep-key2"
+                                   "wep-key3"
+                                   "wep-key-type"
+                                   "psk"
+                                   "leap-password"))
+    ("ipv4" . ("addresses"
+               "dns"))))
+
+(defvar enwc-nm-wired-dev nil
+  "The wired device object path.")
+
+(defvar enwc-nm-wireless-dev nil
+  "The wireless device object path.")
+
+(defvar enwc-nm-active-ap nil
+  "The active access point object path.")
+
+(defvar enwc-nm-connecting-p nil
+  "Whether or not NetworkManager is connecting.")
+
+(defvar enwc-nm-wired-p nil
+  "Whether or not NetworkManager is wired.")
+
+(defvar enwc-nm-edit-info nil
+  "The information for the network connection being edited.")
+
+;; D-Bus Signals:
+
+(defvar enwc-nm-access-point-added-signal nil
+  "D-Bus signal object for the \"AccessPointAdded\" signal.")
+
+(defvar enwc-nm-access-point-removed-signal nil
+  "D-Bus signal object for the \"AccessPointRemoved\" signal.")
+
+(defvar enwc-nm-properties-changed-signal nil
+  "D-Bus signal object for the \"PropertiesChanged\" signal.")
+
+(defvar enwc-nm-wired-state-changed-signal nil
+  "D-Bus signal object for the \"StateChanged\" signal for the wired device.")
+
+(defvar enwc-nm-state-changed-signal nil
+  "D-Bus signal object for the \"StateChanged\" signal for the default path.")
+
+(defun enwc-nm-dbus-call-method (method &optional path interface &rest args)
+  (unless path (setq path enwc-nm-dbus-path))
+  (unless interface (setq interface enwc-nm-dbus-interface))
+  (apply 'dbus-call-method :system
+         enwc-nm-dbus-service
+         path
+         interface
+         method
+         :timeout 25000
+         args))
+
+(defun enwc-nm-dbus-default-call-method (method &rest args)
+  (apply 'enwc-nm-dbus-call-method method nil nil args))
+
+(defun enwc-nm-dbus-settings-call-method (method &rest args)
+  (apply 'enwc-nm-dbus-call-method
+         method
+         enwc-nm-dbus-settings-path
+         enwc-nm-dbus-settings-interface
+         args))
+
+(defun enwc-nm-dbus-wireless-call-method (method &rest args)
+  (apply 'enwc-nm-dbus-call-method
+         method
+         enwc-nm-wireless-dev
+         enwc-nm-dbus-wireless-interface
+         args))
+
+(defun enwc-nm-dbus-wired-call-method (method &rest args)
+  (apply 'enwc-nm-dbus-call-method
+         method
+         enwc-nm-wired-dev
+         enwc-nm-dbus-wired-interface
+         args))
+
+(defun enwc-nm-get-settings (conn)
+  "Get the connection settings from CONN."
+  (enwc-nm-dbus-call-method "GetSettings" conn
+                            enwc-nm-dbus-connections-interface))
+
+(defun enwc-nm-list-connections ()
+  "List the connections."
+  (enwc-nm-dbus-settings-call-method "ListConnections"))
+
+;; Default
+(defun enwc-nm-get-device-by-name (name)
+  (enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string name))
+
+(defun enwc-nm--ap-to-conn (ap)
+  "Get the connection that corresponds to AP."
+  (let ((ssid (dbus-byte-array-to-string (enwc-nm-get-wireless-network-property
+                                          ap "Ssid")))
+        (conns (enwc-nm-list-connections))
+        conn)
+    (while (and conns (not conn))
+      (setq conn (pop conns))
+      (let ((settings (enwc-nm-get-settings conn)))
+        (if settings
+            (let ((this-ssid (enwc-nm-get-dbus-dict-entry 
"802-11-wireless/ssid"
+                                                          settings)))
+              (unless (and this-ssid
+                           (string-equal (dbus-byte-array-to-string this-ssid)
+                                         ssid))
+                (setq conn nil)))
+          (setq conn nil))))
+    conn))
+
+(defun enwc-nm-connection-p (conn)
+  "Return non-nil if CONN is a connection object."
+  (and conn
+       (stringp conn)
+       (string-match "^/org/freedesktop/NetworkManager/Settings/[0-9]+$" 
conn)))
+
+;;;;;;;;;;;;;;;;;;
+;; Get networks ;;
+;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-get-networks (&optional wired)
+  (if wired
+      (enwc-nm-get-wired-profiles)
+    (enwc-nm-get-wireless-networks)))
+
+(defun enwc-nm-get-wireless-networks ()
+  "The NetworkManager get networks function.
+This returns a list of D-Bus paths to the access points."
+  (enwc-nm-dbus-wireless-call-method "GetAccessPoints"))
+
+(defun enwc-nm-get-wired-profiles ()
+  (let ((profs-list (enwc-nm-list-connections)))
+    (mapcar
+     (lambda (x)
+       (let ((props (enwc-nm-get-settings x)))
+         (when (string= (enwc-nm-get-dbus-dict-entry "connection/type" props)
+                        "802-3-ethernet")
+           (enwc-nm-get-dbus-dict-entry "connection/id" props))))
+     profs-list)))
+
+;;;;;;;;;;;;;
+;; Connect ;;
+;;;;;;;;;;;;;
+
+;; Default
+(defun enwc-nm-connect (nw &optional wired)
+  "The NetworkManager connect function.
+This gets the connection path from NW, and connects to it."
+  (if wired
+      (enwc-nm-wired-connect nw)
+    (enwc-nm-wireless-connect nw)))
+
+(defun enwc-nm-wireless-connect (nw)
+  (let ((ap-ssid (dbus-byte-array-to-string
+                  (dbus-get-property :system
+                                     enwc-nm-dbus-service
+                                     nw
+                                     
"org.freedesktop.NetworkManager.AccessPoint"
+                                     "Ssid")))
+        (profile-table (make-hash-table :test #'equal)))
+    ;; Create a hash table of connections, indexed by ssid
+    ;; TODO: Store this somewhere else
+    (dolist (conn (enwc-nm-list-connections))
+      (let ((settings (dbus-call-method :system
+                                        enwc-nm-dbus-service
+                                        conn
+                                        
"org.freedesktop.NetworkManager.Settings.Connection"
+                                        "GetSettings")))
+        (map-put profile-table
+                 (dbus-byte-array-to-string (caadr (assoc-string "ssid" (cadr 
(assoc-string "802-11-wireless" settings)))))
+                 conn)))
+    (when-let (conn (map-elt profile-table ap-ssid))
+      (enwc-nm-dbus-default-call-method "ActivateConnection"
+                                        :object-path conn
+                                        :object-path enwc-nm-wireless-dev
+                                        :object-path conn))))
+
+(defun enwc-nm-wired-connect (nw)
+  (enwc-nm-dbus-default-call-method "ActivateConnection"
+                                    :object-path nw
+                                    :object-path enwc-nm-wired-dev
+                                    :object-path nw))
+
+;;;;;;;;;;;;;;;;
+;; Disconnect ;;
+;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-disconnect (&optional wired)
+  (if wired
+      (enwc-nm-wired-disconnect)
+    (enwc-nm-disconnect-wireless)))
+
+;; Device
+(defun enwc-nm-disconnect-wireless ()
+  (enwc-nm-dbus-call-method "Disconnect"
+                            enwc-nm-wireless-dev
+                            enwc-nm-dbus-device-interface))
+
+(defun enwc-nm-wired-disconnect ()
+  (enwc-nm-dbus-call-method "Disconnect"
+                            enwc-nm-wired-dev
+                            enwc-nm-dbus-device-interface))
+
+;;;;;;;;;;
+;; Scan ;;
+;;;;;;;;;;
+
+(defun enwc-nm-scan (&optional wired)
+  "The NetworkManager scan function."
+  (let ((dev (if wired
+                 enwc-nm-wired-dev
+               enwc-nm-wireless-dev))
+        (interface (if wired
+                       enwc-nm-dbus-wired-interface
+                     enwc-nm-dbus-wireless-interface)))
+    (enwc-nm-dbus-call-method "RequestScan"
+                              dev interface
+                              '(:array :signature "{sv}"))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Get network properties ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-get-wireless-network-property (nw prop)
+  "The NetworkManager get wireless network property function.
+This runs like normal, using element ID of `enwc-access-points'
+ to determine the access point path, then obtains the property
+PROP from that access point.  It also sets the channel from the
+ frequency if necessary."
+  (dbus-get-property :system
+                     enwc-nm-dbus-service
+                     nw
+                     enwc-nm-dbus-accesspoint-interface
+                     prop))
+
+(defun enwc-nm--freq-to-channel (freq)
+  "Convert a frequency FREQ into a channel."
+  (1+ (/ (- freq 2412) 5)))
+
+(defun enwc-nm-get-wireless-nw-props (nw)
+  "Get the network properties for the network NW."
+  (let ((props (dbus-get-all-properties :system
+                                        enwc-nm-dbus-service
+                                        nw
+                                        enwc-nm-dbus-accesspoint-interface)))
+
+    `((essid    . ,(dbus-byte-array-to-string (cdr (assoc "Ssid" props))))
+      (bssid    . ,(cdr (assoc "HwAddress" props)))
+      (strength . ,(cdr (assoc "Strength" props)))
+      (encrypt  . ,(or (enwc-nm-get-encryption-type nw) "Unsecured"))
+      (channel  . ,(enwc-nm--freq-to-channel
+                    (cdr (assoc "Frequency" props)))))))
+
+(defun enwc-nm-get-encryption-type (nw)
+  "The NetworkManager get encryption type function.
+This gets the WPA flags and RSN flags from access point in NW.
+If both are 0, then it returns WEP, otherwise WPA."
+  (let ((wpa-flags (enwc-nm-get-wireless-network-property nw "WpaFlags"))
+        (rsn-flags (enwc-nm-get-wireless-network-property nw "RsnFlags")))
+    (if (and (= wpa-flags 0) (= rsn-flags 0))
+        "WEP"
+      "WPA")))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Get Current network id ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-wireless-prop-changed (props)
+  "Called when network properties are changed.
+PROPS is a list of updated properties."
+  (let ((ap (assoc "ActiveAccessPoint" props)))
+    (when ap
+      (setq enwc-nm-active-ap (car (cadr ap))))))
+
+(defun enwc-nm-get-current-nw-id (wired)
+  "The NetworkManager get current network id function.
+This simply checks for the active access point."
+  (cond
+   (wired 'wired)
+   ((string= enwc-nm-active-ap "/") nil)
+   (t enwc-nm-active-ap)))
+
+(defun enwc-nm-prop-changed (state)
+  "Called when NetworkManager's state is changed.
+STATE is the new state
+
+If STATE is 40, then NetworkManager is connecting to a new AP."
+  (setq enwc-nm-connecting-p (eq state 40)))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Check Connecting ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-check-connecting ()
+  "The NetworkManager check connecting function."
+  enwc-nm-connecting-p)
+
+(defun enwc-nm-dev-prop-changed (new-state old-state reason)
+  (setq enwc-nm-wired-p (eq new-state 100)))
+
+(defun enwc-nm-is-wired ()
+  enwc-nm-wired-p)
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Profile Handling ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-gen-uuid ()
+  "Generate a UUID."
+  (random t)
+  (apply 'format
+         "%04x%04x-%04x-%04x-%04x-%04x%04x%04x"
+         (mapcar (lambda (x)
+                   (random 65535))
+                 (number-sequence 0 7))))
+
+(defmacro enwc-nm--hex-substring (str st ed)
+  "Get a standard integer from hex string STR starting at ST and ending st ED"
+  `(string-to-number (substring ,str ,st ,ed) 16))
+
+(defun enwc-nm-convert-addr (addr)
+  "Convert an address ADDR from an integer in network byte order to a string."
+  (if (and addr (integerp addr))
+      (let* ((hex-addr (format "%08x" addr))
+             (subs (mapcar
+                    (lambda (n)
+                      (enwc-nm--hex-substring hex-addr n (+ n 2)))
+                    (number-sequence 6 0 -2))))
+        (apply 'format "%i.%i.%i.%i" subs))
+    ""))
+
+(defun enwc-nm-addr-back (addr)
+  "Convert an IP address ADDR in dots notation to an integer."
+  (cl-check-type addr string)
+  (let* ((bytes (split-string addr "\\."))
+         (byte-string (mapcar
+                       (lambda (n) (lsh (string-to-number (nth n bytes))
+                                   (* 8 n)))
+                       (number-sequence 0 3))))
+    (apply 'logior byte-string)))
+
+;; These next two come from libnm-util/nm-utils.c in NM's source.
+
+;; (defun enwc-nm-netmask-to-prefix (netmask)
+;;   "Convert a netmask to a CIDR prefix.
+;; NETMASK is an ip address in network byte order."
+;;   (if (and netmask (integerp netmask))
+;;       (progn
+;;         (setq netmask (enwc--htonl netmask))
+;;         (while (cl-evenp netmask)
+;;           (setq netmask (lsh netmask -1)))
+;;         (floor (log (1+ netmask) 2)))
+;;     0))
+
+;; (defun enwc-nm-prefix-to-netmask (prefix)
+;;   "Convert a CIDR prefix to a netmask.
+;; PREFIX is an integer <= 32."
+;;   (if (and prefix (integerp prefix))
+;;       (progn
+;;         (setq prefix (min prefix 32))
+;;         (enwc--htonl (lsh (1- (expt 2 prefix)) (- 32 prefix))))
+;;     0))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; D-Bus Conversion ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-nm-get-dbus-dict-entry (entry dict)
+  "Get an entry ENTRY from D-Bus dictionary DICT.
+
+ENTRY is in the form LVL1/LVL2/.../LVLN, where each LVLi is a string
+representing another layer in the dictionary."
+  (cl-check-type entry string)
+  (cl-check-type dict list)
+  (let ((ent-strs (split-string entry "/"))
+        (cur-ent dict)
+        cur-str)
+    (while ent-strs
+      (setq cur-str (pop ent-strs))
+      (setq cur-ent (assoc cur-str cur-ent))
+      (when cur-ent
+        (setq cur-ent (cadr cur-ent))))
+    cur-ent))
+
+(defun enwc-nm--recurse-dbus-entry (dict value entries)
+  "Look in DICT for ENTRIES, and set the final one to VALUE."
+  (if (not entries)
+      (setcar dict value)
+    (let* ((cur-str (car entries))
+           (cur-ent (assoc cur-str dict)))
+      (unless cur-ent
+        (if (equal dict '(nil))
+            (setcar dict `(,cur-str (nil)))
+          (nconc dict `((,cur-str (nil)))))
+        (setq cur-ent (assoc cur-str dict)))
+      (enwc-nm--recurse-dbus-entry (cadr cur-ent) value (cdr entries)))))
+
+(defun enwc-nm-set-dbus-dict-entry (entry dict value)
+  "Set entry ENTRY in D-Bus dictionary DICT to VALUE."
+  (cl-check-type entry string)
+  (cl-check-type dict list)
+  (enwc-nm--recurse-dbus-entry dict value (split-string entry "/")))
+
+(defun enwc-nm-convert-dict-list (dict-ent settings)
+  "Convert a D-Bus dictionary entry DICT-ENT from SETTINGS to an alist."
+  (mapcar
+   (lambda (ent)
+     (cons
+      (intern (car ent))
+      (cl-caadr ent)))
+   (cadr (assoc dict-ent settings))))
+
+(defun enwc-nm-get-sec-info (settings)
+  "Get security information from SETTINGS."
+  (append
+   (enwc-nm-convert-dict-list "802-11-wireless-security" settings)
+   (enwc-nm-convert-dict-list "802-1x" settings)))
+
+(defun enwc-nm-pair-to-dbus-dict-ent (pair)
+  "Convert PAIR into a D-Bus dictionary entry."
+  (let ((str (car pair))
+        (var (cdr pair)))
+    `(:dict-entry (:string ,str :variant ,var))))
+
+(defun enwc-nm-alist-to-dbus-dict (alist)
+  "Convert ALIST into a D-Bus dictionary."
+  (let (dict)
+    (append
+     '(:array)
+     (dolist (pr alist dict)
+       (setq dict (apply 'list dict (enwc-nm-pair-to-dbus-dict-ent pr)))))))
+
+(defun enwc-nm-process-profile-info (settings prof-info)
+  (dolist (ent prof-info settings)
+    ;; Find the corresponding entry in settings, and set it to the new value.
+    ;; Check 802-11-wireless-security, then 802-1x, then ipv4.
+    (let ((ent-list '("802-11-wireless-security"
+                      "ipv4"))
+          cur-ent)
+      (while ent-list
+        (setq cur-ent (pop ent-list))
+        (when (enwc-nm-set-dbus-dict-entry (concat cur-ent "/"
+                                                   (symbol-name (car ent)))
+                                           settings
+                                           (cdr ent))
+          (setq ent-list nil))))))
+
+(defun enwc-nm-alist-to-dbus-str-str-var-map-map (alist)
+  (let (ret)
+    (dolist (ent alist ret)
+      (push `(:string (car ent) ,(enwc-nm-alist-to-dbus-dict (cadr ent))) ret)
+      (push :dict-entry ret))))
+
+;; (defun enwc-nm-get-profile-info (ap &optional wired)
+;;   "Get the profile info for access point AP."
+;;   (let ((conn (enwc-nm--ap-to-conn ap))
+;;         settings)
+;;     (when conn
+;;       (setq settings (enwc-nm-get-settings conn)))
+;;     (when settings
+;;       (let* ((adr-info (caar (enwc-nm-get-dbus-dict-entry "ipv4/addresses" 
settings)))
+;;              (ip-addr (enwc-nm-convert-addr (nth 0 adr-info)))
+;;              (netmask (enwc-nm-convert-addr (enwc-nm-prefix-to-netmask (nth 
1 adr-info))))
+;;              (gateway (enwc-nm-convert-addr (nth 2 adr-info)))
+;;              (dns-list (mapcar 'enwc-nm-convert-addr
+;;                                (car (enwc-nm-get-dbus-dict-entry "ipv4/dns"
+;;                                                                  
settings))))
+;;              (sec-info (enwc-nm-get-sec-info settings)))
+;;         `((addr . ,ip-addr)
+;;           (netmask . ,netmask)
+;;           (gateway . ,gateway)
+;;           (dns1    . ,(nth 0 dns-list))
+;;           (dns2    . ,(nth 1 dns-list))
+;;           ,@sec-info)))))
+
+(defun enwc-nm-finalize-settings (settings)
+  "Set up all of the D-BUS types of a settings list SETTINGS.
+This will place all of the necessary markers in the list, such as :array,
+:dict-entry, etc."
+  `(:array ,@(enwc-nm-alist-to-dbus-str-str-var-map-map settings)))
+
+(defun enwc-nm-setup-settings (conn settings wired)
+  "Set up NetworkManager settings.
+Get the current network properties of network CONN
+and uses the information in the association list SETTINGS
+to put it in the form that NetworkManager will recognize."
+  (let (conn-settings)
+    (if (enwc-nm-connection-p conn)
+        (setq conn-settings (enwc-nm-get-settings conn))
+      (message "Not a connection")
+      (print conn)
+      ;;TODO: ssid will be invalid for wired connections.
+      ;; This would actually throw an error in that case.
+      (let ((ssid (dbus-byte-array-to-string 
(enwc-nm-get-wireless-network-property
+                                              conn "Ssid")))
+            (type (if wired "802-3-ethernet" "802-11-wireless")))
+        (setq conn-settings `(("connection"
+                               (("id" (,(concat ssid " settings")))
+                                ("uuid" (,(enwc-nm-gen-uuid)))
+                                ("autoconnect" (nil))
+                                ("type" (,type))))))))
+    (setq conn-settings (enwc-nm-process-profile-info conn-settings settings))
+    (pp conn-settings)
+    (print conn-settings)
+    (enwc-nm-finalize-settings conn-settings)))
+
+(defun enwc-nm-save-nw-settings (ap settings wired)
+  "Save network AP with settings SETTINGS."
+  (let ((conn (enwc-nm--ap-to-conn ap)))
+    (print conn)
+    (if conn
+        (enwc-nm-dbus-call-method "Update"
+                                  conn
+                                  enwc-nm-dbus-connections-interface
+                                  (enwc-nm-setup-settings conn settings wired))
+      (enwc-nm-dbus-call-method "AddConnection"
+                                enwc-nm-dbus-settings-path
+                                enwc-nm-dbus-settings-interface
+                                (enwc-nm-setup-settings ap settings wired)))))
+
+
+                                        ; ;;;;;;;;;;;;;;;;; ;
+                                        ; ;; Load/Unload ;; ;
+                                        ; ;;;;;;;;;;;;;;;;; ;
+
+
+(defun enwc-nm-load ()
+  "Setup the NetworkManager back-end."
+  ;;TODO: Add way of changing these two after load.
+  (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)
+        enwc-nm-wireless-dev (enwc-nm-get-device-by-name enwc-wireless-device))
+
+  (setq enwc-nm-access-point-added-signal
+        (dbus-register-signal :system
+                              enwc-nm-dbus-service
+                              enwc-nm-wireless-dev
+                              enwc-nm-dbus-wireless-interface
+                              "AccessPointAdded"
+                              'enwc-process-scan))
+
+  (setq enwc-nm-access-point-removed-signal
+        (dbus-register-signal :system
+                              enwc-nm-dbus-service
+                              enwc-nm-wireless-dev
+                              enwc-nm-dbus-wireless-interface
+                              "AccessPointRemoved"
+                              'enwc-process-scan))
+
+  (setq enwc-nm-active-ap
+        (let ((cur-net (dbus-get-property :system
+                                          enwc-nm-dbus-service
+                                          enwc-nm-wireless-dev
+                                          enwc-nm-dbus-wireless-interface
+                                          "ActiveAccessPoint")))
+          (if (string= cur-net "/")
+              "/"
+            cur-net)))
+
+  (setq enwc-nm-properties-changed-signal
+        (dbus-register-signal :system
+                              enwc-nm-dbus-service
+                              enwc-nm-wireless-dev
+                              enwc-nm-dbus-wireless-interface
+                              "PropertiesChanged"
+                              'enwc-nm-wireless-prop-changed))
+
+  (setq enwc-nm-connecting-p
+        (let ((state (dbus-get-property :system
+                                        enwc-nm-dbus-service
+                                        enwc-nm-dbus-path
+                                        enwc-nm-dbus-interface
+                                        "State")))
+          (eq state 40)))
+
+  (setq enwc-nm-wired-state-changed-signal
+        (dbus-register-signal :system
+                              enwc-nm-dbus-service
+                              enwc-nm-wired-dev
+                              enwc-nm-dbus-device-interface
+                              "StateChanged"
+                              'enwc-nm-dev-prop-changed))
+
+  (setq enwc-nm-wired-p
+        (let ((state (dbus-get-property :system
+                                        enwc-nm-dbus-service
+                                        enwc-nm-wired-dev
+                                        enwc-nm-dbus-device-interface
+                                        "State")))
+          (eq state 100)))
+  (setq enwc-nm-state-changed-signal
+        (dbus-register-signal :system
+                              enwc-nm-dbus-service
+                              enwc-nm-dbus-path
+                              enwc-nm-dbus-interface
+                              "StateChanged"
+                              'enwc-nm-prop-changed)))
+
+(defun enwc-nm-unload ()
+  "Unload the NetworkManager back-end.
+
+Unregister all of the D-Bus signals set up during load."
+  (dbus-unregister-object enwc-nm-access-point-added-signal)
+  (dbus-unregister-object enwc-nm-access-point-removed-signal)
+  (dbus-unregister-object enwc-nm-properties-changed-signal)
+  (dbus-unregister-object enwc-nm-wired-state-changed-signal)
+  (dbus-unregister-object enwc-nm-state-changed-signal))
+
+(defun enwc-nm-can-load-p ()
+  ;; (dbus-ping :system enwc-nm-dbus-service)
+  ;; NetworkManager doesn't allow Ping, so we have to use an alternative.
+  (dbus-introspect :system enwc-nm-dbus-service enwc-nm-dbus-path))
+
+(enwc-register-backend
+ (make-enwc-backend
+  :key 'nm
+  :can-load-p #'enwc-nm-can-load-p
+  :load #'enwc-nm-load
+  :unload #'enwc-nm-unload
+  :network-ids #'enwc-nm-get-networks
+  :scan #'enwc-nm-scan
+  :connect #'enwc-nm-connect
+  :disconnect #'enwc-nm-disconnect
+  :current-nw-id #'enwc-nm-get-current-nw-id
+  :is-connecting-p #'enwc-nm-check-connecting
+  :wireless-nw-props #'enwc-nm-get-wireless-nw-props
+  :is-wired-p #'enwc-nm-is-wired))
+
+(provide 'enwc-nm)
+
+;;; enwc-nm.el ends here
diff --git a/packages/enwc/enwc-wicd.el b/packages/enwc/enwc-wicd.el
new file mode 100644
index 0000000..011f91e
--- /dev/null
+++ b/packages/enwc/enwc-wicd.el
@@ -0,0 +1,473 @@
+;;; enwc-wicd.el --- The Wicd backend to ENWC
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; Wicd is one of the default supported back-ends for ENWC.
+
+;;; Code:
+
+(require 'enwc-backend)
+(require 'enwc)
+(require 'dbus)
+
+(defgroup enwc-wicd nil
+  "*Wicd variables for ENWC."
+  :prefix "enwc-wicd-"
+  :group 'enwc)
+
+(defcustom enwc-wicd-dbus-service "org.wicd.daemon"
+  "The wicd D-Bus service identifier."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wireless-path "/org/wicd/daemon/wireless"
+  "The wicd wireless D-Bus path."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wireless-interface "org.wicd.daemon.wireless"
+  "The wicd wireless D-Bus interface."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wired-path "/org/wicd/daemon/wired"
+  "The wicd wired D-Bus path."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wired-interface "org.wicd.daemon.wired"
+  "The wicd wired D-Bus interface."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defvar enwc-wicd-details-list
+  '("essid" "bssid" "quality" "encryption" "channel")
+  "The list of the desired details to be obtained from each network.")
+
+(defvar enwc-wicd-current-ap ""
+  "Current access point.
+UNUSED")
+
+(defvar enwc-wicd-current-nw-id -1
+  "Id of the current network.
+UNUSED")
+
+(defvar enwc-wicd-end-scan-signal nil
+  "D-Bus signal object for the \"SendEndScanSignal\" signal.")
+
+(defvar enwc-wicd-status-changed-signal nil
+  "D-Bus signal objects for the \"StatusChanged\" signal.")
+
+(defun enwc-wicd-dbus-wireless-call-method (method &rest args)
+  "Calls D-Bus method METHOD with arguments ARGS within
+the wicd wireless interface."
+  (apply 'dbus-call-method :system
+         enwc-wicd-dbus-service
+         enwc-wicd-dbus-wireless-path
+         enwc-wicd-dbus-wireless-interface
+         method
+         :timeout 25000
+         args))
+
+(defun enwc-wicd-dbus-wired-call-method (method &rest args)
+  "Calls D-Bus method METHOD with arguments ARGS within
+the wicd wired interface."
+  (apply 'dbus-call-method :system
+         enwc-wicd-dbus-service
+         enwc-wicd-dbus-wired-path
+         enwc-wicd-dbus-wired-interface
+         method
+         :timeout 25000
+         args))
+
+;;;;;;;;;;
+;; Scan ;;
+;;;;;;;;;;
+
+(defun enwc-wicd-scan ()
+  "Wicd scan function."
+  (enwc-wicd-dbus-wireless-call-method "Scan"))
+
+;;;;;;;;;;;;;;;;;;
+;; Get networks ;;
+;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-get-networks (&optional wired)
+  (if wired
+      (enwc-wicd-get-wired-profiles)
+    (enwc-wicd-get-wireless-networks)))
+
+(defun enwc-wicd-get-wireless-networks ()
+  "Wicd get networks function.
+Just returns a number sequence."
+  (number-sequence 0 (1- (enwc-wicd-dbus-wireless-call-method 
"GetNumberOfNetworks"))))
+
+(defun enwc-wicd-get-wired-profiles ()
+  "Get the list of wired network profiles."
+  (enwc-wicd-dbus-wired-call-method "GetWiredProfileList"))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Get network properties ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defvar enwc-wicd-prop-values nil)
+(defvar enwc-wicd-prop-num 0)
+(defvar enwc-wicd-prop-timeout 3)
+
+(defun enwc-wicd-nw-prop-handler (prop &rest args)
+  "The handler for `enwc-wicd-get-wireless-network-property'.
+This receives the value of network property PROP,
+and appends the value to `enwc-wicd-prop-values'."
+  (push (cons prop (car args)) enwc-wicd-prop-values)
+  (setq enwc-wicd-prop-num (1+ enwc-wicd-prop-num)))
+
+(defun enwc-wicd-prop-to-prop (prop)
+  "Convert a Wicd network property to an ENWC network property."
+  (cond
+   ((equal prop "essid") 'essid)
+   ((equal prop "bssid") 'bssid)
+   ((equal prop "quality") 'strength)
+   ((equal prop "encryption") 'encrypt)
+   ((equal prop "mode") 'mode)
+   ((equal prop "channel") 'channel)))
+
+(defun enwc-wicd-get-wireless-network-property (id prop)
+  "Wicd get wireless network property function.
+This calls the D-Bus method on Wicd to get the property PROP
+from wireless network with id ID."
+  (dbus-call-method-asynchronously :system
+                                   enwc-wicd-dbus-service
+                                   enwc-wicd-dbus-wireless-path
+                                   enwc-wicd-dbus-wireless-interface
+                                   "GetWirelessProperty"
+                                   `(lambda (x) (enwc-wicd-nw-prop-handler 
,prop x))
+                                   :timeout 1000
+                                   :int32 id
+                                   :string prop))
+
+(defun enwc-wicd-build-prop-list (prop-list det-list)
+  (mapcar
+   (lambda (det)
+     (let* ((cur-prop (assoc det prop-list))
+            (act-det (enwc-wicd-prop-to-prop det))
+            (act-prop (when cur-prop (cdr cur-prop))))
+       (when (or (string-equal det "essid")
+                 (string-equal det "channel"))
+         (setq act-prop (string-to-number cur-prop)))
+       (cons act-det act-prop)))
+   det-list))
+
+(defun enwc-wicd-get-wireless-nw-props (id)
+  "Get the network properties of a network.
+This function returns an associative list of properties
+for the network with id ID.
+For a list of properties, see `enwc-wicd-details-list'."
+  (setq enwc-wicd-prop-values nil)
+  (setq enwc-wicd-prop-num 0)
+  (dolist (x enwc-wicd-details-list)
+    (enwc-wicd-get-wireless-network-property id x))
+
+  (with-timeout (enwc-wicd-prop-timeout)
+    (while (< enwc-wicd-prop-num (length enwc-wicd-details-list))
+      (read-event nil nil 0.001)))
+
+  (if (assoc "encryption" enwc-wicd-prop-values)
+      (let ((enc-type (enwc-wicd-get-encryption-type id)))
+        (setcdr (assoc "encryption" enwc-wicd-prop-values)
+                (or enc-type "Unsecured")))
+    (setq enwc-wicd-prop-values
+          (cons (cons "encryption" "Unsecured")
+                enwc-wicd-prop-values)))
+
+  (enwc-wicd-build-prop-list enwc-wicd-prop-values enwc-wicd-details-list))
+
+(defalias 'enwc-wicd-get-wireless-network-props 
'enwc-wicd-get-wireless-nw-props)
+
+(defun enwc-wicd-get-encryption-type (id)
+  "Wicd get encryption type function.
+This calls the D-Bus method on Wicd to get the encryption_method
+property from wireless network with id ID."
+  (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty"
+                                       id "encryption_method"))
+
+(defun enwc-wicd-get-wired-nw-prop (id det)
+  "Get property DET from the wired network with id ID."
+  (enwc-wicd-dbus-wired-call-method "GetWiredProperty" id det))
+
+;;;;;;;;;;;;;;;;;;;;;;;
+;; Connect Functions ;;
+;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-connect (id &optional wired)
+  "Wicd connect function.
+This calls the D-Bus method on Wicd to connect to a
+wired or wireless network with id ID."
+  (if wired
+      (enwc-wicd-wired-connect id)
+    (enwc-wicd-dbus-wireless-call-method "ConnectWireless" id)))
+
+(defun enwc-wicd-wireless-connect (id)
+  "Wicd connect function.
+This calls the D-Bus method on Wicd to connect to a
+wireless network with id ID."
+  (enwc-wicd-dbus-wireless-call-method "ConnectWireless" id))
+
+(defun enwc-wicd-wired-connect (id)
+  "Connect to the wired network with profile id ID."
+  (let* ((profs (enwc-wicd-get-wired-profiles))
+         (prf (nth id profs)))
+    (enwc-wicd-dbus-wired-call-method "ReadWiredNetworkProfile" prf)
+    (enwc-wicd-dbus-wired-call-method "ConnectWired")))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Disconnect functions ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-disconnect (&optional wired)
+  (if wired
+      (enwc-wicd-wired-disconnect)
+    (enwc-wicd-wireless-disconnect)))
+
+(defun enwc-wicd-wireless-disconnect ()
+  "Wicd disconnect function."
+  (enwc-wicd-dbus-wireless-call-method "DisconnectWireless"))
+
+(defun enwc-wicd-wired-disconnect ()
+  "Disconnect from the wired connection."
+  (enwc-wicd-dbus-wired-call-method "DisconnectWired"))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Get current network id ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-get-current-nw-id (wired-p)
+  "Wicd get current network id function.
+The current network id is updated upon connect,
+so this jut returns the tracked network id."
+  (let ((ap (enwc-wicd-dbus-wireless-call-method "GetCurrentNetworkID")))
+    (cond
+     (wired-p 'wired)
+     ((< ap 0) nil)
+     (t ap))))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Check Connecting ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-check-connecting ()
+  "Return non-nil if currently connecting to a network."
+  (enwc-wicd-dbus-wireless-call-method "CheckIfWirelessConnecting"))
+
+;;;;;;;;;;;;;
+;; Is Wired
+;;;;;;;;;;;;;
+
+(defun enwc-wicd-is-wired ()
+  "Return non-nil if connected to a wired network."
+  (not (not (enwc-wicd-dbus-wired-call-method "GetWiredIP"))))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Get Profile Info ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+;; (defun enwc-wicd-get-profile-ent (id ent wired)
+;;   "Get profile entry ENT from the network with id ID.
+;; WIRED is set to indicate whether this is a wired network.
+;; This function is a wrapper around the *-get-(wired|wireless)-nw-prop
+;; functions, allowing for a single function that checks for wired."
+;;   (if wired
+;;       (enwc-wicd-get-wired-nw-prop id ent)
+;;     (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty" id ent)))
+
+;; (defun enwc-wicd-get-profile-info (id &optional wired)
+;;   "Get the profile for profile ID.
+;; WIRED is set to indicate whether this is a wired network."
+;;   (let ((dns-list (enwc-wicd-get-dns id wired))
+;;         (sec-info (enwc-wicd-get-profile-sec-info id wired)))
+;;     `((addr . ,(enwc-wicd-get-ip-addr id wired))
+;;       (netmask . ,(enwc-wicd-get-netmask id wired))
+;;       (gateway . ,(enwc-wicd-get-gateway id wired))
+;;       (dns1 . ,(nth 0 dns-list))
+;;       (dns2 . ,(nth 1 dns-list))
+;;       ,@sec-info)))
+
+;; (defun enwc-wicd-get-profile-sec-info (id &optional wired)
+;;   "Get the security info for profile with id ID.
+;; WIRED is set to indicate whether this is a wired network."
+;;   (remq nil
+;;    (mapcar
+;;     (lambda (ent)
+;;       (let ((info (enwc-wicd-get-profile-ent wired id (symbol-name (car 
ent)))))
+;;         (if info
+;;             (cons (car ent) info)
+;;           nil)))
+;;     enwc-supplicant-alist)))
+
+;; (defun enwc-wicd-get-ip-addr (id wired)
+;;   "Get the IP Address from the network with id ID.
+;; Wired is set to indicate whether this is a wired network."
+;;   (or (enwc-wicd-get-profile-ent id "ip" wired) ""))
+
+;; (defun enwc-wicd-get-netmask (id wired)
+;;   "Get the Netmask from the network with id ID.
+;; WIRED is set to indicate whether this is a wired network."
+;;   (or (enwc-wicd-get-profile-ent id "netmask" wired) ""))
+
+;; (defun enwc-wicd-get-gateway (id wired)
+;;   "Get the Gateway from the network with id ID.
+;; WIRED is set to indicate whether this is a wired network."
+;;   (or (enwc-wicd-get-profile-ent id "gateway" wired) ""))
+
+;; (defun enwc-wicd-get-dns (id wired)
+;;   "Get the list of DNS servers from the network with id ID.
+;; WIRED is set to indicate whether this is a wired network."
+;;   (list (or (enwc-wicd-get-profile-ent id "dns1" wired) "")
+;;         (or (enwc-wicd-get-profile-ent id "dns2" wired) "")
+;;         (or (enwc-wicd-get-profile-ent id "dns3" wired) "")))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Save Network Settings ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-wicd-set-nw-prop (wired id prop val)
+  "Set the network property PROP of the network with id ID
+to VAL.
+WIRED indicates whether this is a wired network."
+  (if wired
+      (enwc-wicd-dbus-wired-call-method "SetWiredProperty"
+                                        id prop val)
+    (enwc-wicd-dbus-wireless-call-method "SetWirelessProperty"
+                                         id prop val)))
+
+(defun enwc-wicd-save-nw-profile (wired id)
+  "Save the network profile with for the network with id ID.
+WIRED indicates whether this is a wired network."
+  (if wired
+      (enwc-wicd-dbus-wired-call-method "SaveWiredNetworkProfile" id)
+    (enwc-wicd-dbus-wireless-call-method "SaveWirelessNetworkProfile" id)))
+
+(defun enwc-wicd--phase-to-string (phase)
+  "Convert a list of phase settings PHASE into a string.
+
+The format of this string is \"ENT0=VAL0 ENT1=VAL1 ... ENTN=VALN\",
+for each entry in PHASE."
+  (mapconcat
+   (lambda (ent)
+     (format "%s=%s" (car ent) (cdr ent)))
+   phase " "))
+
+(defun enwc-wicd-save-nw-settings (id settings &optional wired)
+  "Set the settings for network ID to SETTINGS and save the profile.
+The association list SETTINGS contains the settings for the network.
+WIRED indicates whether or not ID is a wired connection."
+  (dolist (setting settings)
+    (let (key ent)
+      ;; There are four special cases in here:
+      ;;  1. IP Address, which has a different key.
+      ;;  2. Encryption type, which has a different key and value.
+      ;;  3,4. Phases, both of which need to have their results concatenated.
+      (pcase (car setting)
+        ('addr (setq key "ip"
+                     ent (cdr setting)))
+        ('sec-type (setq key "enctype"
+                         ent (if (cdr setting)
+                                 (symbol-name (cdr setting))
+                               "None")))
+        ('phase1 (setq key "phase1"
+                       ent (enwc-wicd--phase-to-string (cdr setting))))
+        ('phase2 (setq key "phase2"
+                       ent (enwc-wicd--phase-to-string (cdr setting))))
+        (_ (setq key (symbol-name (car setting))
+                 ent (or (cdr setting) ""))))
+      (enwc-wicd-set-nw-prop wired id key ent)))
+
+  (enwc-wicd-save-nw-profile wired id))
+
+(defun enwc-wicd-wireless-prop-changed (state info)
+  "Callback for when the network status changes."
+  (when state
+    (if (eq state 0)
+        (setq enwc-wicd-current-ap ""
+              enwc-wicd-current-nw-id nil)
+      (setq enwc-wicd-current-ap (car (cadr info))
+            enwc-wicd-current-nw-id (and info
+                                         (nthcdr 3 info)
+                                         (caar (nthcdr 3 info))
+                                         (string-to-number (caar (nthcdr 3 
info))))))))
+
+
+; ;;;;;;;;;;;;;;;;; ;
+; ;; Load/Unload ;; ;
+; ;;;;;;;;;;;;;;;;; ;
+
+(defun enwc-wicd-load ()
+  "Load the Wicd backend."
+  ;; Thanks to Michael Albinus for pointing out this signal.
+  (setq enwc-wicd-end-scan-signal
+        (dbus-register-signal :system
+                              enwc-wicd-dbus-service
+                              enwc-wicd-dbus-wireless-path
+                              enwc-wicd-dbus-wireless-interface
+                              "SendEndScanSignal"
+                              'enwc-process-scan))
+
+  (setq enwc-wicd-status-changed-signal
+        (dbus-register-signal :system
+                              enwc-wicd-dbus-service
+                              "/org/wicd/daemon"
+                              enwc-wicd-dbus-service
+                              "StatusChanged"
+                              'enwc-wicd-wireless-prop-changed)))
+
+(defun enwc-wicd-unload ()
+  "Unload the Wicd back-end.
+
+Unregister all of the D-Bus signals set up during load."
+  (dbus-unregister-object enwc-wicd-end-scan-signal)
+  (dbus-unregister-object enwc-wicd-status-changed-signal))
+
+(defun enwc-wicd-can-load-p ()
+  (dbus-ping :system enwc-wicd-dbus-service))
+
+(enwc-register-backend
+ (make-enwc-backend
+  :key 'enwc
+  :can-load-p #'enwc-wicd-can-load-p
+  :load #'enwc-wicd-load
+  :unload #'enwc-wicd-unload
+  :network-ids #'enwc-wicd-get-networks
+  :scan #'enwc-wicd-scan
+  :connect #'enwc-wicd-connect
+  :disconnect #'enwc-wicd-disconnect
+  :current-nw-id #'enwc-wicd-get-current-nw-id
+  :is-connecting-p #'enwc-wicd-check-connecting
+  :wireless-nw-props #'enwc-wicd-get-wireless-network-props
+  :is-wired-p #'enwc-wicd-is-wired))
+
+(provide 'enwc-wicd)
+
+;;; enwc-wicd.el ends here.
diff --git a/packages/enwc/enwc.el b/packages/enwc/enwc.el
new file mode 100644
index 0000000..4728e93
--- /dev/null
+++ b/packages/enwc/enwc.el
@@ -0,0 +1,709 @@
+;;; enwc.el --- The Emacs Network Client
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0beta1
+;; Package-Requires: ((emacs "25.1"))
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;; This file is part of GNU Emacs.
+
+;; 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, 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.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; ENWC is the Emacs Network Client.  It is designed to provide a front-end to
+;; various network managers, such as NetworkManager and Wicd.
+;;
+;; Currently, only NetworkManager and Wicd are supported, although experimental
+;; support exists for Connman.
+;;
+;; In order to use this package, add
+;;
+;; (setq enwc-default-backend 'backend-symbol)
+;;
+;; to your .emacs file (or other init file).
+;;
+;; Then you can just run `enwc' to start everything.
+
+;;; TODO:
+;;
+;; - Add hooks for scan completion, and possibly upon network connection.
+;; - Wired uses profiles, not networks; Refer to them as such
+;; - Is an association list the best idea for scan results?  Perhaps a 
structure
+;;   would work better?
+
+;;; Code:
+
+(require 'enwc-backend)
+
+(require 'tabulated-list)
+(require 'cl-lib)
+(require 'cl-macs)
+(require 'format-spec)
+
+(require 'map)
+(require 'seq)
+
+(defgroup enwc nil
+  "*The Emacs Network Client"
+  :prefix "enwc-"
+  :group 'external)
+
+(defcustom enwc-wireless-device "wlan0"
+  "The wireless device to use for ENWC."
+  :group 'enwc
+  :type 'string)
+
+(defcustom enwc-wired-device "eth0"
+  "The wired device to use for ENWC."
+  :group 'enwc
+  :type 'string)
+
+(defcustom enwc-display-mode-line t
+  "Non-nil means display network information in the mode line.
+The specific information can be set using `enwc-mode-line-format'."
+  :group 'enwc
+  :type 'boolean)
+
+(defcustom enwc-auto-scan nil
+  "Whether or not to have ENWC automatically scan.
+If non-nil, then ENWC will automatically scan for
+networks every `enwc-auto-scan-interval' seconds."
+  :group 'enwc
+  :type 'boolean)
+
+(defcustom enwc-auto-scan-interval 20
+  "The interval between automatic scans."
+  :group 'enwc
+  :type 'integer)
+
+(defcustom enwc-mode-line-format " [%s%%] "
+  "The format for displaying the mode line.
+
+%s = The current signal strength.  If wired, then this is set to 100.
+
+%e = The essid of the current network.  If wired, then this set to 'Wired'
+
+%b = The bssid of the current network.  If using a wired connection, then this
+is set to 'Wired'.
+
+%n = The encryption type of the current network, or 'Wired' if using a wired
+connection.
+
+%c = The channel of the current network, or 'Wired' if using a wired 
connection.
+
+%% = A Normal '%'"
+  :group 'enwc
+  :type 'string)
+
+;;; The function variables for the abstract layer.
+
+(defvar enwc-display-string " [0%] "
+  "The mode line display string.
+This is altered every second to display the current network strength
+in `enwc-update-mode-line'.")
+
+(defun enwc--print-strength (s)
+  "Convert signal strength S to a string to dispay."
+  (format "%s%%" s))
+
+(defmacro enwc--make-number-sorter (n)
+  `(lambda (a b)
+     (let ((act-a (aref (nth 1 a) ,n))
+           (act-b (aref (nth 1 b) ,n)))
+       (< act-a act-b))))
+
+(defalias 'enwc--str-sorter (enwc--make-number-sorter 0))
+(defalias 'enwc--chnl-sorter (enwc--make-number-sorter 4))
+
+(cl-defstruct enwc-column-spec ()
+  detail display sorter width conv)
+
+(defconst enwc-column-specs
+  (list
+   (make-enwc-column-spec
+    :detail 'strength
+    :display "Str"
+    :sorter #'enwc--str-sorter
+    :conv #'enwc--print-strength)
+   (make-enwc-column-spec
+    :detail 'essid
+    :display "Essid"
+    :sorter t
+    :conv #'identity)
+   (make-enwc-column-spec
+    :detail 'encrypt
+    :display "Encrypt"
+    :sorter t
+    :conv #'identity)
+   (make-enwc-column-spec
+    :detail 'bssid
+    :display "Bssid"
+    :sorter t
+    :conv #'identity)
+   (make-enwc-column-spec
+    :detail 'channel
+    :display "Channel"
+    :sorter #'enwc--chnl-sorter
+    :conv #'number-to-string)))
+
+(defvar enwc-last-scan (make-hash-table :test #'equal)
+  "The most recent scan results.
+
+This will be an association list of the form:
+
+((ID . ((strength . STRENGTH) (essid . ESSID) ...)) ...)
+
+Each ID is a backend-specific network ID.
+
+Each key in the children association lists corresponds to an entry in
+`enwc-column-specs'.")
+
+(defvar enwc-access-points nil
+  "The most recent access point list.")
+
+(defvar enwc-using-wired nil
+  "Non-nil means ENWC is using wired connections.
+
+Note that this is NOT the same as `enwc-is-wired'.  This checks
+whether or not ENWC is in wired mode.")
+
+(defvar enwc-edit-id nil
+  "This is the network id of the network being edited.")
+
+(defvar enwc-scan-requested nil
+  "This is non-nil when a scan has been requested.
+This is used so as to avoid multiple updates of the scan data.")
+
+(defvar enwc-scan-interactive nil
+  "This is non-nil that a scan was interactively requested.
+This is only used internally.")
+
+(defvar enwc-display-mode-line-timer nil
+  "The timer that updates the mode line display.")
+
+(defvar enwc-scan-timer nil
+  "The timer for automatic scanning.")
+
+(defvar enwc-mode-line-timer nil)
+
+(make-local-variable 'enwc-edit-id)
+
+;; The Faces
+
+(defface enwc-header
+  '((((class color) (background light))
+     (:foreground "Blue"))
+    (((class color) (background dark))
+     (:foreground "Blue"))
+    (t (:background "Blue")))
+  "The face for the headers."
+  :group 'enwc)
+
+(defface enwc-connected
+  '((((class color) (background dark))
+     (:foreground "Green"))
+    (((class color) (background light))
+     (:foreground "Green"))
+    (t (:background "Green")))
+  "The face for the connected network."
+  :group 'enwc)
+
+;;;;;;;;;;;;;;;;;;;;
+;; ENWC functions ;;
+;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-get-networks ()
+  "Get the identifiers for the access points
+from a previous scan."
+  (enwc--network-ids enwc--current-backend))
+
+(defun enwc-request-scan ()
+  "Request a backend scan."
+  (setq enwc-scan-requested t)
+  (enwc--scan enwc--current-backend))
+
+(defun enwc-connect (id)
+  "Connect to network with id ID.
+
+ID is specific to the backend."
+  (enwc--connect enwc--current-backend id enwc-using-wired))
+
+(defun enwc-disconnect ()
+  "Disconnect from the current network."
+  (enwc--disconnect enwc--current-backend enwc-using-wired))
+
+(defun enwc-get-current-nw-id ()
+  "Get the id of the current network id,
+or nil if there isn't one.
+
+The returned id is specific to the backend."
+  (enwc--current-nw-id enwc--current-backend enwc-using-wired))
+
+(defun enwc-check-connecting-p ()
+  "Check to see if there is a connection in progress.
+Returns `non-nil' if there is one, nil otherwise."
+  (enwc--is-connecting-p enwc--current-backend))
+
+(defun enwc-get-wireless-nw-props (id)
+  "Get the network properties of the wireless network with id ID.
+This will return an associative list with the keys
+corresponding to `enwc-column-specs'.
+
+ID is specific to the backend."
+  (enwc--wireless-nw-props enwc--current-backend id))
+
+(defun enwc-is-wired-p ()
+  "Check whether or not ENWC is connected to a wired network.
+Note that this is NOT the same as `enwc-using-wired'.
+This checks for an active wired connection."
+  (enwc--is-wired-p enwc--current-backend))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Actual Functions ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-connected-to-network-p ()
+    (enwc-is-valid-nw-id-p (enwc-get-current-nw-id)))
+
+(defun enwc-is-valid-nw-id-p (id)
+  "Confirm that ID is a valid network id."
+  (and id (not (eq id 'wired))))
+
+(defun enwc-value-from-scan (detail &optional id)
+  "Retrieve a value for DETAIL from `enwc-last-scan'.
+If ID is specified, then it will get the entry for ID.
+Otherwise, ID is set to the current network ID.
+
+If DETAIL is not found in `enwc-last-scan', then return nil."
+  (setq id (or id (enwc-get-current-nw-id)))
+  (when enwc-last-scan
+    (map-nested-elt enwc-last-scan `(,id ,detail))))
+
+(defun enwc-make-format-spec ()
+  "Create a format specification for the mode line string."
+  ;; Variables here are cached to avoid latencies when communicating with 
D-Bus.
+  (let* ((cur-id (enwc-get-current-nw-id))
+         (wiredp (enwc-is-wired-p))
+         (no-last (not enwc-last-scan))
+         (invalid-id (not (enwc-is-valid-nw-id-p cur-id)))
+         (connectingp (enwc-check-connecting-p)))
+    (format-spec-make ?s (cond
+                          (wiredp "100")
+                          ((or invalid-id no-last) "0")
+                          (connectingp "*")
+                          (t (enwc-value-from-scan 'strength cur-id)))
+                      ?e (cond
+                          (wiredp "Wired")
+                          ((or invalid-id connectingp no-last) "None")
+                          (t (enwc-value-from-scan 'essid cur-id)))
+                      ?b (cond
+                          (wiredp "Wired")
+                          ((or invalid-id connectingp no-last) "none")
+                          (t (enwc-value-from-scan 'bssid cur-id)))
+                      ?n (cond
+                          (wiredp "None")
+                          ((or invalid-id connectingp no-last) "None")
+                          (t (enwc-value-from-scan 'encrypt cur-id)))
+                      ?c (cond
+                          (wiredp "None")
+                          ((or invalid-id connectingp no-last) "None")
+                          (t (enwc-value-from-scan 'channel cur-id)))
+                      ?% "%")))
+
+(defun enwc-format-mode-line-string ()
+  "Format the mode line string.
+This is derived from `enwc-mode-line-format'.
+See the documentation for it for more details."
+  (format-spec enwc-mode-line-format (enwc-make-format-spec)))
+
+(defun enwc-update-mode-line ()
+  "Update the mode line display.
+This uses the format specified by `enwc-mode-line-format'.
+This is initiated during setup, and runs once every second."
+  (setq enwc-display-string (enwc-format-mode-line-string))
+  (force-mode-line-update))
+
+(defun enwc-enable-display-mode-line ()
+  "Enable the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line t)
+  (unless (member 'enwc-display-string global-mode-string)
+    (setq global-mode-string (append global-mode-string 
'(enwc-display-string))))
+  (unless enwc-display-mode-line-timer
+    (setq enwc-display-mode-line-timer
+          (run-at-time t 1 'enwc-update-mode-line)))
+  (message "ENWC mode line enabled"))
+
+(defun enwc-disable-display-mode-line ()
+  "Disable the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line nil)
+  (setq global-mode-string (remove 'enwc-display-string global-mode-string))
+  (when enwc-display-mode-line-timer
+    (cancel-timer enwc-display-mode-line-timer))
+  (setq enwc-display-mode-line-timer nil)
+  (message "ENWC mode line disabled"))
+
+(defun enwc-toggle-display-mode-line ()
+  "Toggles the mode line display."
+  (interactive)
+  (if (not enwc-display-mode-line)
+      (enwc-enable-display-mode-line)
+    (enwc-disable-display-mode-line)))
+
+(defun enwc-enable-auto-scan ()
+  "Enable auto scanning."
+  (interactive)
+  (unless enwc-scan-timer
+    (setq enwc-scan-timer
+          (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
+  (setq enwc-auto-scan t)
+  (message "Auto-scan enabled"))
+
+(defun enwc-disable-auto-scan ()
+  "Disable auto scanning."
+  (interactive)
+  (when enwc-scan-timer (cancel-timer enwc-scan-timer))
+  (setq enwc-auto-scan nil)
+  (message "Auto scan disabled"))
+
+(defun enwc-toggle-auto-scan ()
+  "Toggles automatic scanning.
+This will use the current value of `enwc-auto-scan-interval'."
+  (interactive)
+  (if enwc-auto-scan
+      (enwc-disable-auto-scan)
+    (enwc-enable-auto-scan)))
+
+;;;;;;;;;;;;;;;;;;;
+;; Scan internal ;;
+;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-scan (&optional nodisp)
+  "The frontend of the scanning routine.
+Set up and move to the ENWC buffer if necessary, and scan and display the
+ networks.  If NODISP is `non-nil', then do not display the results in the ENWC
+buffer."
+  (interactive)
+  (unless nodisp
+    (setq enwc-scan-interactive t)
+    (enwc-ensure-buffer))
+  (with-current-buffer "*ENWC*"
+    (enwc-scan-internal)))
+
+(defun enwc-scan-internal-wireless ()
+  "The initial scan routine for wireless networks.
+This initiates a scan using D-Bus, then exits, waiting for the callback.
+
+All back-ends must call `enwc-process-scan' in some way upon completion of a
+ scan."
+  (when enwc-scan-interactive
+    (message "Scanning..."))
+  (enwc-request-scan))
+
+(defun enwc-scan-internal-wired ()
+  "The scanning routine for a wired connection.
+This gets the list of wired network profiles."
+  (message "Updating Profiles...")
+  (let ((profs (enwc-get-networks)))
+    (message "Updating Profiles... Done")
+    (setq enwc-access-points profs
+          enwc-last-scan     profs)
+    (enwc-display-wired-networks profs)))
+
+(defun enwc-scan-internal ()
+  "The entry point for the internal scan routines.
+This checks whether or not wired is being used, and runs the appropriate
+ function."
+  (if enwc-using-wired
+      (enwc-scan-internal-wired)
+    (enwc-scan-internal-wireless)))
+
+(defun enwc--update-scan-results ()
+  (setq enwc-last-scan (make-hash-table :test #'equal))
+  (dolist (ap (enwc-get-networks))
+    (puthash ap (enwc-get-wireless-nw-props ap) enwc-last-scan)))
+
+(defun enwc-redisplay-wireless-networks ()
+  (interactive)
+  (enwc--update-scan-results)
+  (enwc-display-wireless-networks enwc-last-scan))
+
+(defun enwc-process-scan (&rest args)
+  "The scanning callback.
+After a scan has been performed, this processes and displays the scan results.
+
+ARGS is only for compatibility with the calling function."
+  (unless (or enwc-using-wired (not enwc-scan-requested))
+    (setq enwc-scan-requested nil)
+    (when enwc-scan-interactive
+      (message "Scanning... Done"))
+    (enwc--update-scan-results)
+    (enwc-display-wireless-networks enwc-last-scan)
+    (setq enwc-scan-interactive nil)))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;; Display Networks ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+(cl-defun enwc-refresh-widths (&optional (networks enwc-last-scan))
+  "Refresh the column widths for display."
+  (setq enwc-column-specs
+        (mapcar
+         (lambda (spec)
+           (pcase-let* (((cl-struct enwc-column-spec detail display conv) spec)
+                        (new-max (seq-max
+                                  (map-apply
+                                   (lambda (id nw)
+                                     (length (funcall conv (alist-get detail 
nw))))
+                                   networks)))
+                        (min-width (+ (length display) 2)))
+             (setf (enwc-column-spec-width spec) (max new-max min-width)))
+           spec)
+         enwc-column-specs)))
+
+(defun enwc-display-wired-networks (networks)
+  "Display the wired networks specified in the list NETWORKS.
+NETWORKS must be in the form returned from
+`enwc-scan-internal-wired'."
+  (let ((inhibit-read-only t))
+    (setq tabulated-list-format (vector '("Profile" . 1)))
+    ;;TODO: actually get names of profiles, if possible.
+    (setq tabulated-list-entries (mapcar (lambda (prop) (cons prop prop)) 
networks))
+    (tabulated-list-init-header)
+    (tabulated-list-print)))
+
+(defun enwc--get-details (network-entry)
+  (mapcar
+   (lambda (detail)
+     (alist-get (enwc-column-spec-detail detail) network-entry))
+   enwc-column-specs))
+
+(defun enwc--tabulated-list-entries ()
+  (map-apply
+   (lambda (id nw) (list id (vconcat (enwc--get-details nw))))
+   enwc-last-scan))
+
+(defun enwc--tabulated-list-printer (id cols)
+  "Print the row ID with column values COL."
+  (let ((cur-id (enwc-get-current-nw-id)))
+    (tabulated-list-print-entry
+     id
+     (vconcat
+      (seq-map-indexed
+       (lambda (col idx)
+         (let* ((detail (nth idx enwc-column-specs))
+                (conv   (funcall (enwc-column-spec-conv detail) col)))
+           (if (equal cur-id id)
+               (propertize conv 'font-lock-face 'enwc-connected)
+             conv)))
+       cols)))))
+
+(defun enwc-display-wireless-networks (networks)
+  "Display the networks in the list NETWORKS in the current buffer."
+  (enwc-ensure-buffer)
+  ;; Update the display widths.
+  (enwc-refresh-widths)
+  (with-current-buffer (get-buffer "*ENWC*")
+    (setq tabulated-list-format
+          (vconcat
+           (mapcar
+            (pcase-lambda ((cl-struct enwc-column-spec display width sorter))
+              (list display width sorter))
+            enwc-column-specs)))
+    (setq tabulated-list-entries #'enwc--tabulated-list-entries)
+    (setq tabulated-list-printer #'enwc--tabulated-list-printer)
+
+    (tabulated-list-init-header)
+
+    (tabulated-list-print)))
+
+(defun enwc-display-networks (networks)
+  "Displays the network in NETWORKS.
+This is an entry to the display functions, and checks whether or not ENWC is
+ using wired."
+  (unless (eq major-mode 'enwc-mode)
+    (enwc-setup-buffer))
+  (cl-check-type networks list)
+  (if enwc-using-wired
+      (enwc-display-wired-networks networks)
+    (enwc-display-wireless-networks networks)))
+
+(defun enwc-find-network (essid &optional networks)
+  "Checks through NETWORKS for the network with essid ESSID,
+and returns the network identifier.  Uses `enwc-last-scan' if
+NETWORKS is nil.  If the network is not found, then it returns nil.
+
+   When called interactively, this only prints out what it finds.
+Otherwise, it actually returns it."
+  (interactive "sNetwork ESSID: ")
+  (unless (or networks enwc-last-scan)
+    (setq enwc-scan-interactive nil)
+    (enwc-scan-internal))
+  (let ((nets (or networks enwc-last-scan))
+        need-break cur-net)
+    (while (and nets (not cur-net))
+      (setq cur-net (pop nets))
+      (unless (string-equal (alist-get 'essid (cdr-safe cur-net))
+                            essid)
+        (setq cur-net nil)))
+    (if cur-net
+        (if (called-interactively-p 'any)
+            (message "Network %d has essid %s" (number-to-string (car 
cur-net)) essid)
+          (car cur-net))
+      (when (called-interactively-p 'any)
+        (message "Network not found.")))))
+
+;;;;;;;;;;;;;;;;;;;;;
+;; Connect Network ;;
+;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-connect-network (id)
+  "Connect to network with id ID.
+This is an entry point for the internal connection functions,
+and checks whether or not ENWC is using wired."
+  (enwc-connect id)
+  (if enwc-using-wired
+      id
+    (when enwc-last-scan
+      (enwc-value-from-scan 'essid id))))
+
+(defun enwc-connect-to-network (net-id)
+  "Connect the the network with network id NET-ID.
+Confirms that NET-ID is a valid network id.
+This calls `enwc-connect-network' as a subroutine."
+  (interactive "sNetwork ID: ")
+  (let (cur-net)
+    (unless (enwc-is-valid-nw-id-p net-id)
+      (error "Invalid network id."))
+    (setq cur-net (enwc-connect-network net-id))
+    (message "Connecting to %s" cur-net)))
+
+(defun enwc-connect-to-network-essid (essid)
+  "Connect to the network with essid ESSID."
+  (interactive "sNetwork ESSID: ")
+  (let ((net-id (enwc-find-network essid)))
+    (if net-id
+        (enwc-connect-to-network net-id)
+      (message "Network not found."))))
+
+(defun enwc-connect-to-network-at-point ()
+  "Connect to the network at the current line number.
+Moves to the enwc buffer if necessary."
+  (interactive)
+  (unless (eq major-mode 'enwc-mode)
+    (enwc-setup-buffer))
+  ;;TODO: Fix this for wired (which doesn't have tabulated list)
+  (enwc-connect-to-network (tabulated-list-get-id)))
+
+(defun enwc-disconnect-network ()
+  "Disconnect from the network, if any."
+  (interactive)
+  (message "Disconnecting")
+  (enwc-disconnect))
+
+(defun enwc-toggle-wired ()
+  "Toggle the display and mode between wireless and wired.
+This has the side-effect of setting the variable `enwc-using-wired', and 
calling
+a scan."
+  (interactive)
+  (unless (eq major-mode 'enwc-mode)
+    (enwc-setup-buffer))
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (setq enwc-using-wired (not enwc-using-wired))
+    (enwc-scan)))
+
+(defvar enwc-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "R") 'enwc-scan)
+    (define-key map (kbd "C") 'enwc-connect-to-network-essid)
+    (define-key map (kbd "D") 'enwc-disconnect-network)
+    (define-key map (kbd "W") 'enwc-toggle-wired)
+    ;; (define-key map (kbd "E") 'enwc-edit-entry-at-point)
+    (define-key map (kbd "RET") 'enwc-connect-to-network-at-point)
+    map)
+  "The keymap for network display in ENWC.")
+
+(define-derived-mode enwc-mode tabulated-list-mode "enwc"
+  "Mode for working with network connections.
+\\{enwc-mode-map}"
+  (add-hook 'tabulated-list-revert-hook 'enwc-redisplay-wireless-networks nil 
t))
+
+(defun enwc-setup-buffer (&optional nomove)
+  "Sets up the ENWC buffer.
+This first checks to see that it exists,
+and if it doesn't, then create it.
+
+If NOMOVE is non-nil, then do not move to the
+newly created buffer."
+  (unless (get-buffer "*ENWC*")
+    (with-current-buffer (get-buffer-create "*ENWC*")
+      (enwc-mode)))
+  (unless nomove
+    (switch-to-buffer "*ENWC*")))
+
+(defun enwc-ensure-buffer ()
+  (unless (get-buffer "*ENWC*")
+    (enwc-setup-buffer t)))
+
+(defvar enwc--setup-done nil
+  "Non-nil if enwc has already been set up.")
+
+(defun enwc-setup ()
+  "Set up ENWC.
+
+If `enwc-display-mode-line' is non-nil, enable the mode line.
+
+If `enwc-auto-scan' is non-nil, start the auto-scan timer.
+
+Finally, the default backend is loaded."
+  (unless enwc--setup-done
+    (enwc-load-default-backend enwc-force-backend-loading)
+
+    (when enwc-display-mode-line
+      (enwc-enable-display-mode-line))
+
+    (when (and enwc-auto-scan
+               (> enwc-auto-scan-interval 0)
+               (not enwc-scan-timer))
+      (setq enwc-scan-timer
+            (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
+
+    (setq enwc--setup-done t)))
+
+;;;###autoload
+(defun enwc ()
+  "The main front-end to ENWC.
+This sets up the buffer and scans for networks.
+In order to use this, one must have already run
+`enwc-setup'.
+
+\\{enwc-mode-map}"
+  (interactive)
+  (enwc-setup)
+  (enwc-setup-buffer)
+  (enwc-scan))
+
+(provide 'enwc)
+
+;;; enwc.el ends here



reply via email to

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