pax_global_header00006660000000000000000000000064136034311460014513gustar00rootroot0000000000000052 comment=df9abf1a1bce3fadb5e0657eb8f4c7026efa3c69 magit-popup-2.13.2/000077500000000000000000000000001360343114600140425ustar00rootroot00000000000000magit-popup-2.13.2/.gitignore000066400000000000000000000001531360343114600160310ustar00rootroot00000000000000/*.elc /*-autoloads.el /.config.mk /dir /magit-popup/ /magit-popup.html /magit-popup.info /magit-popup.pdf magit-popup-2.13.2/.mailmap000066400000000000000000000001101360343114600154530ustar00rootroot00000000000000Bar Magal Silent Sphere magit-popup-2.13.2/.travis.yml000066400000000000000000000016101360343114600161510ustar00rootroot00000000000000sudo: false language: generic env: global: - CURL="curl -fsSkL --retry 9 --retry-delay 9" matrix: - EMACS_VERSION=24.4 - EMACS_VERSION=24.5 - EMACS_VERSION=25.1 - EMACS_VERSION=25.3 # 25.2 & security fix - EMACS_VERSION=26 # emacs-26 branch, built daily - EMACS_VERSION=master # master branch, built daily allow_failures: - env: EMACS_VERSION=master install: - $CURL -O https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz - tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C / - export EMACS=/tmp/emacs/bin/emacs - $CURL -O https://raw.githubusercontent.com/magnars/dash.el/master/dash.el - $EMACS -Q --batch -f batch-byte-compile dash.el - $EMACS --version script: - make lisp EMACSBIN=$EMACS EFLAGS='--eval "(setq byte-compile-error-on-warn t)"' notifications: email: on_success: never on_failure: always magit-popup-2.13.2/AUTHORS.md000066400000000000000000000034001360343114600155060ustar00rootroot00000000000000Authors ======= - Adam Benanti <0entropy@protonmail.com> - Ævar Arnfjörð Bjarmason - Alexander Gramiak - Alex Kost - Andrew Schwartzmeyer - Bar Magal - Bastian Beischer - Carl Lieberman - Chris Shoemaker - Christian Dietrich - Damien Cassou - Damien Cassou - Dave Abrahams - Eli Barzilay - Eric Schulte - George Kadianakis - John Wiegley - Jonas Bernoulli - Kyle Meyer - Lele Gaifax - Leonardo Etcheverry - Luke Amdor - Matus Goljer - Moritz Bunkus - mrkkrp - Nicolas Dudebout - Noam Postavsky - Peter J. Weisberg - Phil Jackson - Pieter Praet - Prathamesh Sonpatki - rabio - Ramkumar Ramachandra - Rémi Vanicat - Robert Boone - Robin Green - Roger Crew - Sergey Vinokurov - Silent Sphere - Štěpán Němec - Steven Thomas - Takafumi Arakaki - Thierry Volpiatto - Yann Hodique magit-popup-2.13.2/LICENSE000066400000000000000000001043741360343114600150600ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . magit-popup-2.13.2/Makefile000066400000000000000000000122521360343114600155040ustar00rootroot00000000000000-include config.mk PKG = magit-popup ELS = $(PKG).el ELCS = $(ELS:.el=.elc) DEPS = dash VERSION ?= $(shell test -e $(TOP).git && git describe --tags --abbrev=0 | cut -c2-) EMACS ?= emacs EMACS_ARGS ?= LOAD_PATH ?= $(addprefix -L ../,$(DEPS)) LOAD_PATH += -L . ifndef ORG_LOAD_PATH ORG_LOAD_PATH = -L ../dash ORG_LOAD_PATH += -L ../org/lisp ORG_LOAD_PATH += -L ../org/contrib/lisp ORG_LOAD_PATH += -L ../ox-texinfo+ endif INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info) MAKEINFO ?= makeinfo MANUAL_HTML_ARGS ?= --css-ref /assets/page.css all: lisp info doc: info html html-dir pdf help: $(info make all - generate lisp and manual) $(info make doc - generate most manual formats) $(info make lisp - generate byte-code and autoloads) $(info make texi - generate texi manual (see comments)) $(info make info - generate info manual) $(info make html - generate html manual file) $(info make html-dir - generate html manual directory) $(info make pdf - generate pdf manual) $(info make publish - publish manual) $(info make clean - remove most generated files) @printf "\n" lisp: $(ELCS) loaddefs loaddefs: $(PKG)-autoloads.el $(PKG).elc: $(PKG)-desc.elc: $(PKG).elc $(PKG)-list.elc: $(PKG).elc %.elc: %.el @printf "Compiling $<\n" @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $< info: $(PKG).info dir html: $(PKG).html pdf: $(PKG).pdf ORG_ARGS = --batch -Q $(ORG_LOAD_PATH) -l ox-extra -l ox-texinfo+.el ORG_EVAL = --eval "(ox-extras-activate '(ignore-headlines))" ORG_EVAL += --eval "(setq indent-tabs-mode nil)" ORG_EVAL += --eval "(setq org-src-preserve-indentation nil)" ORG_EVAL += --funcall org-texinfo-export-to-texinfo # This target first bumps version strings in the Org source. The # necessary tools might be missing so other targets do not depend # on this target and it has to be run explicitly when appropriate. # # AMEND=t make texi Update manual to be amended to HEAD. # VERSION=N make texi Update manual for release. # .PHONY: texi texi: @$(EMACS) $(ORG_ARGS) $(PKG).org $(ORG_EVAL) @printf "\n" >> $(PKG).texi @rm -f $(PKG).texi~ %.info: %.texi @printf "Generating $@\n" @$(MAKEINFO) --no-split $< -o $@ dir: $(PKG).info @printf "Generating $@\n" @printf "%s" $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@ HTML_FIXUP_CSS = '//a\ \ \n\ \n\ \n\ \n' HTML_FIXUP_ONLOAD = 's///' HTML_FIXUP_MENU = '/<\/body>/i
<\/div>' %.html: %.texi @printf "Generating $@\n" @$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $< @sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $@ html-dir: $(PKG).texi @printf "Generating $(PKG)/*.html\n" @$(MAKEINFO) --html $(MANUAL_HTML_ARGS) $< @for f in $$(find $(PKG) -name '*.html') ; do \ sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $$f ; \ done %.pdf: %.texi @printf "Generating $@\n" @texi2pdf --clean $< > /dev/null DOMAIN ?= magit.vc PUBLISH_PATH ?= /manual/ S3_BUCKET ?= s3://$(DOMAIN) PUBLISH_TARGET = $(S3_BUCKET)$(PUBLISH_PATH) CFRONT_DIST ?= E2LUHBKU1FBV02 CFRONT_PATHS = $(PKG).html $(PKG).pdf $(PKG)/* comma := , empty := space := $(empty) $(empty) publish: html html-dir pdf @aws s3 cp $(PKG).html $(PUBLISH_TARGET) @aws s3 cp $(PKG).pdf $(PUBLISH_TARGET) @aws s3 sync --delete $(PKG) $(PUBLISH_TARGET)$(PKG)/ @printf "Generating CDN invalidation\n" @aws cloudfront create-invalidation --distribution-id $(CFRONT_DIST) --paths \ "$(subst $(space),$(comma),$(addprefix $(PUBLISH_PATH),$(CFRONT_PATHS)))" > /dev/null CLEAN = $(ELCS) $(PKG)-autoloads.el $(PKG).info dir CLEAN += $(PKG) $(PKG).html $(PKG).pdf clean: @printf "Cleaning...\n" @rm -rf $(CLEAN) define LOADDEFS_TMPL ;;; $(PKG)-autoloads.el --- automatically extracted autoloads ;; ;;; Code: (add-to-list 'load-path (directory-file-name \ (or (file-name-directory #$$) (car load-path)))) ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t ;; End: ;;; $(PKG)-autoloads.el ends here endef export LOADDEFS_TMPL #' $(PKG)-autoloads.el: $(ELS) @printf "Generating $@\n" @printf "%s" "$$LOADDEFS_TMPL" > $@ @$(EMACS) -Q --batch --eval "(progn\ (setq make-backup-files nil)\ (setq vc-handled-backends nil)\ (setq default-directory (file-truename default-directory))\ (setq generated-autoload-file (expand-file-name \"$@\"))\ (setq find-file-visit-truename t)\ (update-directory-autoloads default-directory))" magit-popup-2.13.2/README.md000066400000000000000000000006311360343114600153210ustar00rootroot00000000000000# Magit-Popup This package implements a generic interface for toggling switches and setting options and then invoking an Emacs command that does something with these arguments. Usually the command calls an external process with the specified arguments. This package has been superseded by [Transient]. No new features will be added but bugs will be fixes. [Transient]: https://github.com/magit/transient magit-popup-2.13.2/htmlxref.cnf000066400000000000000000000017371360343114600163730ustar00rootroot00000000000000# https://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Configuration.html EMACS = https://www.gnu.org/software/emacs/manual auth mono ${EMACS}/html_mono/auth.html auth node ${EMACS}/html_node/auth/ ediff mono ${EMACS}/html_mono/ediff.html ediff node ${EMACS}/html_node/ediff/ elisp mono ${EMACS}/html_mono/elisp.html elisp node ${EMACS}/html_node/elisp/ emacs mono ${EMACS}/html_mono/emacs.html emacs node ${EMACS}/html_node/emacs/ MAGIT = https://magit.vc/manual forge mono ${MAGIT}/forge.html forge node ${MAGIT}/forge/ ghub mono ${MAGIT}/ghub.html ghub node ${MAGIT}/ghub/ magit mono ${MAGIT}/magit.html magit node ${MAGIT}/magit/ transient mono ${MAGIT}/transient.html transient node ${MAGIT}/transient/ with-editor mono ${MAGIT}/with-editor.html with-editor node ${MAGIT}/with-editor/ MIRROR = https://emacsmirror.net/manual borg mono ${MAGIT}/borg.html borg node ${MAGIT}/borg/ epkg mono ${MAGIT}/epkg.html epkg node ${MAGIT}/epkg/ magit-popup-2.13.2/magit-popup.el000066400000000000000000001547771360343114600166530ustar00rootroot00000000000000;;; magit-popup.el --- Define prefix-infix-suffix command combos -*- lexical-binding: t -*- ;; Copyright (C) 2010-2020 The Magit Project Contributors ;; ;; You should have received a copy of the AUTHORS.md file which ;; lists all contributors. If not, see http://magit.vc/authors. ;; This library was inspired by and replaces library `magit-key-mode', ;; which was written by Phil Jackson and is ;; distributed under the GNU General Public License version 3 or later. ;; Author: Jonas Bernoulli ;; Maintainer: Jonas Bernoulli ;; Package-Requires: ((emacs "24.4") (dash "2.13.0")) ;; Keywords: bindings ;; Homepage: https://github.com/magit/magit-popup ;; Magit-Popup is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; ;; Magit-Popup 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 Magit-Popup. If not, see http://www.gnu.org/licenses. ;;; Commentary: ;; This package implements a generic interface for toggling switches ;; and setting options and then invoking an Emacs command that does ;; something with these arguments. Usually the command calls an ;; external process with the specified arguments. ;; This package has been superseded by Transient. No new features ;; will be added but bugs will be fixes. ;;; Code: (require 'button) (require 'cl-lib) (require 'dash) (require 'format-spec) (eval-when-compile (require 'subr-x)) (declare-function info 'info) (declare-function Man-find-section 'man) (declare-function Man-next-section 'man) ;; For branch actions. (declare-function magit-branch-set-face 'magit-git) ;;; Settings ;;;; Custom Groups (defgroup magit-popup nil "Infix arguments with a popup as feedback." :link '(info-link "(magit-popup)") :group 'bindings) (defgroup magit-popup-faces nil "Faces used by Magit-Popup." :group 'magit-popup) ;;;; Custom Options (defcustom magit-popup-display-buffer-action '((display-buffer-below-selected)) "The action used to display a popup buffer. Popup buffers are displayed using `display-buffer' with the value of this option as ACTION argument. You can also set this to nil and instead add an entry to `display-buffer-alist'." :package-version '(magit-popup . "2.4.0") :group 'magit-popup :type 'sexp) (defcustom magit-popup-manpage-package (if (memq system-type '(windows-nt ms-dos)) 'woman 'man) "The package used to display manpages. One of `man' or `woman'." :group 'magit-popup :type '(choice (const man) (const woman))) (defcustom magit-popup-show-help-echo t "Show usage information in the echo area." :group 'magit-popup :type 'boolean) (defcustom magit-popup-show-common-commands nil "Whether to initially show section with commands common to all popups. This section can also be toggled temporarily using \ \\\\[magit-popup-toggle-show-common-commands]." :package-version '(magit-popup . "2.9.0") :group 'magit-popup :type 'boolean) (defcustom magit-popup-use-prefix-argument 'default "Control how prefix arguments affect infix argument popups. This option controls the effect that the use of a prefix argument before entering a popup has. `default' With a prefix argument directly invoke the popup's default action (an Emacs command), instead of bringing up the popup. `popup' With a prefix argument bring up the popup, otherwise directly invoke the popup's default action. `nil' Ignore prefix arguments." :group 'magit-popup :type '(choice (const :tag "Call default action instead of showing popup" default) (const :tag "Show popup instead of calling default action" popup) (const :tag "Ignore prefix argument" nil))) ;;;; Custom Faces (defface magit-popup-heading '((t :inherit font-lock-keyword-face)) "Face for key mode header lines." :group 'magit-popup-faces) (defface magit-popup-key '((t :inherit font-lock-builtin-face)) "Face for key mode buttons." :group 'magit-popup-faces) (defface magit-popup-argument '((t :inherit font-lock-warning-face)) "Face used to display enabled arguments in popups." :group 'magit-popup-faces) (defface magit-popup-disabled-argument '((t :inherit shadow)) "Face used to display disabled arguments in popups." :group 'magit-popup-faces) (defface magit-popup-option-value '((t :inherit font-lock-string-face)) "Face used to display option values in popups." :group 'magit-popup-faces) ;;;; Keymap (defvar magit-popup-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap self-insert-command] 'magit-invoke-popup-action) (define-key map (kbd "- ") 'magit-invoke-popup-switch) (define-key map (kbd "= ") 'magit-invoke-popup-option) (define-key map (kbd "C-g") 'magit-popup-quit) (define-key map (kbd "?") 'magit-popup-help) (define-key map (kbd "C-h k") 'magit-popup-help) (define-key map (kbd "C-h i") 'magit-popup-info) (define-key map (kbd "C-t") 'magit-popup-toggle-show-common-commands) (define-key map (kbd "C-c C-c") 'magit-popup-set-default-arguments) (define-key map (kbd "C-x C-s") 'magit-popup-save-default-arguments) (cond ((featurep 'jkl) (define-key map (kbd "C-p") 'universal-argument) (define-key map [return] 'push-button) (define-key map (kbd "C-i") 'backward-button) (define-key map (kbd "C-k") 'forward-button)) (t (define-key map (kbd "C-m") 'push-button) (define-key map (kbd "DEL") 'backward-button) (define-key map (kbd "C-p") 'backward-button) (define-key map (kbd "C-i") 'forward-button) (define-key map (kbd "C-n") 'forward-button))) map) "Keymap for `magit-popup-mode'. \\\ This keymap contains bindings common to all popups. A section listing these commands can be shown or hidden using \ \\[magit-popup-toggle-show-common-commands]. The prefix used to toggle any switch can be changed by binding another key to `magit-invoke-popup-switch'. Likewise binding another key to `magit-invoke-popup-option' changes the prefixed used to set any option. The two prefixes have to be different. If you change these bindings, you should also change the `prefix' property of the button types `magit-popup-switch-button' and `magit-popup-option-button'. If you change any other binding, then you might have to also edit `magit-popup-common-commands' for things to align correctly in the section listing these commands. Never bind an alphabetic character in this keymap or you might make it impossible to invoke certain actions.") (defvar magit-popup-common-commands '(("Set defaults" magit-popup-set-default-arguments) ("View popup manual" magit-popup-info) ("Toggle this section" magit-popup-toggle-show-common-commands) ("Save defaults" magit-popup-save-default-arguments) (" Popup help prefix" magit-popup-help) ("Abort" magit-popup-quit))) ;;;; Buttons (define-button-type 'magit-popup-button 'face nil 'action (lambda (button) (funcall (button-get button 'function) (button-get button 'event)))) (define-button-type 'magit-popup-switch-button 'supertype 'magit-popup-button 'function 'magit-invoke-popup-switch 'property :switches 'heading "Switches\n" 'formatter 'magit-popup-format-argument-button 'format " %k %d (%a)" 'prefix ?- 'maxcols 1) (define-button-type 'magit-popup-option-button 'supertype 'magit-popup-button 'function 'magit-invoke-popup-option 'property :options 'heading "Options\n" 'formatter 'magit-popup-format-argument-button 'format " %k %d (%a%v)" 'prefix ?= 'maxcols 1) (define-button-type 'magit-popup-variable-button 'supertype 'magit-popup-button 'function 'magit-invoke-popup-action 'property :variables 'heading "Variables\n" 'formatter 'magit-popup-format-variable-button 'format " %k %d" 'prefix nil 'maxcols 1) (define-button-type 'magit-popup-action-button 'supertype 'magit-popup-button 'function 'magit-invoke-popup-action 'property :actions 'heading "Actions\n" 'formatter 'magit-popup-format-action-button 'format " %k %d" 'prefix nil 'maxcols :max-action-columns) (define-button-type 'magit-popup-command-button 'supertype 'magit-popup-action-button 'formatter 'magit-popup-format-command-button 'action (lambda (button) (let ((command (button-get button 'function))) (unless (eq command 'push-button) (call-interactively command))))) (define-button-type 'magit-popup-internal-command-button 'supertype 'magit-popup-command-button 'heading "Common Commands\n" 'maxcols 3) ;;; Events (defvar-local magit-this-popup nil "The popup which is currently active. This is intended for internal use only. Don't confuse this with `magit-current-popup'.") (defvar-local magit-this-popup-events nil "The events known to the active popup. This is intended for internal use only. Don't confuse this with `magit-current-popup-args'.") (defvar-local magit-previous-popup nil) (defvar-local magit-pre-popup-buffer nil "The buffer that was current before invoking the active popup.") (defun magit-popup-get (prop) "While a popup is active, get the value of PROP." (if (memq prop '(:switches :options :variables :actions)) (plist-get magit-this-popup-events prop) (plist-get (symbol-value magit-this-popup) prop))) (defun magit-popup-put (prop val) "While a popup is active, set the value of PROP to VAL." (if (memq prop '(:switches :options :variables :actions)) (setq magit-this-popup-events (plist-put magit-this-popup-events prop val)) (error "Property %s isn't supported" prop))) (defvar magit-current-popup nil "The popup from which this editing command was invoked. Use this inside the `interactive' form of a popup aware command to determine whether it was invoked from a popup and if so from which popup. If the current command was invoked without the use of a popup, then this is nil.") (defvar magit-current-popup-action nil "The popup action now being executed.") (defvar magit-current-popup-args nil "The value of the popup arguments for this editing command. If the current command was invoked from a popup, then this is a list of strings of all the set switches and options. This includes arguments which are set by default not only those explicitly set during this invocation. When the value is nil, then that can be because no argument is set, or because the current command wasn't invoked from a popup; consult `magit-current-popup' to tell the difference. Generally it is better to use `NAME-arguments', which is created by `magit-define-popup', instead of this variable or the function by the same name, because `NAME-argument' uses the default value for the arguments when the editing command is invoked directly instead of from a popup. When the command is bound in several popups that might not be feasible though.") (defun magit-current-popup-args (&rest filter) "Return the value of the popup arguments for this editing command. The value is the same as that of the variable by the same name \(which see), except that FILTER is applied. FILTER is a list of regexps; only arguments that match one of them are returned. The first element of FILTER may also be `:not' in which case only arguments that don't match any of the regexps are returned, or `:only' which doesn't change the behaviour." (let ((-compare-fn (lambda (a b) (magit-popup-arg-match b a)))) (-filter (if (eq (car filter) :not) (lambda (arg) (not (-contains-p (cdr filter) arg))) (when (eq (car filter) :only) (pop filter)) (lambda (arg) (-contains-p filter arg))) magit-current-popup-args))) (defvar magit-current-pre-popup-buffer nil "The buffer that was current before invoking the active popup. This is bound when invoking an action or variable.") (defmacro magit-with-pre-popup-buffer (&rest body) "Execute the forms in BODY in the buffer that current before the popup. If `magit-current-pre-popup-buffer' is non-nil use that, else if `magit-pre-popup-buffer' is non-nil use that, otherwise (when no popup is involved) execute the forms in the current buffer." (declare (indent 0)) `(--if-let (or magit-current-pre-popup-buffer magit-pre-popup-buffer) (with-current-buffer it ,@body) ,@body)) (defun magit-popup-arg-match (pattern string) (if (or (string-match-p "=$" pattern) (string-match-p "^-[A-Z]$" pattern)) (string-match (format "^%s\\(.*\\)$" pattern) string) (string-equal string pattern))) (cl-defstruct magit-popup-event key dsc arg fun use val) (defun magit-popup-event-keydsc (ev) (let ((key (magit-popup-event-key ev))) (key-description (if (vectorp key) key (vector key))))) (defun magit-popup-lookup (event type) (--first (equal (magit-popup-event-key it) event) (-filter 'magit-popup-event-p (magit-popup-get type)))) (defun magit-popup-get-args () (--mapcat (when (and (magit-popup-event-p it) (magit-popup-event-use it)) (list (format "%s%s" (magit-popup-event-arg it) (or (magit-popup-event-val it) "")))) (append (magit-popup-get :switches) (magit-popup-get :options)))) (defmacro magit-popup-convert-events (def form) (declare (indent 1) (debug (form form))) `(--map (if (or (null it) (stringp it) (functionp it)) it ,form) ,def)) (defun magit-popup-convert-switches (val def) (magit-popup-convert-events def (let ((a (nth 2 it))) (make-magit-popup-event :key (car it) :dsc (cadr it) :arg a :use (and (member a val) t) ;; For arguments implemented in lisp, this function's ;; doc-string is used by `magit-popup-help'. That is ;; the only thing it is used for. :fun (and (string-prefix-p "\+\+" a) (nth 3 it)))))) (defun magit-popup-convert-options (val def) (magit-popup-convert-events def (let* ((a (nth 2 it)) (r (format "^%s\\(.*\\)" a)) (v (--first (string-match r it) val))) (make-magit-popup-event :key (car it) :dsc (cadr it) :arg a :use (and v t) :val (and v (match-string 1 v)) :fun (or (nth 3 it) 'read-from-minibuffer))))) (defun magit-popup-convert-variables (_val def) (magit-popup-convert-events def (make-magit-popup-event :key (car it) :dsc (cadr it) :fun (nth 2 it) :arg (nth 3 it)))) (defun magit-popup-convert-actions (_val def) (magit-popup-convert-events def (make-magit-popup-event :key (car it) :dsc (cadr it) :fun (nth 2 it)))) ;;; Define (defmacro magit-define-popup (name doc &rest args) "Define a popup command named NAME. NAME should begin with the package prefix and by convention end with `-popup'. That name is used for the actual command as well as for a variable used internally. DOC is used as the doc-string of that command. Also define an option and a function named `SHORTNAME-arguments', where SHORTNAME is NAME with the trailing `-popup' removed. The name of this option and this function can be overwritten using the optional argument OPTION, but that is rarely advisable. As a special case if OPTION is specified but nil, do not define this option and this function at all. The option `SHORTNAME-arguments' holds the default value for the popup arguments. It can be customized from within the popup or using the Custom interface. The function `SHORTNAME-arguments' is a wrapper around the variable `magit-current-popup-args', both of which are intended to be used inside the `interactive' form of commands commonly invoked from the popup `NAME'. When such a command is invoked from that popup, then the function `SHORTNAME-arguments' returns the value of the variable `magit-current-popup-args'; however when the command is invoked directly, then it returns the default value of the variable `SHORTNAME-arguments'. Optional argument GROUP specifies the Custom group into which the option is placed. If omitted, then the option is placed into some group the same way it is done when directly using `defcustom' and omitting the group, except when NAME begins with \"magit-\", in which case the group `magit-git-arguments' is used. Optional argument MODE is deprecated, instead use the keyword arguments `:setup-function' and/or `:refresh-function'. If MODE is non-nil, then it specifies the mode used by the popup buffer, instead of the default, which is `magit-popup-mode'. The remaining arguments should have the form [KEYWORD VALUE]... The following keywords are meaningful (and by convention are usually specified in that order): `:actions' The actions which can be invoked from the popup. VALUE is a list whose members have the form (KEY DESC COMMAND), see `magit-define-popup-action' for details. Actions are regular Emacs commands, which usually have an `interactive' form setup to consume the values of the popup `:switches' and `:options' when invoked from the corresponding popup, else when invoked as the default action or directly without using the popup, the default value of the variable `SHORTNAME-arguments'. This is usually done by calling the function `SHORTNAME-arguments'. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be nil. This should only be used together with `:max-action-columns' and allows having gaps in the action grid, which can help arranging actions sensibly. `:default-action' The default action of the popup which is used directly instead of displaying the popup buffer, when the popup is invoked with a prefix argument. Also see `magit-popup-use-prefix-argument' and `:use-prefix', which can be used to inverse the meaning of the prefix argument. `:use-prefix' Controls when to display the popup buffer and when to invoke the default action (if any) directly. This overrides the global default set using `magit-popup-use-prefix-argument'. The value, if specified, should be one of `default' or `popup', or a function that is called with no arguments and returns one of these symbols. `:max-action-columns' The maximum number of actions to display on a single line, a number or a function that returns a number and takes the name of the section currently being inserted as argument. If there isn't enough room to display as many columns as specified here, then fewer are used. `:switches' The popup arguments which can be toggled on and off. VALUE is a list whose members have the form (KEY DESC SWITCH), see `magit-define-popup-switch' for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. `:options' The popup arguments which take a value, as in \"--opt=OPTVAL\". VALUE is a list whose members have the form (KEY DESC OPTION READER), see `magit-define-popup-option' for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. `:default-arguments' The default arguments, a list of switches (which are then enabled by default) and options with there default values, as in \"--OPT=OPTVAL\". `:variables' Variables which can be set from the popup. VALUE is a list whose members have the form (KEY DESC COMMAND FORMATTER), see `magit-define-popup-variable' for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be actions as described above for `:actions'. VALUE may also be a function that returns a list as describe above. `:sequence-predicate' When this function returns non-nil, then the popup uses `:sequence-actions' instead of `:actions', and does not show the `:switches' and `:options'. `:sequence-actions' The actions which can be invoked from the popup, when `:sequence-predicate' returns non-nil. `:setup-function' When this function is specified, then it is used instead of `magit-popup-default-setup'. `:refresh-function' When this function is specified, then it is used instead of calling `magit-popup-insert-section' three times with symbols `magit-popup-switch-button', `magit-popup-option-button', and finally `magit-popup-action-button' as argument. `:man-page' The name of the manpage to be displayed when the user requests help for a switch or argument. \(fn NAME DOC [GROUP [MODE [OPTION]]] :KEYWORD VALUE...)" (declare (indent defun) (doc-string 2)) (let* ((str (symbol-name name)) (grp (if (keywordp (car args)) (and (string-prefix-p "magit-" str) ''magit-git-arguments) (pop args))) (mode (and (not (keywordp (car args))) (pop args))) (opt (if (keywordp (car args)) (intern (concat (if (string-suffix-p "-popup" str) (substring str 0 -6) str) "-arguments")) (eval (pop args))))) `(progn (defun ,name (&optional arg) ,doc (interactive "P") (magit-invoke-popup ',name ,mode arg)) (defvar ,name (list :variable ',opt ,@args)) (magit-define-popup-keys-deferred ',name) ,@(when opt `((defcustom ,opt (plist-get ,name :default-arguments) "" ,@(and grp (list :group grp)) :type '(repeat (string :tag "Argument"))) (defun ,opt () (if (eq magit-current-popup ',name) magit-current-popup-args ,opt)) (put ',opt 'definition-name ',name)))))) (defun magit-define-popup-switch (popup key desc switch &optional enable at prepend) "In POPUP, define KEY as SWITCH. POPUP is a popup command defined using `magit-define-popup'. SWITCH is a string representing an argument that takes no value. KEY is a character representing the second event in the sequence of keystrokes used to toggle the argument. (The first event, the prefix, is shared among all switches, defaults to -, and can be changed in `magit-popup-mode-keymap'). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional ENABLE is non-nil, then the switch is on by default. SWITCH is inserted after all other switches already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil, then it should be the KEY of another switch already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND." (declare (indent defun)) (magit-define-popup-key popup :switches key (list desc switch enable) at prepend)) (defun magit-define-popup-option (popup key desc option &optional reader value at prepend) "In POPUP, define KEY as OPTION. POPUP is a popup command defined using `magit-define-popup'. OPTION is a string representing an argument that takes a value. KEY is a character representing the second event in the sequence of keystrokes used to set the argument's value. (The first event, the prefix, is shared among all options, defaults to =, and can be changed in `magit-popup-mode-keymap'). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional VALUE is non-nil then the option is on by default, and VALUE is its default value. READER is used to read a value from the user when the option is invoked and does not currently have a value. (When the option has a value, then invoking the option causes it to be unset.) This function must take two arguments but may choose to ignore them. The first argument is the name of the option (with \": \" appended, unless it ends with \"=\") and can be used as the prompt. The second argument is nil or the value that was in effect before the option was unset, which may be suitable as initial completion input. If no reader is specified, then `read-from-minibuffer' is used. OPTION is inserted after all other options already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil, then it should be the KEY of another option already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND." (declare (indent defun)) (magit-define-popup-key popup :options key (list desc option reader value) at prepend)) (defun magit-define-popup-variable (popup key desc command formatter &optional at prepend) "In POPUP, define KEY as COMMAND. POPUP is a popup command defined using `magit-define-popup'. COMMAND is a command which calls `magit-popup-set-variable'. FORMATTER is a function which calls `magit-popup-format-variable'. These two functions have to be called with the same arguments. KEY is a character representing the event used interactively call the COMMAND. DESC is the variable or a representation thereof. It's not actually used for anything. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil, then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND." (declare (indent defun)) (magit-define-popup-key popup :variables key (list desc command formatter) at prepend)) (defun magit-define-popup-action (popup key desc command &optional at prepend) "In POPUP, define KEY as COMMAND. POPUP is a popup command defined using `magit-define-popup'. COMMAND can be any command but should usually consume the popup arguments in its `interactive' form. KEY is a character representing the event used invoke the action, i.e. to interactively call the COMMAND. DESC is a string describing the purpose of the action, it is displayed in the popup. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil, then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND." (declare (indent defun)) (magit-define-popup-key popup :actions key (list desc command) at prepend)) (defun magit-define-popup-sequence-action (popup key desc command &optional at prepend) "Like `magit-define-popup-action' but for `:sequence-action'." (declare (indent defun)) (magit-define-popup-key popup :sequence-actions key (list desc command) at prepend)) (defconst magit-popup-type-plural-alist '((:switch . :switches) (:option . :options) (:variable . :variables) (:action . :actions) (:sequence-action . :sequence-actions))) (defun magit-popup-pluralize-type (type) (or (cdr (assq type magit-popup-type-plural-alist)) type)) (defun magit-define-popup-key (popup type key def &optional at prepend) "In POPUP, define KEY as an action, switch, or option. It's better to use one of the specialized functions `magit-define-popup-action', `magit-define-popup-sequence-action', `magit-define-popup-switch', `magit-define-popup-option', or `magit-define-popup-variable'." (declare (indent defun)) (setq type (magit-popup-pluralize-type type)) (if (memq type '(:switches :options :variables :actions :sequence-actions)) (if (boundp popup) (let* ((plist (symbol-value popup)) (value (plist-get plist type)) (elt (assoc key value))) (if elt (setcdr elt def) (setq elt (cons key def))) (if at (when (setq at (cl-member at value :key 'car-safe :test 'equal)) (setq value (cl-delete key value :key 'car-safe :test 'equal)) (if prepend (progn (push (car at) (cdr at)) (setcar at elt)) (push elt (cdr at)))) (setq value (cl-delete key value :key 'car-safe :test 'equal))) (unless (assoc key value) (setq value (if prepend (cons elt value) (append value (list elt))))) (set popup (plist-put plist type value))) (push (list type key def at prepend) (get popup 'magit-popup-deferred))) (error "Unknown popup event type: %s" type))) (defun magit-define-popup-keys-deferred (popup) (dolist (args (get popup 'magit-popup-deferred)) (condition-case err (apply #'magit-define-popup-key popup args) ((debug error) (display-warning 'magit (error-message-string err) :error)))) (put popup 'magit-popup-deferred nil)) (defun magit-change-popup-key (popup type from to) "In POPUP, bind TO to what FROM was bound to. TYPE is one of `:action', `:sequence-action', `:switch', or `:option'. Bind TO and unbind FROM, both are characters." (--if-let (assoc from (plist-get (symbol-value popup) (magit-popup-pluralize-type type))) (setcar it to) (message "magit-change-popup-key: FROM key %c is unbound" from))) (defun magit-remove-popup-key (popup type key) "In POPUP, remove KEY's binding of TYPE. POPUP is a popup command defined using `magit-define-popup'. TYPE is one of `:action', `:sequence-action', `:switch', or `:option'. KEY is the character which is to be unbound." (setq type (magit-popup-pluralize-type type)) (let* ((plist (symbol-value popup)) (alist (plist-get plist type)) (value (assoc key alist))) (set popup (plist-put plist type (delete value alist))))) ;;; Invoke (defvar-local magit-popup-previous-winconf nil) (defun magit-invoke-popup (popup mode arg) (let* ((def (symbol-value popup)) (val (symbol-value (plist-get def :variable))) (default (plist-get def :default-action)) (local (plist-get def :use-prefix)) (local (if (functionp local) (funcall local) local)) (use-prefix (or local magit-popup-use-prefix-argument))) (cond ((or (and (eq use-prefix 'default) arg) (and (eq use-prefix 'popup) (not arg))) (if default (let ((magit-current-popup (list popup 'default)) (magit-current-popup-args (let ((magit-this-popup popup) (magit-this-popup-events nil)) (magit-popup-default-setup val def) (magit-popup-get-args)))) (when (and arg (listp arg)) (setq current-prefix-arg (and (not (= (car arg) 4)) (list (/ (car arg) 4))))) (call-interactively default)) (message "%s has no default action; showing popup instead." popup) (magit-popup-mode-setup popup mode))) ((memq use-prefix '(default popup nil)) (magit-popup-mode-setup popup mode) (when magit-popup-show-help-echo (let ((message-log-max nil)) (message (format "[%s] show common commands, [%s] describe events, [%s] show manual" (propertize "C-t" 'face 'magit-popup-key) (propertize "?" 'face 'magit-popup-key) (propertize "C-h i" 'face 'magit-popup-key)))))) (local (error "Invalid :use-prefix popup property value: %s" use-prefix)) (t (error "Invalid magit-popup-use-prefix-argument value: %s" use-prefix))))) (defun magit-invoke-popup-switch (event) (interactive (list last-command-event)) (--if-let (magit-popup-lookup event :switches) (progn (setf (magit-popup-event-use it) (not (magit-popup-event-use it))) (magit-refresh-popup-buffer)) (user-error "%c isn't bound to any switch" event))) (defun magit-invoke-popup-option (event) (interactive (list last-command-event)) (--if-let (magit-popup-lookup event :options) (progn (if (magit-popup-event-use it) (setf (magit-popup-event-use it) nil) (let* ((arg (magit-popup-event-arg it)) (val (funcall (magit-popup-event-fun it) (concat arg (unless (string-match-p "=$" arg) ": ")) (magit-popup-event-val it)))) (setf (magit-popup-event-use it) t) (setf (magit-popup-event-val it) val))) (magit-refresh-popup-buffer)) (user-error "%c isn't bound to any option" event))) (defun magit-invoke-popup-action (event) (interactive (list last-command-event)) (let ((action (magit-popup-lookup event :actions)) (variable (magit-popup-lookup event :variables))) (when (and variable (not (magit-popup-event-arg variable))) (setq action variable) (setq variable nil)) (cond ((or action variable) (let* ((magit-current-popup magit-this-popup) (magit-current-popup-args (magit-popup-get-args)) (magit-current-pre-popup-buffer magit-pre-popup-buffer) (command (magit-popup-event-fun (or action variable))) (magit-current-popup-action command)) (when action (magit-popup-quit)) (setq this-command command) (call-interactively command) (unless action (magit-refresh-popup-buffer)))) ((eq event ?q) (magit-popup-quit) (when magit-previous-popup (magit-popup-mode-setup magit-previous-popup nil))) (t (user-error "%c isn't bound to any action" event))))) (defun magit-popup-quit () "Quit the current popup command without invoking an action." (interactive) (let ((winconf magit-popup-previous-winconf)) (if (derived-mode-p 'magit-popup-mode) (kill-buffer) (magit-popup-help-mode -1) (kill-local-variable 'magit-popup-previous-winconf)) (when winconf (set-window-configuration winconf)))) (defun magit-popup-read-number (prompt &optional default) "Like `read-number' but DEFAULT may be a numeric string." (read-number prompt (if (stringp default) (string-to-number default) default))) ;;; Save (defun magit-popup-set-default-arguments (arg) "Set default value for the arguments for the current popup. Then close the popup without invoking an action; unless a prefix argument is used in which case the popup remains open. For a popup named `NAME-popup' that usually means setting the value of the custom option `NAME-arguments'." (interactive "P") (-if-let (var (magit-popup-get :variable)) (progn (customize-set-variable var (magit-popup-get-args)) (unless arg (magit-popup-quit))) (user-error "Nothing to set"))) (defun magit-popup-save-default-arguments (arg) "Save default value for the arguments for the current popup. Then close the popup without invoking an action; unless a prefix argument is used in which case the popup remains open. For a popup named `NAME-popup' that usually means saving the value of the custom option `NAME-arguments'." (interactive "P") (-if-let (var (magit-popup-get :variable)) (progn (customize-save-variable var (magit-popup-get-args)) (unless arg (magit-popup-quit))) (user-error "Nothing to save"))) ;;; Help (defun magit-popup-toggle-show-common-commands () "Show or hide an additional section with common commands. The commands listed in this section are common to all popups and are defined in `magit-popup-mode-map' (which see)." (interactive) (setq magit-popup-show-common-commands (not magit-popup-show-common-commands)) (magit-refresh-popup-buffer) (fit-window-to-buffer)) (defun magit-popup-help () "Show help for the argument or action at point." (interactive) (let* ((man (magit-popup-get :man-page)) (key (read-key-sequence (concat "Describe key" (and man " (? for manpage)") ": "))) (int (aref key (1- (length key)))) (def (or (lookup-key (current-local-map) key t) (lookup-key (current-global-map) key)))) (pcase def (`magit-invoke-popup-switch (--if-let (magit-popup-lookup int :switches) (if (and (string-prefix-p "++" (magit-popup-event-arg it)) (magit-popup-event-fun it)) (magit-popup-describe-function (magit-popup-event-fun it)) (magit-popup-manpage man it)) (user-error "%c isn't bound to any switch" int))) (`magit-invoke-popup-option (--if-let (magit-popup-lookup int :options) (if (and (string-prefix-p "++" (magit-popup-event-arg it)) (magit-popup-event-fun it)) (magit-popup-describe-function (magit-popup-event-fun it)) (magit-popup-manpage man it)) (user-error "%c isn't bound to any option" int))) (`magit-popup-help (magit-popup-manpage man nil)) ((or `self-insert-command `magit-invoke-popup-action) (setq def (or (magit-popup-lookup int :actions) (magit-popup-lookup int :variables))) (if def (magit-popup-describe-function (magit-popup-event-fun def)) (ding) (message nil))) (`nil (ding) (message nil)) (_ (magit-popup-describe-function def))))) (defun magit-popup-manpage (topic arg) (unless topic (user-error "No man page associated with %s" (magit-popup-get :man-page))) (when arg (setq arg (magit-popup-event-arg arg)) (when (string-prefix-p "--" arg) ;; handle '--' option and the '--[no-]' shorthand (setq arg (cond ((string= "-- " arg) "\\(?:\\[--\\] \\)?<[^[:space:]]+>\\.\\.\\.") ((string-prefix-p "--no-" arg) (concat "--" "\\[?no-\\]?" (substring arg 5))) (t (concat "--" "\\(?:\\[no-\\]\\)?" (substring arg 2))))))) (let ((winconf (current-window-configuration)) buffer) (pcase magit-popup-manpage-package (`woman (delete-other-windows) (split-window-below) (with-no-warnings ; display-buffer-function is obsolete (let ((display-buffer-alist nil) (display-buffer-function nil) (display-buffer-overriding-action nil)) (woman topic))) (setq buffer (current-buffer))) (`man (cl-letf (((symbol-function #'fboundp) (lambda (_) nil))) (setq buffer (man topic))) (delete-other-windows) (split-window-below) (set-window-buffer (selected-window) buffer))) (with-current-buffer buffer (setq magit-popup-previous-winconf winconf) (magit-popup-help-mode) (fit-window-to-buffer (next-window)) (if (and arg (Man-find-section "OPTIONS") (let ((case-fold-search nil) ;; This matches preceding/proceeding options. ;; Options such as '-a', '-S[]', and ;; '--grep=' are matched by this regex ;; without the shy group. The '. ' in the shy ;; group is for options such as '-m ;; parent-number', and the '-[^[:space:]]+ ' is ;; for options such as '--mainline parent-number' (others "-\\(?:. \\|-[^[:space:]]+ \\)?[^[:space:]]+")) (re-search-forward ;; should start with whitespace, and may have any ;; number of options before/after (format "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$" others ;; options don't necessarily end in an '=' ;; (e.g., '--gpg-sign[=]') (string-remove-suffix "=" arg) ;; Simple options don't end in an '='. ;; Splitting this into 2 cases should make ;; getting false positives less likely. (if (string-suffix-p "=" arg) ;; [^[:space:]]*[^.[:space:]] matches ;; the option value, which is usually ;; after the option name and either '=' ;; or '[='. The value can't end in a ;; period, as that means it's being used ;; at the end of a sentence. The space ;; is for options such as '--mainline ;; parent-number'. "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]" ;; Either this doesn't match anything ;; (e.g., '-a'), or the option is followed ;; by a value delimited by a '[', '<', or ;; ':'. A space might appear before this ;; value, as in '-f '. The space ;; alternative is for options such as '-m ;; parent-number'. "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?") others) nil t))) (goto-char (match-beginning 1)) (goto-char (point-min)))))) (defun magit-popup-describe-function (function) (let ((winconf (current-window-configuration))) (delete-other-windows) (split-window-below) (other-window 1) (with-no-warnings ; display-buffer-function is obsolete (let ((display-buffer-alist '(("" display-buffer-use-some-window))) (display-buffer-function nil) (display-buffer-overriding-action nil) (help-window-select nil)) (describe-function function))) (fit-window-to-buffer) (other-window 1) (setq magit-popup-previous-winconf winconf) (magit-popup-help-mode))) (defun magit-popup-info () "Show the popup manual." (interactive) (let ((winconf (current-window-configuration))) (delete-other-windows) (split-window-below) (info "(magit-popup.info)Usage") (magit-popup-help-mode) (setq magit-popup-previous-winconf winconf)) (magit-popup-help-mode) (fit-window-to-buffer (next-window))) (define-minor-mode magit-popup-help-mode "Auxiliary minor mode used to restore previous window configuration. When some sort of help buffer is created from within a popup, then this minor mode is turned on in that buffer, so that when the user quits it, the previous window configuration is also restored." :keymap '(([remap Man-quit] . magit-popup-quit) ([remap Info-exit] . magit-popup-quit) ([remap quit-window] . magit-popup-quit))) ;;; Modes (define-derived-mode magit-popup-mode fundamental-mode "MagitPopup" "Major mode for infix argument popups." :mode 'magit-popup (setq truncate-lines t) (setq buffer-read-only t) (setq-local scroll-margin 0) (setq-local magit-popup-show-common-commands magit-popup-show-common-commands) (hack-dir-local-variables-non-file-buffer)) (put 'magit-popup-mode 'mode-class 'special) (defun magit-popup-default-setup (val def) (if (--when-let (magit-popup-get :sequence-predicate) (funcall it)) (magit-popup-put :actions (magit-popup-convert-actions val (magit-popup-get :sequence-actions))) (let ((vars (plist-get def :variables))) (when (functionp vars) (setq vars (funcall vars))) (when vars (magit-popup-put :variables (magit-popup-convert-variables val vars)))) (magit-popup-put :switches (magit-popup-convert-switches val (plist-get def :switches))) (magit-popup-put :options (magit-popup-convert-options val (plist-get def :options))) (magit-popup-put :actions (magit-popup-convert-actions val (plist-get def :actions))))) (defun magit-popup-mode-setup (popup mode) (setq magit-previous-popup magit-current-popup) (let ((val (symbol-value (plist-get (symbol-value popup) :variable))) (def (symbol-value popup)) (buf (current-buffer))) (magit-popup-mode-display-buffer (get-buffer-create (format "*%s*" popup)) (or mode 'magit-popup-mode)) (setq magit-this-popup popup) (setq magit-pre-popup-buffer buf) (if (bound-and-true-p magit-popup-setup-hook) ; obsolete (run-hook-with-args 'magit-popup-setup-hook val def) (funcall (or (magit-popup-get :setup-function) 'magit-popup-default-setup) val def))) (magit-refresh-popup-buffer) (fit-window-to-buffer nil nil (line-number-at-pos (point-max)))) (defun magit-popup-mode-display-buffer (buffer mode) (let ((winconf (current-window-configuration))) (select-window (display-buffer buffer magit-popup-display-buffer-action)) (funcall mode) (setq magit-popup-previous-winconf winconf))) (defvar magit-refresh-popup-buffer-hook nil "Hook run by `magit-refresh-popup-buffer'. The hook is run right after inserting the representation of the popup events but before optionally inserting the representation of events shared by all popups and before point is adjusted.") (defun magit-refresh-popup-buffer () (let* ((inhibit-read-only t) (button (button-at (point))) (prefix (and button (button-get button 'prefix))) (event (and button (button-get button 'event)))) (erase-buffer) (save-excursion (--if-let (magit-popup-get :refresh-function) (funcall it) (magit-popup-insert-section 'magit-popup-variable-button) (magit-popup-insert-section 'magit-popup-switch-button) (magit-popup-insert-section 'magit-popup-option-button) (magit-popup-insert-section 'magit-popup-action-button)) (run-hooks 'magit-refresh-popup-buffer-hook) (when magit-popup-show-common-commands (magit-popup-insert-command-section 'magit-popup-internal-command-button magit-popup-common-commands))) (set-buffer-modified-p nil) (when event (while (and (ignore-errors (forward-button 1)) (let ((b (button-at (point)))) (or (not (equal (button-get b 'prefix) prefix)) (not (equal (button-get b 'event) event))))))))) ;;; Draw (defvar magit-popup-min-padding 3 "Minimal amount of whitespace between columns in popup buffers.") (defun magit-popup-insert-section (type &optional spec heading) (if (not spec) (progn (setq spec (magit-popup-get (button-type-get type 'property))) (when spec (if (or (stringp (car spec)) (functionp (car spec))) (--each (--partition-by-header (or (stringp it) (functionp it)) spec) (magit-popup-insert-section type (cdr it) (car it))) (magit-popup-insert-section type spec)))) (let* ((formatter (button-type-get type 'formatter)) (items (mapcar (lambda (ev) (and ev (or (funcall formatter type ev) '("")))) (or spec (magit-popup-get (button-type-get type 'property))))) (maxcols (button-type-get type 'maxcols)) (pred (magit-popup-get :sequence-predicate))) (when items (if (functionp heading) (when (setq heading (funcall heading)) (insert heading ?\n)) (unless heading (setq heading (button-type-get type 'heading))) (insert (propertize heading 'face 'magit-popup-heading)) (unless (string-match "\n$" heading) (insert "\n"))) (if (and pred (funcall pred)) (setq maxcols nil) (cl-typecase maxcols (keyword (setq maxcols (magit-popup-get maxcols))) (symbol (setq maxcols (symbol-value maxcols))))) (when (functionp maxcols) (setq maxcols (funcall maxcols heading))) (when heading (let ((colwidth (+ (apply 'max (mapcar (lambda (e) (length (car e))) items)) magit-popup-min-padding))) (dolist (item items) (unless (bolp) (let ((padding (- colwidth (% (current-column) colwidth)))) (if (and (< (+ (current-column) padding colwidth) (window-width)) (< (ceiling (/ (current-column) (* colwidth 1.0))) (or maxcols 1000))) (insert (make-string padding ?\s)) (insert "\n")))) (unless (equal item '("")) (if item (apply 'insert-button item) (insert ?\s))))) (insert (if (= (char-before) ?\n) "\n" "\n\n"))))))) (defun magit-popup-format-argument-button (type ev) (list (format-spec (button-type-get type 'format) `((?k . ,(propertize (concat (--when-let (button-type-get type 'prefix) (char-to-string it)) (magit-popup-event-keydsc ev)) 'face 'magit-popup-key)) (?d . ,(magit-popup-event-dsc ev)) (?a . ,(propertize (magit-popup-event-arg ev) 'face (if (magit-popup-event-use ev) 'magit-popup-argument 'magit-popup-disabled-argument))) (?v . ,(let ((val (magit-popup-event-val ev))) (if (and (magit-popup-event-use ev) (not (equal val ""))) (propertize (format "\"%s\"" val) 'face 'magit-popup-option-value) ""))))) 'type type 'event (magit-popup-event-key ev))) (defun magit-popup-format-variable-button (type ev) (if (not (magit-popup-event-arg ev)) (magit-popup-format-action-button 'magit-popup-action-button ev) (list (format-spec (button-type-get type 'format) `((?k . ,(propertize (magit-popup-event-keydsc ev) 'face 'magit-popup-key)) (?d . ,(funcall (magit-popup-event-arg ev))))) 'type type 'event (magit-popup-event-key ev)))) (defun magit-popup-format-action-button (type ev) (let* ((cmd (magit-popup-event-fun ev)) (dsc (magit-popup-event-dsc ev)) (fun (and (functionp dsc) dsc))) (unless (and disabled-command-function (symbolp cmd) (get cmd 'disabled)) (when fun (setq dsc (-when-let (branch (funcall fun)) (if (text-property-not-all 0 (length branch) 'face nil branch) branch (magit-branch-set-face branch))))) (when dsc (list (format-spec (button-type-get type 'format) `((?k . ,(propertize (magit-popup-event-keydsc ev) 'face 'magit-popup-key)) (?d . ,dsc) (?D . ,(if (and (not fun) (eq cmd (magit-popup-get :default-action))) (propertize dsc 'face 'bold) dsc)))) 'type type 'event (magit-popup-event-key ev)))))) (defun magit-popup-insert-command-section (type spec) (magit-popup-insert-section type (mapcar (lambda (elt) (list (car (where-is-internal (cadr elt) (current-local-map))) (car elt))) spec))) (defun magit-popup-format-command-button (type elt) (nconc (magit-popup-format-action-button type (make-magit-popup-event :key (car elt) :dsc (cadr elt))) (list 'function (lookup-key (current-local-map) (car elt))))) ;;; Utilities (defun magit-popup-import-file-args (args files) (if files (cons (concat "-- " (mapconcat #'identity files ",")) args) args)) (defun magit-popup-export-file-args (args) (let ((files (--first (string-prefix-p "-- " it) args))) (when files (setq args (remove files args)) (setq files (split-string (substring files 3) ","))) (list args files))) (defconst magit-popup-font-lock-keywords (eval-when-compile `((,(concat "(\\(magit-define-popup\\)\\_>" "[ \t'\(]*" "\\(\\(?:\\sw\\|\\s_\\)+\\)?") (1 'font-lock-keyword-face) (2 'font-lock-function-name-face nil t))))) (font-lock-add-keywords 'emacs-lisp-mode magit-popup-font-lock-keywords) ;;; _ (provide 'magit-popup) ;; Local Variables: ;; indent-tabs-mode: nil ;; End: ;;; magit-popup.el ends here magit-popup-2.13.2/magit-popup.org000066400000000000000000000662341360343114600170300ustar00rootroot00000000000000#+TITLE: Magit-Popup User Manual :PREAMBLE: #+AUTHOR: Jonas Bernoulli #+EMAIL: jonas@bernoul.li #+DATE: 2015-2020 #+LANGUAGE: en #+TEXINFO_DIR_CATEGORY: Emacs #+TEXINFO_DIR_TITLE: Magit-Popup: (magit-popup). #+TEXINFO_DIR_DESC: Infix arguments with feedback #+SUBTITLE: for version 2.13.2 #+TEXINFO_DEFFN: t #+OPTIONS: H:4 num:4 toc:2 #+PROPERTY: header-args :eval never #+BIND: ox-texinfo+-before-export-hook ox-texinfo+-update-copyright-years #+BIND: ox-texinfo+-before-export-hook ox-texinfo+-update-version-strings This package implements a generic interface for toggling switches and setting options and then invoking an Emacs command that does something with these arguments. Usually the command calls an external process with the specified arguments. This package has been superseded by Transient ([[info:transient]]). No new features will be added but bugs will be fixes. #+TEXINFO: @noindent This manual is for Magit-Popup version 2.13.2. #+BEGIN_QUOTE Copyright (C) 2015-2020 Jonas Bernoulli 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_QUOTE :END: * Introduction Taking inspiration from regular prefix commands and prefix arguments, this library implements a similar abstraction; a new kind of prefix command that is associated with a specific set of infix arguments and suffix commands. Invoking such a prefix command displays a popup buffer which lists the associated infix arguments and suffix commands. In that buffer each argument is prefixed with the key sequence that can be used to toggle it or change its value. Likewise each suffix command is prefixed with the key used to invoke it. Such a popup buffer might look like this: #+BEGIN_EXAMPLE ,----------------------------------------- |Switches | -l Show graph (--graph) | -d Show refnames (--decorate) | |Options | =m Search messages (--grep="popup") | =p Search patches (-G) | |Action | l Show log for current branch | o Show log for another branch '----------------------------------------- #+END_EXAMPLE The user could then for example type ~-l~ to toggle the ~--graph~ *switch* (when it is on then it is shown in green, otherwise in gray), or ~=m~ to change the value of the *option* ~--grep~. Once all arguments are as desired one invokes a suffix command, which causes the popup buffer to disappear. The suffix command should then retrieve the infix arguments in its ~interactive~ form like this is done for prefix arguments. While such "prefix-infix-suffix" combos were inspired by regular prefix commands and prefix arguments, they are also quite different. This should illustrate the most basic differences: - A regular prefix command #+BEGIN_EXAMPLE /- command1 prefix --- command2 \- command3 #+END_EXAMPLE - Prefix arguments #+BEGIN_EXAMPLE /- command1 C-u ... --- command2 \- well any command #+END_EXAMPLE - A Prefix-Infix-Suffix combo #+BEGIN_EXAMPLE /- argument1 -\ /- suffix1 prefix----- argument2 --+-- suffix2 ^ \- argument3 -/ | | '--------' (refresh buffer) #+END_EXAMPLE This package has been superseded by Transient ([[info:transient]]). No new features will be added but bugs will be fixes. * Usage ** _ :ignore: Every popup buffers created with a prefix command contains a section named "Actions" listing the available suffix commands. Most buffers also contain a "Switches" and/or an "Options" section which list the two types of infix arguments separately. Switches are arguments that can be toggled on or off. When a switch is active then it is shown in color, when it is off then it is shown in gray (of course the details depend on the color theme in use). Options are arguments that have a value. When an option has a value then that is shown after the option itself. Because for some options the empty string is a valid value, options are additionally colorized like switches to indicate whether they are active or not. The events bound to suffix commands are always single alphabetic characters. The bindings for arguments are always two events long. For switches the first key is always ~-~, for options it is always ~=~. The second key is always an alphabetic character. By default popup buffers also feature a section listing commands common to all popups. To avoid conflicts with suffix commands, the bindings of these common commands are not alphabetic characters. This section is shown by default so that documentation-resistant users get a chance to notice them. - User Option: magit-popup-show-common-commands This option controls whether the section that lists the commands that are common to all popups is initially shown. By default this is not the case, but note that you can temporarily show this section using ~C-t~, which therefore is the only common command you actually have to memorize. - Key: C-t, magit-popup-toggle-show-common-commands Show or hide the section listing the commands shared by all popups. - Key: C-g, magit-popup-quit Quit popup buffer without invoking a suffix command. Without further action, setting arguments only affects the next suffix command. Invoking the same prefix command again resets the arguments to their default value, but the defaults can be changed directly from the popup buffer itself. For a prefix command named ~NAME-popup~ the default values are stored as the value of the custom option named ~NAME-arguments~. While this option can be customized using the Custom interface, it is better to do so directly from the popup buffer. - Key: C-c C-c, magit-popup-set-default-arguments This sets the default value for the arguments for the current popup. Then the popup buffer is closed without invoking a suffix command; unless a prefix argument is used in which case the popup remains open. - Key: C-x C-s, magit-popup-save-default-arguments This sets the default value for the arguments for the current popup and saves it for future Emacs sessions. Then the popup buffer is closed without invoking an action; unless a prefix argument is used in which case the popup remains open. It is also possible to add additional arguments and commands to an existing popup, but that cannot be done directly from the popup (or the Custom interface). See [[*Customizing Existing Popups]]. Documentation about a popup's arguments and commands can be shown directly from the popup. - Key: C-h i, magit-popup-info Show this manual. - Key: ?, magit-popup-help This command reads a key sequence and then shows the documentation of the argument or command that sequence is bound to. In other words type the same keys that you would use to invoke the argument or command, but prefix the sequence with ~?~. For suffix commands this shows the doc-string. For arguments this command can only show something for popups that have an associated man-page. If the man-page is set, then this command displays it in a separate buffer and puts point on the entry about the argument in question. The buffer which is used to display the documentation is selected. Simply press ~q~ to leave that buffer and restore the old window configuration. While it isn't very useful, it is possible to move around in a popup buffer using ~C-p~ and ~C-n~, and to invoke the argument or command at point using ~RET~. But it is much more efficient to use the dedicated key bindings instead, so these commands are not listed in popup buffers along with the other common commands. ** Customizing Existing Popups It is possible to define additional infix arguments and suffix commands to an existing popup using the following functions. You can find some examples which use the below commands at https://github.com/magit/magit/wiki/Additional-proposed-infix-arguments-and-suffix-commands. - Function: magit-define-popup-switch popup key desc switch &optional enable at prepend In POPUP, define KEY as SWITCH. POPUP is a popup command defined using ~magit-define-popup~. SWITCH is a string representing an argument that takes no value. KEY is a character representing the second event in the sequence of keystrokes used to toggle the argument. (The first event, the prefix, is shared among all switches, defaults to ~-~, and can be changed in ~magit-popup-mode-keymap~). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional ENABLE is non-nil then the switch is on by default. SWITCH is inserted after all other switches already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another switch already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND. - Function: magit-define-popup-option popup key desc option &optional reader value at prepend In POPUP, define KEY as OPTION. POPUP is a popup command defined using ~magit-define-popup~. OPTION is a string representing an argument that takes a value. KEY is a character representing the second event in the sequence of keystrokes used to set the argument's value. (The first event, the prefix, is shared among all options, defaults to ~=~, and can be changed in ~magit-popup-mode-keymap~). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional VALUE is non-nil then the option is on by default, and VALUE is its default value. READER is used to read a value from the user when the option is invoked and does not currently have a value. (When the option has a value, then invoking the option causes it to be unset.) This function must take two arguments but may choose to ignore them. The first argument is the name of the option (with ": \" appended, unless it ends with "=") and can be used as the prompt. The second argument is nil or the value that was in effect before the option was unset, which may be suitable as initial completion input. If no reader is specified, then ~read-from-minibuffer~ is used. OPTION is inserted after all other options already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another option already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND. - Function: magit-define-popup-action popup key desc command &optional at prepend In POPUP, define KEY as COMMAND. POPUP is a popup command defined using ~magit-define-popup~. COMMAND can be any command but should usually consume the popup arguments in its ~interactive~ form. KEY is a character representing the event used invoke the action, i.e. to interactively call the COMMAND. DESC is a string describing the purpose of the action, it is displayed in the popup. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND. - Function: magit-define-popup-sequence-action popup key desc command &optional at prepend Like ~magit-define-popup-action~, but modifies the value of the ~:sequence-actions~ property instead of ~:actions~. - Function: magit-define-popup-variable popup key desc command formatter &optional at prepend In POPUP, define KEY as COMMAND. POPUP is a popup command defined using ~magit-define-popup~. COMMAND is a command which calls ~magit-popup-set-variable~. FORMATTER is a function which calls ~magit-popup-format-variable~. These two functions have to be called with the same arguments. KEY is a character representing the event used interactively call the COMMAND. DESC is the variable or a representation thereof. It's not actually used for anything. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND." - Function: magit-change-popup-key popup type from to In POPUP, bind TO to what FROM was bound to. TYPE is one of ~:action~, ~:sequence-action~, ~:switch~, or ~:option~. Bind TO and unbind FROM, both are characters. - Function: magit-remove-popup-key popup type key In POPUP, remove KEY's binding of TYPE. POPUP is a popup command defined using ~magit-define-popup~. TYPE is one of ~:action~, ~:sequence-action~, ~:switch~, or ~:option~. KEY is the character which is to be unbound. It is also possible to change other aspects of a popup by setting a property using ~plist-put~. See [[*Defining Prefix Commands]] for valid properties. The most likely change Magit users might want to make is: #+BEGIN_SRC emacs-lisp (plist-put magit-show-refs-popup :use-prefix nil) #+END_SRC ** Other Options - User Option: magit-popup-use-prefix-argument This option controls the effect that the use of a prefix argument before entering a popup has. - ~default~ With a prefix argument directly invoke the popup's default action (an Emacs command), instead of bringing up the popup. - ~popup~ With a prefix argument bring up the popup, otherwise directly invoke the popup's default action. - ~nil~ Ignore prefix arguments. This option can be overridden for individual popups. ~magit-show-refs-popup~ for example defaults to invoking the default action directly. It only shows the popup buffer when a prefix argument is used. See [[*Customizing Existing Popups]]. - User Option: magit-popup-manpage-package The Emacs package used to display man-pages, one of ~man~ or ~woman~. - User Option: magit-popup-display-buffer-action The option controls how the window used to display a popup buffer is created. Popup buffers are displayed using ~display-buffer~ with the value of this option as ACTION argument. You can also set this to nil and instead add an entry to ~display-buffer-alist~. To emphasize the default action by making it bold use this: #+BEGIN_SRC emacs-lisp (button-type-put 'magit-popup-action-button 'format " %k %D") #+END_SRC * Defining Prefix and Suffix Commands ** _ :ignore: If you write an extension for Magit then you should use this library now and later when ~transient~ is released port to that. If you are considering using this library to define popups for packages not related to Magit, then keep in mind that it will be superseded eventually. Once ~transient~ has been released I will only fix bugs in ~magit-popup~ but not implement any new features. Also consider using ~hydra~ instead. To some extend ~magit-popup~ and ~hydra~ are similar but have a different focus. The main purpose of ~magit-popup~ is to pass infix arguments to suffix commands. If all you need is a command dispatcher then you are better of using ~hydra~. Of course ~hydra~ may also be a better fit not only because of the features it lacks, but also because of the features it provides, which are in turn missing from ~magit-popup~. Here is an example of how one defines a prefix command along with its infix arguments, and then also one of its suffix commands. #+BEGIN_SRC emacs-lisp ;;;###autoload (autoload 'magit-tag-popup "magit" nil t) (magit-define-popup magit-tag-popup "Show popup buffer featuring tagging commands." 'magit-commands :man-page "git-tag" :switches '((?a "Annotate" "--annotate") (?s "Sign" "--sign") (?f "Force" "--force")) :actions '((?t "Create" magit-tag) (?k "Delete" magit-tag-delete) (?p "Prune" magit-tag-prune)) :default-action 'magit-tag) ;;;###autoload (defun magit-tag (name rev &optional args) "Create a new tag with the given NAME at REV." (interactive (list (magit-read-tag "Tag name") (magit-read-branch-or-commit "Place tag on") (magit-tag-arguments))) (magit-run-git-with-editor "tag" args name rev)) #+END_SRC ** Defining Prefix Commands Prefix commands and their infix arguments are defined using the macro ~magit-define-popup~. The key bindings and descriptions of suffix commands are also defined using that macro, but the actual interactive commands have to be defined separately using plain ~defun~. - Macro: magit-define-popup name doc [group [mode [option]]] :keyword value... This macro defines a popup named NAME. The NAME should begin with the package prefix and by convention end with ~-popup~, it is used as the name of the command which shows the popup and for an internal variable (whose value is used to store information about the popup and should not be accessed directly). DOC is the doc-string of the popup command. This macro also defines an option and a function both named ~SHORTNAME-arguments~, where SHORTNAME is NAME with the trailing ~-popup~ removed. The name of this option and this function can be overwritten using the optional argument OPTION, but that is rarely advisable. As a special case if OPTION is specified but ~nil~, then this option and this function are not defined at all, which is useful for popups that are used as simple dispatchers that offer no arguments. The option ~SHORTNAME-arguments~ holds the value for the popup arguments. It can be customized from within the popup or using the Custom interface. It can also have a buffer local value in any non-popup buffer. The local value for the buffer from which the popup command was invoked, can be set from within the popup buffer. The function ~SHORTNAME-arguments~ returns the currently effective value of the variable by the same name. See below for more information. Optional argument GROUP specifies the Custom group into which the option is placed. If omitted then the option is placed into some group the same way it is done when directly using ~defcustom~ and omitting the group, except when NAME begins with "magit-", in which case the group ~magit-git-arguments~ is used. The optional argument MODE specifies the mode used by the popup buffer. If it is omitted or ~nil~ then ~magit-popup-mode~ is used. The remaining arguments should have the form ~[KEYWORD VALUE]...~. The following keywords are meaningful (and by convention are usually specified in that order): - ~:actions~ The actions which can be invoked from the popup. VALUE is a list whose members have the form (KEY DESC COMMAND), see ~magit-define-popup-action~ for details. Actions are regular Emacs commands, which usually have an ~interactive~ form setup to consume the values of the popup ~:switches~ and ~:options~ when invoked from the corresponding popup, else when invoked as the default action or directly without using the popup, the default value of the variable ~SHORTNAME-arguments~. This is usually done by calling the function ~SHORTNAME-arguments~. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be nil. This should only be used together with ~:max-action-columns~ and allows having gaps in the action grit, which can help arranging actions sensibly. - ~:default-action~ The default action of the popup which is used directly instead of displaying the popup buffer, when the popup is invoked with a prefix argument. Also see ~magit-popup-use-prefix-argument~ and ~:use-prefix~, which can be used to inverse the meaning of the prefix argument. - ~:use-prefix~ Controls when to display the popup buffer and when to invoke the default action (if any) directly. This overrides the global default set using ~magit-popup-use-prefix-argument~. The value, if specified, should be one of ~default~ or ~prefix~, or a function that is called with no arguments and returns one of these symbols. - ~:max-action-columns~ The maximum number of actions to display on a single line, a number or a function that return a number and takes the name of the section currently being inserted as argument. If there isn't enough room to display as many columns as specified here, then fewer are used. - ~:switches~ The popup arguments which can be toggled on and off. VALUE is a list whose members have the form ~(KEY DESC SWITCH)~, see ~magit-define-popup-switch~ for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. - ~:options~ The popup arguments which take a value, as in "--opt~OPTVAL". VALUE is a list whose members have the form ~(KEY DESC OPTION READER)~, see ~magit-define-popup-option~ for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. - ~:default-arguments~ The default arguments, a list of switches (which are then enabled by default) and options with there default values, as in ~"--OPT=OPTVAL"~. - ~:variables~ Variables which can be set from the popup. VALUE is a list whose members have the form ~(KEY DESC COMMAND FORMATTER)~, see ~magit-define-popup-variable~ for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be actions as described above for ~:actions~. VALUE may also be a function that returns a list as describe above. - ~:sequence-predicate~ When this function returns non-nil, then the popup uses ~:sequence-actions~ instead of ~:actions~, and does not show the ~:switches~ and ~:options~. - ~:sequence-actions~ The actions which can be invoked from the popup, when ~:sequence-predicate~ returns non-nil. - ~:setup-function~ When this function is specified, then it is used instead of ~magit-popup-default-setup~. - ~:refresh-function~ When this function is specified, then it is used instead of calling ~magit-popup-insert-section~ three times with symbols ~magit-popup-switch-button~, ~magit-popup-option-button~, and finally ~magit-popup-action-button~ as argument. - ~:man-page~ The name of the manpage to be displayed when the user requests help for an argument. ** Defining Suffix Commands Commands intended to be invoked from a particular popup should determine the currently effective arguments by calling the function ~SHORTNAME-arguments~ inside their ~interactive~ form. This function is created by the ~magit-define-popup~ macro. For a popup named ~prefix-foo-popup~ the name of this function is ~prefix-foo-arguments~. When the command was invoked as an action in the respective popup, then this function returns the arguments that were set in the popup. Otherwise when the command was invoked as the default of the popup (by calling the popup command with a prefix argument), or without using the popup command at all, then this function returns the buffer-local or global value of the variable ~SHORTNAME-arguments~. Internally arguments are handled as a list of strings. This might not be appropriate for the intended use inside commands, or it might be necessary to manipulate that list somehow, i.e. to split "--ARG=VAL" into "--ARG""VAL". This should be done by advising or redefining the function ~SHORTNAME-arguments~. Internally ~SHORNAME-arguments~ used following variables and function. Except when redefining the former, you should not use these directly. - Variable: magit-current-popup The popup from which this editing command was invoked. - Variable: magit-current-popup-args The value of the popup arguments for this editing command. If the current command was invoked from a popup, then this is a list of strings of all the set switches and options. This includes arguments which are set by default not only those explicitly set during this invocation. When the value is nil, then that can be because no argument is set, or because the current command wasn't invoked from a popup at all. - Function: magit-current-popup-args &rest args This function returns the value of the popup arguments for this editing command. The value is the same as that of the variable by the same name, except that FILTER is applied. FILTER is a list of regexps; only arguments that match one of them are returned. The first element of FILTER may also be ~:not~ in which case only arguments that don't match any of the regexps are returned, or ~:only~ which doesn't change the behavior. * _ Copying :PROPERTIES: :COPYING: t :END: #+BEGIN_QUOTE Copyright (C) 2015-2020 Jonas Bernoulli 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_QUOTE * _ :ignore: # LocalWords: ARG DESC KEY's LocalWords Magit OPTVAL POPUP PREPEND # LocalWords: Popup SHORTNAME args desc magit manpage popup popup's # LocalWords: popups pre prepend # IMPORTANT: Also update ORG_ARGS and ORG_EVAL in the Makefile. # Local Variables: # eval: (require 'magit-utils nil t) # eval: (require 'org-man nil t) # eval: (require 'ox-extra nil t) # eval: (require 'ox-texinfo+ nil t) # eval: (and (featurep 'ox-extra) (ox-extras-activate '(ignore-headlines))) # indent-tabs-mode: nil # org-src-preserve-indentation: nil # End: magit-popup-2.13.2/magit-popup.texi000066400000000000000000000675451360343114600172200ustar00rootroot00000000000000\input texinfo @c -*- texinfo -*- @c %**start of header @setfilename magit-popup.info @settitle Magit-Popup User Manual @documentencoding UTF-8 @documentlanguage en @c %**end of header @copying @quotation Copyright (C) 2015-2020 Jonas Bernoulli 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 * Magit-Popup: (magit-popup). Infix arguments with feedback. @end direntry @finalout @titlepage @title Magit-Popup User Manual @subtitle for version 2.13.2 @author Jonas Bernoulli @page @vskip 0pt plus 1filll @insertcopying @end titlepage @contents @ifnottex @node Top @top Magit-Popup User Manual This package implements a generic interface for toggling switches and setting options and then invoking an Emacs command that does something with these arguments. Usually the command calls an external process with the specified arguments. This package has been superseded by Transient (@ref{Top,,,transient,}). No new features will be added but bugs will be fixes. @noindent This manual is for Magit-Popup version 2.13.2. @quotation Copyright (C) 2015-2020 Jonas Bernoulli 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 ifnottex @menu * Introduction:: * Usage:: * Defining Prefix and Suffix Commands:: @detailmenu --- The Detailed Node Listing --- Usage * Customizing Existing Popups:: * Other Options:: Defining Prefix and Suffix Commands * Defining Prefix Commands:: * Defining Suffix Commands:: @end detailmenu @end menu @node Introduction @chapter Introduction Taking inspiration from regular prefix commands and prefix arguments, this library implements a similar abstraction; a new kind of prefix command that is associated with a specific set of infix arguments and suffix commands. Invoking such a prefix command displays a popup buffer which lists the associated infix arguments and suffix commands. In that buffer each argument is prefixed with the key sequence that can be used to toggle it or change its value. Likewise each suffix command is prefixed with the key used to invoke it. Such a popup buffer might look like this: @example ,----------------------------------------- |Switches | -l Show graph (--graph) | -d Show refnames (--decorate) | |Options | =m Search messages (--grep="popup") | =p Search patches (-G) | |Action | l Show log for current branch | o Show log for another branch '----------------------------------------- @end example The user could then for example type @code{-l} to toggle the @code{--graph} @strong{switch} (when it is on then it is shown in green, otherwise in gray), or @code{=m} to change the value of the @strong{option} @code{--grep}. Once all arguments are as desired one invokes a suffix command, which causes the popup buffer to disappear. The suffix command should then retrieve the infix arguments in its @code{interactive} form like this is done for prefix arguments. While such "prefix-infix-suffix" combos were inspired by regular prefix commands and prefix arguments, they are also quite different. This should illustrate the most basic differences: @itemize @item A regular prefix command @example /- command1 prefix --- command2 \- command3 @end example @item Prefix arguments @example /- command1 C-u ... --- command2 \- well any command @end example @item A Prefix-Infix-Suffix combo @example /- argument1 -\ /- suffix1 prefix----- argument2 --+-- suffix2 ^ \- argument3 -/ | | '--------' (refresh buffer) @end example @end itemize This package has been superseded by Transient (@ref{Top,,,transient,}). No new features will be added but bugs will be fixes. @node Usage @chapter Usage Every popup buffers created with a prefix command contains a section named "Actions" listing the available suffix commands. Most buffers also contain a "Switches" and/or an "Options" section which list the two types of infix arguments separately. Switches are arguments that can be toggled on or off. When a switch is active then it is shown in color, when it is off then it is shown in gray (of course the details depend on the color theme in use). Options are arguments that have a value. When an option has a value then that is shown after the option itself. Because for some options the empty string is a valid value, options are additionally colorized like switches to indicate whether they are active or not. The events bound to suffix commands are always single alphabetic characters. The bindings for arguments are always two events long. For switches the first key is always @code{-}, for options it is always @code{=}. The second key is always an alphabetic character. By default popup buffers also feature a section listing commands common to all popups. To avoid conflicts with suffix commands, the bindings of these common commands are not alphabetic characters. This section is shown by default so that documentation-resistant users get a chance to notice them. @defopt magit-popup-show-common-commands This option controls whether the section that lists the commands that are common to all popups is initially shown. By default this is not the case, but note that you can temporarily show this section using @code{C-t}, which therefore is the only common command you actually have to memorize. @end defopt @table @asis @kindex C-t @cindex magit-popup-toggle-show-common-commands @item @kbd{C-t} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-toggle-show-common-commands}) Show or hide the section listing the commands shared by all popups. @kindex C-g @cindex magit-popup-quit @item @kbd{C-g} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-quit}) Quit popup buffer without invoking a suffix command. @end table Without further action, setting arguments only affects the next suffix command. Invoking the same prefix command again resets the arguments to their default value, but the defaults can be changed directly from the popup buffer itself. For a prefix command named @code{NAME-popup} the default values are stored as the value of the custom option named @code{NAME-arguments}. While this option can be customized using the Custom interface, it is better to do so directly from the popup buffer. @table @asis @kindex C-c C-c @cindex magit-popup-set-default-arguments @item @kbd{C-c C-c} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-set-default-arguments}) This sets the default value for the arguments for the current popup. Then the popup buffer is closed without invoking a suffix command; unless a prefix argument is used in which case the popup remains open. @kindex C-x C-s @cindex magit-popup-save-default-arguments @item @kbd{C-x C-s} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-save-default-arguments}) This sets the default value for the arguments for the current popup and saves it for future Emacs sessions. Then the popup buffer is closed without invoking an action; unless a prefix argument is used in which case the popup remains open. @end table It is also possible to add additional arguments and commands to an existing popup, but that cannot be done directly from the popup (or the Custom interface). See @ref{Customizing Existing Popups}. Documentation about a popup's arguments and commands can be shown directly from the popup. @table @asis @kindex C-h i @cindex magit-popup-info @item @kbd{C-h i} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-info}) Show this manual. @kindex ? @cindex magit-popup-help @item @kbd{?} @tie{}@tie{}@tie{}@tie{}(@code{magit-popup-help}) This command reads a key sequence and then shows the documentation of the argument or command that sequence is bound to. In other words type the same keys that you would use to invoke the argument or command, but prefix the sequence with @code{?}. For suffix commands this shows the doc-string. For arguments this command can only show something for popups that have an associated man-page. If the man-page is set, then this command displays it in a separate buffer and puts point on the entry about the argument in question. The buffer which is used to display the documentation is selected. Simply press @code{q} to leave that buffer and restore the old window configuration. @end table While it isn't very useful, it is possible to move around in a popup buffer using @code{C-p} and @code{C-n}, and to invoke the argument or command at point using @code{RET}. But it is much more efficient to use the dedicated key bindings instead, so these commands are not listed in popup buffers along with the other common commands. @menu * Customizing Existing Popups:: * Other Options:: @end menu @node Customizing Existing Popups @section Customizing Existing Popups It is possible to define additional infix arguments and suffix commands to an existing popup using the following functions. You can find some examples which use the below commands at @uref{https://github.com/magit/magit/wiki/Additional-proposed-infix-arguments-and-suffix-commands}. @defun magit-define-popup-switch popup key desc switch &optional enable at prepend In POPUP, define KEY as SWITCH@. POPUP is a popup command defined using @code{magit-define-popup}. SWITCH is a string representing an argument that takes no value. KEY is a character representing the second event in the sequence of keystrokes used to toggle the argument. (The first event, the prefix, is shared among all switches, defaults to @code{-}, and can be changed in @code{magit-popup-mode-keymap}). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional ENABLE is non-nil then the switch is on by default. SWITCH is inserted after all other switches already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another switch already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND@. @end defun @defun magit-define-popup-option popup key desc option &optional reader value at prepend In POPUP, define KEY as OPTION@. POPUP is a popup command defined using @code{magit-define-popup}. OPTION is a string representing an argument that takes a value. KEY is a character representing the second event in the sequence of keystrokes used to set the argument's value. (The first event, the prefix, is shared among all options, defaults to @code{=}, and can be changed in @code{magit-popup-mode-keymap}). DESC is a string describing the purpose of the argument, it is displayed in the popup. If optional VALUE is non-nil then the option is on by default, and VALUE is its default value. READER is used to read a value from the user when the option is invoked and does not currently have a value. (When the option has a value, then invoking the option causes it to be unset.) This function must take two arguments but may choose to ignore them. The first argument is the name of the option (with ": \" appended, unless it ends with "=") and can be used as the prompt. The second argument is nil or the value that was in effect before the option was unset, which may be suitable as initial completion input. If no reader is specified, then @code{read-from-minibuffer} is used. OPTION is inserted after all other options already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another option already defined for POPUP, the argument is then placed before or after AT, depending on PREPEND@. @end defun @defun magit-define-popup-action popup key desc command &optional at prepend In POPUP, define KEY as COMMAND@. POPUP is a popup command defined using @code{magit-define-popup}. COMMAND can be any command but should usually consume the popup arguments in its @code{interactive} form. KEY is a character representing the event used invoke the action, i.e. to interactively call the COMMAND@. DESC is a string describing the purpose of the action, it is displayed in the popup. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND@. @end defun @defun magit-define-popup-sequence-action popup key desc command &optional at prepend Like @code{magit-define-popup-action}, but modifies the value of the @code{:sequence-actions} property instead of @code{:actions}. @end defun @defun magit-define-popup-variable popup key desc command formatter &optional at prepend In POPUP, define KEY as COMMAND@. POPUP is a popup command defined using @code{magit-define-popup}. COMMAND is a command which calls @code{magit-popup-set-variable}. FORMATTER is a function which calls @code{magit-popup-format-variable}. These two functions have to be called with the same arguments. KEY is a character representing the event used interactively call the COMMAND@. DESC is the variable or a representation thereof. It's not actually used for anything. COMMAND is inserted after all other commands already defined for POPUP, unless optional PREPEND is non-nil, in which case it is placed first. If optional AT is non-nil then it should be the KEY of another command already defined for POPUP, the command is then placed before or after AT, depending on PREPEND." @end defun @defun magit-change-popup-key popup type from to In POPUP, bind TO to what FROM was bound to. TYPE is one of @code{:action}, @code{:sequence-action}, @code{:switch}, or @code{:option}. Bind TO and unbind FROM, both are characters. @end defun @defun magit-remove-popup-key popup type key In POPUP, remove KEY's binding of TYPE@. POPUP is a popup command defined using @code{magit-define-popup}. TYPE is one of @code{:action}, @code{:sequence-action}, @code{:switch}, or @code{:option}. KEY is the character which is to be unbound. @end defun It is also possible to change other aspects of a popup by setting a property using @code{plist-put}. See @ref{Defining Prefix Commands} for valid properties. The most likely change Magit users might want to make is: @lisp (plist-put magit-show-refs-popup :use-prefix nil) @end lisp @node Other Options @section Other Options @defopt magit-popup-use-prefix-argument This option controls the effect that the use of a prefix argument before entering a popup has. @itemize @item @code{default} With a prefix argument directly invoke the popup's default action (an Emacs command), instead of bringing up the popup. @item @code{popup} With a prefix argument bring up the popup, otherwise directly invoke the popup's default action. @item @code{nil} Ignore prefix arguments. @end itemize This option can be overridden for individual popups. @code{magit-show-refs-popup} for example defaults to invoking the default action directly. It only shows the popup buffer when a prefix argument is used. See @ref{Customizing Existing Popups}. @end defopt @defopt magit-popup-manpage-package The Emacs package used to display man-pages, one of @code{man} or @code{woman}. @end defopt @defopt magit-popup-display-buffer-action The option controls how the window used to display a popup buffer is created. Popup buffers are displayed using @code{display-buffer} with the value of this option as ACTION argument. You can also set this to nil and instead add an entry to @code{display-buffer-alist}. @end defopt To emphasize the default action by making it bold use this: @lisp (button-type-put 'magit-popup-action-button 'format " %k %D") @end lisp @node Defining Prefix and Suffix Commands @chapter Defining Prefix and Suffix Commands If you write an extension for Magit then you should use this library now and later when @code{transient} is released port to that. If you are considering using this library to define popups for packages not related to Magit, then keep in mind that it will be superseded eventually. Once @code{transient} has been released I will only fix bugs in @code{magit-popup} but not implement any new features. Also consider using @code{hydra} instead. To some extend @code{magit-popup} and @code{hydra} are similar but have a different focus. The main purpose of @code{magit-popup} is to pass infix arguments to suffix commands. If all you need is a command dispatcher then you are better of using @code{hydra}. Of course @code{hydra} may also be a better fit not only because of the features it lacks, but also because of the features it provides, which are in turn missing from @code{magit-popup}. Here is an example of how one defines a prefix command along with its infix arguments, and then also one of its suffix commands. @lisp ;;;###autoload (autoload 'magit-tag-popup "magit" nil t) (magit-define-popup magit-tag-popup "Show popup buffer featuring tagging commands." 'magit-commands :man-page "git-tag" :switches '((?a "Annotate" "--annotate") (?s "Sign" "--sign") (?f "Force" "--force")) :actions '((?t "Create" magit-tag) (?k "Delete" magit-tag-delete) (?p "Prune" magit-tag-prune)) :default-action 'magit-tag) ;;;###autoload (defun magit-tag (name rev &optional args) "Create a new tag with the given NAME at REV." (interactive (list (magit-read-tag "Tag name") (magit-read-branch-or-commit "Place tag on") (magit-tag-arguments))) (magit-run-git-with-editor "tag" args name rev)) @end lisp @menu * Defining Prefix Commands:: * Defining Suffix Commands:: @end menu @node Defining Prefix Commands @section Defining Prefix Commands Prefix commands and their infix arguments are defined using the macro @code{magit-define-popup}. The key bindings and descriptions of suffix commands are also defined using that macro, but the actual interactive commands have to be defined separately using plain @code{defun}. @defmac magit-define-popup name doc [group [mode [option]]] :keyword value@dots{} This macro defines a popup named NAME@. The NAME should begin with the package prefix and by convention end with @code{-popup}, it is used as the name of the command which shows the popup and for an internal variable (whose value is used to store information about the popup and should not be accessed directly). DOC is the doc-string of the popup command. This macro also defines an option and a function both named @code{SHORTNAME-arguments}, where SHORTNAME is NAME with the trailing @code{-popup} removed. The name of this option and this function can be overwritten using the optional argument OPTION, but that is rarely advisable. As a special case if OPTION is specified but @code{nil}, then this option and this function are not defined at all, which is useful for popups that are used as simple dispatchers that offer no arguments. The option @code{SHORTNAME-arguments} holds the value for the popup arguments. It can be customized from within the popup or using the Custom interface. It can also have a buffer local value in any non-popup buffer. The local value for the buffer from which the popup command was invoked, can be set from within the popup buffer. The function @code{SHORTNAME-arguments} returns the currently effective value of the variable by the same name. See below for more information. Optional argument GROUP specifies the Custom group into which the option is placed. If omitted then the option is placed into some group the same way it is done when directly using @code{defcustom} and omitting the group, except when NAME begins with "magit-", in which case the group @code{magit-git-arguments} is used. The optional argument MODE specifies the mode used by the popup buffer. If it is omitted or @code{nil} then @code{magit-popup-mode} is used. The remaining arguments should have the form @code{[KEYWORD VALUE]...}. The following keywords are meaningful (and by convention are usually specified in that order): @itemize @item @code{:actions} The actions which can be invoked from the popup. VALUE is a list whose members have the form (KEY DESC COMMAND), see @code{magit-define-popup-action} for details. Actions are regular Emacs commands, which usually have an @code{interactive} form setup to consume the values of the popup @code{:switches} and @code{:options} when invoked from the corresponding popup, else when invoked as the default action or directly without using the popup, the default value of the variable @code{SHORTNAME-arguments}. This is usually done by calling the function @code{SHORTNAME-arguments}. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be nil. This should only be used together with @code{:max-action-columns} and allows having gaps in the action grit, which can help arranging actions sensibly. @item @code{:default-action} The default action of the popup which is used directly instead of displaying the popup buffer, when the popup is invoked with a prefix argument. Also see @code{magit-popup-use-prefix-argument} and @code{:use-prefix}, which can be used to inverse the meaning of the prefix argument. @item @code{:use-prefix} Controls when to display the popup buffer and when to invoke the default action (if any) directly. This overrides the global default set using @code{magit-popup-use-prefix-argument}. The value, if specified, should be one of @code{default} or @code{prefix}, or a function that is called with no arguments and returns one of these symbols. @item @code{:max-action-columns} The maximum number of actions to display on a single line, a number or a function that return a number and takes the name of the section currently being inserted as argument. If there isn't enough room to display as many columns as specified here, then fewer are used. @item @code{:switches} The popup arguments which can be toggled on and off. VALUE is a list whose members have the form @code{(KEY DESC SWITCH)}, see @code{magit-define-popup-switch} for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. @item @code{:options} The popup arguments which take a value, as in "--opt~OPTVAL". VALUE is a list whose members have the form @code{(KEY DESC OPTION READER)}, see @code{magit-define-popup-option} for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. @item @code{:default-arguments} The default arguments, a list of switches (which are then enabled by default) and options with there default values, as in @code{"--OPT=OPTVAL"}. @item @code{:variables} Variables which can be set from the popup. VALUE is a list whose members have the form @code{(KEY DESC COMMAND FORMATTER)}, see @code{magit-define-popup-variable} for details. Members of VALUE may also be strings and functions, assuming the first member is a string or function. In that case the members are split into sections and these special elements are used as headings. If such an element is a function then it is called with no arguments and must return either a string, which is used as the heading, or nil, in which case the section is not inserted. Members of VALUE may also be actions as described above for @code{:actions}. VALUE may also be a function that returns a list as describe above. @item @code{:sequence-predicate} When this function returns non-nil, then the popup uses @code{:sequence-actions} instead of @code{:actions}, and does not show the @code{:switches} and @code{:options}. @item @code{:sequence-actions} The actions which can be invoked from the popup, when @code{:sequence-predicate} returns non-nil. @item @code{:setup-function} When this function is specified, then it is used instead of @code{magit-popup-default-setup}. @item @code{:refresh-function} When this function is specified, then it is used instead of calling @code{magit-popup-insert-section} three times with symbols @code{magit-popup-switch-button}, @code{magit-popup-option-button}, and finally @code{magit-popup-action-button} as argument. @item @code{:man-page} The name of the manpage to be displayed when the user requests help for an argument. @end itemize @end defmac @node Defining Suffix Commands @section Defining Suffix Commands Commands intended to be invoked from a particular popup should determine the currently effective arguments by calling the function @code{SHORTNAME-arguments} inside their @code{interactive} form. This function is created by the @code{magit-define-popup} macro. For a popup named @code{prefix-foo-popup} the name of this function is @code{prefix-foo-arguments}. When the command was invoked as an action in the respective popup, then this function returns the arguments that were set in the popup. Otherwise when the command was invoked as the default of the popup (by calling the popup command with a prefix argument), or without using the popup command at all, then this function returns the buffer-local or global value of the variable @code{SHORTNAME-arguments}. Internally arguments are handled as a list of strings. This might not be appropriate for the intended use inside commands, or it might be necessary to manipulate that list somehow, i.e. to split "--ARG=VAL" into "--ARG""VAL". This should be done by advising or redefining the function @code{SHORTNAME-arguments}. Internally @code{SHORNAME-arguments} used following variables and function. Except when redefining the former, you should not use these directly. @defvar magit-current-popup The popup from which this editing command was invoked. @end defvar @defvar magit-current-popup-args The value of the popup arguments for this editing command. If the current command was invoked from a popup, then this is a list of strings of all the set switches and options. This includes arguments which are set by default not only those explicitly set during this invocation. When the value is nil, then that can be because no argument is set, or because the current command wasn't invoked from a popup at all. @end defvar @defun magit-current-popup-args &rest args This function returns the value of the popup arguments for this editing command. The value is the same as that of the variable by the same name, except that FILTER is applied. FILTER is a list of regexps; only arguments that match one of them are returned. The first element of FILTER may also be @code{:not} in which case only arguments that don't match any of the regexps are returned, or @code{:only} which doesn't change the behavior. @end defun @bye