| @ -1,5 +1,6 @@ | |||
| (use-package rust-mode | |||
| :diminish rust-ts-mode | |||
| :ensure t | |||
| :init | |||
| (setq rust-format-on-save t)) | |||
| :diminish rust-ts-mode | |||
| :ensure t | |||
| :init | |||
| (setq rust-mode-treesitter-derive t) | |||
| (setq rust-format-on-save t)) | |||
| @ -1,7 +0,0 @@ | |||
| ;; Enable xit-mode | |||
| ;; https://github.com/ryanolsonx/xit-mode/ | |||
| ;; https://xit.jotaen.net/ | |||
| (load "~/.emacs.d/vendor/xit-mode.el") | |||
| (add-hook 'xit-mode-hook | |||
| '(lambda () | |||
| (setq tab-width 4))) | |||
| @ -1,8 +0,0 @@ | |||
| ;;; Directory Local Variables -*- no-byte-compile: t; -*- | |||
| ;;; For more information see (info "(emacs) Directory Variables") | |||
| ((nil . ((sentence-end-double-space . t) | |||
| (emacs-lisp-docstring-fill-column . 65) | |||
| (fill-column . 70))) | |||
| (emacs-lisp-mode . ((indent-tabs-mode . nil))) | |||
| (lisp-data-mode . ((indent-tabs-mode . nil)))) | |||
| @ -1 +0,0 @@ | |||
| LICENSE | |||
| @ -1,45 +0,0 @@ | |||
| ## test.yml | |||
| name: Main workflow | |||
| on: [push, pull_request] | |||
| permissions: {} | |||
| jobs: | |||
| build: | |||
| runs-on: ubuntu-latest | |||
| strategy: | |||
| matrix: | |||
| emacs_version: | |||
| - 24.3 | |||
| - 24.4 | |||
| - 24.5 | |||
| - 25.1 | |||
| - 25.3 | |||
| - 26.1 | |||
| - 26.2 | |||
| - 26.3 | |||
| - 27.1 | |||
| - 27.2 | |||
| - 28.1 | |||
| - 28.2 | |||
| - snapshot | |||
| include: | |||
| - emacs_version: 'snapshot' | |||
| allow_failure: true | |||
| steps: | |||
| - uses: actions/checkout@v3 | |||
| with: | |||
| persist-credentials: false | |||
| - name: Install Emacs | |||
| uses: purcell/setup-emacs@master | |||
| with: | |||
| version: ${{ matrix.emacs_version }} | |||
| - name: Run tests | |||
| if: matrix.allow_failure != true | |||
| run: 'make && make test' | |||
| - name: Run tests (allow failure) | |||
| if: matrix.allow_failure == true | |||
| run: 'make && make test || true' | |||
| @ -1,12 +0,0 @@ | |||
| *~ | |||
| /*-autoloads.el | |||
| /*.elc | |||
| /*.html | |||
| /*.info | |||
| /config.mk | |||
| /dir | |||
| /doc/content/* | |||
| /stats/ | |||
| /use-package/ | |||
| .dir-locals-2.el | |||
| @ -1,674 +0,0 @@ | |||
| GNU GENERAL PUBLIC LICENSE | |||
| Version 3, 29 June 2007 | |||
| Copyright (C) 2007 Free Software Foundation, Inc. <https://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 <https://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 | |||
| <https://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 | |||
| <https://www.gnu.org/licenses/why-not-lgpl.html>. | |||
| @ -1,171 +0,0 @@ | |||
| -include config.mk | |||
| include default.mk | |||
| ## ################################################################### | |||
| .PHONY: install install-lisp install-docs install-info \ | |||
| test test-interactive use-package \ | |||
| clean clean-lisp clean-docs clean-archives \ | |||
| stats bump-version melpa-post-release \ | |||
| dist use-package-$(VERSION).tar.gz | |||
| all: elc docs | |||
| help: | |||
| $(info ) | |||
| $(info Current version: use-package-$(VERSION)) | |||
| $(info ) | |||
| $(info See default.mk for variables you might want to set.) | |||
| $(info ) | |||
| $(info Build) | |||
| $(info =====) | |||
| $(info ) | |||
| $(info make [all] - compile elisp and documentation) | |||
| $(info make elc - compile elisp) | |||
| $(info make docs - generate info manuals) | |||
| $(info make info - generate info manuals) | |||
| $(info make html - generate html manual files) | |||
| $(info make html-dir - generate html manual directories) | |||
| $(info make pdf - generate pdf manuals) | |||
| $(info ) | |||
| $(info Install) | |||
| $(info =======) | |||
| $(info ) | |||
| $(info make install - install elisp and documentation) | |||
| $(info make install-lisp - install elisp) | |||
| $(info make install-docs - install all documentation) | |||
| $(info make install-info - install info manuals only) | |||
| $(info ) | |||
| $(info Clean) | |||
| $(info ====) | |||
| $(info ) | |||
| $(info make clean - clean elisp, documentation and tarball) | |||
| $(info make clean-lisp - clean elisp) | |||
| $(info make clean-docs - clean docs) | |||
| $(info make clean-archives - clean release tarball) | |||
| $(info make clean-all - clean everything) | |||
| $(info make clean-stats - clean stats) | |||
| $(info ) | |||
| $(info Test) | |||
| $(info ====) | |||
| $(info ) | |||
| $(info make test - run tests) | |||
| $(info make test-interactive - run tests interactively) | |||
| $(info make emacs-Q - run emacs -Q plus Use-Package) | |||
| $(info ) | |||
| $(info Release Management) | |||
| $(info ==================) | |||
| $(info ) | |||
| $(info make stats - regenerate statistics) | |||
| $(info make authors - regenerate AUTHORS.md) | |||
| $(info make preview-stats - preview statistics) | |||
| $(info make publish-stats - publish statistics) | |||
| $(info make preview-manuals - preview manuals) | |||
| $(info make publish-manuals - publish manuals) | |||
| $(info make dist - create tarballs) | |||
| @printf "\n" | |||
| ## Build ############################################################# | |||
| elc: | |||
| @$(MAKE) -f Makefile.lisp lisp | |||
| docs: | |||
| @$(MAKE) -f Makefile.doc all | |||
| info: | |||
| @$(MAKE) -f Makefile.doc info | |||
| html: | |||
| @$(MAKE) -f Makefile.doc html | |||
| html-dir: | |||
| @$(MAKE) -f Makefile.doc html-dir | |||
| pdf: | |||
| @$(MAKE) -f Makefile.doc pdf | |||
| ## Install ########################################################### | |||
| install: install-lisp install-docs | |||
| install-lisp: | |||
| @$(MAKE) -f Makefile.lisp install | |||
| install-docs: docs | |||
| @$(MAKE) -f Makefile.doc install-docs | |||
| install-info: info | |||
| @$(MAKE) -f Makefile.doc install-info | |||
| ## Test ############################################################## | |||
| test: | |||
| @$(BATCH) --eval "(progn\ | |||
| (load-file \"use-package-tests.el\")\ | |||
| (ert-run-tests-batch-and-exit))" | |||
| test-interactive: | |||
| @$(EMACS) -Q $(LOAD_PATH) --eval "(progn\ | |||
| (load-file \"use-package-tests.el\")\ | |||
| (ert t))" | |||
| emacs-Q: clean-lisp | |||
| @$(EMACS) -Q $(LOAD_PATH) --debug-init --eval "(progn\ | |||
| (setq debug-on-error t)\ | |||
| (require 'use-package))" | |||
| ## Clean ############################################################# | |||
| clean: clean-lisp clean-docs clean-archives | |||
| @printf "Cleaning...\n" | |||
| @$(RM) *.elc $(ELGS) # temporary cleanup kludge | |||
| @$(RM) *.texi~ *.info* | |||
| clean-lisp: | |||
| @$(MAKE) -f Makefile.lisp clean | |||
| clean-docs: | |||
| @$(MAKE) -f Makefile.doc clean | |||
| clean-archives: | |||
| @$(RM) *.tar.gz *.tar | |||
| @$(RMDIR) use-package-$(VERSION) | |||
| clean-all: clean clean-stats | |||
| clean-stats: | |||
| @$(RMDIR) $(statsdir) | |||
| ## Release management ################################################ | |||
| stats: | |||
| @$(MAKE) -f Makefile.doc stats | |||
| authors: | |||
| @$(MAKE) -f Makefile.doc authors | |||
| preview-stats: | |||
| @$(MAKE) -f Makefile.doc preview-stats | |||
| publish-stats: | |||
| @$(MAKE) -f Makefile.doc publish-stats | |||
| preview-manuals: | |||
| @$(MAKE) -f Makefile.doc preview-manuals | |||
| publish-manuals: | |||
| @$(MAKE) -f Makefile.doc publish-manuals | |||
| dist: use-package-$(VERSION).tar.gz | |||
| DIST_ROOT_FILES = COPYING default.mk Makefile README.md | |||
| DIST_LISP_FILES = $(ELS) Makefile.lisp | |||
| DIST_DOCS_FILES = $(TEXIPAGES) AUTHORS.md Makefile.doc | |||
| use-package-$(VERSION).tar.gz: lisp info | |||
| @printf "Packing $@\n" | |||
| @$(MKDIR) use-package-$(VERSION) | |||
| @$(CP) $(DIST_ROOT_FILES) use-package-$(VERSION) | |||
| @$(TAR) cz --mtime=./use-package-$(VERSION) -f use-package-$(VERSION).tar.gz use-package-$(VERSION) | |||
| @$(RMDIR) use-package-$(VERSION) | |||
| @ -1,153 +0,0 @@ | |||
| # -*- Makefile -*- | |||
| -include config.mk | |||
| include default.mk | |||
| ## ################################################################### | |||
| .PHONY: install clean AUTHORS.md stats | |||
| all: info | |||
| ## Build ############################################################# | |||
| info: $(INFOPAGES) dir | |||
| html: $(HTMLFILES) | |||
| pdf: $(PDFFILES) | |||
| %.info: %.texi | |||
| @printf "Generating $@\n" | |||
| @$(MAKEINFO) --no-split $< -o $@ | |||
| dir: use-package.info | |||
| @printf "Generating dir\n" | |||
| @echo $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@ | |||
| %.html: %.texi | |||
| @printf "Generating $@\n" | |||
| @$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $< | |||
| html-dir: $(TEXIFILES) | |||
| @printf "Generating use-package/*.html\n" | |||
| @$(MAKEINFO) --html $(MANUAL_HTML_ARGS) use-package.texi | |||
| %.pdf: %.texi | |||
| @printf "Generating $@\n" | |||
| @texi2pdf --clean $< > /dev/null | |||
| ## Install ########################################################### | |||
| install: install-info install-docs | |||
| install-docs: install-info | |||
| @$(MKDIR) $(DESTDIR)$(docdir) | |||
| $(CP) AUTHORS.md $(DESTDIR)$(docdir) | |||
| install-info: info | |||
| @$(MKDIR) $(DESTDIR)$(infodir) | |||
| $(CP) $(INFOPAGES) $(DESTDIR)$(infodir) | |||
| ## Clean ############################################################# | |||
| clean: | |||
| @printf "Cleaning Documentation/*...\n" | |||
| @$(RMDIR) dir $(INFOPAGES) $(HTMLFILES) $(HTMLDIRS) $(PDFFILES) | |||
| ## Release management ################################################ | |||
| stats: | |||
| @printf "Generating statistics\n" | |||
| @gitstats -c style=/assets/stats.css -c max_authors=999 $(TOP) $(statsdir) | |||
| authors: AUTHORS.md | |||
| AUTHORS.md: | |||
| @printf "Generating AUTHORS.md..." | |||
| @test -e $(TOP).git \ | |||
| && (printf "$$AUTHORS_HEADER\n" > $@ \ | |||
| && git log --pretty=format:'- %aN <%aE>' | sort -u >> $@ \ | |||
| && printf "done\n" ; ) \ | |||
| || printf "FAILED (non-fatal)\n" | |||
| DOMAIN ?= use-package.vc | |||
| CFRONT_DIST ?= E2LUHBKU1FBV02 | |||
| PUBLISH_BUCKET ?= s3://$(DOMAIN) | |||
| PREVIEW_BUCKET ?= s3://preview.$(DOMAIN) | |||
| PUBLISH_URL ?= http://$(DOMAIN).s3-website.eu-central-1.amazonaws.com | |||
| PREVIEW_URL ?= http://preview.$(DOMAIN).s3-website.eu-central-1.amazonaws.com | |||
| preview-stats: stats | |||
| @printf "Uploading statistics...\n" | |||
| @aws s3 sync $(statsdir) $(PREVIEW_BUCKET)/stats/ | |||
| @aws cloudfront create-invalidation \ | |||
| --distribution-id $(CFRONT_DIST) --paths "/stats/*" | |||
| @printf "Uploaded to $(PREVIEW_URL)/stats/\n" | |||
| publish-stats: stats | |||
| @printf "Uploading statistics...\n" | |||
| @aws s3 sync $(statsdir) $(PUBLISH_BUCKET)/stats/ | |||
| @aws cloudfront create-invalidation \ | |||
| --distribution-id $(CFRONT_DIST) --paths "/stats/*" | |||
| @printf "Uploaded to $(PUBLISH_URL)/stats/\n" | |||
| preview-manuals: html html-dir pdf | |||
| @printf "Uploading manuals...\n" | |||
| @aws s3 sync use-package $(PREVIEW_BUCKET)/manual/use-package/ | |||
| @aws s3 cp use-package.html $(PREVIEW_BUCKET)/manual/ | |||
| @aws s3 cp use-package.pdf $(PREVIEW_BUCKET)/manual/ | |||
| @aws cloudfront create-invalidation \ | |||
| --distribution-id $(CFRONT_DIST) --paths "/manual/*" | |||
| @printf "Uploaded to $(PREVIEW_URL)/manual/\n" | |||
| publish-manuals: html html-dir pdf | |||
| @printf "Uploading manuals...\n" | |||
| @aws s3 sync use-package $(PUBLISH_BUCKET)/manual/use-package/ | |||
| @aws s3 cp use-package.html $(PUBLISH_BUCKET)/manual/ | |||
| @aws s3 cp use-package.pdf $(PUBLISH_BUCKET)/manual/ | |||
| @aws cloudfront create-invalidation \ | |||
| --distribution-id $(CFRONT_DIST) --paths "/manual/*" | |||
| @printf "Uploaded to $(PUBLISH_URL)/manual/\n" | |||
| # Templates ########################################################## | |||
| define AUTHORS_HEADER | |||
| Authors | |||
| ======= | |||
| The following people have contributed to Use-Package. | |||
| For statistics see https://magit.vc/stats/authors.html. | |||
| Names below are sorted alphabetically. | |||
| Author | |||
| ------ | |||
| - Marius Vollmer <marius.vollmer@gmail.com> | |||
| Maintainer | |||
| ---------- | |||
| - Jonas Bernoulli <jonas@bernoul.li> | |||
| Developers | |||
| ---------- | |||
| - Kyle Meyer <kyle@kyleam.com> | |||
| - Noam Postavsky <npostavs@users.sourceforge.net> | |||
| Retired Maintainers and Developers | |||
| ---------------------------------- | |||
| - Nicolas Dudebout <nicolas.dudebout@gatech.edu> | |||
| - Peter J. Weisberg <pj@irregularexpressions.net> | |||
| - Pieter Praet <pieter@praet.org> | |||
| - Phil Jackson <phil@shellarchive.co.uk> | |||
| - Rémi Vanicat <vanicat@debian.org> | |||
| - Yann Hodique <yann.hodique@gmail.com> | |||
| Contributors | |||
| ------------ | |||
| endef | |||
| export AUTHORS_HEADER | |||
| @ -1,42 +0,0 @@ | |||
| # -*- Makefile -*- | |||
| -include config.mk | |||
| include default.mk | |||
| ## ################################################################### | |||
| .PHONY: install | |||
| all: lisp | |||
| ## Build order ####################################################### | |||
| use-package.elc: bind-key.elc | |||
| ## Build ############################################################# | |||
| lisp: $(ELCS) | |||
| %.elc: %.el | |||
| @printf "Compiling $<\n" | |||
| @$(BATCH) -q --eval "(progn\ | |||
| (setq byte-compile-error-on-warn t) \ | |||
| (when (file-exists-p \"$@\")\ | |||
| (delete-file \"$@\"))\ | |||
| (fset 'message* (symbol-function 'message))\ | |||
| (fset 'message (lambda (f &rest a)\ | |||
| (unless (equal f \"Wrote %s\")\ | |||
| (apply 'message* f a)))))" \ | |||
| -f batch-byte-compile $< | |||
| ## Install ########################################################### | |||
| install: lisp | |||
| @$(MKDIR) $(DESTDIR)$(lispdir) | |||
| $(CP) $(ELS) $(ELCS) $(DESTDIR)$(lispdir) | |||
| ## Clean ############################################################# | |||
| clean: | |||
| @printf "Cleaning lisp...\n" | |||
| $(RM) *.elc $(ELGS) | |||
| @ -1,277 +0,0 @@ | |||
| # Changes | |||
| ## 2.4.4 | |||
| This release prepares for inclusion to GNU ELPA and includes no other changes | |||
| ## 2.4.1 | |||
| This is mostly a bug-fix release: | |||
| - Update the documentation for :custom as per #850 | |||
| - Fix broken test due to #850 | |||
| - better tests | |||
| - add test for #845 | |||
| - Support keymap symbol in bind-key. Fix #845 | |||
| - use-package-core.el: use the Emacs set-default function to avoid saving :custom vars twice | |||
| - Fix Travis | |||
| - typo, should be a vector, not a bytecode object | |||
| Solves https://github.com/jwiegley/use-package/issues/842 | |||
| - Add special value back again, in case needed for backwards compat | |||
| I don't know why this special value exists, but perhaps old client code uses it. | |||
| The additional `t' in the macro expansion is accidental but not harmful I guess. | |||
| - Even when there's no :config, run any pre/post config hooks | |||
| i.e., following the existing docs for use-package-inject-hooks, these hooks are | |||
| run: | |||
| use-package--foo--pre-config-hook | |||
| use-package--foo--post-config-hook | |||
| This should make config customisations more predictable (for example, spacemacs | |||
| uses these hooks extensively to allow 'layers' to be customised). | |||
| I got rid of the "special" default value for :config, because it doesn't seem to | |||
| be treated any differently than nil. | |||
| Fixes #785 | |||
| - Clarify the documentation for :after | |||
| - add table of contents to README | |||
| - Fix typos | |||
| Typos found with codespell. | |||
| - Fix typos | |||
| - Attempt to explain omit "-hook" better | |||
| - Update tests | |||
| - Switch from `require' to `load' + `featurep' | |||
| - Use `require', not `load', when byte-compiling | |||
| - Make custom-face evaluate elisp. | |||
| Fix #696. | |||
| - Add a line of documentation for (use-pacakage ... :hook). | |||
| - Fix typo in README | |||
| - Fix documentation for defer | |||
| - Add no-query option for pdf-tools-install | |||
| - Fix typo in README | |||
| - Fix all notes in README | |||
| - Mention use-package-ensure in README | |||
| Without requiring `use-package-ensure`, setting `use-package-always-ensure` | |||
| did not actually work for me. | |||
| ## 2.4 | |||
| ### Breaking changes | |||
| - `use-package` no longer requires `diminish` as a dependency, allowing people | |||
| to decide whether they want to use diminish or delight. This means that if | |||
| you do use diminish, you'll now need to pull it into your configuration | |||
| before any use of the `:diminish` kewyord. For example: | |||
| ``` elisp | |||
| (use-package diminish :ensure t) | |||
| ``` | |||
| - Emacs 24.3 or higher is now a requirement. | |||
| - The `:defer-install` keyword has been removed. It may reappear as an add-on | |||
| module for use-package in a future release. See issue #442 for more details. | |||
| - There is no longer a `use-package-debug` option, since `use-package-verbose` | |||
| already has the possible value of `debug`. | |||
| - The ordering of several elements of `use-package-keywords` have changed; if | |||
| you had previously customized this (or were an extension author adding to | |||
| this list), you may need to rework your changes. | |||
| - For extension authors, `:commands` should no longer be propagated down for | |||
| autoloading. See more below. | |||
| ### Other changes | |||
| - Upgrade license to GPL 3. | |||
| - If `use-package-verbose` is set to the symbol `debug`, any evaluation errors | |||
| during package configuration will cause a complete report to be written to a | |||
| `*use-package*` buffer, including: the text of the error, the `use-package` | |||
| declaration that caused the error, the post-normalized form of this | |||
| declaration, and the macro-expanded version (without verbosity-related | |||
| code). Note that this still does not help if there are parsing errors, which | |||
| cause Emacs to register a Lisp error at startup time. | |||
| - New customization variable `use-package-deferring-keywords`, mainly intended | |||
| for use by extension packages, indicates keywords that, if used without | |||
| `:demand`, cause deferred loading (as if `:defer t` had been specified). | |||
| - The `:ensure` keyword now accepts a specific pinning sub-keyword. For | |||
| example: | |||
| ``` elisp | |||
| (use-package foo | |||
| :pin "elpa") | |||
| ``` | |||
| This ensure the package `foo` is installed from `"elpa"`. | |||
| ``` elisp | |||
| (use-package foo | |||
| :ensure bar | |||
| :ensure (quux :pin "melpa")) | |||
| ``` | |||
| This says that `foo` ensures that `bar` is installed, as well as `quux` from | |||
| `"melpa"`. It does *not* ensure that `foo` is installed, because explicit | |||
| `:ensure` keywords were given. | |||
| - New `:hook` keyword. | |||
| - New `:catch` keyword. If `t` or `nil`, it enables (the default, see | |||
| `use-package-defaults`) or disables catching errors at load time in | |||
| use-package expansions. It can also be a function taking two arguments: the | |||
| keyword being processed at the time the error was encountered, and the error | |||
| object (as generated by `condition-case`). | |||
| - New keywords `:custom (foo1 bar1) (foo2 bar2)` etc., and `:custom-face`. | |||
| NOTE: These are only for people who wish to keep customizations with their | |||
| accompanying use-package declarations. Functionally, the only benefit over | |||
| using `setq` in a `:config` block is that customizations might execute code | |||
| when values are assigned. If you currently use `M-x customize-option` and | |||
| save to a settings file, you do not want to use this option. | |||
| - New `:magic` and `:magic-fallback` keywords. | |||
| - New `:defer-install` keyword. | |||
| - New customization variable `use-package-enable-imenu-support`. | |||
| - New customization variable `use-package-hook-name-suffix`. Any symbols named | |||
| in `:hook`, or in the CAR of cons cells passed to `:hook`, have this text | |||
| appended to them as a convenience. If you find yourself using this keyword | |||
| to add to hooks of different names, or just don't want such appending done, | |||
| you can change the text to an empty string. | |||
| - New customization variable `use-package-compute-statistics`, and an | |||
| accompanying command `M-x use-package-report`. See the README for more | |||
| details. | |||
| - Allow `:diminish` to take no arguments. | |||
| - Support multiple symbols passed to `:after`, and a mini-DSL using `:all` and | |||
| `:any`. | |||
| - `:mode` and `:interpreter` can now accept `(rx ...)` forms. | |||
| - Using `:load-path` without also using `:ensure` now implies `:ensure nil`. | |||
| - `:bind (:map foo-map ...)` now defers binding in the map until the package | |||
| has been loaded. | |||
| - Print key bindings for keymaps in `describe-personal-keybindings`. | |||
| - When `use-package-inject-hooks` is non-nil, always fire `:init` and | |||
| `:config` hooks. | |||
| - Documentation added for the `:after`, `:defer-install`, `:delight`, | |||
| `:requires`, `:when` and `:unless` keywords. | |||
| - `:requires SYM` is subtly different from `:if (featurep SYM)`, in that it | |||
| happens before the `:preface`. This means that using `:requires` will cause | |||
| definitions in the `:preface` to not be visible to the byte-compiler, | |||
| leading to possible warnings about unknown functions, or functions that may | |||
| not be available at run-time (which can generally be ignored, since | |||
| `:requires` is intended as a check for basic system functionality; `:after` | |||
| should be used to check for the presence of other modules). | |||
| - New undocumented (and currently experimental) keyword `:load` may be used to | |||
| change the name of the actual package loaded, rather than the package name, | |||
| and may even add other names. For example: `(use-package auctex :load | |||
| tex-site)`. This keyword is used internally to generate the `require` for a | |||
| package, so that deferral is simply a matter of not generating this keyword. | |||
| - The source code is now broken into several files, so that certain optional | |||
| features (diminish, delight, ensure) may be maintained separately from the | |||
| core functionality. | |||
| - When using the `:after` keyword, now even autoloadeds keybinding are | |||
| deferred until after that other package has loaded, in order to allow | |||
| convenient `:bind` to maps only present in that other package. Consider the | |||
| following: | |||
| ``` elisp | |||
| (use-package helm-descbinds | |||
| :load-path "site-lisp/helm-descbinds" | |||
| :after helm | |||
| :bind ("C-h b" . helm-descbinds) | |||
| :init | |||
| (fset 'describe-bindings 'helm-descbinds)) | |||
| ``` | |||
| The binding of `C-h b` here will not occur until helm is loaded; and after | |||
| it is loaded, `helm-descbinds` itself is not loaded until the user presses | |||
| `C-h b`. | |||
| - For extension authors, if you add a keyword to `use-package-keywords` whose | |||
| presence should indicate deferred loading, please also add it to | |||
| `use-package-deferring-keywords`. Note that this is a bit of a sledgehammer, | |||
| in that the mere presence of these keywords implies deferred loading. For a | |||
| more subtle approach, see the new `use-package-autoloads/<KEYWORD>` support | |||
| mentioned in the next bullet. | |||
| - For extension authors, if you wish deferred loading to possibly occur, | |||
| create functions named `use-package-autoloads/<KEYWORD>` for each keyword | |||
| that you define, returning an alist of the form `(SYMBOL . TYPE)` of symbols | |||
| to be autoloaded. `SYMBOL` should be an interactive function, and `TYPE` the | |||
| smybol `command`, but this functionality may be extended in future. These | |||
| autoloads are established if deferred loading is to happen. | |||
| - If you specify a lambda form rather than a function symbol in any of the | |||
| constructs that *might* introduce autoloads: `:bind`, `:bind*`, | |||
| `:interpreter`, `:mode`, `:magic`, `:magic-fallback`, and `:hook`: then | |||
| deferred loading will no longer be implied, since there's nothing to | |||
| associate an autoload with that could later load the module. In these cases, | |||
| it will be as if you'd specified `:demand t`, in order to ensure the lambda | |||
| form is able to execute in the context of the loaded package. | |||
| - For extension authors, there is a new customization variable | |||
| `use-package-merge-key-alist` that specifies how values passed to multiple | |||
| occurrences of the same key should be merged into a single value, during | |||
| normalization of the `use-package` declaration into a proper plist. The | |||
| default behavior is to simply append the values together (since they are | |||
| always normalized to lists). | |||
| ### Bug fixes | |||
| - Repeating a bind no longer causes duplicates in personal-keybindings. | |||
| - When byte-compiling, correctly output declare-function directives. | |||
| - Append to *use-package* when debugging, don't clear it. | |||
| - Don't allow :commands, :bind, etc., to be given an empty list. | |||
| - Explicit :defer t should override use-package-always-demand. | |||
| @ -1,113 +0,0 @@ | |||
| ;;; bind-chord.el --- key-chord binding helper for use-package-chords -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2015-2022 Free Software Foundation, Inc. | |||
| ;; Author: Justin Talbott <justin@waymondo.com> | |||
| ;; Keywords: convenience, tools, extensions | |||
| ;; URL: https://github.com/jwiegley/use-package | |||
| ;; Version: 0.2.1 | |||
| ;; Package-Requires: ((emacs "24.3") (bind-key "1.0") (key-chord "0.6")) | |||
| ;; Filename: bind-chord.el | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;;; Code: | |||
| (require 'bind-key) | |||
| (require 'key-chord nil t) | |||
| ;;;###autoload | |||
| (defmacro bind-chord (chord command &optional keymap) | |||
| "Bind CHORD to COMMAND in KEYMAP (`global-map' if not passed)." | |||
| (let ((key1 (logand 255 (aref chord 0))) | |||
| (key2 (logand 255 (aref chord 1)))) | |||
| (if (eq key1 key2) | |||
| `(bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap) | |||
| `(progn | |||
| (bind-key (vector 'key-chord ,key1 ,key2) ,command ,keymap) | |||
| (bind-key (vector 'key-chord ,key2 ,key1) ,command ,keymap))))) | |||
| (defun bind-chords-form (args keymap) | |||
| "Bind multiple chords at once. | |||
| Accepts keyword arguments: | |||
| :map MAP - a keymap into which the keybindings should be | |||
| added | |||
| The rest of the arguments are conses of keybinding string and a | |||
| function symbol (unquoted)." | |||
| (let (map pkg) | |||
| (let ((cont t)) | |||
| (while (and cont args) | |||
| (if (cond ((eq :map (car args)) | |||
| (setq map (cadr args))) | |||
| ((eq :package (car args)) | |||
| (setq pkg (cadr args)))) | |||
| (setq args (cddr args)) | |||
| (setq cont nil)))) | |||
| (unless map (setq map keymap)) | |||
| (let (first next) | |||
| (while args | |||
| (if (keywordp (car args)) | |||
| (progn | |||
| (setq next args) | |||
| (setq args nil)) | |||
| (if first | |||
| (nconc first (list (car args))) | |||
| (setq first (list (car args)))) | |||
| (setq args (cdr args)))) | |||
| (cl-flet | |||
| ((wrap (map bindings) | |||
| (if (and map pkg (not (memq map '(global-map | |||
| override-global-map)))) | |||
| `((if (boundp ',map) | |||
| ,(macroexp-progn bindings) | |||
| (eval-after-load | |||
| ,(if (symbolp pkg) `',pkg pkg) | |||
| ',(macroexp-progn bindings)))) | |||
| bindings))) | |||
| (append | |||
| (wrap map | |||
| (cl-mapcan | |||
| (lambda (form) | |||
| (let ((fun (and (cdr form) (list 'function (cdr form))))) | |||
| (if (and map (not (eq map 'global-map))) | |||
| `((bind-chord ,(car form) ,fun ,map)) | |||
| `((bind-chord ,(car form) ,fun nil))))) | |||
| first)) | |||
| (when next | |||
| (bind-chords-form (if pkg | |||
| (cons :package (cons pkg next)) | |||
| next) map))))))) | |||
| ;;;###autoload | |||
| (defmacro bind-chords (&rest args) | |||
| "Bind multiple chords at once. | |||
| Accepts keyword argument: | |||
| :map - a keymap into which the keybindings should be added | |||
| The rest of the arguments are conses of keybinding string and a | |||
| function symbol (unquoted)." | |||
| (macroexp-progn (bind-chords-form args nil))) | |||
| (provide 'bind-chord) | |||
| ;;; bind-chord.el ends here | |||
| @ -1,544 +0,0 @@ | |||
| ;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*- | |||
| ;; Copyright (c) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; Created: 16 Jun 2012 | |||
| ;; Version: 2.4.1 | |||
| ;; Package-Requires: ((emacs "24.3")) | |||
| ;; Keywords: keys keybinding config dotemacs extensions | |||
| ;; URL: https://github.com/jwiegley/use-package | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; If you have lots of keybindings set in your .emacs file, it can be hard to | |||
| ;; know which ones you haven't set yet, and which may now be overriding some | |||
| ;; new default in a new Emacs version. This module aims to solve that | |||
| ;; problem. | |||
| ;; | |||
| ;; Bind keys as follows in your .emacs: | |||
| ;; | |||
| ;; (require 'bind-key) | |||
| ;; | |||
| ;; (bind-key "C-c x" 'my-ctrl-c-x-command) | |||
| ;; | |||
| ;; If the keybinding argument is a vector, it is passed straight to | |||
| ;; `define-key', so remapping a key with `[remap COMMAND]' works as | |||
| ;; expected: | |||
| ;; | |||
| ;; (bind-key [remap original-ctrl-c-x-command] 'my-ctrl-c-x-command) | |||
| ;; | |||
| ;; If you want the keybinding to override all minor modes that may also bind | |||
| ;; the same key, use the `bind-key*' form: | |||
| ;; | |||
| ;; (bind-key* "<C-return>" 'other-window) | |||
| ;; | |||
| ;; If you want to rebind a key only in a particular keymap, use: | |||
| ;; | |||
| ;; (bind-key "C-c x" 'my-ctrl-c-x-command some-other-mode-map) | |||
| ;; | |||
| ;; To unbind a key within a keymap (for example, to stop your favorite major | |||
| ;; mode from changing a binding that you don't want to override everywhere), | |||
| ;; use `unbind-key': | |||
| ;; | |||
| ;; (unbind-key "C-c x" some-other-mode-map) | |||
| ;; | |||
| ;; To bind multiple keys at once, or set up a prefix map, a `bind-keys' macro | |||
| ;; is provided. It accepts keyword arguments, please see its documentation | |||
| ;; for a detailed description. | |||
| ;; | |||
| ;; To add keys into a specific map, use :map argument | |||
| ;; | |||
| ;; (bind-keys :map dired-mode-map | |||
| ;; ("o" . dired-omit-mode) | |||
| ;; ("a" . some-custom-dired-function)) | |||
| ;; | |||
| ;; To set up a prefix map, use `:prefix-map' and `:prefix' arguments (both are | |||
| ;; required) | |||
| ;; | |||
| ;; (bind-keys :prefix-map my-customize-prefix-map | |||
| ;; :prefix "C-c c" | |||
| ;; ("f" . customize-face) | |||
| ;; ("v" . customize-variable)) | |||
| ;; | |||
| ;; You can combine all the keywords together. Additionally, | |||
| ;; `:prefix-docstring' can be specified to set documentation of created | |||
| ;; `:prefix-map' variable. | |||
| ;; | |||
| ;; To bind multiple keys in a `bind-key*' way (to be sure that your bindings | |||
| ;; will not be overridden by other modes), you may use `bind-keys*' macro: | |||
| ;; | |||
| ;; (bind-keys* | |||
| ;; ("C-o" . other-window) | |||
| ;; ("C-M-n" . forward-page) | |||
| ;; ("C-M-p" . backward-page)) | |||
| ;; | |||
| ;; After Emacs loads, you can see a summary of all your personal keybindings | |||
| ;; currently in effect with this command: | |||
| ;; | |||
| ;; M-x describe-personal-keybindings | |||
| ;; | |||
| ;; This display will tell you if you've overridden a default keybinding, and | |||
| ;; what the default was. Also, it will tell you if the key was rebound after | |||
| ;; your binding it with `bind-key', and what it was rebound it to. | |||
| ;;; Code: | |||
| (require 'cl-lib) | |||
| (require 'easy-mmode) | |||
| (defgroup bind-key nil | |||
| "A simple way to manage personal keybindings." | |||
| :group 'emacs) | |||
| (defcustom bind-key-column-widths '(18 . 40) | |||
| "Width of columns in `describe-personal-keybindings'." | |||
| :type '(cons integer integer) | |||
| :group 'bind-key) | |||
| (defcustom bind-key-segregation-regexp | |||
| "\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)" | |||
| "Regular expression used to divide key sets in the output from | |||
| \\[describe-personal-keybindings]." | |||
| :type 'regexp | |||
| :group 'bind-key) | |||
| (defcustom bind-key-describe-special-forms nil | |||
| "If non-nil, extract docstrings from lambdas, closures and keymaps if possible." | |||
| :type 'boolean | |||
| :group 'bind-key) | |||
| ;; Create override-global-mode to force key remappings | |||
| (defvar override-global-map (make-keymap) | |||
| "Keymap for `override-global-mode'.") | |||
| (define-minor-mode override-global-mode | |||
| "A minor mode so that keymap settings override other modes." | |||
| :init-value t | |||
| :lighter "") | |||
| ;; the keymaps in `emulation-mode-map-alists' take precedence over | |||
| ;; `minor-mode-map-alist' | |||
| (add-to-list 'emulation-mode-map-alists | |||
| `((override-global-mode . ,override-global-map))) | |||
| (defvar personal-keybindings nil | |||
| "List of bindings performed by `bind-key'. | |||
| Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)") | |||
| ;;;###autoload | |||
| (defmacro bind-key (key-name command &optional keymap predicate) | |||
| "Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed). | |||
| KEY-NAME may be a vector, in which case it is passed straight to | |||
| `define-key'. Or it may be a string to be interpreted as | |||
| spelled-out keystrokes, e.g., `C-c C-z'. See documentation of | |||
| `edmacro-mode' for details. | |||
| COMMAND must be an interactive function or lambda form. | |||
| KEYMAP, if present, should be a keymap variable or symbol. | |||
| For example: | |||
| (bind-key \"M-h\" #\\='some-interactive-function my-mode-map) | |||
| (bind-key \"M-h\" #\\='some-interactive-function \\='my-mode-map) | |||
| If PREDICATE is non-nil, it is a form evaluated to determine when | |||
| a key should be bound. It must return non-nil in such cases. | |||
| Emacs can evaluate this form at any time that it does redisplay | |||
| or operates on menu data structures, so you should write it so it | |||
| can safely be called at any time." | |||
| (let ((namevar (make-symbol "name")) | |||
| (keyvar (make-symbol "key")) | |||
| (kmapvar (make-symbol "kmap")) | |||
| (kdescvar (make-symbol "kdesc")) | |||
| (bindingvar (make-symbol "binding"))) | |||
| `(let* ((,namevar ,key-name) | |||
| (,keyvar ,(if (stringp key-name) (read-kbd-macro key-name) | |||
| `(if (vectorp ,namevar) ,namevar | |||
| (read-kbd-macro ,namevar)))) | |||
| (,kmapvar (or (if (and ,keymap (symbolp ,keymap)) | |||
| (symbol-value ,keymap) ,keymap) | |||
| global-map)) | |||
| (,kdescvar (cons (if (stringp ,namevar) ,namevar | |||
| (key-description ,namevar)) | |||
| (if (symbolp ,keymap) ,keymap (quote ,keymap)))) | |||
| (,bindingvar (lookup-key ,kmapvar ,keyvar))) | |||
| (let ((entry (assoc ,kdescvar personal-keybindings)) | |||
| (details (list ,command | |||
| (unless (numberp ,bindingvar) | |||
| ,bindingvar)))) | |||
| (if entry | |||
| (setcdr entry details) | |||
| (add-to-list 'personal-keybindings (cons ,kdescvar details)))) | |||
| ,(if predicate | |||
| `(define-key ,kmapvar ,keyvar | |||
| '(menu-item "" nil :filter (lambda (&optional _) | |||
| (when ,predicate | |||
| ,command)))) | |||
| `(define-key ,kmapvar ,keyvar ,command))))) | |||
| ;;;###autoload | |||
| (defmacro unbind-key (key-name &optional keymap) | |||
| "Unbind the given KEY-NAME, within the KEYMAP (if specified). | |||
| See `bind-key' for more details." | |||
| (let ((namevar (make-symbol "name")) | |||
| (kdescvar (make-symbol "kdesc"))) | |||
| `(let* ((,namevar ,key-name) | |||
| (,kdescvar (cons (if (stringp ,namevar) ,namevar | |||
| (key-description ,namevar)) | |||
| (if (symbolp ,keymap) ,keymap (quote ,keymap))))) | |||
| (bind-key--remove (if (vectorp ,namevar) ,namevar | |||
| (read-kbd-macro ,namevar)) | |||
| (or (if (and ,keymap (symbolp ,keymap)) | |||
| (symbol-value ,keymap) ,keymap) | |||
| global-map)) | |||
| (setq personal-keybindings | |||
| (cl-delete-if (lambda (k) (equal (car k) ,kdescvar)) | |||
| personal-keybindings)) | |||
| nil))) | |||
| (defun bind-key--remove (key keymap) | |||
| "Remove KEY from KEYMAP. | |||
| In contrast to `define-key', this function removes the binding from the keymap." | |||
| (define-key keymap key nil) | |||
| ;; Split M-key in ESC key | |||
| (setq key (cl-mapcan (lambda (k) | |||
| (if (and (integerp k) (/= (logand k ?\M-\0) 0)) | |||
| (list ?\e (logxor k ?\M-\0)) | |||
| (list k))) | |||
| key)) | |||
| ;; Delete single keys directly | |||
| (if (= (length key) 1) | |||
| (delete key keymap) | |||
| ;; Lookup submap and delete key from there | |||
| (let* ((prefix (vconcat (butlast key))) | |||
| (submap (lookup-key keymap prefix))) | |||
| (unless (keymapp submap) | |||
| (error "Not a keymap for %s" key)) | |||
| (when (symbolp submap) | |||
| (setq submap (symbol-function submap))) | |||
| (delete (last key) submap) | |||
| ;; Delete submap if it is empty | |||
| (when (= 1 (length submap)) | |||
| (bind-key--remove prefix keymap))))) | |||
| ;;;###autoload | |||
| (defmacro bind-key* (key-name command &optional predicate) | |||
| "Similar to `bind-key', but overrides any mode-specific bindings." | |||
| `(bind-key ,key-name ,command override-global-map ,predicate)) | |||
| (defun bind-keys-form (args keymap) | |||
| "Bind multiple keys at once. | |||
| Accepts keyword arguments: | |||
| :map MAP - a keymap into which the keybindings should be | |||
| added | |||
| :prefix KEY - prefix key for these bindings | |||
| :prefix-map MAP - name of the prefix map that should be created | |||
| for these bindings | |||
| :prefix-docstring STR - docstring for the prefix-map variable | |||
| :menu-name NAME - optional menu string for prefix map | |||
| :repeat-docstring STR - docstring for the repeat-map variable | |||
| :repeat-map MAP - name of the repeat map that should be created | |||
| for these bindings. If specified, the | |||
| `repeat-map' property of each command bound | |||
| (within the scope of the `:repeat-map' keyword) | |||
| is set to this map. | |||
| :exit BINDINGS - Within the scope of `:repeat-map' will bind the | |||
| key in the repeat map, but will not set the | |||
| `repeat-map' property of the bound command. | |||
| :continue BINDINGS - Within the scope of `:repeat-map' forces the | |||
| same behaviour as if no special keyword had | |||
| been used (that is, the command is bound, and | |||
| it's `repeat-map' property set) | |||
| :filter FORM - optional form to determine when bindings apply | |||
| The rest of the arguments are conses of keybinding string and a | |||
| function symbol (unquoted)." | |||
| (let (map | |||
| prefix-doc | |||
| prefix-map | |||
| prefix | |||
| repeat-map | |||
| repeat-doc | |||
| repeat-type ;; Only used internally | |||
| filter | |||
| menu-name | |||
| pkg) | |||
| ;; Process any initial keyword arguments | |||
| (let ((cont t) | |||
| (arg-change-func 'cddr)) | |||
| (while (and cont args) | |||
| (if (cond ((and (eq :map (car args)) | |||
| (not prefix-map)) | |||
| (setq map (cadr args))) | |||
| ((eq :prefix-docstring (car args)) | |||
| (setq prefix-doc (cadr args))) | |||
| ((and (eq :prefix-map (car args)) | |||
| (not (memq map '(global-map | |||
| override-global-map)))) | |||
| (setq prefix-map (cadr args))) | |||
| ((eq :repeat-docstring (car args)) | |||
| (setq repeat-doc (cadr args))) | |||
| ((and (eq :repeat-map (car args)) | |||
| (not (memq map '(global-map | |||
| override-global-map)))) | |||
| (setq repeat-map (cadr args)) | |||
| (setq map repeat-map)) | |||
| ((eq :continue (car args)) | |||
| (setq repeat-type :continue | |||
| arg-change-func 'cdr)) | |||
| ((eq :exit (car args)) | |||
| (setq repeat-type :exit | |||
| arg-change-func 'cdr)) | |||
| ((eq :prefix (car args)) | |||
| (setq prefix (cadr args))) | |||
| ((eq :filter (car args)) | |||
| (setq filter (cadr args)) t) | |||
| ((eq :menu-name (car args)) | |||
| (setq menu-name (cadr args))) | |||
| ((eq :package (car args)) | |||
| (setq pkg (cadr args)))) | |||
| (setq args (funcall arg-change-func args)) | |||
| (setq cont nil)))) | |||
| (when (or (and prefix-map (not prefix)) | |||
| (and prefix (not prefix-map))) | |||
| (error "Both :prefix-map and :prefix must be supplied")) | |||
| (when repeat-type | |||
| (unless repeat-map | |||
| (error ":continue and :exit require specifying :repeat-map"))) | |||
| (when (and menu-name (not prefix)) | |||
| (error "If :menu-name is supplied, :prefix must be too")) | |||
| (unless map (setq map keymap)) | |||
| ;; Process key binding arguments | |||
| (let (first next) | |||
| (while args | |||
| (if (keywordp (car args)) | |||
| (progn | |||
| (setq next args) | |||
| (setq args nil)) | |||
| (if first | |||
| (nconc first (list (car args))) | |||
| (setq first (list (car args)))) | |||
| (setq args (cdr args)))) | |||
| (cl-flet | |||
| ((wrap (map bindings) | |||
| (if (and map pkg (not (memq map '(global-map | |||
| override-global-map)))) | |||
| `((if (boundp ',map) | |||
| ,(macroexp-progn bindings) | |||
| (eval-after-load | |||
| ,(if (symbolp pkg) `',pkg pkg) | |||
| ',(macroexp-progn bindings)))) | |||
| bindings))) | |||
| (append | |||
| (when prefix-map | |||
| `((defvar ,prefix-map) | |||
| ,@(when prefix-doc `((put ',prefix-map 'variable-documentation ,prefix-doc))) | |||
| ,@(if menu-name | |||
| `((define-prefix-command ',prefix-map nil ,menu-name)) | |||
| `((define-prefix-command ',prefix-map))) | |||
| ,@(if (and map (not (eq map 'global-map))) | |||
| (wrap map `((bind-key ,prefix ',prefix-map ,map ,filter))) | |||
| `((bind-key ,prefix ',prefix-map nil ,filter))))) | |||
| (when repeat-map | |||
| `((defvar ,repeat-map (make-sparse-keymap) | |||
| ,@(when repeat-doc `(,repeat-doc))))) | |||
| (wrap map | |||
| (cl-mapcan | |||
| (lambda (form) | |||
| (let ((fun (and (cdr form) (list 'function (cdr form))))) | |||
| (if prefix-map | |||
| `((bind-key ,(car form) ,fun ,prefix-map ,filter)) | |||
| (if (and map (not (eq map 'global-map))) | |||
| ;; Only needed in this branch, since when | |||
| ;; repeat-map is non-nil, map is always | |||
| ;; non-nil | |||
| `(,@(when (and repeat-map (not (eq repeat-type :exit))) | |||
| `((put ,fun 'repeat-map ',repeat-map))) | |||
| (bind-key ,(car form) ,fun ,map ,filter)) | |||
| `((bind-key ,(car form) ,fun nil ,filter)))))) | |||
| first)) | |||
| (when next | |||
| (bind-keys-form `(,@(when repeat-map `(:repeat-map ,repeat-map)) | |||
| ,@(if pkg | |||
| (cons :package (cons pkg next)) | |||
| next)) map))))))) | |||
| ;;;###autoload | |||
| (defmacro bind-keys (&rest args) | |||
| "Bind multiple keys at once. | |||
| Accepts keyword arguments: | |||
| :map MAP - a keymap into which the keybindings should be | |||
| added | |||
| :prefix KEY - prefix key for these bindings | |||
| :prefix-map MAP - name of the prefix map that should be created | |||
| for these bindings | |||
| :prefix-docstring STR - docstring for the prefix-map variable | |||
| :menu-name NAME - optional menu string for prefix map | |||
| :repeat-docstring STR - docstring for the repeat-map variable | |||
| :repeat-map MAP - name of the repeat map that should be created | |||
| for these bindings. If specified, the | |||
| `repeat-map' property of each command bound | |||
| (within the scope of the `:repeat-map' keyword) | |||
| is set to this map. | |||
| :exit BINDINGS - Within the scope of `:repeat-map' will bind the | |||
| key in the repeat map, but will not set the | |||
| `repeat-map' property of the bound command. | |||
| :continue BINDINGS - Within the scope of `:repeat-map' forces the | |||
| same behaviour as if no special keyword had | |||
| been used (that is, the command is bound, and | |||
| it's `repeat-map' property set) | |||
| :filter FORM - optional form to determine when bindings apply | |||
| The rest of the arguments are conses of keybinding string and a | |||
| function symbol (unquoted)." | |||
| (macroexp-progn (bind-keys-form args nil))) | |||
| ;;;###autoload | |||
| (defmacro bind-keys* (&rest args) | |||
| (macroexp-progn (bind-keys-form args 'override-global-map))) | |||
| (defun get-binding-description (elem) | |||
| (cond | |||
| ((listp elem) | |||
| (cond | |||
| ((memq (car elem) '(lambda function)) | |||
| (if (and bind-key-describe-special-forms | |||
| (stringp (nth 2 elem))) | |||
| (nth 2 elem) | |||
| "#<lambda>")) | |||
| ((eq 'closure (car elem)) | |||
| (if (and bind-key-describe-special-forms | |||
| (stringp (nth 3 elem))) | |||
| (nth 3 elem) | |||
| "#<closure>")) | |||
| ((eq 'keymap (car elem)) | |||
| "#<keymap>") | |||
| (t | |||
| elem))) | |||
| ;; must be a symbol, non-symbol keymap case covered above | |||
| ((and bind-key-describe-special-forms (keymapp elem)) | |||
| (let ((doc (get elem 'variable-documentation))) | |||
| (if (stringp doc) doc elem))) | |||
| ((symbolp elem) | |||
| elem) | |||
| (t | |||
| "#<byte-compiled lambda>"))) | |||
| (defun compare-keybindings (l r) | |||
| (let* ((regex bind-key-segregation-regexp) | |||
| (lgroup (and (string-match regex (caar l)) | |||
| (match-string 0 (caar l)))) | |||
| (rgroup (and (string-match regex (caar r)) | |||
| (match-string 0 (caar r)))) | |||
| (lkeymap (cdar l)) | |||
| (rkeymap (cdar r))) | |||
| (cond | |||
| ((and (null lkeymap) rkeymap) | |||
| (cons t t)) | |||
| ((and lkeymap (null rkeymap)) | |||
| (cons nil t)) | |||
| ((and lkeymap rkeymap | |||
| (not (string= (symbol-name lkeymap) (symbol-name rkeymap)))) | |||
| (cons (string< (symbol-name lkeymap) (symbol-name rkeymap)) t)) | |||
| ((and (null lgroup) rgroup) | |||
| (cons t t)) | |||
| ((and lgroup (null rgroup)) | |||
| (cons nil t)) | |||
| ((and lgroup rgroup) | |||
| (if (string= lgroup rgroup) | |||
| (cons (string< (caar l) (caar r)) nil) | |||
| (cons (string< lgroup rgroup) t))) | |||
| (t | |||
| (cons (string< (caar l) (caar r)) nil))))) | |||
| ;;;###autoload | |||
| (defun describe-personal-keybindings () | |||
| "Display all the personal keybindings defined by `bind-key'." | |||
| (interactive) | |||
| (with-output-to-temp-buffer "*Personal Keybindings*" | |||
| (princ (format (concat "Key name%s Command%s Comments\n%s %s " | |||
| "---------------------\n") | |||
| (make-string (- (car bind-key-column-widths) 9) ? ) | |||
| (make-string (- (cdr bind-key-column-widths) 8) ? ) | |||
| (make-string (1- (car bind-key-column-widths)) ?-) | |||
| (make-string (1- (cdr bind-key-column-widths)) ?-))) | |||
| (let (last-binding) | |||
| (dolist (binding | |||
| (setq personal-keybindings | |||
| (sort personal-keybindings | |||
| (lambda (l r) | |||
| (car (compare-keybindings l r)))))) | |||
| (if (not (eq (cdar last-binding) (cdar binding))) | |||
| (princ (format "\n\n%s: %s\n%s\n\n" | |||
| (cdar binding) (caar binding) | |||
| (make-string (+ 21 (car bind-key-column-widths) | |||
| (cdr bind-key-column-widths)) ?-))) | |||
| (if (and last-binding | |||
| (cdr (compare-keybindings last-binding binding))) | |||
| (princ "\n"))) | |||
| (let* ((key-name (caar binding)) | |||
| (at-present (lookup-key (or (symbol-value (cdar binding)) | |||
| (current-global-map)) | |||
| (read-kbd-macro key-name))) | |||
| (command (nth 1 binding)) | |||
| (was-command (nth 2 binding)) | |||
| (command-desc (get-binding-description command)) | |||
| (was-command-desc (and was-command | |||
| (get-binding-description was-command))) | |||
| (at-present-desc (get-binding-description at-present))) | |||
| (let ((line | |||
| (format | |||
| (format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths) | |||
| (cdr bind-key-column-widths)) | |||
| key-name (format "`%s\'" command-desc) | |||
| (if (string= command-desc at-present-desc) | |||
| (if (or (null was-command) | |||
| (string= command-desc was-command-desc)) | |||
| "" | |||
| (format "was `%s\'" was-command-desc)) | |||
| (format "[now: `%s\']" at-present))))) | |||
| (princ (if (string-match "[ \t]+\n" line) | |||
| (replace-match "\n" t t line) | |||
| line)))) | |||
| (setq last-binding binding))))) | |||
| (provide 'bind-key) | |||
| ;; Local Variables: | |||
| ;; outline-regexp: ";;;\\(;* [^\s\t\n]\\|###autoload\\)\\|(" | |||
| ;; End: | |||
| ;;; bind-key.el ends here | |||
| @ -1,92 +0,0 @@ | |||
| TOP := $(dir $(lastword $(MAKEFILE_LIST))) | |||
| ## User options ###################################################### | |||
| # | |||
| # You can override these settings in "config.mk" or on the command | |||
| # line. | |||
| # | |||
| # You might also want to set LOAD_PATH. If you do, then it must | |||
| # contain "-L .". | |||
| # | |||
| # If you don't do so, then the default is set in the "Load-Path" | |||
| # section below. The default assumes that all dependencies are | |||
| # installed either at "../<DEPENDENCY>", or when using package.el | |||
| # at "ELPA_DIR/<DEPENDENCY>-<HIGHEST-VERSION>". | |||
| PREFIX ?= /usr/local | |||
| sharedir ?= $(PREFIX)/share | |||
| lispdir ?= $(sharedir)/emacs/site-lisp/use-package | |||
| infodir ?= $(sharedir)/info | |||
| docdir ?= $(sharedir)/doc/use-package | |||
| statsdir ?= $(TOP)/stats | |||
| CP ?= install -p -m 644 | |||
| MKDIR ?= install -p -m 755 -d | |||
| RMDIR ?= rm -rf | |||
| TAR ?= tar | |||
| SED ?= sed | |||
| EMACS ?= emacs | |||
| BATCH = $(EMACS) -Q --batch $(LOAD_PATH) | |||
| INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info) | |||
| MAKEINFO ?= makeinfo | |||
| MANUAL_HTML_ARGS ?= --css-ref /assets/page.css | |||
| ## Files ############################################################# | |||
| PKG = use-package | |||
| PACKAGES = use-package | |||
| TEXIPAGES = $(addsuffix .texi,$(filter-out git-commit,$(PACKAGES))) | |||
| INFOPAGES = $(addsuffix .info,$(filter-out git-commit,$(PACKAGES))) | |||
| HTMLFILES = $(addsuffix .html,$(filter-out git-commit,$(PACKAGES))) | |||
| HTMLDIRS = $(filter-out git-commit,$(PACKAGES)) | |||
| PDFFILES = $(addsuffix .pdf,$(filter-out git-commit,$(PACKAGES))) | |||
| ELS = use-package.el | |||
| ELS += bind-key.el | |||
| ELS += bind-chord.el | |||
| ELS += use-package-bind-key.el | |||
| ELS += use-package-core.el | |||
| ELS += use-package-delight.el | |||
| ELS += use-package-diminish.el | |||
| ELS += use-package-ensure.el | |||
| ELS += use-package-jump.el | |||
| ELS += use-package-tests.el | |||
| ELS += use-package-chords.el | |||
| ELS += use-package-ensure-system-package.el | |||
| ELCS = $(ELS:.el=.elc) | |||
| ELMS = use-package.el $(filter-out $(addsuffix .el,$(PACKAGES)),$(ELS)) | |||
| ELGS = | |||
| ## Versions ########################################################## | |||
| VERSION = 2.4.4 | |||
| USE_PACKAGE_VERSION = 2.4.4 | |||
| EMACS_VERSION = 24.3 | |||
| EMACSOLD := $(shell $(BATCH) --eval \ | |||
| "(and (version< emacs-version \"$(EMACS_VERSION)\") (princ \"true\"))") | |||
| ifeq "$(EMACSOLD)" "true" | |||
| $(error At least version $(EMACS_VERSION) of Emacs is required) | |||
| endif | |||
| ## Load-Path ######################################################### | |||
| ifndef LOAD_PATH | |||
| ELPA_DIR ?= $(HOME)/.emacs.d/elpa | |||
| SYSTYPE := $(shell $(EMACS) -Q --batch --eval "(princ system-type)") | |||
| ifeq ($(SYSTYPE), windows-nt) | |||
| CYGPATH := $(shell cygpath --version 2>/dev/null) | |||
| endif | |||
| LOAD_PATH = -L $(TOP) | |||
| endif # ifndef LOAD_PATH | |||
| DOC_LOAD_PATH ?= $(LOAD_PATH) -L $(HOME)/emacs/site-lisp | |||
| @ -1,171 +0,0 @@ | |||
| ;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap* | |||
| ;; keywords. Note that these are currently still baked into | |||
| ;; `use-package-keywords' and `use-package-deferring-keywords', although this | |||
| ;; is harmless if they are never used. | |||
| ;;; Code: | |||
| (require 'use-package-core) | |||
| (require 'bind-key) | |||
| ;;;###autoload | |||
| (defun use-package-autoload-keymap (keymap-symbol package override) | |||
| "Loads PACKAGE and then binds the key sequence used to invoke | |||
| this function to KEYMAP-SYMBOL. It then simulates pressing the | |||
| same key sequence a again, so that the next key pressed is routed | |||
| to the newly loaded keymap. | |||
| This function supports use-package's :bind-keymap keyword. It | |||
| works by binding the given key sequence to an invocation of this | |||
| function for a particular keymap. The keymap is expected to be | |||
| defined by the package. In this way, loading the package is | |||
| deferred until the prefix key sequence is pressed." | |||
| (if (not (require package nil t)) | |||
| (use-package-error (format "Cannot load package.el: %s" package)) | |||
| (if (and (boundp keymap-symbol) | |||
| (keymapp (symbol-value keymap-symbol))) | |||
| (let* ((kv (this-command-keys-vector)) | |||
| (key (key-description kv)) | |||
| (keymap (symbol-value keymap-symbol))) | |||
| (if override | |||
| (bind-key* key keymap) | |||
| (bind-key key keymap)) | |||
| (setq unread-command-events | |||
| (mapcar (lambda (ev) (cons t ev)) | |||
| (listify-key-sequence kv)))) | |||
| (use-package-error | |||
| (format "package.el %s failed to define keymap %s" | |||
| package keymap-symbol))))) | |||
| ;;;###autoload | |||
| (defun use-package-normalize-binder (name keyword args) | |||
| (let ((arg args) | |||
| args*) | |||
| (while arg | |||
| (let ((x (car arg))) | |||
| (cond | |||
| ;; (KEY . COMMAND) | |||
| ((and (consp x) | |||
| (or (stringp (car x)) | |||
| (vectorp (car x))) | |||
| (or (use-package-recognize-function (cdr x) t #'stringp))) | |||
| (setq args* (nconc args* (list x))) | |||
| (setq arg (cdr arg))) | |||
| ;; KEYWORD | |||
| ;; :map KEYMAP | |||
| ;; :prefix-docstring STRING | |||
| ;; :prefix-map SYMBOL | |||
| ;; :prefix STRING | |||
| ;; :repeat-docstring STRING | |||
| ;; :repeat-map SYMBOL | |||
| ;; :filter SEXP | |||
| ;; :menu-name STRING | |||
| ;; :package SYMBOL | |||
| ;; :continue and :exit are used within :repeat-map | |||
| ((or (and (eq x :map) (symbolp (cadr arg))) | |||
| (and (eq x :prefix) (stringp (cadr arg))) | |||
| (and (eq x :prefix-map) (symbolp (cadr arg))) | |||
| (and (eq x :prefix-docstring) (stringp (cadr arg))) | |||
| (and (eq x :repeat-map) (symbolp (cadr arg))) | |||
| (eq x :continue) | |||
| (eq x :exit) | |||
| (and (eq x :repeat-docstring) (stringp (cadr arg))) | |||
| (eq x :filter) | |||
| (and (eq x :menu-name) (stringp (cadr arg))) | |||
| (and (eq x :package) (symbolp (cadr arg)))) | |||
| (setq args* (nconc args* (list x (cadr arg)))) | |||
| (setq arg (cddr arg))) | |||
| ((listp x) | |||
| (setq args* | |||
| (nconc args* (use-package-normalize-binder name keyword x))) | |||
| (setq arg (cdr arg))) | |||
| (t | |||
| ;; Error! | |||
| (use-package-error | |||
| (concat (symbol-name name) | |||
| " wants arguments acceptable to the `bind-keys' macro," | |||
| " or a list of such values")))))) | |||
| args*)) | |||
| ;;;; :bind, :bind* | |||
| ;;;###autoload | |||
| (defalias 'use-package-normalize/:bind 'use-package-normalize-binder) | |||
| ;;;###autoload | |||
| (defalias 'use-package-normalize/:bind* 'use-package-normalize-binder) | |||
| ;; jww (2017-12-07): This is too simplistic. It will fail to determine | |||
| ;; autoloads in this situation: | |||
| ;; (use-package foo | |||
| ;; :bind (:map foo-map (("C-a" . func)))) | |||
| ;;;###autoload | |||
| (defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode) | |||
| ;;;###autoload | |||
| (defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:bind | |||
| (name _keyword args rest state &optional bind-macro) | |||
| (use-package-concat | |||
| (use-package-process-keywords name rest state) | |||
| `(,@(mapcar | |||
| #'(lambda (xs) | |||
| `(,(if bind-macro bind-macro 'bind-keys) | |||
| :package ,name ,@(use-package-normalize-commands xs))) | |||
| (use-package-split-list-at-keys :break args))))) | |||
| (defun use-package-handler/:bind* (name keyword arg rest state) | |||
| (use-package-handler/:bind name keyword arg rest state 'bind-keys*)) | |||
| ;;;; :bind-keymap, :bind-keymap* | |||
| ;;;###autoload | |||
| (defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder) | |||
| ;;;###autoload | |||
| (defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:bind-keymap | |||
| (name _keyword args rest state &optional override) | |||
| (use-package-concat | |||
| (use-package-process-keywords name rest state) | |||
| (mapcar | |||
| #'(lambda (binding) | |||
| `(,(if override 'bind-key* 'bind-key) | |||
| ,(car binding) | |||
| #'(lambda () | |||
| (interactive) | |||
| (use-package-autoload-keymap | |||
| ',(cdr binding) ',(use-package-as-symbol name) | |||
| ,override)))) | |||
| args))) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:bind-keymap* (name keyword arg rest state) | |||
| (use-package-handler/:bind-keymap name keyword arg rest state t)) | |||
| (provide 'use-package-bind-key) | |||
| ;;; use-package-bind-key.el ends here | |||
| @ -1,153 +0,0 @@ | |||
| ;;; use-package-chords-tests.el --- Tests for use-package-chords.el -*- lexical-binding: t; -*- | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Code: | |||
| (require 'use-package) | |||
| (require 'use-package-tests) | |||
| (require 'use-package-chords) | |||
| (defmacro match-expansion (form &rest value) | |||
| `(should (pcase (expand-minimally ,form) | |||
| ,@(mapcar #'(lambda (x) (list x t)) value)))) | |||
| (defun use-package-test-normalize-chord (&rest args) | |||
| (apply #'use-package-normalize-binder 'foo :chords args)) | |||
| (ert-deftest use-package-test-normalize/:chords-1 () | |||
| (should (equal (use-package-test-normalize-chord | |||
| '(("C-a" . alpha))) | |||
| '(("C-a" . alpha))))) | |||
| (ert-deftest use-package-test-normalize/:chords-2 () | |||
| (should (equal (use-package-test-normalize-chord | |||
| '(("C-a" . alpha) | |||
| :map foo-map | |||
| ("C-b" . beta))) | |||
| '(("C-a" . alpha) | |||
| :map foo-map | |||
| ("C-b" . beta))))) | |||
| (ert-deftest use-package-test-normalize/:chords-3 () | |||
| (should (equal (use-package-test-normalize-chord | |||
| '(:map foo-map | |||
| ("C-a" . alpha) | |||
| ("C-b" . beta))) | |||
| '(:map foo-map | |||
| ("C-a" . alpha) | |||
| ("C-b" . beta))))) | |||
| (ert-deftest use-package-test/:chords-1 () | |||
| (match-expansion | |||
| (use-package foo :chords ("C-k" . key1) ("C-u" . key2)) | |||
| `(progn | |||
| (unless | |||
| (fboundp 'key1) | |||
| (autoload #'key1 "foo" nil t)) | |||
| (unless | |||
| (fboundp 'key2) | |||
| (autoload #'key2 "foo" nil t)) | |||
| (bind-chord "C-k" #'key1 nil) | |||
| (bind-chord "C-u" #'key2 nil)))) | |||
| (ert-deftest use-package-test/:chords-2 () | |||
| (match-expansion | |||
| (use-package foo :chords (("C-k" . key1) ("C-u" . key2))) | |||
| `(progn | |||
| (unless (fboundp 'key1) | |||
| (autoload #'key1 "foo" nil t)) | |||
| (unless (fboundp 'key2) | |||
| (autoload #'key2 "foo" nil t)) | |||
| (bind-chord "C-k" #'key1 nil) | |||
| (bind-chord "C-u" #'key2 nil)))) | |||
| (ert-deftest use-package-test/:chords-3 () | |||
| (match-expansion | |||
| (use-package foo :chords (:map my-map ("C-k" . key1) ("C-u" . key2))) | |||
| `(progn | |||
| (unless | |||
| (fboundp 'key1) | |||
| (autoload #'key1 "foo" nil t)) | |||
| (unless | |||
| (fboundp 'key2) | |||
| (autoload #'key2 "foo" nil t)) | |||
| (if | |||
| (boundp 'my-map) | |||
| (progn | |||
| (bind-chord "C-k" #'key1 my-map) | |||
| (bind-chord "C-u" #'key2 my-map)) | |||
| (eval-after-load 'foo | |||
| '(progn | |||
| (bind-chord "C-k" #'key1 my-map) | |||
| (bind-chord "C-u" #'key2 my-map))))))) | |||
| (ert-deftest use-package-test/:chords-4 () | |||
| (should-error | |||
| (match-expansion | |||
| (use-package foo :chords :map my-map ("C-k" . key1) ("C-u" . key2)) | |||
| `(bind-chords :package foo)))) | |||
| (ert-deftest use-package-test/:chords-5 () | |||
| (match-expansion | |||
| (use-package foo :chords ("C-k" . key1) (:map my-map ("C-u" . key2))) | |||
| `(progn | |||
| (unless (fboundp 'key1) | |||
| (autoload #'key1 "foo" nil t)) | |||
| (unless (fboundp 'key2) | |||
| (autoload #'key2 "foo" nil t)) | |||
| (progn | |||
| (bind-chord "C-k" #'key1 nil) | |||
| (if | |||
| (boundp 'my-map) | |||
| (bind-chord "C-u" #'key2 my-map) | |||
| (eval-after-load 'foo | |||
| '(bind-chord "C-u" #'key2 my-map))))))) | |||
| (ert-deftest use-package-test/:chords-6 () | |||
| (match-expansion | |||
| (use-package foo | |||
| :chords | |||
| ("C-k" . key1) | |||
| (:map my-map ("C-u" . key2)) | |||
| (:map my-map2 ("C-u" . key3))) | |||
| `(progn | |||
| (unless | |||
| (fboundp 'key1) | |||
| (autoload #'key1 "foo" nil t)) | |||
| (unless | |||
| (fboundp 'key2) | |||
| (autoload #'key2 "foo" nil t)) | |||
| (unless | |||
| (fboundp 'key3) | |||
| (autoload #'key3 "foo" nil t)) | |||
| (progn | |||
| (bind-chord "C-k" #'key1 nil) | |||
| (if | |||
| (boundp 'my-map) | |||
| (bind-chord "C-u" #'key2 my-map) | |||
| (eval-after-load 'foo | |||
| '(bind-chord "C-u" #'key2 my-map))) | |||
| (if | |||
| (boundp 'my-map2) | |||
| (bind-chord "C-u" #'key3 my-map2) | |||
| (eval-after-load 'foo | |||
| '(bind-chord "C-u" #'key3 my-map2))))))) | |||
| ;; Local Variables: | |||
| ;; no-byte-compile: t | |||
| ;; no-update-autoloads: t | |||
| ;; End: | |||
| ;;; use-package-chords-tests.el ends here | |||
| @ -1,54 +0,0 @@ | |||
| ;;; use-package-chords.el --- key-chord keyword for use-package -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2015-2022 Free Software Foundation, Inc. | |||
| ;; Author: Justin Talbott <justin@waymondo.com> | |||
| ;; Keywords: convenience, tools, extensions | |||
| ;; URL: https://github.com/jwiegley/use-package | |||
| ;; Version: 0.2.1 | |||
| ;; Package-Requires: ((use-package "2.1") (bind-key "1.0") (bind-chord "0.2") (key-chord "0.6")) | |||
| ;; Filename: use-package-chords.el | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; The `:chords' keyword allows you to define `key-chord' bindings for | |||
| ;; `use-package' declarations in the same manner as the `:bind' | |||
| ;; keyword. | |||
| ;;; Code: | |||
| (require 'use-package) | |||
| (require 'bind-chord) | |||
| ;;;###autoload | |||
| (defalias 'use-package-autoloads/:chords 'use-package-autoloads-mode) | |||
| ;;;###autoload | |||
| (defalias 'use-package-normalize/:chords 'use-package-normalize-binder) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:chords (name _keyword arg rest state) | |||
| "Handler for `:chords' keyword in `use-package'." | |||
| (use-package-concat | |||
| (use-package-process-keywords name rest state) | |||
| `(,(macroexpand | |||
| `(bind-chords :package ,name ,@arg))))) | |||
| (add-to-list 'use-package-keywords :chords) | |||
| (provide 'use-package-chords) | |||
| ;;; use-package-chords.el ends here | |||
| @ -1,83 +0,0 @@ | |||
| ;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides support for the :delight keyword, which is made available by | |||
| ;; default by requiring `use-package'. | |||
| ;;; Code: | |||
| (require 'use-package-core) | |||
| (defun use-package-normalize-delight (name args) | |||
| "Normalize ARGS for a single call to `delight'." | |||
| (when (eq :eval (car args)) | |||
| ;; Handle likely common mistake. | |||
| (use-package-error ":delight mode line constructs must be quoted")) | |||
| (cond ((and (= (length args) 1) | |||
| (use-package-non-nil-symbolp (car args))) | |||
| `(,(nth 0 args) nil ,name)) | |||
| ((= (length args) 2) | |||
| `(,(nth 0 args) ,(nth 1 args) ,name)) | |||
| ((= (length args) 3) | |||
| args) | |||
| (t | |||
| (use-package-error | |||
| ":delight expects `delight' arguments or a list of them")))) | |||
| ;;;###autoload | |||
| (defun use-package-normalize/:delight (name _keyword args) | |||
| "Normalize arguments to delight." | |||
| (cond ((null args) | |||
| `((,(use-package-as-mode name) nil ,name))) | |||
| ((and (= (length args) 1) | |||
| (use-package-non-nil-symbolp (car args))) | |||
| `((,(car args) nil ,name))) | |||
| ((and (= (length args) 1) | |||
| (stringp (car args))) | |||
| `((,(use-package-as-mode name) ,(car args) ,name))) | |||
| ((and (= (length args) 1) | |||
| (listp (car args)) | |||
| (eq 'quote (caar args))) | |||
| `((,(use-package-as-mode name) ,@(cdar args) ,name))) | |||
| ((and (= (length args) 2) | |||
| (listp (nth 1 args)) | |||
| (eq 'quote (car (nth 1 args)))) | |||
| `((,(car args) ,@(cdr (nth 1 args)) ,name))) | |||
| (t (mapcar | |||
| (apply-partially #'use-package-normalize-delight name) | |||
| (if (use-package-non-nil-symbolp (car args)) | |||
| (list args) | |||
| args))))) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:delight (name _keyword args rest state) | |||
| (let ((body (use-package-process-keywords name rest state))) | |||
| (use-package-concat | |||
| body | |||
| `((if (fboundp 'delight) | |||
| (delight '(,@args))))))) | |||
| (add-to-list 'use-package-keywords :delight t) | |||
| (provide 'use-package-delight) | |||
| ;;; use-package-delight.el ends here | |||
| @ -1,72 +0,0 @@ | |||
| ;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides support for the :diminish keyword, which is made available by | |||
| ;; default by requiring `use-package'. | |||
| ;;; Code: | |||
| (require 'use-package-core) | |||
| (defun use-package-normalize-diminish (name label arg &optional recursed) | |||
| "Normalize the arguments to diminish down to a list of one of two forms: | |||
| SYMBOL | |||
| (SYMBOL . STRING)" | |||
| (cond | |||
| ((not arg) | |||
| (list (use-package-as-mode name))) | |||
| ((use-package-non-nil-symbolp arg) | |||
| (list arg)) | |||
| ((stringp arg) | |||
| (list (cons (use-package-as-mode name) arg))) | |||
| ((and (consp arg) (stringp (cdr arg))) | |||
| (list arg)) | |||
| ((and (not recursed) (listp arg) (listp (cdr arg))) | |||
| (mapcar #'(lambda (x) (car (use-package-normalize-diminish | |||
| name label x t))) arg)) | |||
| (t | |||
| (use-package-error | |||
| (concat label " wants a string, symbol, " | |||
| "(symbol . string) or list of these"))))) | |||
| ;;;###autoload | |||
| (defun use-package-normalize/:diminish (name keyword args) | |||
| (use-package-as-one (symbol-name keyword) args | |||
| (apply-partially #'use-package-normalize-diminish name) t)) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:diminish (name _keyword arg rest state) | |||
| (let ((body (use-package-process-keywords name rest state))) | |||
| (use-package-concat | |||
| (mapcar #'(lambda (var) | |||
| `(if (fboundp 'diminish) | |||
| ,(if (consp var) | |||
| `(diminish ',(car var) ,(cdr var)) | |||
| `(diminish ',var)))) | |||
| arg) | |||
| body))) | |||
| (add-to-list 'use-package-keywords :diminish t) | |||
| (provide 'use-package-diminish) | |||
| ;;; use-package-diminish.el ends here | |||
| @ -1,99 +0,0 @@ | |||
| ;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2022 Free Software Foundation, Inc. | |||
| ;; Author: Justin Talbott <justin@waymondo.com> | |||
| ;; Keywords: convenience, tools, extensions | |||
| ;; URL: https://github.com/waymondo/use-package-ensure-system-package | |||
| ;; Version: 0.2 | |||
| ;; Package-Requires: ((use-package "2.1") (system-packages "1.0.4")) | |||
| ;; Filename: use-package-ensure-system-package.el | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; | |||
| ;; The `:ensure-system-package` keyword allows you to ensure system | |||
| ;; binaries exist alongside your `use-package` declarations. | |||
| ;; | |||
| ;;; Code: | |||
| (require 'use-package) | |||
| (require 'system-packages nil t) | |||
| (eval-when-compile | |||
| (declare-function system-packages-get-command "system-packages")) | |||
| (defvar use-package-ensure-system-package--custom-packages '() | |||
| "List of custom packages installed.") | |||
| (defun use-package-ensure-system-package-consify (arg) | |||
| "Turn ARG into a cons of (`package-name' . `install-command')." | |||
| (cond | |||
| ((stringp arg) | |||
| (cons arg `(system-packages-install ,arg))) | |||
| ((symbolp arg) | |||
| (cons arg `(system-packages-install ,(symbol-name arg)))) | |||
| ((consp arg) | |||
| (cond | |||
| ((not (cdr arg)) | |||
| (use-package-ensure-system-package-consify (car arg))) | |||
| ((stringp (cdr arg)) | |||
| (progn | |||
| (push (cdr arg) use-package-ensure-system-package--custom-packages) | |||
| (cons (car arg) `(async-shell-command ,(cdr arg))))) | |||
| (t | |||
| (cons (car arg) | |||
| `(system-packages-install ,(symbol-name (cdr arg))))))))) | |||
| (defun use-package-ensure-system-package-update-custom-packages () | |||
| (interactive) | |||
| (dolist (cmd use-package-ensure-system-package--custom-packages) | |||
| (async-shell-command cmd))) | |||
| ;;;###autoload | |||
| (defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) | |||
| "Turn ARGS into a list of conses of (`package-name' . `install-command')." | |||
| (use-package-as-one (symbol-name keyword) args | |||
| (lambda (_label arg) | |||
| (cond | |||
| ((and (listp arg) (listp (cdr arg))) | |||
| (mapcar #'use-package-ensure-system-package-consify arg)) | |||
| (t | |||
| (list (use-package-ensure-system-package-consify arg))))))) | |||
| (defun use-package-ensure-system-package-exists? (file-or-exe) | |||
| "If variable is a string, ensure the file path exists. | |||
| If it is a symbol, ensure the binary exist." | |||
| (if (stringp file-or-exe) | |||
| (file-exists-p file-or-exe) | |||
| (executable-find (symbol-name file-or-exe)))) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:ensure-system-package (name _keyword arg rest state) | |||
| "Execute the handler for `:ensure-system-package' keyword in `use-package'." | |||
| (let ((body (use-package-process-keywords name rest state))) | |||
| (use-package-concat | |||
| (mapcar #'(lambda (cons) | |||
| `(unless (use-package-ensure-system-package-exists? ',(car cons)) | |||
| ,(cdr cons))) arg) | |||
| body))) | |||
| (add-to-list 'use-package-keywords :ensure-system-package t) | |||
| (provide 'use-package-ensure-system-package) | |||
| ;;; use-package-ensure-system-package.el ends here | |||
| @ -1,206 +0,0 @@ | |||
| ;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides support for the :ensure and :pin keywords, which is made available | |||
| ;; by default by requiring `use-package'. | |||
| ;;; Code: | |||
| (require 'cl-lib) | |||
| (require 'use-package-core) | |||
| (defgroup use-package-ensure nil | |||
| "Support for :ensure and :pin keywords in `use-package' declarations." | |||
| :group 'use-package) | |||
| (eval-when-compile | |||
| (declare-function package-installed-p "package") | |||
| (declare-function package-read-all-archive-contents "package" ())) | |||
| (defcustom use-package-always-ensure nil | |||
| "Treat every package as though it had specified using `:ensure SEXP'. | |||
| See also `use-package-defaults', which uses this value." | |||
| :type 'sexp | |||
| :group 'use-package-ensure) | |||
| (defcustom use-package-always-pin nil | |||
| "Treat every package as though it had specified using `:pin SYM'. | |||
| See also `use-package-defaults', which uses this value." | |||
| :type 'symbol | |||
| :group 'use-package-ensure) | |||
| (defcustom use-package-ensure-function 'use-package-ensure-elpa | |||
| "Function that ensures a package is installed. | |||
| This function is called with three arguments: the name of the | |||
| package declared in the `use-package' form; the arguments passed | |||
| to all `:ensure' keywords (always a list, even if only one); and | |||
| the current `state' plist created by previous handlers. | |||
| Note that this function is called whenever `:ensure' is provided, | |||
| even if it is nil. It is up to the function to decide on the | |||
| semantics of the various values for `:ensure'. | |||
| This function should return non-nil if the package is installed. | |||
| The default value uses package.el to install the package." | |||
| :type '(choice (const :tag "package.el" use-package-ensure-elpa) | |||
| (function :tag "Custom")) | |||
| :group 'use-package-ensure) | |||
| ;;;; :pin | |||
| (defun use-package-normalize/:pin (_name keyword args) | |||
| (use-package-only-one (symbol-name keyword) args | |||
| #'(lambda (_label arg) | |||
| (cond | |||
| ((stringp arg) arg) | |||
| ((use-package-non-nil-symbolp arg) (symbol-name arg)) | |||
| (t | |||
| (use-package-error | |||
| ":pin wants an archive name (a string)")))))) | |||
| (eval-when-compile | |||
| (defvar package-pinned-packages) | |||
| (defvar package-archives)) | |||
| (defun use-package-archive-exists-p (archive) | |||
| "Check if a given ARCHIVE is enabled. | |||
| ARCHIVE can be a string or a symbol or `manual' to indicate a | |||
| manually updated package." | |||
| (if (member archive '(manual "manual")) | |||
| 't | |||
| (let ((valid nil)) | |||
| (dolist (pa package-archives) | |||
| (when (member archive (list (car pa) (intern (car pa)))) | |||
| (setq valid 't))) | |||
| valid))) | |||
| (defun use-package-pin-package (package archive) | |||
| "Pin PACKAGE to ARCHIVE." | |||
| (unless (boundp 'package-pinned-packages) | |||
| (setq package-pinned-packages ())) | |||
| (let ((archive-symbol (if (symbolp archive) archive (intern archive))) | |||
| (archive-name (if (stringp archive) archive (symbol-name archive)))) | |||
| (if (use-package-archive-exists-p archive-symbol) | |||
| (add-to-list 'package-pinned-packages (cons package archive-name)) | |||
| (error "Archive '%s' requested for package '%s' is not available" | |||
| archive-name package)) | |||
| (unless (bound-and-true-p package--initialized) | |||
| (package-initialize t)))) | |||
| (defun use-package-handler/:pin (name _keyword archive-name rest state) | |||
| (let ((body (use-package-process-keywords name rest state)) | |||
| (pin-form (if archive-name | |||
| `(use-package-pin-package ',(use-package-as-symbol name) | |||
| ,archive-name)))) | |||
| ;; Pinning should occur just before ensuring | |||
| ;; See `use-package-handler/:ensure'. | |||
| (if (bound-and-true-p byte-compile-current-file) | |||
| (eval pin-form) ; Eval when byte-compiling, | |||
| (push pin-form body)) ; or else wait until runtime. | |||
| body)) | |||
| ;;;; :ensure | |||
| (defvar package-archive-contents) | |||
| ;;;###autoload | |||
| (defun use-package-normalize/:ensure (_name keyword args) | |||
| (if (null args) | |||
| (list t) | |||
| (use-package-only-one (symbol-name keyword) args | |||
| #'(lambda (_label arg) | |||
| (cond | |||
| ((symbolp arg) | |||
| (list arg)) | |||
| ((and (listp arg) (= 3 (length arg)) | |||
| (symbolp (nth 0 arg)) | |||
| (eq :pin (nth 1 arg)) | |||
| (or (stringp (nth 2 arg)) | |||
| (symbolp (nth 2 arg)))) | |||
| (list (cons (nth 0 arg) (nth 2 arg)))) | |||
| (t | |||
| (use-package-error | |||
| (concat ":ensure wants an optional package name " | |||
| "(an unquoted symbol name), or (<symbol> :pin <string>)")))))))) | |||
| (defun use-package-ensure-elpa (name args _state &optional _no-refresh) | |||
| (dolist (ensure args) | |||
| (let ((package | |||
| (or (and (eq ensure t) (use-package-as-symbol name)) | |||
| ensure))) | |||
| (when package | |||
| (require 'package) | |||
| (when (consp package) | |||
| (use-package-pin-package (car package) (cdr package)) | |||
| (setq package (car package))) | |||
| (unless (package-installed-p package) | |||
| (condition-case-unless-debug err | |||
| (progn | |||
| (when (assoc package (bound-and-true-p | |||
| package-pinned-packages)) | |||
| (package-read-all-archive-contents)) | |||
| (if (assoc package package-archive-contents) | |||
| (package-install package) | |||
| (package-refresh-contents) | |||
| (when (assoc package (bound-and-true-p | |||
| package-pinned-packages)) | |||
| (package-read-all-archive-contents)) | |||
| (package-install package)) | |||
| t) | |||
| (error | |||
| (display-warning 'use-package | |||
| (format "Failed to install %s: %s" | |||
| name (error-message-string err)) | |||
| :error)))))))) | |||
| ;;;###autoload | |||
| (defun use-package-handler/:ensure (name _keyword ensure rest state) | |||
| (let* ((body (use-package-process-keywords name rest state))) | |||
| ;; We want to avoid installing packages when the `use-package' macro is | |||
| ;; being macro-expanded by elisp completion (see `lisp--local-variables'), | |||
| ;; but still install packages when byte-compiling, to avoid requiring | |||
| ;; `package' at runtime. | |||
| (if (bound-and-true-p byte-compile-current-file) | |||
| ;; Eval when byte-compiling, | |||
| (funcall use-package-ensure-function name ensure state) | |||
| ;; or else wait until runtime. | |||
| (push `(,use-package-ensure-function ',name ',ensure ',state) | |||
| body)) | |||
| body)) | |||
| (add-to-list 'use-package-defaults | |||
| '(:ensure (list use-package-always-ensure) | |||
| (lambda (name args) | |||
| (and use-package-always-ensure | |||
| (not (plist-member args :load-path))))) t) | |||
| (add-to-list 'use-package-defaults | |||
| '(:pin use-package-always-pin use-package-always-pin) t) | |||
| (add-to-list 'use-package-keywords :ensure) | |||
| (add-to-list 'use-package-keywords :pin) | |||
| (provide 'use-package-ensure) | |||
| ;;; use-package-ensure.el ends here | |||
| @ -1,70 +0,0 @@ | |||
| ;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides the command `M-x use-package-jump-to-package-form', however it | |||
| ;; only works if the package being jumped to was required during | |||
| ;; initialization. If it was delay-loaded, it will not work. | |||
| ;; Improvements are needed. | |||
| ;;; Code: | |||
| (require 'use-package-core) | |||
| (defun use-package-find-require (package) | |||
| "Find file that required PACKAGE by searching `load-history'. | |||
| Returns an absolute file path or nil if none is found." | |||
| (catch 'suspect | |||
| (dolist (filespec load-history) | |||
| (dolist (entry (cdr filespec)) | |||
| (when (equal entry (cons 'require package)) | |||
| (throw 'suspect (car filespec))))))) | |||
| ;;;###autoload | |||
| (defun use-package-jump-to-package-form (package) | |||
| "Attempt to find and jump to the `use-package' form that loaded PACKAGE. | |||
| This will only find the form if that form actually required | |||
| PACKAGE. If PACKAGE was previously required then this function | |||
| will jump to the file that originally required PACKAGE instead." | |||
| (interactive (list (completing-read "Package: " features))) | |||
| (let* ((package (if (stringp package) (intern package) package)) | |||
| (requiring-file (use-package-find-require package)) | |||
| file location) | |||
| (if (null requiring-file) | |||
| (user-error "Can't find file requiring file; may have been autoloaded") | |||
| (setq file (if (string= (file-name-extension requiring-file) "elc") | |||
| (concat (file-name-sans-extension requiring-file) ".el") | |||
| requiring-file)) | |||
| (when (file-exists-p file) | |||
| (find-file-other-window file) | |||
| (save-excursion | |||
| (goto-char (point-min)) | |||
| (setq location | |||
| (re-search-forward | |||
| (format (eval use-package-form-regexp-eval) package) nil t))) | |||
| (if (null location) | |||
| (message "No use-package form found.") | |||
| (goto-char location) | |||
| (beginning-of-line)))))) | |||
| (provide 'use-package-jump) | |||
| ;;; use-package-jump.el ends here | |||
| @ -1,76 +0,0 @@ | |||
| ;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; Provides the command `M-x use-package-lint'. | |||
| ;;; Code: | |||
| (require 'cl-lib) | |||
| (require 'use-package-core) | |||
| (defun use-package-lint-declaration (name plist) | |||
| (dolist (path (plist-get plist :load-path)) | |||
| (unless (file-exists-p path) | |||
| (display-warning | |||
| 'use-package | |||
| (format "%s :load-path does not exist: %s" | |||
| name path) :error))) | |||
| (unless (or (plist-member plist :disabled) | |||
| (plist-get plist :no-require) | |||
| (locate-library (use-package-as-string name) nil | |||
| (plist-get plist :load-path))) | |||
| (display-warning | |||
| 'use-package | |||
| (format "%s module cannot be located" name) :error)) | |||
| ;; (dolist (command (plist-get plist :commands)) | |||
| ;; (unless (string= (find-lisp-object-file-name command nil) | |||
| ;; (locate-library (use-package-as-string name) nil | |||
| ;; (plist-get plist :load-path))) | |||
| ;; (display-warning | |||
| ;; 'use-package | |||
| ;; (format "%s :command is from different path: %s" | |||
| ;; name (symbol-name command)) :error))) | |||
| ) | |||
| ;;;###autoload | |||
| (defun use-package-lint () | |||
| "Check for errors in `use-package' declarations. | |||
| For example, if the module's `:if' condition is met, but even | |||
| with the specified `:load-path' the module cannot be found." | |||
| (interactive) | |||
| (save-excursion | |||
| (goto-char (point-min)) | |||
| (let ((re (eval use-package-form-regexp-eval))) | |||
| (while (re-search-forward re nil t) | |||
| (goto-char (match-beginning 0)) | |||
| (let ((decl (read (current-buffer)))) | |||
| (when (eq (car decl) 'use-package) | |||
| (use-package-lint-declaration | |||
| (use-package-as-string (cadr decl)) | |||
| (use-package-normalize-keywords | |||
| (cadr decl) (cddr decl))))))))) | |||
| (provide 'use-package-lint) | |||
| ;;; use-package-lint.el ends here | |||
| @ -1,51 +0,0 @@ | |||
| ;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- | |||
| ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| ;; Author: John Wiegley <johnw@newartisans.com> | |||
| ;; Maintainer: John Wiegley <johnw@newartisans.com> | |||
| ;; Created: 17 Jun 2012 | |||
| ;; Version: 2.4.4 | |||
| ;; Package-Requires: ((emacs "24.3") (bind-key "2.4")) | |||
| ;; Keywords: dotemacs startup speed config package extensions | |||
| ;; URL: https://github.com/jwiegley/use-package | |||
| ;; 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 <https://www.gnu.org/licenses/>. | |||
| ;;; Commentary: | |||
| ;; The `use-package' declaration macro allows you to isolate package | |||
| ;; configuration in your ".emacs" in a way that is performance-oriented and, | |||
| ;; well, just tidy. I created it because I have over 80 packages that I use | |||
| ;; in Emacs, and things were getting difficult to manage. Yet with this | |||
| ;; utility my total load time is just under 1 second, with no loss of | |||
| ;; functionality! | |||
| ;; | |||
| ;; Please see README.md from the same repository for documentation. | |||
| ;;; Code: | |||
| (require 'use-package-core) | |||
| (require 'use-package-bind-key) | |||
| (require 'use-package-diminish) | |||
| (require 'use-package-delight) | |||
| (require 'use-package-ensure) | |||
| (declare-function use-package-jump-to-package-form "use-package-jump") | |||
| (autoload #'use-package-jump-to-package-form "use-package-jump" nil t) | |||
| (provide 'use-package) | |||
| ;;; use-package.el ends here | |||
| @ -1,946 +0,0 @@ | |||
| \input texinfo @c -*- texinfo -*- | |||
| @c %**start of header | |||
| @setfilename use-package.info | |||
| @settitle use-package User Manual | |||
| @documentencoding UTF-8 | |||
| @documentlanguage en | |||
| @c %**end of header | |||
| @copying | |||
| @quotation | |||
| Copyright (C) 2012-2022 Free Software Foundation, Inc. | |||
| You can redistribute this document 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 document 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. | |||
| @end quotation | |||
| @end copying | |||
| @dircategory Emacs | |||
| @direntry | |||
| * use-package: (use-package). Declarative package configuration for Emacs. | |||
| @end direntry | |||
| @finalout | |||
| @titlepage | |||
| @title use-package User Manual | |||
| @subtitle for version 2.4.1-119-g0be480e+1 | |||
| @author John Wiegley | |||
| @page | |||
| @vskip 0pt plus 1filll | |||
| @insertcopying | |||
| @end titlepage | |||
| @contents | |||
| @ifnottex | |||
| @node Top | |||
| @top use-package User Manual | |||
| The @code{use-package} macro allows you to isolate package configuration in your | |||
| @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I | |||
| created it because I have over 80 packages that I use in Emacs, and things | |||
| were getting difficult to manage. Yet with this utility my total load time is | |||
| around 2 seconds, with no loss of functionality! | |||
| @insertcopying | |||
| @end ifnottex | |||
| @menu | |||
| * Introduction:: | |||
| * Installation:: | |||
| * Getting Started:: | |||
| * Basic Concepts:: | |||
| * Issues/Requests:: | |||
| * Keywords:: | |||
| * Debugging Tools:: | |||
| @detailmenu | |||
| --- The Detailed Node Listing --- | |||
| Installation | |||
| * Installing from GNU ELPA:: | |||
| * Installing from the Git Repository:: | |||
| * Post-Installation Tasks:: | |||
| Keywords | |||
| * @code{after}:: @code{:after}. | |||
| * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}. | |||
| * @code{bind} @code{bind*}:: @code{:bind}, @code{:bind*}. | |||
| * @code{commands}:: @code{:commands}. | |||
| * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}. | |||
| * @code{custom}:: @code{:custom}. | |||
| * @code{custom-face}:: @code{:custom-face}. | |||
| * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}. | |||
| * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}. | |||
| * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}. | |||
| * @code{disabled}:: @code{:disabled}. | |||
| * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}. | |||
| * @code{hook}:: @code{:hook}. | |||
| * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}. | |||
| * @code{load-path}:: @code{:load-path}. | |||
| * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}. | |||
| * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}. | |||
| * @code{no-require}:: @code{:no-require}. | |||
| * @code{requires}:: @code{:requires}. | |||
| @code{bind}, @code{bind*} | |||
| * Binding to local keymaps:: | |||
| @end detailmenu | |||
| @end menu | |||
| @node Introduction | |||
| @chapter Introduction | |||
| The @code{use-package} macro allows you to isolate package configuration in your | |||
| @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I | |||
| created it because I have over 80 packages that I use in Emacs, and things | |||
| were getting difficult to manage. Yet with this utility my total load time is | |||
| around 2 seconds, with no loss of functionality! | |||
| More text to come@dots{} | |||
| @node Installation | |||
| @chapter Installation | |||
| use-package can be installed using Emacs' package manager or manually from | |||
| its development repository. | |||
| @menu | |||
| * Installing from GNU ELPA:: | |||
| * Installing from the Git Repository:: | |||
| * Post-Installation Tasks:: | |||
| @end menu | |||
| @node Installing from GNU ELPA | |||
| @section Installing from GNU ELPA | |||
| use-package is available from GNU ELPA. If you haven't used | |||
| Emacs' package manager before, then it is high time you familiarize yourself | |||
| with it by reading the documentation in the Emacs manual, see | |||
| @ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}: | |||
| First, you need to update the local package list using: | |||
| @example | |||
| M-x package-refresh-contents RET | |||
| @end example | |||
| Once you have done that, you can install use-package and its | |||
| dependencies using: | |||
| @example | |||
| M-x package-install RET use-package RET | |||
| @end example | |||
| Now see @ref{Post-Installation Tasks}. | |||
| @node Installing from the Git Repository | |||
| @section Installing from the Git Repository | |||
| First, use Git to clone the use-package repository: | |||
| @example | |||
| $ git clone https://github.com/jwiegley/use-package.git ~/.emacs.d/site-lisp/use-package | |||
| $ cd ~/.emacs.d/site-lisp/use-package | |||
| @end example | |||
| Then compile the libraries and generate the info manuals: | |||
| @example | |||
| $ make | |||
| @end example | |||
| You may need to create @code{/path/to/use-package/config.mk} with the following | |||
| content before running @code{make}: | |||
| @example | |||
| LOAD_PATH = -L /path/to/use-package | |||
| @end example | |||
| Finally add this to your init file: | |||
| @lisp | |||
| (add-to-list 'load-path "~/.emacs.d/site-lisp/use-package") | |||
| (require 'use-package) | |||
| (with-eval-after-load 'info | |||
| (info-initialize) | |||
| (add-to-list 'Info-directory-list | |||
| "~/.emacs.d/site-lisp/use-package/")) | |||
| @end lisp | |||
| Note that elements of @code{load-path} should not end with a slash, while those of | |||
| @code{Info-directory-list} should. | |||
| Instead of running use-package directly from the repository by adding it to | |||
| the @code{load-path}, you might want to instead install it in some other directory | |||
| using @code{sudo make install} and setting @code{load-path} accordingly. | |||
| To update use-package use: | |||
| @example | |||
| $ git pull | |||
| $ make | |||
| @end example | |||
| At times it might be necessary to run @code{make clean all} instead. | |||
| To view all available targets use @code{make help}. | |||
| Now see @ref{Post-Installation Tasks}. | |||
| @node Post-Installation Tasks | |||
| @section Post-Installation Tasks | |||
| After installing use-package you should verify that you are indeed using the | |||
| use-package release you think you are using. It's best to restart Emacs before | |||
| doing so, to make sure you are not using an outdated value for @code{load-path}. | |||
| @example | |||
| C-h v use-package-version RET | |||
| @end example | |||
| should display something like | |||
| @example | |||
| use-package-version’s value is "2.4.3" | |||
| @end example | |||
| If you are completely new to use-package then see @ref{Getting Started}. | |||
| If you run into problems, then please see the @ref{Debugging Tools}. | |||
| @node Getting Started | |||
| @chapter Getting Started | |||
| TODO@. For now, see @code{README.md}. | |||
| @node Basic Concepts | |||
| @chapter Basic Concepts | |||
| @code{use-package} was created for few basic reasons, each of which drove the | |||
| design in various ways. Understanding these reasons may help make some of | |||
| those decisions clearer: | |||
| @itemize | |||
| @item | |||
| To gather all configuration details of a package into one place, | |||
| making it easier to copy, disable, or move it elsewhere in the init | |||
| file. | |||
| @item | |||
| To reduce duplication and boilerplate, capturing several common | |||
| practices as mere keywords both easy and intuitive to use. | |||
| @item | |||
| To make startup time of Emacs as quick as possible, without | |||
| sacrificing the quantity of add-on packages used. | |||
| @item | |||
| To make it so errors encountered during startup disable only the | |||
| package raising the error, and as little else as possible, leaving a | |||
| close to a functional Emacs as possible. | |||
| @item | |||
| To allow byte-compilation of one's init file so that any warnings or | |||
| errors seen are meaningful. In this way, even if byte-compilation is not | |||
| used for speed (reason 3), it can still be used as a sanity check. | |||
| @end itemize | |||
| @node Issues/Requests | |||
| @chapter Issues/Requests | |||
| @node Keywords | |||
| @chapter Keywords | |||
| @menu | |||
| * @code{after}:: @code{after}. | |||
| * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}. | |||
| * @code{bind} @code{bind*}:: @code{bind} @code{:bind*}. | |||
| * @code{commands}:: @code{:commands}. | |||
| * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}. | |||
| * @code{custom}:: @code{:custom}. | |||
| * @code{custom-face}:: @code{:custom-face}. | |||
| * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}. | |||
| * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}. | |||
| * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}. | |||
| * @code{disabled}:: @code{:disabled}. | |||
| * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}. | |||
| * @code{hook}:: @code{:hook}. | |||
| * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}. | |||
| * @code{load-path}:: @code{:load-path}. | |||
| * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}. | |||
| * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}. | |||
| * @code{no-require}:: @code{:no-require}. | |||
| * @code{requires}:: @code{:requires}. | |||
| @end menu | |||
| @node @code{after} | |||
| @section @code{:after} | |||
| Sometimes it only makes sense to configure a package after another has been | |||
| loaded, because certain variables or functions are not in scope until that | |||
| time. This can achieved using an @code{:after} keyword that allows a fairly rich | |||
| description of the exact conditions when loading should occur. Here is an | |||
| example: | |||
| @lisp | |||
| (use-package hydra | |||
| :load-path "site-lisp/hydra") | |||
| (use-package ivy | |||
| :load-path "site-lisp/swiper") | |||
| (use-package ivy-hydra | |||
| :after (ivy hydra)) | |||
| @end lisp | |||
| In this case, because all of these packages are demand-loaded in the order | |||
| they occur, the use of @code{:after} is not strictly necessary. By using it, | |||
| however, the above code becomes order-independent, without an implicit | |||
| depedence on the nature of your init file. | |||
| By default, @code{:after (foo bar)} is the same as @code{:after (:all foo bar)}, meaning | |||
| that loading of the given package will not happen until both @code{foo} and @code{bar} | |||
| have been loaded. Here are some of the other possibilities: | |||
| @lisp | |||
| :after (foo bar) | |||
| :after (:all foo bar) | |||
| :after (:any foo bar) | |||
| :after (:all (:any foo bar) (:any baz quux)) | |||
| :after (:any (:all foo bar) (:all baz quux)) | |||
| @end lisp | |||
| When you nest selectors, such as @code{(:any (:all foo bar) (:all baz quux))}, it | |||
| means that the package will be loaded when either both @code{foo} and @code{bar} have | |||
| been loaded, or both @code{baz} and @code{quux} have been loaded. | |||
| @strong{NOTE}: Pay attention if you set @code{use-package-always-defer} to t, and also use | |||
| the @code{:after} keyword, as you will need to specify how the declared package is | |||
| to be loaded: e.g., by some @code{:bind}. If you're not using one of the mechanisms | |||
| that registers autoloads, such as @code{:bind} or @code{:hook}, and your package manager | |||
| does not provide autoloads, it's possible that without adding @code{:demand t} to | |||
| those declarations, your package will never be loaded. | |||
| @node @code{bind-keymap} @code{bind-keymap*} | |||
| @section @code{:bind-keymap}, @code{:bind-keymap*} | |||
| Normally @code{:bind} expects that commands are functions that will be autoloaded | |||
| from the given package. However, this does not work if one of those commands | |||
| is actually a keymap, since keymaps are not functions, and cannot be | |||
| autoloaded using Emacs' @code{autoload} mechanism. | |||
| To handle this case, @code{use-package} offers a special, limited variant of | |||
| @code{:bind} called @code{:bind-keymap}. The only difference is that the "commands" | |||
| bound to by @code{:bind-keymap} must be keymaps defined in the package, rather than | |||
| command functions. This is handled behind the scenes by generating custom code | |||
| that loads the package containing the keymap, and then re-executes your | |||
| keypress after the first load, to reinterpret that keypress as a prefix key. | |||
| For example: | |||
| @lisp | |||
| (use-package projectile | |||
| :bind-keymap | |||
| ("C-c p" . projectile-command-map) | |||
| @end lisp | |||
| @node @code{bind} @code{bind*} | |||
| @section @code{:bind}, @code{:bind*} | |||
| Another common thing to do when loading a module is to bind a key to primary | |||
| commands within that module: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :bind ("C-." . ace-jump-mode)) | |||
| @end lisp | |||
| This does two things: first, it creates an autoload for the @code{ace-jump-mode} | |||
| command and defers loading of @code{ace-jump-mode} until you actually use it. | |||
| Second, it binds the key @code{C-.} to that command. After loading, you can use | |||
| @code{M-x describe-personal-keybindings} to see all such keybindings you've set | |||
| throughout your @code{.emacs} file. | |||
| A more literal way to do the exact same thing is: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :commands ace-jump-mode | |||
| :init | |||
| (bind-key "C-." 'ace-jump-mode)) | |||
| @end lisp | |||
| When you use the @code{:commands} keyword, it creates autoloads for those commands | |||
| and defers loading of the module until they are used. Since the @code{:init} form | |||
| is always run---even if @code{ace-jump-mode} might not be on your system---remember | |||
| to restrict @code{:init} code to only what would succeed either way. | |||
| The @code{:bind} keyword takes either a cons or a list of conses: | |||
| @lisp | |||
| (use-package hi-lock | |||
| :bind (("M-o l" . highlight-lines-matching-regexp) | |||
| ("M-o r" . highlight-regexp) | |||
| ("M-o w" . highlight-phrase))) | |||
| @end lisp | |||
| The @code{:commands} keyword likewise takes either a symbol or a list of symbols. | |||
| NOTE: Special keys like @code{tab} or @code{F1}-@code{Fn} can be written in square brackets, | |||
| i.e. @code{[tab]} instead of @code{"tab"}. The syntax for the keybindings is similar to | |||
| the "kbd" syntax: see @uref{https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html, the Emacs Manual} for more information. | |||
| Examples: | |||
| @lisp | |||
| (use-package helm | |||
| :bind (("M-x" . helm-M-x) | |||
| ("M-<f5>" . helm-find-files) | |||
| ([f10] . helm-buffers-list) | |||
| ([S-f10] . helm-recentf))) | |||
| @end lisp | |||
| @menu | |||
| * Binding to local keymaps:: | |||
| @end menu | |||
| @node Binding to local keymaps | |||
| @subsection Binding to local keymaps | |||
| Slightly different from binding a key to a keymap, is binding a key @strong{within} a | |||
| local keymap that only exists after the package is loaded. @code{use-package} | |||
| supports this with a @code{:map} modifier, taking the local keymap to bind to: | |||
| @lisp | |||
| (use-package helm | |||
| :bind (:map helm-command-map | |||
| ("C-c h" . helm-execute-persistent-action))) | |||
| @end lisp | |||
| The effect of this statement is to wait until @code{helm} has loaded, and then to | |||
| bind the key @code{C-c h} to @code{helm-execute-persistent-action} within Helm's local | |||
| keymap, @code{helm-mode-map}. | |||
| Multiple uses of @code{:map} may be specified. Any binding occurring before the | |||
| first use of @code{:map} are applied to the global keymap: | |||
| @lisp | |||
| (use-package term | |||
| :bind (("C-c t" . term) | |||
| :map term-mode-map | |||
| ("M-p" . term-send-up) | |||
| ("M-n" . term-send-down) | |||
| :map term-raw-map | |||
| ("M-o" . other-window) | |||
| ("M-p" . term-send-up) | |||
| ("M-n" . term-send-down))) | |||
| @end lisp | |||
| @node @code{commands} | |||
| @section @code{:commands} | |||
| @node @code{preface} @code{init} @code{config} | |||
| @section @code{:preface}, @code{:init}, @code{:config} | |||
| Here is the simplest @code{use-package} declaration: | |||
| @lisp | |||
| ;; This is only needed once, near the top of the file | |||
| (eval-when-compile | |||
| ;; Following line is not needed if use-package.el is in ~/.emacs.d | |||
| (add-to-list 'load-path "<path where use-package is installed>") | |||
| (require 'use-package)) | |||
| (use-package foo) | |||
| @end lisp | |||
| This loads in the package @code{foo}, but only if @code{foo} is available on your | |||
| system. If not, a warning is logged to the @code{*Messages*} buffer. If it | |||
| succeeds, a message about @code{"Loading foo"} is logged, along with the time it | |||
| took to load, if it took over 0.1 seconds. | |||
| Use the @code{:init} keyword to execute code before a package is loaded. It | |||
| accepts one or more forms, up until the next keyword: | |||
| @lisp | |||
| (use-package foo | |||
| :init | |||
| (setq foo-variable t)) | |||
| @end lisp | |||
| Similarly, @code{:config} can be used to execute code after a package is loaded. | |||
| In cases where loading is done lazily (see more about autoloading below), this | |||
| execution is deferred until after the autoload occurs: | |||
| @lisp | |||
| (use-package foo | |||
| :init | |||
| (setq foo-variable t) | |||
| :config | |||
| (foo-mode 1)) | |||
| @end lisp | |||
| As you might expect, you can use @code{:init} and @code{:config} together: | |||
| @lisp | |||
| (use-package color-moccur | |||
| :commands (isearch-moccur isearch-all) | |||
| :bind (("M-s O" . moccur) | |||
| :map isearch-mode-map | |||
| ("M-o" . isearch-moccur) | |||
| ("M-O" . isearch-moccur-all)) | |||
| :init | |||
| (setq isearch-lazy-highlight t) | |||
| :config | |||
| (use-package moccur-edit)) | |||
| @end lisp | |||
| In this case, I want to autoload the commands @code{isearch-moccur} and | |||
| @code{isearch-all} from @code{color-moccur.el}, and bind keys both at the global level | |||
| and within the @code{isearch-mode-map} (see next section). When the package is | |||
| actually loaded (by using one of these commands), @code{moccur-edit} is also | |||
| loaded, to allow editing of the @code{moccur} buffer. | |||
| @node @code{custom} | |||
| @section @code{:custom} | |||
| The @code{:custom} keyword allows customization of package custom variables. | |||
| @lisp | |||
| (use-package comint | |||
| :custom | |||
| (comint-buffer-maximum-size 20000 "Increase comint buffer size.") | |||
| (comint-prompt-read-only t "Make the prompt read only.")) | |||
| @end lisp | |||
| The documentation string is not mandatory. | |||
| @node @code{custom-face} | |||
| @section @code{:custom-face} | |||
| The @code{:custom-face} keyword allows customization of package custom faces. | |||
| @lisp | |||
| (use-package eruby-mode | |||
| :custom-face | |||
| (eruby-standard-face ((t (:slant italic))))) | |||
| @end lisp | |||
| @node @code{defer} @code{demand} | |||
| @section @code{:defer}, @code{:demand} | |||
| In almost all cases you don't need to manually specify @code{:defer t}. This is | |||
| implied whenever @code{:bind} or @code{:mode} or @code{:interpreter} is used. Typically, you | |||
| only need to specify @code{:defer} if you know for a fact that some other package | |||
| will do something to cause your package to load at the appropriate time, and | |||
| thus you would like to defer loading even though use-package isn't creating | |||
| any autoloads for you. | |||
| You can override package deferral with the @code{:demand} keyword. Thus, even if | |||
| you use @code{:bind}, using @code{:demand} will force loading to occur immediately and | |||
| not establish an autoload for the bound key. | |||
| @node @code{defines} @code{functions} | |||
| @section @code{:defines}, @code{:functions} | |||
| Another feature of @code{use-package} is that it always loads every file that it | |||
| can when @code{.emacs} is being byte-compiled. This helps to silence spurious | |||
| warnings about unknown variables and functions. | |||
| However, there are times when this is just not enough. For those times, use | |||
| the @code{:defines} and @code{:functions} keywords to introduce dummy variable and | |||
| function declarations solely for the sake of the byte-compiler: | |||
| @lisp | |||
| (use-package texinfo | |||
| :defines texinfo-section-list | |||
| :commands texinfo-mode | |||
| :init | |||
| (add-to-list 'auto-mode-alist '("\\.texi$" . texinfo-mode))) | |||
| @end lisp | |||
| If you need to silence a missing function warning, you can use @code{:functions}: | |||
| @lisp | |||
| (use-package ruby-mode | |||
| :mode "\\.rb\\'" | |||
| :interpreter "ruby" | |||
| :functions inf-ruby-keys | |||
| :config | |||
| (defun my-ruby-mode-hook () | |||
| (require 'inf-ruby) | |||
| (inf-ruby-keys)) | |||
| (add-hook 'ruby-mode-hook 'my-ruby-mode-hook)) | |||
| @end lisp | |||
| @node @code{diminish} @code{delight} | |||
| @section @code{:diminish}, @code{:delight} | |||
| @code{use-package} also provides built-in support for the diminish and delight | |||
| utilities---if you have them installed. Their purpose is to remove or change | |||
| minor mode strings in your mode-line. | |||
| @uref{https://github.com/myrjola/diminish.el, diminish} is invoked with the @code{:diminish} keyword, which is passed either a | |||
| minor mode symbol, a cons of the symbol and its replacement string, or just a | |||
| replacement string, in which case the minor mode symbol is guessed to be the | |||
| package name with "-mode" appended at the end: | |||
| @lisp | |||
| (use-package abbrev | |||
| :diminish abbrev-mode | |||
| :config | |||
| (if (file-exists-p abbrev-file-name) | |||
| (quietly-read-abbrev-file))) | |||
| @end lisp | |||
| @uref{https://elpa.gnu.org/packages/delight.html, delight} is invoked with the @code{:delight} keyword, which is passed a minor mode | |||
| symbol, a replacement string or quoted @uref{https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html, mode-line data} (in which case the minor | |||
| mode symbol is guessed to be the package name with "-mode" appended at the | |||
| end), both of these, or several lists of both. If no arguments are provided, | |||
| the default mode name is hidden completely. | |||
| @lisp | |||
| ;; Don't show anything for rainbow-mode. | |||
| (use-package rainbow-mode | |||
| :delight) | |||
| ;; Don't show anything for auto-revert-mode, which doesn't match | |||
| ;; its package name. | |||
| (use-package autorevert | |||
| :delight auto-revert-mode) | |||
| ;; Remove the mode name for projectile-mode, but show the project name. | |||
| (use-package projectile | |||
| :delight '(:eval (concat " " (projectile-project-name)))) | |||
| ;; Completely hide visual-line-mode and change auto-fill-mode to " AF". | |||
| (use-package emacs | |||
| :delight | |||
| (auto-fill-function " AF") | |||
| (visual-line-mode)) | |||
| @end lisp | |||
| @node @code{disabled} | |||
| @section @code{:disabled} | |||
| The @code{:disabled} keyword can turn off a module you're having difficulties with, | |||
| or stop loading something you're not using at the present time: | |||
| @lisp | |||
| (use-package ess-site | |||
| :disabled | |||
| :commands R) | |||
| @end lisp | |||
| When byte-compiling your @code{.emacs} file, disabled declarations are omitted | |||
| from the output entirely, to accelerate startup times. | |||
| @node @code{ensure} @code{pin} | |||
| @section @code{:ensure}, @code{:pin} | |||
| You can use @code{use-package} to load packages from ELPA with @code{package.el}. This | |||
| is particularly useful if you share your @code{.emacs} among several machines; the | |||
| relevant packages are downloaded automatically once declared in your @code{.emacs}. | |||
| The @code{:ensure} keyword causes the package(s) to be installed automatically if | |||
| not already present on your system (set @code{(setq use-package-always-ensure t)} | |||
| if you wish this behavior to be global for all packages): | |||
| @lisp | |||
| (use-package magit | |||
| :ensure t) | |||
| @end lisp | |||
| If you need to install a different package from the one named by | |||
| @code{use-package}, you can specify it like this: | |||
| @lisp | |||
| (use-package tex | |||
| :ensure auctex) | |||
| @end lisp | |||
| Lastly, when running on Emacs 24.4 or later, use-package can pin a package to | |||
| a specific archive, allowing you to mix and match packages from different | |||
| archives. The primary use-case for this is preferring packages from the | |||
| @code{melpa-stable} and @code{gnu} archives, but using specific packages from @code{melpa} | |||
| when you need to track newer versions than what is available in the @code{stable} | |||
| archives is also a valid use-case. | |||
| By default @code{package.el} prefers @code{melpa} over @code{melpa-stable} due to the | |||
| versioning @code{(> evil-20141208.623 evil-1.0.9)}, so even if you are tracking | |||
| only a single package from @code{melpa}, you will need to tag all the non-@code{melpa} | |||
| packages with the appropriate archive. If this really annoys you, then you can | |||
| set @code{use-package-always-pin} to set a default. | |||
| If you want to manually keep a package updated and ignore upstream updates, | |||
| you can pin it to @code{manual}, which as long as there is no repository by that | |||
| name, will Just Work(tm). | |||
| @code{use-package} throws an error if you try to pin a package to an archive that | |||
| has not been configured using @code{package-archives} (apart from the magic | |||
| @code{manual} archive mentioned above): | |||
| @example | |||
| Archive 'foo' requested for package 'bar' is not available. | |||
| @end example | |||
| Example: | |||
| @lisp | |||
| (use-package company | |||
| :ensure t | |||
| :pin melpa-stable) | |||
| (use-package evil | |||
| :ensure t) | |||
| ;; no :pin needed, as package.el will choose the version in melpa | |||
| (use-package adaptive-wrap | |||
| :ensure t | |||
| ;; as this package is available only in the gnu archive, this is | |||
| ;; technically not needed, but it helps to highlight where it | |||
| ;; comes from | |||
| :pin gnu) | |||
| (use-package org | |||
| :ensure t | |||
| ;; ignore org-mode from upstream and use a manually installed version | |||
| :pin manual) | |||
| @end lisp | |||
| @strong{NOTE}: the @code{:pin} argument has no effect on emacs versions < 24.4. | |||
| @node @code{hook} | |||
| @section @code{:hook} | |||
| The @code{:hook} keyword allows adding functions onto hooks, here only the basename | |||
| of the hook is required. Thus, all of the following are equivalent: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :hook prog-mode) | |||
| (use-package ace-jump-mode | |||
| :hook (prog-mode . ace-jump-mode)) | |||
| (use-package ace-jump-mode | |||
| :commands ace-jump-mode | |||
| :init | |||
| (add-hook 'prog-mode-hook #'ace-jump-mode)) | |||
| @end lisp | |||
| And likewise, when multiple hooks should be applied, the following are also | |||
| equivalent: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :hook (prog-mode text-mode)) | |||
| (use-package ace-jump-mode | |||
| :hook ((prog-mode text-mode) . ace-jump-mode)) | |||
| (use-package ace-jump-mode | |||
| :hook ((prog-mode . ace-jump-mode) | |||
| (text-mode . ace-jump-mode))) | |||
| (use-package ace-jump-mode | |||
| :commands ace-jump-mode | |||
| :init | |||
| (add-hook 'prog-mode-hook #'ace-jump-mode) | |||
| (add-hook 'text-mode-hook #'ace-jump-mode)) | |||
| @end lisp | |||
| The use of @code{:hook}, as with @code{:bind}, @code{:mode}, @code{:interpreter}, etc., causes the | |||
| functions being hooked to implicitly be read as @code{:commands} (meaning they will | |||
| establish interactive @code{autoload} definitions for that module, if not already | |||
| defined as functions), and so @code{:defer t} is also implied by @code{:hook}. | |||
| @node @code{if} @code{when} @code{unless} | |||
| @section @code{:if}, @code{:when}, @code{:unless} | |||
| You can use the @code{:if} keyword to predicate the loading and initialization of | |||
| modules. | |||
| For example, I only want @code{edit-server} running for my main, graphical Emacs, | |||
| not for other Emacsen I may start at the command line: | |||
| @lisp | |||
| (use-package edit-server | |||
| :if window-system | |||
| :init | |||
| (add-hook 'after-init-hook 'server-start t) | |||
| (add-hook 'after-init-hook 'edit-server-start t)) | |||
| @end lisp | |||
| In another example, we can load things conditional on the operating system: | |||
| @lisp | |||
| (use-package exec-path-from-shell | |||
| :if (memq window-system '(mac ns)) | |||
| :ensure t | |||
| :config | |||
| (exec-path-from-shell-initialize)) | |||
| @end lisp | |||
| Note that @code{:when} is provided as an alias for @code{:if}, and @code{:unless foo} means | |||
| the same thing as @code{:if (not foo)}. | |||
| @node @code{load-path} | |||
| @section @code{:load-path} | |||
| If your package needs a directory added to the @code{load-path} in order to load, | |||
| use @code{:load-path}. This takes a symbol, a function, a string or a list of | |||
| strings. If the path is relative, it is expanded within | |||
| @code{user-emacs-directory}: | |||
| @lisp | |||
| (use-package ess-site | |||
| :load-path "site-lisp/ess/lisp/" | |||
| :commands R) | |||
| @end lisp | |||
| Note that when using a symbol or a function to provide a dynamically generated | |||
| list of paths, you must inform the byte-compiler of this definition so the | |||
| value is available at byte-compilation time. This is done by using the special | |||
| form @code{eval-and-compile} (as opposed to @code{eval-when-compile}). Further, this | |||
| value is fixed at whatever was determined during compilation, to avoid looking | |||
| up the same information again on each startup: | |||
| @lisp | |||
| (eval-and-compile | |||
| (defun ess-site-load-path () | |||
| (shell-command "find ~ -path ess/lisp"))) | |||
| (use-package ess-site | |||
| :load-path (lambda () (list (ess-site-load-path))) | |||
| :commands R) | |||
| @end lisp | |||
| @node @code{mode} @code{interpreter} | |||
| @section @code{:mode}, @code{:interpreter} | |||
| Similar to @code{:bind}, you can use @code{:mode} and @code{:interpreter} to establish a | |||
| deferred binding within the @code{auto-mode-alist} and @code{interpreter-mode-alist} | |||
| variables. The specifier to either keyword can be a cons cell, a list of cons | |||
| cells, or a string or regexp: | |||
| @lisp | |||
| (use-package ruby-mode | |||
| :mode "\\.rb\\'" | |||
| :interpreter "ruby") | |||
| ;; The package is "python" but the mode is "python-mode": | |||
| (use-package python | |||
| :mode ("\\.py\\'" . python-mode) | |||
| :interpreter ("python" . python-mode)) | |||
| @end lisp | |||
| If you aren't using @code{:commands}, @code{:bind}, @code{:bind*}, @code{:bind-keymap}, | |||
| @code{:bind-keymap*}, @code{:mode}, or @code{:interpreter} (all of which imply @code{:defer}; see | |||
| the docstring for @code{use-package} for a brief description of each), you can | |||
| still defer loading with the @code{:defer} keyword: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :defer t | |||
| :init | |||
| (autoload 'ace-jump-mode "ace-jump-mode" nil t) | |||
| (bind-key "C-." 'ace-jump-mode)) | |||
| @end lisp | |||
| This does exactly the same thing as the following: | |||
| @lisp | |||
| (use-package ace-jump-mode | |||
| :bind ("C-." . ace-jump-mode)) | |||
| @end lisp | |||
| @node @code{magic} @code{magic-fallback} | |||
| @section @code{:magic}, @code{:magic-fallback} | |||
| Similar to @code{:mode} and @code{:interpreter}, you can also use @code{:magic} and | |||
| @code{:magic-fallback} to cause certain function to be run if the beginning of a | |||
| file matches a given regular expression. The difference between the two is | |||
| that @code{:magic-fallback} has a lower priority than @code{:mode}. For example: | |||
| @lisp | |||
| (use-package pdf-tools | |||
| :load-path "site-lisp/pdf-tools/lisp" | |||
| :magic ("%PDF" . pdf-view-mode) | |||
| :config | |||
| (pdf-tools-install)) | |||
| @end lisp | |||
| This registers an autoloaded command for @code{pdf-view-mode}, defers loading of | |||
| @code{pdf-tools}, and runs @code{pdf-view-mode} if the beginning of a buffer matches the | |||
| string @code{"%PDF"}. | |||
| @node @code{no-require} | |||
| @section @code{:no-require} | |||
| Normally, @code{use-package} will load each package at compile time before | |||
| compiling the configuration, to ensure that any necessary symbols are in scope | |||
| to satisfy the byte-compiler. At times this can cause problems, since a | |||
| package may have special loading requirements, and all that you want to use | |||
| @code{use-package} for is to add a configuration to the @code{eval-after-load} hook. In | |||
| such cases, use the @code{:no-require} keyword: | |||
| @lisp | |||
| (use-package foo | |||
| :no-require t | |||
| :config | |||
| (message "This is evaluated when `foo' is loaded")) | |||
| @end lisp | |||
| @node @code{requires} | |||
| @section @code{:requires} | |||
| While the @code{:after} keyword delays loading until the dependencies are loaded, | |||
| the somewhat simpler @code{:requires} keyword simply never loads the package if the | |||
| dependencies are not available at the time the @code{use-package} declaration is | |||
| encountered. By "available" in this context it means that @code{foo} is available | |||
| of @code{(featurep 'foo)} evaluates to a non-nil value. For example: | |||
| @lisp | |||
| (use-package abbrev | |||
| :requires foo) | |||
| @end lisp | |||
| This is the same as: | |||
| @lisp | |||
| (use-package abbrev | |||
| :if (featurep 'foo)) | |||
| @end lisp | |||
| As a convenience, a list of such packages may be specified: | |||
| @lisp | |||
| (use-package abbrev | |||
| :requires (foo bar baz)) | |||
| @end lisp | |||
| For more complex logic, such as that supported by @code{:after}, simply use @code{:if} | |||
| and the appropriate Lisp expression. | |||
| @node Debugging Tools | |||
| @chapter Debugging Tools | |||
| TODO | |||
| @bye | |||
| @ -1,133 +0,0 @@ | |||
| ;;; xit-mode.el --- A [x]it! major mode for Emacs. -*- lexical-binding: t; -*- | |||
| ;; See: https://xit.jotaen.net/ | |||
| ;; Copyright (C) 2022 Ryan Olson | |||
| ;; Authors: Ryan Olson <ryolson@me.com> | |||
| ;; Keywords: xit todo | |||
| ;; 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/>. | |||
| ;;; Commentary: | |||
| ;; | |||
| ;;; Code: | |||
| (defvar xit-mode-hook nil) | |||
| ;; (defvar xit-mode-map | |||
| ;; (let ((map (make-sparse-keymap))) | |||
| ;; (define-key map "\C-j" 'newline-and-indent) | |||
| ;; map) | |||
| ;; "Keymap for `xit-mode'.") | |||
| ;;;###autoload | |||
| (add-to-list 'auto-mode-alist '("\\.xit\\'" . xit-mode)) | |||
| ;; descriptions disabled until tags in descriptions are resolved. | |||
| ;; right now tags don't display if a description has a face. | |||
| (defvar xit-mode-font-lock-keywords | |||
| (list | |||
| '("^[a-zA-Z]+.*$" 0 'xit-group-title) | |||
| '("^\\(\\[ \\]\\) [\\!|\\.]*\\(.*\\)" | |||
| (1 'xit-open-checkbox)) | |||
| ;(2 'xit-open-description)) | |||
| '("^\\(\\[x\\]\\) \\(.*\\)" | |||
| (1 'xit-checked-checkbox)) | |||
| ;(2 'xit-checked-description)) | |||
| '("^\\(\\[@\\]\\) [\\!|\\.]*\\(.*\\)" | |||
| (1 'xit-ongoing-checkbox)) | |||
| ;(2 'xit-ongoing-description)) | |||
| '("^\\(\\[~\\]\\) \\(.*\\)" | |||
| (1 'xit-obsolete-checkbox) | |||
| (2 'xit-obsolete-description)) | |||
| '("^\\[[x|@| |~]\\] \\([\\!|\\.]+\\)[^\\!|\\.]" 1 'xit-priority) | |||
| '("\s#[a-zA-Z0-9\\-_]+\\(=[a-zA-Z0-9\\-+]+\\)?\\w" 0 'xit-tag) | |||
| '("\s->\s\\([1-2][0-1][0-9][0-9]-[0-1][0-9]\\(-[0-3][0-9]\\)?\\)" 1 'xit-due-date)) | |||
| "Highlighting specification for `xit-mode'.") | |||
| (defface xit-group-title | |||
| '((t :inherit (font-lock-string-face underline))) | |||
| "Face used for checkboxes group title" | |||
| :group 'xit-faces) | |||
| (defface xit-open-checkbox | |||
| '((t :inherit font-lock-type-face)) | |||
| "Face used for open checkbox." | |||
| :group 'xit-faces) | |||
| (defface xit-open-description | |||
| '((t :inherit default)) | |||
| "Face used for open checkbox description." | |||
| :group 'xit-faces) | |||
| (defface xit-checked-checkbox | |||
| '((t :inherit success)) | |||
| "Face used for checked checkbox." | |||
| :group 'xit-faces) | |||
| (defface xit-checked-description | |||
| '((t :foreground "#838383")) | |||
| "Face used for checked checkbox description." | |||
| :group 'xit-faces) | |||
| (defface xit-ongoing-checkbox | |||
| '((t :inherit font-lock-keyword-face)) | |||
| "Face used for ongoing checkbox." | |||
| :group 'xit-faces) | |||
| (defface xit-ongoing-description | |||
| '((t :inherit default)) | |||
| "Face used for ongoing checkbox description." | |||
| :group 'xit-faces) | |||
| (defface xit-obsolete-checkbox | |||
| '((t :foreground "#838383")) | |||
| "Face used for obsolete checkbox." | |||
| :group 'xit-faces) | |||
| (defface xit-obsolete-description | |||
| '((t :foreground "#838383")) | |||
| "Face used for obsolete checkbox description." | |||
| :group 'xit-faces) | |||
| (defface xit-priority | |||
| '((t :inherit error)) | |||
| "Face used for priority markers ! or ." | |||
| :group 'xit-faces) | |||
| (defface xit-tag | |||
| '((t :inherit font-lock-constant-face)) | |||
| "Face used for tags." | |||
| :group 'xit-faces) | |||
| (defface xit-due-date | |||
| '((t :inherit font-lock-variable-name-face)) | |||
| "Face used for due dates." | |||
| :group 'xit-faces) | |||
| (defun xit-mode () | |||
| "Major mode for [x]it!" | |||
| (interactive) | |||
| (kill-all-local-variables) | |||
| ;;(use-local-map xit-mode-map) | |||
| (setq font-lock-defaults '(xit-mode-font-lock-keywords)) | |||
| (setq major-mode 'xit-mode) | |||
| (setq mode-name "[x]it!") | |||
| (run-hooks 'xit-mode-hook)) | |||
| (provide 'xit-mode) | |||
| ;;; xit-mode.el ends here | |||
| @ -1,48 +0,0 @@ | |||
| # Setup RVM | |||
| rvm () { | |||
| source ${HOME}/.rvm/scripts/rvm | |||
| rvm "$@" | |||
| } | |||
| # Setup NVM | |||
| load_nvm () { | |||
| unset -f node npm yarn | |||
| source $(brew --prefix nvm)/nvm.sh | |||
| } | |||
| nvm () { | |||
| load_nvm | |||
| nvm "$@" | |||
| } | |||
| node () { | |||
| load_nvm | |||
| node "$@" | |||
| } | |||
| npm () { | |||
| load_nvm | |||
| npm "$@" | |||
| } | |||
| yarn () { | |||
| load_nvm | |||
| yarn "$@" | |||
| } | |||
| # Init chef | |||
| chef () { | |||
| eval "$(chef shell-init zsh)" | |||
| chef "$@" | |||
| } | |||
| # Upgrade functions | |||
| update_spacemacs () { | |||
| cd ~/dotfiles | |||
| git subtree pull --prefix emacs.d --squash --message "Upgrade spacemacs" https://github.com/syl20bnr/spacemacs master | |||
| popd | |||
| } | |||
| update_oh_my_zsh () { | |||
| cd ~/dotfiles | |||
| git subtree pull --prefix zshrc.d/oh-my-zsh --squash --message "Upgrade oh-my-zsh" https://github.com/robbyrussell/oh-my-zsh master | |||
| popd | |||
| } | |||