commit 74daf568d8eff69cb86795622900ca66e8e92a9e parent bd549ad0e9d6292a8be536af54c8680d3e4de353 Author: Mark Feller <mark.feller@member.fsf.org> Date: Thu, 26 Sep 2019 11:23:52 -0600 track emacs config Diffstat:
A | dots/.emacs.d/.gitignore | | | 12 | ++++++++++++ |
A | dots/.emacs.d/LICENSE | | | 675 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/README | | | 35 | +++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-bootstrap.el | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-defuns.el | | | 208 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-osx.el | | | 69 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-packages.el | | | 262 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-paths.el | | | 67 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/core/core-ui.el | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/etc/.keep | | | 0 | |
A | dots/.emacs.d/init.el | | | 133 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/.keep | | | 0 | |
A | dots/.emacs.d/lisp/helm/LICENSE | | | 674 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/helm/helm.el | | | 372 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/kubel/LICENSE | | | 674 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/kubel/README.md | | | 78 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/kubel/kubel.el | | | 487 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/lisp/redeam.el | | | 102 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-avy.el | | | 30 | ++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-bbdb.el | | | 31 | +++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-benchmarking.el | | | 30 | ++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-c.el | | | 31 | +++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-clojure.el | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-company.el | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-css.el | | | 33 | +++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-csv.el | | | 28 | ++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-docker.el | | | 30 | ++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-eldoc.el | | | 29 | +++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-emacs-lisp.el | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-eshell.el | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-evil.el | | | 91 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-git.el | | | 62 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-gitlab.el | | | 1 | + |
A | dots/.emacs.d/modules/module-go.el | | | 123 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-god-mode.el | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-gruvbox.el | | | 3 | +++ |
A | dots/.emacs.d/modules/module-haskell.el | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-hydra.el | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-js.el | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-kubernetes.el | | | 10 | ++++++++++ |
A | dots/.emacs.d/modules/module-ledger.el | | | 32 | ++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-lsp.el | | | 9 | +++++++++ |
A | dots/.emacs.d/modules/module-lua.el | | | 31 | +++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-markdown.el | | | 8 | ++++++++ |
A | dots/.emacs.d/modules/module-mastodon.el | | | 3 | +++ |
A | dots/.emacs.d/modules/module-multiple-cursors.el | | | 10 | ++++++++++ |
A | dots/.emacs.d/modules/module-neotree.el | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-notmuch.el | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-org.el | | | 119 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-pretty.el | | | 112 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-projectile.el | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-protobuf.el | | | 30 | ++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-python.el | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-r.el | | | 29 | +++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-restclient.el | | | 31 | +++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-rust.el | | | 75 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-scheme.el | | | 33 | +++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-solarized.el | | | 124 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-sql.el | | | 31 | +++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-tex.el | | | 28 | ++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-toml.el | | | 28 | ++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-undo-tree.el | | | 6 | ++++++ |
A | dots/.emacs.d/modules/module-vagrant.el | | | 5 | +++++ |
A | dots/.emacs.d/modules/module-web.el | | | 28 | ++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-yaml.el | | | 28 | ++++++++++++++++++++++++++++ |
A | dots/.emacs.d/modules/module-yasnippet.el | | | 34 | ++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/network-security.data | | | 3 | +++ |
A | dots/.emacs.d/snippets/go-mode/append | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/benchmark | | | 10 | ++++++++++ |
A | dots/.emacs.d/snippets/go-mode/case | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/constructor | | | 10 | ++++++++++ |
A | dots/.emacs.d/snippets/go-mode/dd | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/else | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/elseif | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/error | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/example | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/for | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/forrange | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/func | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/ginkgo-describe | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/ginkgo-import | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/ginkgo-it | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/go | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/gomega-equal | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/gomega-error | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/gomega-no-error | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/if | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/import | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/init | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/interface | | | 6 | ++++++ |
A | dots/.emacs.d/snippets/go-mode/it | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/main | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/map | | | 6 | ++++++ |
A | dots/.emacs.d/snippets/go-mode/method | | | 10 | ++++++++++ |
A | dots/.emacs.d/snippets/go-mode/package | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/printf | | | 7 | +++++++ |
A | dots/.emacs.d/snippets/go-mode/struct | | | 8 | ++++++++ |
A | dots/.emacs.d/snippets/go-mode/switch | | | 10 | ++++++++++ |
A | dots/.emacs.d/snippets/go-mode/test | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/testmain | | | 22 | ++++++++++++++++++++++ |
A | dots/.emacs.d/snippets/go-mode/tests | | | 17 | +++++++++++++++++ |
A | dots/.emacs.d/snippets/go-mode/trun | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/go-mode/wrap-error | | | 9 | +++++++++ |
A | dots/.emacs.d/snippets/org-mode/el | | | 7 | +++++++ |
A | dots/.emacs.d/theme/poet-fork/LICENSE | | | 21 | +++++++++++++++++++++ |
A | dots/.emacs.d/theme/poet-fork/README.md | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/theme/poet-fork/poet-theme.el | | | 310 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/theme/poet-fork/tests/test.md | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/theme/poet-fork/tests/test.org | | | 33 | +++++++++++++++++++++++++++++++++ |
A | dots/.emacs.d/transient/history.el | | | 2 | ++ |
110 files changed, 6777 insertions(+), 0 deletions(-)
diff --git a/dots/.emacs.d/.gitignore b/dots/.emacs.d/.gitignore @@ -0,0 +1,11 @@ +*.elc +/elpa/ +/etc/* +/games/ +/lisp/* +/src/ + +!.keep +!/lisp/kubel +!/lisp/helm +!/lisp/redeam.el+ \ No newline at end of file diff --git a/dots/.emacs.d/LICENSE b/dots/.emacs.d/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>.+ \ No newline at end of file diff --git a/dots/.emacs.d/README b/dots/.emacs.d/README @@ -0,0 +1,34 @@ +Installation + +To install, clone this repo to ~/.emacs.d. + + git clone https://gitlab.com/mark.feller/emacs.d ~/.emacs.d + +Upon starting up Emacs for the first time, packages will be downloaded and +installed via the public repos. If you encounter any errors at that stage, try +restarting Emacs, and possibly running 'M-x package-refresh-contents' before +doing so. After successfully installing packages future startups will be much +faster. + +There are several subdirectories: + +'core' holds primary configuration that I feel lost without. +'elpa' holds vendored packages from package.el. +'etc' holds configuration files for packages, files often written to + like bookmarks.el, and the custom.el file used when configuring + emacs through the customization interface. +'lisp' holds custom user lisp code. Useful for personal packages, + personal information, etc. +'modules' holds package/language specific configuration that is useful when + working with specific tasks or within specific languages, but are + not needed generally. +'src' holds the Emacs source directory for jumping to definition and + viewing docs within the C code. +'snippets' holds Yasnippet snippets. +'theme' holds theme packages. Poet is my current goto. + +Disclaimer + +This is an everchanging and evolving Emacs configuration for my personal use. I +see this repo more as a collection of ideas to be incorporated into your own +configurations.+ \ No newline at end of file diff --git a/dots/.emacs.d/core/core-bootstrap.el b/dots/.emacs.d/core/core-bootstrap.el @@ -0,0 +1,49 @@ +;;; core-bootstrap.el --- bootstrap for use-package + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Setup Emacs package repos and grab use-package for rest of package +;; management. + +;;; Code: + +(require 'package) + +(setq package-archives + '(("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") + ("gnu" . "http://elpa.gnu.org/packages/") + ("org" . "http://orgmode.org/elpa/"))) + +(package-initialize) + +;; bootstrap use-package +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package) + (package-install 'diminish) + (package-install 'bind-key) + (package-install 'bind-chord)) + +(require 'use-package) +(setq use-package-always-ensure t) + +(provide 'core-bootstrap) + +;;; core-bootstrap.el ends here diff --git a/dots/.emacs.d/core/core-defuns.el b/dots/.emacs.d/core/core-defuns.el @@ -0,0 +1,208 @@ +;;; core-defuns.el --- personal defuns + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(defun server-shutdown () + "Save buffers, Quit, and Shutdown (kill) server" + (interactive) + (save-some-buffers) + (kill-emacs)) + +(defun iwb() + "Indent Whole Buffer" + (interactive) + (delete-trailing-whitespace) + (indent-region (point-min) (point-max) nil) + (untabify (point-min) (point-max))) + +(defun transpose-words (arg) + "[Override for default transpose-words in simple.el] + Interchange words around point, leaving point at end of + them. With prefix arg ARG, effect is to take word before or + around point and drag it backward past ARG other words (forward + if ARG negative). If ARG is zero, the words around or after + point and around or after mark are interchanged." + (interactive "*p") + (if (eolp) (forward-char -1)) + (transpose-subr 'backward-word arg) + (forward-word (+ arg 1))) + +(defun untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer. +Including indent-buffer, which should not be called automatically on save." + (interactive) + (untabify-buffer) + (delete-trailing-whitespace) + (indent-buffer)) + +(defun toggle-window-split () + "Toggle the current window split." + (interactive) + (if (= (count-windows) 2) + (let* ((this-win-buffer (window-buffer)) + (next-win-buffer (window-buffer (next-window))) + (this-win-edges (window-edges (selected-window))) + (next-win-edges (window-edges (next-window))) + (this-win-2nd (not (and (<= (car this-win-edges) + (car next-win-edges)) + (<= (cadr this-win-edges) + (cadr next-win-edges))))) + (splitter + (if (= (car this-win-edges) + (car (window-edges (next-window)))) + 'split-window-horizontally + 'split-window-vertically))) + (delete-other-windows) + (let ((first-win (selected-window))) + (funcall splitter) + (if this-win-2nd (other-window 1)) + (set-window-buffer (selected-window) this-win-buffer) + (set-window-buffer (next-window) next-win-buffer) + (select-window first-win) + (if this-win-2nd (other-window 1)))))) + +(defun toggle-fullscreen () + "Toggle full screen" + (interactive) + (set-frame-parameter + nil 'fullscreen + (when (not (frame-parameter nil 'fullscreen)) 'fullboth))) + +(defun info-mode () + (interactive) + (let ((file-name (buffer-file-name))) + (kill-buffer (current-buffer)) + (info file-name))) +(add-to-list 'auto-mode-alist '("\\.info\\'" . info-mode)) + +(defadvice move-beginning-of-line (around smarter-bol activate) + ;; Move to requested line if needed. + (let ((arg (or (ad-get-arg 0) 1))) + (when (/= arg 1) + (forward-line (1- arg)))) + ;; Move to indentation on first call, then to actual BOL on second. + (let ((pos (point))) + (back-to-indentation) + (when (= pos (point)) + ad-do-it))) + +;; If the *scratch* buffer is killed, recreate it automatically +;; FROM: Morten Welind +;;http://www.geocrawler.com/archives/3/338/1994/6/0/1877802/ +(save-excursion + (set-buffer (get-buffer-create "*scratch*")) + (lisp-interaction-mode) + (make-local-variable 'kill-buffer-query-functions) + (add-hook 'kill-buffer-query-functions 'kill-scratch-buffer)) + +(defun kill-scratch-buffer () + ;; The next line is just in case someone calls this manually + (set-buffer (get-buffer-create "*scratch*")) + ;; Kill the current (*scratch*) buffer + (remove-hook 'kill-buffer-query-functions 'kill-scratch-buffer) + (kill-buffer (current-buffer)) + ;; Make a brand new *scratch* buffer + (set-buffer (get-buffer-create "*scratch*")) + (lisp-interaction-mode) + (make-local-variable 'kill-buffer-query-functions) + (add-hook 'kill-buffer-query-functions 'kill-scratch-buffer) + ;; Since we killed it, don't let caller do that. + nil) + +(defun save-buffer-without-dtw () + (interactive) + (let ((b (current-buffer))) ; memorize the buffer + (with-temp-buffer ; new temp buffer to bind the global value of before-save-hook + (let ((before-save-hook (remove 'delete-trailing-whitespace before-save-hook))) + (with-current-buffer b ; go back to the current buffer, before-save-hook is now buffer-local + (let ((before-save-hook (remove 'delete-trailing-whitespace before-save-hook))) + (save-buffer))))))) + +(defun narrow-or-widen-dwim (p) + "Widen if buffer is narrowed, narrow-dwim otherwise. +Dwim means: region, org-src-block, org-subtree, or +defun, whichever applies first. Narrowing to +org-src-block actually calls `org-edit-src-code'. + +With prefix P, don't widen, just narrow even if buffer +is already narrowed." + (interactive "P") + (declare (interactive-only)) + (cond ((and (buffer-narrowed-p) (not p)) (widen)) + ((region-active-p) + (narrow-to-region (region-beginning) + (region-end))) + ((derived-mode-p 'org-mode) + ;; `org-edit-src-code' is not a real narrowing + ;; command. Remove this first conditional if + ;; you don't want it. + (cond ((ignore-errors (org-edit-src-code) t) + (delete-other-windows)) + ((ignore-errors (org-narrow-to-block) t)) + (t (org-narrow-to-subtree)))) + ((derived-mode-p 'latex-mode) + (LaTeX-narrow-to-environment)) + (t (narrow-to-defun)))) + +;; (define-key endless/toggle-map "n" +;; #'narrow-or-widen-dwim) +;; This line actually replaces Emacs' entire narrowing +;; keymap, that's how much I like this command. Only +;; copy it if that's what you want. +(define-key ctl-x-map "n" #'narrow-or-widen-dwim) +(add-hook 'LaTeX-mode-hook + (lambda () + (define-key LaTeX-mode-map "\C-xn" + nil))) + +(defun toggle-modeline () + (interactive) + (if (not (consp mode-line-format)) + (setq mode-line-format (default-value 'mode-line-format)) + (setq mode-line-format nil))) + +(defun resize-small () + (interactive) + (set-frame-width (selected-frame) 85) + (set-frame-height (selected-frame) 50)) + +(defun resize-wide () + (interactive) + (set-frame-width (selected-frame) 200) + (set-frame-height (selected-frame) 50)) + +(defun resize-big () + (interactive) + (set-frame-width (selected-frame) 240) + (set-frame-height (selected-frame) 70)) + +(provide 'core-defuns) + +;;; core-defuns.el ends here diff --git a/dots/.emacs.d/core/core-osx.el b/dots/.emacs.d/core/core-osx.el @@ -0,0 +1,69 @@ +;;; core-osx.el --- solarized module for my emacs + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. +;;; Commentary: + +;;; Code: + +;; transparent title bar +(use-package ns-auto-titlebar + :config (ns-auto-titlebar-mode)) + +(setq ns-use-srgb-colorspace t) +(setq ns-use-proxy-icon nil) ; hide icon in title bar +(setq frame-title-format nil) ; hide text in title bar +(menu-bar-mode t) ; use macos menu bar + +(setq mac-option-modifier 'meta) +(setq mac-command-modifier 'hyper) + +;; Enable emoji, and stop the UI from freezing when trying to display them. +(if (fboundp 'set-fontset-font) + (set-fontset-font t 'unicode "Apple Color Emoji" nil 'prepend)) + +(use-package exec-path-from-shell + :demand + :config (exec-path-from-shell-initialize)) + +(defun finder () + "Opens file directory in Finder." + (interactive) + (let ((file (buffer-file-name))) + (if file + (shell-command + (format "%s %s" (executable-find "open") (file-name-directory file))) + (error "Buffer is not attached to any file.")))) + +(when (not (display-graphic-p)) + (defun bw/copy-from-osx () + "Copies the current clipboard content using the `pbcopy` command" + (shell-command-to-string "pbpaste")) + + (defun bw/paste-to-osx (text &optional push) + "Copies the top of the kill ring stack to the OSX clipboard" + (let ((process-connection-type nil)) + (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) + (process-send-string proc text) + (process-send-eof proc)))) + + (setq interprogram-cut-function 'bw/paste-to-osx) + (setq interprogram-paste-function 'bw/copy-from-osx)) + +(provide 'core-osx) + +;;; core-osx.el ends here diff --git a/dots/.emacs.d/core/core-packages.el b/dots/.emacs.d/core/core-packages.el @@ -0,0 +1,262 @@ +;;; core-packages.el --- Core packages for my Emacs config + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. +;;; Commentary: + +;;; Code: + +;; (use-package paradox +;; :config +;; (progn (paradox-enable) +;; (add-hook 'paradox-menu-mode-hook (lambda () (display-line-numbers-mode 0))))) + +(use-package swiper + :demand + :delight (ivy-mode) + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-c u" . swiper-all) + ("C-c C-r" . ivy-resume) + ("C-c C-o" . ivy-occur) + ("C-c C-b" . ivy-switch-buffer) + ("C-c C-k" . kill-buffer)) + :config + (progn (ivy-mode 1) + (setq ivy-height 6) + (setq enable-recursive-minibuffers t) + (setq swiper-include-line-number-in-search t) + (define-key ivy-minibuffer-map (kbd "TAB") 'ivy-partial-or-done))) + +;; ivy sorted via smex +(use-package smex + :demand + :config (setq smex-save-file (concat persistent-dir "/smex-items"))) + +(use-package counsel + :after (ivy) + :demand + :bind (("M-x" . counsel-M-x) + ("C-x C-f" . counsel-find-file) + ("C-h f" . counsel-describe-function) + ("C-h v" . counsel-describe-variable) + ("C-c f r" . counsel-recentf) + ("C-c g" . counsel-git) + ("C-c /" . counsel-git-grep) + ("M-y" . counsel-yank-pop))) + +(use-package saveplace + :config + (progn (setq save-place-file (concat persistent-dir "/places") + backup-by-copying t + delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t))) + +(use-package ibuffer + :bind (("C-x C-b" . ibuffer) + :map ibuffer-mode-map + ("/ m" . ibuffer-set-filter-groups-by-mode)) + :config + (progn (setq ibuffer-default-sorting-mode 'major-mode + ibuffer-display-summary nil) + + (defun ibuffer-get-major-modes-ibuff-rules-list (mm-list result-list) + (if mm-list + (let* ((cur-mm (car mm-list)) + (next-res-list-el `(,(symbol-name cur-mm) (mode . ,cur-mm)))) + (ibuffer-get-major-modes-ibuff-rules-list + (cdr mm-list) (cons next-res-list-el result-list))) + result-list)) + + (defun ibuffer-get-major-modes-list () + (mapcar + (function (lambda (buffer) + (buffer-local-value 'major-mode (get-buffer buffer)))) + (buffer-list (selected-frame)))) + + (defun ibuffer-create-buffs-group () + (interactive) + (let* ((ignore-modes '(Buffer-menu-mode + compilation-mode + minibuffer-inactive-mode + ibuffer-mode + magit-process-mode + messages-buffer-mode + fundamental-mode + completion-list-mode + help-mode + Info-mode)) + (cur-bufs + (list (cons "Home" + (ibuffer-get-major-modes-ibuff-rules-list + (cl-set-difference + (remove-duplicates + (ibuffer-get-major-modes-list)) + ignore-modes) '()))))) + (setq ibuffer-saved-filter-groups cur-bufs) + (ibuffer-switch-to-saved-filter-groups "Home"))) + + (autoload 'ibuffer "ibuffer" "List buffers." t) + + (defun ibuffer-group-by-modes () + "Group buffers by modes." + (ibuffer-create-buffs-group)) + + (add-hook 'ibuffer-hook 'ibuffer-group-by-modes) + + (setq ibuffer-expert t) + + ;; Environment Variables + (setq ibuffer-show-empty-filter-groups nil) + (setq ibuffer-marked-char ?-) + (add-hook 'ibuffer-mode-hook (lambda () (ibuffer-auto-mode 1))) + + (defadvice ibuffer-update-title-and-summary (after remove-column-titles) + (with-no-warnings + (save-excursion + (set-buffer "*Ibuffer*") + (toggle-read-only 0) + (goto-char 1) + (search-forward "-\n" nil t) + (delete-region 1 (point)) + ;; (let ((window-min-height 1)) + ;; ;; save a little screen estate + ;; (shrink-window-if-larger-than-buffer)) + (toggle-read-only)))) + + (ad-activate 'ibuffer-update-title-and-summary) + + ;; Use human readable Size column instead of original one + (define-ibuffer-column size-h + (:name "Size" :inline t) + (cond + ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) + ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) + ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) + (t (format "%8d" (buffer-size))))) + + ;; Modify the default ibuffer-formats + (setq ibuffer-formats + '((mark modified read-only " " + (name 18 18 :left :elide) + " " + (size-h 9 -1 :right) + " " + (mode 16 16 :left :elide) + " " + filename-and-process))))) + +(use-package autopair + :delight (autopair-mode) + :config (autopair-global-mode)) + +(global-auto-revert-mode t) + +(use-package comment-dwim-2 + :bind (("M-;" . comment-dwim-2))) + +(use-package dired + :ensure nil + :bind (("C-x C-j" . dired-jump)) + :config + (progn (setq wdired-use-dired-vertical-movement 'sometimes) + + (set-face-attribute 'dired-directory nil + :inherit 'default + :foreground "#839496" + :weight 'bold) + + (setq dired-listing-switches "-la") + + (defun dired-sort-dir-first () + "Sort dired listings with directories first." + (save-excursion + (let (buffer-read-only) + (forward-line 2) ;; beyond dir. header + (sort-regexp-fields t "^.*$" "[ ]*." (point) (point-max))) + (set-buffer-modified-p nil))) + + (defadvice dired-readin + (after dired-after-updating-hook first () activate) + "Sort dired listings with directories first before adding marks." + (dired-sort-dir-first)))) + +;; better describe +(use-package helpful + :bind (("C-h f" . helpful-function) + ("C-h o" . helpful-symbol) + ("C-h k" . helpful-key) + ("C-h v" . helpful-variable))) + +(use-package rg + :config + (progn (rg-enable-default-bindings (kbd "M-s")) + (setq rg-executable "/usr/local/bin/rg"))) + +;; window management +(bind-keys + ("H-e" . windmove-up) + ("H-d" . windmove-down) + ("H-f" . windmove-right) + ("H-s" . windmove-left) + + ;; Window Resizing + ("H-E" . enlarge-window) + ("H-D" . shrink-window) + ("H-F" . enlarge-window-horizontally) + ("H-S" . shrink-window-horizontally) + + ;; Window Splitting + ("H-v" . split-window-vertically) + ("H-r" . split-window-horizontally) + ("H-w" . delete-window) + ("H-q" . delete-other-windows) + + ;; Misc Window Commands + ("H-a" . balance-windows) + ("H-t" . toggle-window-split) + ("H-<return>". toggle-fullscreen)) + +(use-package bind-chord + :config + (progn + (key-chord-mode 1) + + (bind-chords + ("wh" . windmove-left) + ("wj" . windmove-down) + ("wk" . windmove-up) + ("wl" . windmove-right) + + ("wt" . split-window-horizontally) + ("wv" . split-window-vertically) + ("wq" . delete-window) + ("wa" . balance-windows)) + + (setq key-chord-two-key-delay 0.075))) + +(delight 'subword-mode "" "subword") + +;; woman +(add-hook 'woman-mode-hook (lambda () (display-line-numbers-mode 0))) +(add-hook 'Man-mode-hook (lambda () (display-line-numbers-mode 0))) + +(provide 'core-packages) + +;;; core-packages.el ends here diff --git a/dots/.emacs.d/core/core-paths.el b/dots/.emacs.d/core/core-paths.el @@ -0,0 +1,67 @@ +;;; core-paths.el --- path confiugration for my emacs + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. +;;; Commentary: + +;; move all the misc files created by emacs into a seperate directory to +;; decluter emacs config root + +;;; Code: + +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) + +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) + +(setq auto-save-list-file-prefix + (concat persistent-dir "/auto-save-list/.saves-")) + +(setq bookmark-default-file + (concat persistent-dir "bookmarks.el")) + +(setq ede-project-placeholder-cache-file + (concat temporary-file-directory "/ede-projects.el")) + +(setq semanticdb-default-save-directory + (concat temporary-file-directory "/semanticdb")) + +(setq abbrev-file-name + (concat persistent-dir "/abbrev_defs.el")) + +(setq tramp-persistency-file-name + (concat persistent-dir "/tramp.el")) + +(setq recentf-save-file + (concat persistent-dir "/recentf")) + +(setq org-id-locations-file + (concat persistent-dir "/org-id-locations.el")) + +(setq nsm-settings-file + (concat persistent-dir "/network-security.data")) + +(setq url-configuration-directory + (concat persistent-dir "/url/")) + +(unless (file-exists-p custom-file) + (write-region "" nil custom-file)) + +(provide 'core-paths) + +;;; core-paths.el ends here diff --git a/dots/.emacs.d/core/core-ui.el b/dots/.emacs.d/core/core-ui.el @@ -0,0 +1,84 @@ +;;; core-ui.el --- ui configuration for my emacs + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(when (fboundp 'tool-bar-mode) + (tool-bar-mode -1)) + +(menu-bar-mode -1) + +(when (fboundp 'scroll-bar-mode) + (scroll-bar-mode -1)) + +(blink-cursor-mode -1) ; the blinking cursor is nothing, but an annoyance +(setq ring-bell-function 'ignore) ; disable the annoying bell ring +(setq inhibit-startup-screen t) ; disable startup screen +(fset 'yes-or-no-p 'y-or-n-p) ; enable y/n answers + +;; nice scrolling +(setq scroll-margin 0 + scroll-conservatively 100000 + scroll-preserve-screen-position 1) + +;; mode line numbers +(line-number-mode 0) +(column-number-mode t) + +(delete-selection-mode t) ; Delete Marked regions +(show-paren-mode t) ; Show matching parenthesis + +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) +(setq-default indicate-empty-lines nil) + +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(prefer-coding-system 'utf-8) + +(setq-default fill-column 80) + +(add-hook 'before-save-hook 'whitespace-cleanup) + +(setq echo-keystrokes 0.1) + +(setq frame-resize-pixelwise t) + +(defun on-after-init () + (unless (display-graphic-p (selected-frame)) + (set-face-background 'default "unspecified-bg" (selected-frame)))) +(add-hook 'window-setup-hook 'on-after-init) + +;; line numbers +(setq-default display-line-numbers-width 4) +(setq display-line-numbers-type 'relative + display-line-numbers-current-absolute t + display-line-numbers-widen nil) ; don't count narrowed regions + +(global-display-line-numbers-mode) + +;; add some padding around the entire frame and fringes +(set-fringe-mode 15) +(set-frame-parameter nil 'internal-border-width 10) + +(provide 'core-ui) + +;;; core-ui.el ends here diff --git a/dots/.emacs.d/etc/.keep b/dots/.emacs.d/etc/.keep diff --git a/dots/.emacs.d/init.el b/dots/.emacs.d/init.el @@ -0,0 +1,133 @@ +;;; init.el --- initialize + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +;;--------------------------------------------------------------------- +;; Init +;;--------------------------------------------------------------------- + +;; Added by Package.el. This must come before configurations of +;; installed packages. Don't delete this line. If you don't want it, +;; just comment it out by adding a semicolon to the start of the line. +;; You may delete these explanatory comments. +(package-initialize) + +(defvar current-user + (getenv + (if (equal system-type 'windows-nt) "USERNAME" "USER"))) + +(message "Powering up... Be patient, Master %s!" current-user) + +(when (version< emacs-version "24.4") + (error "Requires at least GNU Emacs 24.4, but you're running %s" emacs-version)) + +;; Always load newest byte code +(setq load-prefer-newer t) + +;; reduce the frequency of garbage collection by making it happen on +;; each 50MB of allocated data (the default is on every 0.76MB) +(setq gc-cons-threshold 50000000) + +;; warn when opening files bigger than 100MB +(setq large-file-warning-threshold 100000000) + +(setq inhibit-startup-echo-area-message t) + +;;--------------------------------------------------------------------- +;; Variables and Load Paths +;;--------------------------------------------------------------------- + +(defvar emacs-dir (file-name-directory "~/.emacs.d/") + "The root dir of the Emacs distribution.") + +(defvar core-dir (expand-file-name "core" emacs-dir) + "The home of core functionality.") + +(defvar modules-dir (expand-file-name "modules" emacs-dir) + "This directory houses all of the modules.") + +(defvar persistent-dir (expand-file-name "etc" emacs-dir) + "This directory houses files created by emacs packages") + +(defvar lisp-dir (expand-file-name "lisp" emacs-dir) + "This directory houses user lisp and site lisp") + +(unless (file-exists-p persistent-dir) + (make-directory persistent-dir)) + +(if (file-exists-p (concat emacs-dir "src")) + (setq source-directory (concat emacs-dir "src"))) + +(add-to-list 'load-path core-dir) +(add-to-list 'load-path modules-dir) +(add-to-list 'load-path lisp-dir) + +;; load the custom file +(setq custom-file (concat persistent-dir "/custom.el")) +(unless (file-exists-p custom-file) + (write-region "" nil custom-file)) +(load custom-file) + +(require 'init-preload-local nil t) + +;;--------------------------------------------------------------------- +;; Core +;;--------------------------------------------------------------------- + +(message "Loading core...") + +(require 'core-bootstrap) +(require 'core-ui) +(when (eq system-type 'darwin) (require 'core-osx)) +(require 'core-packages) +(require 'core-defuns) +(require 'core-paths) + +;;--------------------------------------------------------------------- +;; Modules +;;--------------------------------------------------------------------- + +(message "Loading modules...") + +(require 'module-bbdb) +(require 'module-c) +(require 'module-company) +(require 'module-eldoc) +(require 'module-emacs-lisp) +(require 'module-evil) +(require 'module-git) +(require 'module-go) +(require 'module-multiple-cursors) +(require 'module-org) +(require 'module-projectile) +(require 'module-protobuf) +(require 'module-python) +(require 'module-restclient) +(require 'module-yaml) +(require 'module-yasnippet) + +;; load any custom user provided locals +(require 'init-local nil t) + +(message "Ready to do thy bidding, Master %s!" current-user) + +;;; init.el ends here diff --git a/dots/.emacs.d/lisp/.keep b/dots/.emacs.d/lisp/.keep diff --git a/dots/.emacs.d/lisp/helm/LICENSE b/dots/.emacs.d/lisp/helm/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/dots/.emacs.d/lisp/helm/helm.el b/dots/.emacs.d/lisp/helm/helm.el @@ -0,0 +1,372 @@ +;;; helm.el --- extension for controlling Kubernetes with limited permissions -*- lexical-binding: t; -*- + +;; Copyright (C) 2019, Mark Feller + +;; This file is NOT part of Emacs. + +;; 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 2 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, write to the Free Software +;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +;; USA + +;; Version: 0.1 +;; Author: Mark Feller +;; Keywords: helm k8s tools processes +;; License: GNU General Public License >= 3 +;; Package-Requires: ((transient "0.1.0") (emacs "25.3")) + +;;; Commentary: + +;;; Usage: + +;; M-x helm + +;;; Code: + +(require 'transient) + +(defvar helm-command "helm" + "Helm binary") + +(defvar kubectl-command "kubectl" + "Kubectl binary") + +(defconst helm--list-format + [("Name" 30 t) + ("Revision" 10 t) + ("Updated" 30 t) + ("Status" 10 t) + ("Chart" 20 t) + ("AppVersion" 10 t) + ("Namespace" 10 t)] + "List format.") + +(defvar helm-context + (replace-regexp-in-string + "\n" "" (shell-command-to-string "kubectl config current-context")) + "current context. tries to smart default.") + +(defun helm-set-context () + "Set the context." + (interactive) + (setq helm-context + (completing-read + "Select context: " + (split-string (shell-command-to-string "kubectl config view -o jsonpath='{.contexts[*].name}'") " "))) + (helm)) + +(defconst helm--list-sort-key + '("Name" . nil) + "Sort table on this key.") + +(defun helm--get-context () + "Utility function to return the proper context and namespace arguments." + (unless (equal helm-context "") + (list "--kube-context" helm-context))) + +(defun helm--buffer-name () + "Return helm buffer name." + (concat "*helm [" helm-context "]*")) + +(defun helm--propertize-status (status) + "Return the status in proper font color. + +STATUS is the pod status string." + (let ((pair (cdr (assoc status helm--status-colors)))) + (if pair + (propertize status 'font-lock-face `(:foreground ,pair)) + status))) + +(defun helm--get-command-prefix () + "Utility function to prefix the kubectl command with proper context and namespace." + (mapconcat 'identity (append '("helm") (helm--get-context)) " ")) + +(defun helm--list-entries () + "Create the entries for the service list." + (let ((output (helm--exec-string '("ls --output json")))) + (mapcar (lambda (x) + (list (cdr (car x)) + (vconcat (mapcar (lambda (y) + (format "%s" (cdr y))) x)))) + (cdr (car (cdr (json-read-from-string output))))))) + +(defun helm--exec (buffer-name async args) + "Utility function to run commands in the proper context and namespace. + +\"BUFFER-NAME\" is the buffer-name. Default to *helm-command*. +ASYNC is a bool. If true will run async. +ARGS is a ist of arguments." + (when (equal buffer-name "") + (setq buffer-name "*helm-command*")) + (when (get-buffer buffer-name) + (kill-buffer buffer-name)) + (if async + (apply #'start-process buffer-name buffer-name "helm" (append (helm--get-context) args)) + (apply #'call-process "helm" nil buffer-name nil (append (helm--get-context) args))) + (pop-to-buffer buffer-name)) + +(defun helm--exec-string (args) + "" + (shell-command-to-string + (mapconcat 'identity (append '("helm") (helm--get-context) args) " "))) + +(defun helm--pop-to-buffer (name) + "Utility function to pop to buffer or create it. + +NAME is the buffer name." + (unless (get-buffer name) + (get-buffer-create name)) + (pop-to-buffer name)) + +(defun helm--get-chart-under-cursor () + "Utility function to get the name of the pod under the cursor." + (aref (tabulated-list-get-entry) 0)) + +(defun helm-get-values (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Values - %s*" chart))) + (helm--exec buffer-name nil `("get" "values" ,chart)))) + +(defun helm-get-notes (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Notes - %s*" chart))) + (helm--exec buffer-name nil `("get" "notes" ,chart)))) + +(defun helm-get-manifest (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Manifest - %s*" chart))) + (helm--exec buffer-name nil `("get" "manifest" ,chart)))) + +(defun helm-get-hooks (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Hooks - %s*" chart))) + (helm--exec buffer-name nil `("get" "hooks" ,chart)))) + +(defun helm-get-status (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Status - %s*" chart))) + (helm--exec buffer-name nil `("status" ,chart)))) + +(defun helm-get-history (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm History - %s*" chart))) + (helm--exec buffer-name nil `("history" ,chart)))) + +(defun helm-rollback (revision &optional args) + "test" + (interactive (list (read-string "Revision: ") + (transient-args 'helm-rollback-popup))) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm History - %s*" chart))) + (message "Revision:" revision) + (let ((arg (append '("rollback") args (list chart revision)))) + (helm--exec buffer-name nil arg)))) + +(defun helm-delete (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm History - %s*" chart))) + (helm--exec buffer-name nil `("delete" ,chart)))) + +(defun helm-search (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm History - %s*" chart))) + (helm--exec buffer-name nil (list "search")))) + +(defun helm-repo-list (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Repo Add - %s*" chart))) + (helm--exec buffer-name nil (list "repo" "list")))) + +(defun helm-repo-list (&optional args) + "test" + (interactive) + (let* ((chart (helm--get-chart-under-cursor)) + (buffer-name (format "*Helm Repo Add - %s*" chart))) + (helm--exec buffer-name nil (list "repo" "update")))) + +(defun helm-version (&optional args) + (interactive (list (transient-args 'helm-version-popup))) + (let ((buffer-name (format "*Helm Version*"))) + (if (member "--short" args) + (message (helm--exec-string (append '("version") args))) + (helm--exec buffer-name nil (append '("version") args))))) + +;; ---------------------------------------------------------------------- +;; popups +;; ---------------------------------------------------------------------- + +(define-transient-command helm-history-popup () + "Helm History Menu" + ["Arguments" + ("-y" "YAML" "-o yaml") + ("-j" "JSON" "-o json") + ("--max" "Max revisions" "--max=10")] + ["Actions" + ("h" "History" helm-get-history)]) + +(define-transient-command helm-get-popup () + "Helm Values Menu" + ["Arguments" + ("-r" "revision" "--revision=")] + ["Actions" + ("v" "Values" helm-get-values) + ("n" "Notes" helm-get-notes) + ("m" "Manifest" helm-get-manifest) + ("h" "Hooks" helm-get-hooks)]) + +(define-transient-command helm-repo-popup () + "Helm Values Menu" + ["Arguments" + ("-r" "revision" "--revision=")] + ["Actions" + ;; ("a" "Add" helm-repo-add) + ;; ("i" "Index" helm-repo-index) + ("l" "List" helm-repo-list) + ;; ("r" "Remove" helm-repo-remove) + ("u" "Update" helm-repo-update) + ]) + +(define-transient-command helm-rollback-popup () + "Helm Rollback Menu" + ["Arguments" + ("-d" "simulate a rollback" "--dry-run") + ("-f" "force resource update" "--force") + ("-r" "performs pods restart if applicable" "--recreate-pods") + ("-D" "specify a description for he release" "--description=")] + ["Actions" + ("r" "Rollback" helm-rollback)]) + +(define-transient-command helm-delete-popup () + "Helm Rollback Menu" + ["Arguments" + ("-d" "simulate a rollback" "--dry-run") + ("-p" "remove the release from the store and make its name free for later use" "--purge") + ("-D" "specify a description for he release" "--description=")] + ["Actions" + ("k" "Delete" helm-delete)]) + +(define-transient-command helm-values-popup () + "Helm Values Menu" + ["Arguments" + ("-y" "YAML" "-o yaml") + ("-j" "JSON" "-o json") + ("-a" "dump all (computed) values" "--all") + ("-r" "revision" "--revision=")] + ["Actions" + ("v" "Values" helm-get-values)]) + +(define-transient-command helm-status-popup () + "Helm Values Menu" + ["Arguments" + ("-y" "YAML" "-o yaml") + ("-j" "JSON" "-o json") + ("-r" "Revision" "--revision=")] + ["Actions" + ("s" "Status" helm-get-status)]) + +(define-transient-command helm-search-popup () + "Helm Search Packges Menu" + ["Arguments" + ("-y" "yaml output format" "-o yaml") + ("-j" "json output format" "-o json") + ("-l" "long listings with each version on it's own line" "--versions") + ("-r" "Regexp" "")] + ["Actions" + ("S" "Search" helm-search)]) + +(define-transient-command helm-version-popup () + "Helm Version Menu" + ["Arguments" + ("-c" "client version only" "--client") + ("-s" "server version only" "--server") + ("-S" "print the version number" "--short")] + ["Actions" + ("V" "Version" helm-version)]) + +(define-transient-command helm-help-popup () + "Helm Menu" + ["Transient Commands" + [("s" "Status" helm-status-popup) + ("v" "Values" helm-values-popup) + ("d" "Describe" helm-get-popup)] + [("h" "History" helm-history-popup) + ("R" "Rollback" helm-rollback-popup) + ("k" "Delete" helm-delete-popup)] + [("r" "Repo" helm-repo-popup) + ("S" "Search" helm-search-popup)]] + ["Config" + ("C" "set kubernetes context" helm-set-context) + ("V" "get helm version information" helm-version-popup)] + ["Essential commands" + ("g" "refresh current buffer" helm) + ("?" "helm menu" helm-help-popup)]) + +;; mode map +(setq helm-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C") 'helm-set-context) + (define-key map (kbd "d") 'helm-get-popup) + (define-key map (kbd "v") 'helm-values-popup) + (define-key map (kbd "r") 'helm-repo-popup) + (define-key map (kbd "R") 'helm-rollback-popup) + (define-key map (kbd "k") 'helm-delete-popup) + (define-key map (kbd "s") 'helm-status-popup) + (define-key map (kbd "S") 'helm-search-popup) + (define-key map (kbd "V") 'helm-version-popup) + (define-key map (kbd "h") 'helm-history-popup) + (define-key map (kbd "?") 'helm-help-popup) + map)) + +;;;###autoload +(defun helm () + "Invoke the helm buffer." + (interactive) + (helm--pop-to-buffer (helm--buffer-name)) + (helm-mode)) + +(define-derived-mode helm-mode tabulated-list-mode "Helm" + "Special mode for helm buffers." + (buffer-disable-undo) + (kill-all-local-variables) + (setq truncate-lines t) + (setq mode-name "Helm") + (setq major-mode 'helm-mode) + (use-local-map helm-mode-map) + (setq tabulated-list-format helm--list-format) + (setq tabulated-list-entries 'helm--list-entries) + (setq tabulated-list-sort-key helm--list-sort-key) + (tabulated-list-init-header) + (tabulated-list-print) + (hl-line-mode 1) + (run-mode-hooks 'helm-mode-hook)) + +(provide 'helm) +;;; helm.el ends here diff --git a/dots/.emacs.d/lisp/kubel/LICENSE b/dots/.emacs.d/lisp/kubel/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/dots/.emacs.d/lisp/kubel/README.md b/dots/.emacs.d/lisp/kubel/README.md @@ -0,0 +1,78 @@ +[![MELPA](https://melpa.org/packages/kubel-badge.svg)](https://melpa.org/#/kubel) + +# kubel + +Emacs extension for controlling Kubernetes with limited permissions. + +## Features +This is mostly pod management for now. More may come. + +- switch context and namespace +- show pods +- get pod details +- tail container logs (possibly with `-f` follow flag) +- copy pod name to clipboard +- copy container log command to clipboard +- port forward a pod to your localhost + +## Installation + +Get it from Melpa, or copy and load the `kubel.el` file. + +## Usage + +To list the pods in your current context and namespace, call +``` +M-x kubel +``` +To set said namespace and context, respectively call +``` +M-x kubel-set-namespace +M-x kubel-set-context +``` +Note that namespace will autocomplete but not context, +this is because I interact with kubernetes through a user who +does not have permissions to list namespaces. + +## Shortcuts + +On the kubel screen, place your cursor on the pod +``` +enter => get pod details +h => help popup +C => set context +n => set namespace +g => refresh pods +p => port forward pod +e => exec into pod +d => describe popup +l => log popup +c => copy popup +k => delete pod +j => jab deployment to force rolling update +``` + +## Customize + +By default, kubel log tails from the last 100 lintes, you can change the `kubel-log-tail-n` variable to set another line number. + + +## TODO +- [x] Pods +- [x] Deployments +- [x] Services +- [x] Config map +- [x] Jobs +- [x] Ingress +- [ ] HPA +- [ ] Endpoints +- [ ] Accounts +- [ ] Secrets +- [x] Delete pods +- [x] View logs +- [x] Describe +- [ ] Edit +- [x] Switch clusters +- [ ] Apply manifest +- [x] exec +- [ ] logs for previous instance diff --git a/dots/.emacs.d/lisp/kubel/kubel.el b/dots/.emacs.d/lisp/kubel/kubel.el @@ -0,0 +1,487 @@ +;;; kubel.el --- extension for controlling Kubernetes with limited permissions -*- lexical-binding: t; -*- + +;; Copyright (C) 2018, Adrien Brochard + +;; This file is NOT part of Emacs. + +;; 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 2 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, write to the Free Software +;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +;; USA + +;; Version: 1.0 +;; Author: Adrien Brochard +;; Keywords: kubernetes k8s tools processes +;; URL: https://github.com/abrochard/kubel +;; License: GNU General Public License >= 3 +;; Package-Requires: ((transient "0.1.0") (emacs "25.3")) + +;;; Commentary: + +;; Emacs extension for controlling Kubernetes with limited permissions. +;; Mostly focuses on pod management for now. + +;;; Usage: + +;; To list the pods in your current context and namespace, call +;; +;; M-x kubel +;; +;; To set said namespace and context, respectively call +;; +;; M-x kubel-set-namespace +;; M-x kubel-set-context +;; +;; Note that namespace will autocomplete but not context, +;; this is because I interact with kubernetes through a user who +;; does not have permissions to list namespaces. + +;;; Shortcuts: + +;; On the kubel screen, place your cursor on the pod +;; +;; enter => get pod details +;; h => help popup +;; C => set context +;; n => set namespace +;; g => refresh pods +;; p => port forward pod +;; e => exec into pod +;; d => describe popup +;; l => log popup +;; c => copy popup +;; k => delete pod +;; j => jab deployment to force rolling update +;; + +;;; Customize: + +;; By default, kubel log tails from the last 100 lines, you can change the `kubel-log-tail-n` variable to set another line number. + +;;; Code: + +(require 'transient) + +(defconst kubel--list-format + [("Name" 50 t) + ("Ready" 10 t) + ("Status" 20 t) + ("Restarts" 10 t) + ("Age" 15 t)] + "List format.") + +(defconst kubel--list-sort-key + '("Name" . nil) + "Sort table on this key.") + +(defconst kubel--status-colors + (let ((warning 'DarkOrange) + (error "#bf360c") + (good "#388E3C")) + `(("Pending" . DarkOrange) + ("ContainerCreating" . DarkOrange) + ("Running" . ,good) + ("Completed" . ,good) + ("Error" . ,error) + ("CrashLoopBackOff" . ,error) + ("ImagePullBackOff" . ,error) + ("Terminating" . ,error))) + "Associative list of status to color.") + +(defvar kubel-namespace "" + "Current namespace.") +(defvar kubel-context + (replace-regexp-in-string + "\n" "" (shell-command-to-string "kubectl config current-context")) + "current context. tries to smart default.") + +(defvar kubel-log-tail-n "100" + "Number of lines to tail.") + +(defun kubel--buffer-name () + "Return kubel buffer name." + (concat "*kubel (" kubel-namespace ") [" kubel-context "]*")) + +(defun kubel--propertize-status (status) + "Return the status in proper font color. + +STATUS is the pod status string." + (let ((pair (cdr (assoc status kubel--status-colors)))) + (if pair + (propertize status 'font-lock-face `(:foreground ,pair)) + status))) + +(defun kubel--list-entries () + "Create the entries for the service list." + (let ((temp (list))) + (with-temp-buffer + (insert (shell-command-to-string (concat (kubel--get-command-prefix) " get pods --no-headers=true"))) + (goto-char (point-min)) + (while (re-search-forward "^\\([a-z0-9\-]+\\) +\\([0-9]+/[0-9]+\\) +\\(\\w+\\) +\\([0-9]+\\) +\\([0-9a-z]+\\)$" (point-max) t) + (setq temp (append temp (list (list (match-string 1) (vector (match-string 1) (match-string 2) (kubel--propertize-status (match-string 3)) (match-string 4) (match-string 5))))))) + ) + temp)) + +(defun kubel--pop-to-buffer (name) + "Utility function to pop to buffer or create it. + +NAME is the buffer name." + (unless (get-buffer name) + (get-buffer-create name)) + (pop-to-buffer name)) + +(defun kubel--exec (buffer-name async args) + "Utility function to run commands in the proper context and namespace. + +\"BUFFER-NAME\" is the buffer-name. Default to *kubel-command*. +ASYNC is a bool. If true will run async. +ARGS is a ist of arguments." + (when (equal buffer-name "") + (setq buffer-name "*kubel-command*")) + (when (get-buffer buffer-name) + (kill-buffer buffer-name)) + (if async + (apply #'start-process buffer-name buffer-name "kubectl" (append (kubel--get-context-namespace) args)) + (apply #'call-process "kubectl" nil buffer-name nil (append (kubel--get-context-namespace) args))) + (pop-to-buffer buffer-name)) + +(defun kubel--get-pod-under-cursor () + "Utility function to get the name of the pod under the cursor." + (aref (tabulated-list-get-entry) 0)) + +(defun kubel--get-context-namespace () + "Utility function to return the proper context and namespace arguments." + (append + (unless (equal kubel-context "") + (list "--context" kubel-context)) + (unless (equal kubel-namespace "") + (list "-n" kubel-namespace)))) + +(defun kubel--get-command-prefix () + "Utility function to prefix the kubectl command with proper context and namespace." + (mapconcat 'identity (append '("kubectl") (kubel--get-context-namespace)) " ")) + +(defun kubel--get-containers (pod-name) + "List the containers in a pod. + +POD-NAME is the name of the pod." + (split-string + (shell-command-to-string + (format "%s get pod %s -o jsonpath='{.spec.containers[*].name}'" (kubel--get-command-prefix) pod-name)) " ")) + +(defun kubel--select-resource (name) + "Prompt user to select an instance out of a list of resources. + +NAME is the string name of the resource." + (let ((cmd (format "%s get %s -o=jsonpath='{.items[*].metadata.name}'" + (kubel--get-command-prefix) name))) + (completing-read (concat (s-upper-camel-case name) ": ") + (split-string (shell-command-to-string cmd) " ")))) + +(defun kubel--describe-resource (name &optional yaml) + "Describe a specific resource. + +NAME is the string name of the resource to decribe. +YAML is boolean to show resource as yaml" + (let* ((resource (kubel--select-resource name)) + (buffer-name (format "*kubel - %s - %s*" name resource))) + (if yaml + (kubel--exec buffer-name nil (list "get" name "-o" "yaml" resource)) + (kubel--exec buffer-name nil (list "describe" name resource))) + (when yaml + (yaml-mode)) + (beginning-of-buffer))) + +;; interactive +(defun kubel-get-pod-details () + "Get the details of the pod under the cursor." + (interactive) + (let* ((pod (kubel--get-pod-under-cursor)) + (buffer-name (format "*kubel - pod - %s*" pod))) + (kubel--exec buffer-name nil (list "describe" "pod" (kubel--get-pod-under-cursor))) + (beginning-of-buffer))) + +(defun kubel--default-tail-arg (args) + "Ugly function to make sure that there is at least the default tail. + +ARGS is the arg list from transient." + (if (car (remove nil (mapcar (lambda (x) + (string-prefix-p "--tail=" x)) args))) + args + (append args (list (concat "--tail=" kubel-log-tail-n))))) + +(defun kubel-get-pod-logs (&optional args) + "Get the last N logs of the pod under the cursor. + +ARGS is the arguments list from transient." + (interactive + (list (transient-args 'kubel-log-popup))) + (let* ((pod (kubel--get-pod-under-cursor)) + (containers (kubel--get-containers pod)) + (container (if (equal (length containers) 1) + (car containers) + (completing-read "Select container: " containers))) + (buffer-name (format "*kubel - logs - %s - %s*" pod container)) + (async nil)) + (when (member "-f" args) + (setq async t)) + (kubel--exec buffer-name async + (append '("logs") (kubel--default-tail-arg args) (list pod container))))) + +(defun kubel-copy-pod-name () + "Copy the name of the pod under the cursor." + (interactive) + (kill-new (kubel--get-pod-under-cursor)) + (message "Pod name copied to kill-ring")) + +(defun kubel-copy-log-command () + "Copy the streaming log command of the pod under the cursor." + (interactive) + (kill-new (concat (kubel--get-command-prefix) + " logs -f --tail=" kubel-log-tail-n " " + (kubel--get-pod-under-cursor))) + (message "Log command copied to kill-ring")) + +(defun kubel-copy-command-prefix () + "Copy the kubectl command prefix." + (interactive) + (kill-new (kubel--get-command-prefix)) + (message "Command prefix copied to kill-ring")) + +(defun kubel-set-namespace (namespace) + "Set the namespace. + +NAMESPACE is the namespace." + (interactive "MNamespace: ") + (when (get-buffer (kubel--buffer-name)) + (kill-buffer (kubel--buffer-name))) + (setq kubel-namespace namespace) + (kubel)) + +(defun kubel-set-context () + "Set the context." + (interactive) + (setq kubel-context + (completing-read + "Select context: " + (split-string (shell-command-to-string "kubectl config view -o jsonpath='{.contexts[*].name}'") " "))) + (kubel)) + +(defun kubel-port-forward-pod (p) + "Port forward a pod to your local machine. + +P is the port as integer." + (interactive "nPort: ") + (let* ((port (format "%s" p)) + (pod (kubel--get-pod-under-cursor)) + (buffer-name (format "*kubel - port-forward - %s:%s*" pod port))) + (kubel--exec buffer-name t (list "port-forward" pod (format "%s:%s" port port))))) + +(defun kubel-describe-ingress (&optional arg) + "Show the ingress details. + +ARG is the optional param to see yaml." + (interactive "P") + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--describe-resource "ingress" t) + (kubel--describe-resource "ingress"))) + + +(defun kubel-describe-service (&optional arg) + "Descibe a service. + +ARG is the optional param to see yaml." + (interactive "P") + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--describe-resource "service" t) + (kubel--describe-resource "service"))) + +(defun kubel-describe-pod (&optional arg) + "Descibe a service. + +ARG is the optional param to see yaml." + (interactive "P") + (let* ((pod (kubel--get-pod-under-cursor)) + (buffer-name (format "*kubel - Pod - %s*" pod))) + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--exec buffer-name nil (list "describe" "pod" pod "-o" "yaml")) + (kubel--exec buffer-name nil (list "describe" "pod" pod))))) + +(defun kubel-describe-configmaps (&optional arg) + "Describe a configmap. + +ARG is the optional param to see yaml." + (interactive "P") + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--describe-resource "configmap" t) + (kubel--describe-resource "configmap"))) + +(defun kubel-describe-deployment (&optional arg) + "Describe a deployment. + +ARG is the optional param to see yaml." + (interactive "P") + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--describe-resource "deployment" t) + (kubel--describe-resource "deployment"))) + +(defun kubel-describe-job (&optional arg) + "Describe a job. + +ARG is the optional param to see yaml." + (interactive "P") + (if (or arg (transient-args 'kubel-describe-popup)) + (kubel--describe-resource "job" t) + (kubel--describe-resource "job"))) + +(defun kubel-exec-pod () + "Kubectl exec into the pod under the cursor." + (interactive) + (let* ((pod (kubel--get-pod-under-cursor)) + (containers (kubel--get-containers pod)) + (container (if (equal (length containers) 1) + (car containers) + (completing-read "Select container: " containers)))) + (eshell) + (insert (format "%s exec -it %s -c %s /bin/sh" (kubel--get-command-prefix) pod container)))) + +(defun kubel-delete-pod () + "Kubectl delete pod under cursor." + (interactive) + (let* ((pod (kubel--get-pod-under-cursor)) + (buffer-name (format "*kubel - delete pod -%s" pod)) + (args (list "delete" "pod" pod))) + (when (transient-args 'kubel-delete-popup) + (setq args (append args (list "--force" "--grace-period=0")))) + (kubel--exec buffer-name t args))) + +(defun kubel-jab-deployment () + "Make a trivial patch to force a new deployment. + +See https://github.com/kubernetes/kubernetes/issues/27081" + (interactive) + (let* ((deployment (kubel--select-resource "deployment")) + (buffer-name (format "*kubel - bouncing - %s*" deployment))) + (kubel--exec buffer-name nil (list "patch" "deployment" deployment "-p" + (format "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"%s\"}}}}}" + (round (time-to-seconds))))))) + +;; popups +;; (magit-define-popup kubel-log-popup +;; "Popup for kubel log menu" +;; 'kubel +;; :switches '((?f "Follow" "-f") (?p "Previous" "-p")) +;; :options '((?n "lines" "100")) +;; :actions '("Kubel Log Menu" +;; (?l "Tail logs for pod" kubel-get-pod-logs))) + +(define-infix-argument kubel-log-popup:--tail () + :description "Tail" + :class 'transient-option + :shortarg "-n" + :argument "--tail=") + +(define-transient-command kubel-log-popup () + "Kubel Log Menu" + ["Arguments" + ("-f" "Follow" "-f") + ("-p" "Previous" "-p") + (kubel-log-popup:--tail)] + ["Actions" + ("l" "Tail pod logs" kubel-get-pod-logs)]) + +(define-transient-command kubel-copy-popup () + "Kubel Copy Menu" + ["Actions" + ("c" "Copy pod name" kubel-copy-pod-name) + ("l" "Copy pod log command" kubel-copy-log-command) + ("p" "Copy command prefix" kubel-copy-command-prefix)]) + +(define-transient-command kubel-delete-popup () + "Kubel Delete menu" + ["Arguments" + ("-f" "Force" "--force --grace-period=0")] + ["Actions" + ("k" "Delete pod" kubel-delete-pod)]) + +(define-transient-command kubel-describe-popup () + "Kubel Describe Menu" + ["Arguments" + ("-y" "Yaml" "-o yaml")] + ["Actions" + ("d" "Deployment" kubel-describe-deployment) + ("s" "Service" kubel-describe-service) + ("p" "Pod" kubel-describe-pod) + ("j" "Job" kubel-describe-job) + ("i" "Ingress" kubel-describe-ingress) + ("c" "Configmap" kubel-describe-configmaps)]) + +(define-transient-command kubel-help-popup () + "Kubel Menu" + ["Actions" + ("ENTER" "Pod details" kubel-get-pod-details) + ("C" "Set context" kubel-set-context) + ("n" "Set namespace" kubel-set-namespace) + ("g" "Refresh" kubel-mode) + ("p" "Port forward" kubel-port-forward-pod) + ("l" "Logs" kubel-log-popup) + ("c" "Copy" kubel-copy-popup) + ("d" "Describe" kubel-describe-popup) + ("e" "Exec" kubel-exec-pod) + ("k" "Delete" kubel-delete-popup) + ("j" "Jab" kubel-jab-deployment)]) + +;; mode map +(setq kubel-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "RET") 'kubel-get-pod-details) + (define-key map (kbd "C") 'kubel-set-context) + (define-key map (kbd "n") 'kubel-set-namespace) + (define-key map (kbd "g") 'kubel-mode) + (define-key map (kbd "p") 'kubel-port-forward-pod) + (define-key map (kbd "l") 'kubel-log-popup) + (define-key map (kbd "c") 'kubel-copy-popup) + (define-key map (kbd "h") 'kubel-help-popup) + (define-key map (kbd "d") 'kubel-describe-popup) + (define-key map (kbd "e") 'kubel-exec-pod) + (define-key map (kbd "k") 'kubel-delete-popup) + (define-key map (kbd "j") 'kubel-jab-deployment) + map) +) + +;;;###autoload +(defun kubel () + "Invoke the kubel buffer." + (interactive) + (kubel--pop-to-buffer (kubel--buffer-name)) + (kubel-mode) + (message (concat "Namespace: " kubel-namespace))) + +(define-derived-mode kubel-mode tabulated-list-mode "Kubel" + "Special mode for kubel buffers." + (buffer-disable-undo) + (kill-all-local-variables) + (setq truncate-lines t) + (setq mode-name "Kubel") + (setq major-mode 'kubel-mode) + (use-local-map kubel-mode-map) + (setq tabulated-list-format kubel--list-format) + (setq tabulated-list-entries 'kubel--list-entries) + (setq tabulated-list-sort-key kubel--list-sort-key) + (tabulated-list-init-header) + (tabulated-list-print) + (hl-line-mode 1) + (run-mode-hooks 'kubel-mode-hook)) + +(provide 'kubel) +;;; kubel.el ends here diff --git a/dots/.emacs.d/lisp/redeam.el b/dots/.emacs.d/lisp/redeam.el @@ -0,0 +1,102 @@ +(setenv "CORE" (substitute-in-file-name "$GOPATH/src/gitlab.com/redeam/core")) +(setenv "OPS" (substitute-in-file-name "$GOPATH/src/gitlab.com/redeam/ops")) + +(defvar redeam/backplane "https://backplane.develop.redeam.io/v1") + +(defun core () + "open file in core" + (interactive) + (counsel-find-file (getenv "CORE"))) + +(defun ops () + "open file in ops" + (interactive) + (counsel-find-file (substitute-in-file-name "$OPS/deploy/k8s/helm"))) + +(defvar redeam/env-list + '("develop dev-test" "sandbox dev-test") + "list of redeam environments used by the e2e runner") + +(defvar redeam/clusters + '("redeam-develop develop" + "actourex-develop develop3" + "redeam-sandbox sandbox" + "redeam-staging -z us-west1-c staging" + "actourex-production production")) + +(defvar redeam/extra-service-alist + '("channel-api-dragonheart") + "services which do not conform to the -svc pattern in $CORE/cmd") + +(defun redeam/set-cluster (CLUSTER) + "Set kubeconfig to use CLUSTER" + (interactive (list (ivy-read "Environment:" redeam/clusters))) + (cd (substitute-in-file-name "$CORE/scripts/cluster")) + (async-shell-command + (format "./set-cluster.py -p %s" CLUSTER))) + +(defun redeam/get-cluster () + "get the name of the cluster $HOME/cluster.config is using" + (interactive) + (shell-command "kubectl --kubeconfig $HOME/cluster.config config current-context")) + +(defun trim-svc (s) + "Remove trailing -svc commonly seen on redeam services" + (car (split-string s "-svc" t "-svc"))) + +(defun redeam/services () + (cons redeam/extra-service-alist + (directory-files (substitute-in-file-name "$CORE/cmd") nil "svc"))) + +(defun read-service (prompt) + (ivy-read prompt (redeam/services))) + +(defun redeam/e2e-booking (ENVIRONMENT) + "run booking API end to end tests against the specified environment" + (interactive (list (ivy-read "Environment:" redeam/env-list))) + (cd (substitute-in-file-name "$CORE/api/surfaces/booking-api/workflows")) + (async-shell-command + (format "./build-and-run.sh %s" ENVIRONMENT) "*E2E Tests*")) + +(defun redeam/build-image (SERVICE TAG) + (interactive (list (read-service "Service:" ) + (read-string "Image Tag: "))) + (cd (substitute-in-file-name "$CORE")) + (async-shell-command + (format "./scripts/build.py --tag %s --service cmd/%s" TAG SERVICE))) + +(defun redeam/inject (SERVICE) + "inject a new freshly build service into a cluster" + (interactive (list (trim-svc (read-service "Service: ")))) + (async-shell-command (format "inject %s" SERVICE) + (format "*Injecting %s*" SERVICE))) + +(defun redeam/inject-many () + "inject many services into a cluster" + (interactive) + (while (redeam/inject (trim-svc (read-service "Service: "))))) + +(defun mjf/async-shell-command (COMMAND &optional OUTPUT-BUFFER) + (async-shell-command COMMAND OUTPUT-BUFFER) + (switch-to-buffer OUTPUT-BUFFER) + (local-set-key (kbd "q") 'kill-buffer-and-window) + (evil-normal-state) + (previous-buffer)) + +(defun mjf/pretty-json () + (interactive) + (switch-to-buffer "*Pretty JSON*") + (evil-insert-state) + (local-set-key (kbd "q") 'kill-buffer-and-window) + (delete-region (point-min) (point-max)) + (yank) + (json-reformat-region (point-min) (point-max))) + +(defun redeam/deft () + "open deft relative to CODE Documentation" + (interactive) + (let ((deft-directory (substitute-in-file-name "$CORE/Documentation")) + (deft-recursive t)) + (deft))) + +(provide 'redeam) diff --git a/dots/.emacs.d/modules/module-avy.el b/dots/.emacs.d/modules/module-avy.el @@ -0,0 +1,30 @@ +;;; module-avy.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package avy + :bind (("C-:" . avy-goto-char-2) + ("C-;" . avy-goto-char-timer))) + +(provide 'module-avy) + +;;; module-avy.el ends here diff --git a/dots/.emacs.d/modules/module-bbdb.el b/dots/.emacs.d/modules/module-bbdb.el @@ -0,0 +1,31 @@ +;;; module-org.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package bbdb + :config + (progn (setq bbdb-file "~/org/contacts") + (require 'org-bbdb))) + +(provide 'module-bbdb) + +;;; module-bbdb.el ends here diff --git a/dots/.emacs.d/modules/module-benchmarking.el b/dots/.emacs.d/modules/module-benchmarking.el @@ -0,0 +1,30 @@ +;;; module-benchmarking.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package esup + :ensure t + :commands (esup)) + +(provide 'module-benchmarking) + +;;; module-benchmarking.el ends here diff --git a/dots/.emacs.d/modules/module-c.el b/dots/.emacs.d/modules/module-c.el @@ -0,0 +1,31 @@ +(setq path-to-ctags "/usr/local/Cellar/ctags/5.8_1/bin/ctags") + +(use-package ggtags + :delight ggtags-mode + :bind (:map ggtags-mode-map + ("C-c g s" . ggtags-find-other-symbol) + ("C-c g h" . ggtags-view-tag-history) + ("C-c g r" . ggtags-find-reference) + ("C-c g f" . ggtags-find-file) + ("C-c g c" . ggtags-create-tags) + ("C-c g u" . ggtags-update-tags) + ("C-c C-j" . ggtags-find-tag-dwim) + ("M-," . pop-tag-mark)) + :config + (progn (add-hook 'c-mode-common-hook + (lambda () + (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode) + (ggtags-mode 1)))) + + (setq font-lock-maximum-decoration + '((c-mode . 3))) + + (setq c-default-style "gnu" + c-basic-offset 4))) + +(use-package company-c-headers + :after company) + +;; (bind-key "C-c C-c" #'compile c-mode-map) + +(provide 'module-c) diff --git a/dots/.emacs.d/modules/module-clojure.el b/dots/.emacs.d/modules/module-clojure.el @@ -0,0 +1,42 @@ +;;; module-clojure.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package clojure-mode + :mode "\\.clj\\'" + :init + (progn + (add-hook 'clojure-mode-hook 'paredit-mode))) + +(use-package flycheck-clojure + :after (clojure-mode flycheck-mode) + :config (add-hook 'clojure-mode-hook 'flycheck-mode)) + +(use-package cider + :after (clojure-mode)) + +(use-package cljdoc + :after (clojure-mode eldoc)) + +(provide 'module-clojure) + +;;; module-clojure.el ends here diff --git a/dots/.emacs.d/modules/module-company.el b/dots/.emacs.d/modules/module-company.el @@ -0,0 +1,46 @@ +;;; module-company.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package company + :ensure t + :demand + :delight (company-mode nil "company") + :config + (progn (setq company-idle-delay 0) + (setq company-tooltip-limit 10) + (setq company-echo-delay 0) + (setq company-tooltip-flip-when-above t) + (setq company-begin-commands '(self-insert-command)) + + ;; Face Configuration + (set-face-attribute 'company-tooltip-selection nil :background "#ddffdd") + (set-face-attribute 'company-tooltip-selection nil :background "#cee7cf") + (set-face-attribute 'company-tooltip-common nil :inherit 'fixed-pitch :foreground nil :underline nil :weight 'bold) + (set-face-attribute 'company-scrollbar-fg nil :background "#388E3C") + (set-face-attribute 'company-preview-common nil :underline nil) + (set-face-attribute 'company-tooltip-common nil :underline nil) + (set-face-attribute 'company-tooltip-common-selection nil :underline nil))) + +(provide 'module-company) + +;;; module-company.el ends here diff --git a/dots/.emacs.d/modules/module-css.el b/dots/.emacs.d/modules/module-css.el @@ -0,0 +1,33 @@ +;;; module-css.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package scss-mode) + +(use-package less-css-mode) + +(use-package css-eldoc + :after (eldoc)) + +(provide 'module-css) + +;;; module-css.el ends here diff --git a/dots/.emacs.d/modules/module-csv.el b/dots/.emacs.d/modules/module-csv.el @@ -0,0 +1,28 @@ +;;; module-csv.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package csv-mode) + +(provide 'module-csv) + +;;; module-csv.el ends here diff --git a/dots/.emacs.d/modules/module-docker.el b/dots/.emacs.d/modules/module-docker.el @@ -0,0 +1,30 @@ +;;; module-docker.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package docker) + +(use-package dockerfile-mode) + +(provide 'module-docker) + +;;; module-docker.el ends here diff --git a/dots/.emacs.d/modules/module-eldoc.el b/dots/.emacs.d/modules/module-eldoc.el @@ -0,0 +1,29 @@ +;;; module-eldoc.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package eldoc + :delight (eldoc-mode)) + +(provide 'module-eldoc) + +;;; module-eldoc.el ends here diff --git a/dots/.emacs.d/modules/module-emacs-lisp.el b/dots/.emacs.d/modules/module-emacs-lisp.el @@ -0,0 +1,44 @@ +;;; module-emacs-lisp.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(delight '((emacs-lisp-mode "Elisp" :major))) + +(use-package paredit + :disabled + :delight (paredit-mode nil "paredit") + :init (add-hook 'emacs-lisp-mode-hook 'paredit-mode)) + +(use-package lispy + :config + (add-hook 'emacs-lisp-mode 'lispy-mode)) + +(use-package paren-face + :config + (progn (global-paren-face-mode t) + (set-face-attribute 'parenthesis nil :inherit 'line-number))) + +(use-package macrostep) + +(provide 'module-emacs-lisp) + +;;; module-emacs-lisp.el ends here diff --git a/dots/.emacs.d/modules/module-eshell.el b/dots/.emacs.d/modules/module-eshell.el @@ -0,0 +1,55 @@ +;;; module-eshell.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package eshell + :config + (progn (setq eshell-directory-name "~/.emacs.d/persistent/eshell") + + (setq eshell-cmpl-cycle-completions nil + eshell-buffer-maximum-lines 20000 ; auto truncate after 20k lines + eshell-history-size 350 ; history size + eshell-buffer-shorthand t ; buffer shorthand -> echo foo > #'buffer + eshell-highlight-prompt nil ; my prompt is easy enough to see + eshell-plain-echo-behavior t) ; treat 'echo' like shell echo + + ;;(add-to-list 'eshell-visual-commands '("ncmpcpp" "htop")) + + (add-to-list 'eshell-load-hook 'set-exec-path-from-shell-PATH))) + +;; +;; defuns +;; + +(defun set-exec-path-from-shell-PATH () + "Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell. + This is particularly useful under Mac OSX, where GUI apps are + not started from a shell." + (interactive) + (let ((path-from-shell + (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'")))) + (setenv "PATH" path-from-shell) + (setq exec-path (split-string path-from-shell path-separator)))) + +(provide 'module-eshell) + +;;; module-eshell.el ends here diff --git a/dots/.emacs.d/modules/module-evil.el b/dots/.emacs.d/modules/module-evil.el @@ -0,0 +1,91 @@ +;;; module-evil.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package evil + :config + (progn (setq evil-mode-line-format '(before . mode-line-front-space)) + (setq evil-echo-state nil) + + ;; prevent esc-key from translating to meta-key in terminal mode + (setq evil-esc-delay 0) + + (evil-mode 1) + + (define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up) + (define-key evil-visual-state-map (kbd "C-u") 'evil-scroll-up) + (define-key evil-insert-state-map (kbd "C-u") + (lambda () + (interactive) + (evil-delete (point-at-bol) (point)))))) + +(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) +(evil-define-key 'normal neotree-mode-map (kbd "o") 'neotree-quick-look) +(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) +(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) +(evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) +(evil-define-key 'normal neotree-mode-map (kbd "n") 'neotree-next-line) +(evil-define-key 'normal neotree-mode-map (kbd "p") 'neotree-previous-line) +(evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle) +(evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle) + +;; evil-goggles will slightly delay vi operations and show a shadow on the text +;; area being operated on. Extremely useful for pair programming +(use-package evil-goggles + :delight (evil-goggles-mode) + :config + (progn (evil-goggles-mode t) + (setq evil-goggles-pulse t) + (setq evil-goggles-blocking-duration 0.100) + (setq evil-goggles-async-duration 0.300))) + +(use-package evil-surround + :config (global-evil-surround-mode t)) + +(use-package evil-commentary + :disabled + :delight (evil-commentary-mode) + :config (evil-commentary-mode t)) + +(use-package evil-snipe + :disabled + :delight (evil-snipe-mode nil "snipe") + :config (evil-snipe-override-mode t)) + +(use-package evil-org + :delight (evil-org-mode) + :config + (progn (add-hook 'org-mode-hook 'evil-org-mode) + + (require 'evil-org-agenda) + (evil-org-agenda-set-keys) + (evil-org-set-key-theme '(textobjects + insert + navigation + additional + shift + todo + heading)))) + +(provide 'module-evil) + +;;; module-evil.el ends here diff --git a/dots/.emacs.d/modules/module-git.el b/dots/.emacs.d/modules/module-git.el @@ -0,0 +1,62 @@ +;;; module-git.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package magit + :bind (("C-x g" . magit-status) + ("C-x G" . magit-status-with-prefix)) + :init + (progn (defun magit-status-with-prefix () + (interactive) + (let ((current-prefix-arg '(4))) + (call-interactively 'magit-status))) + + (setq transient-history-file (concat persistent-dir "/transient/history.el") + transient-display-buffer-action '(display-buffer-below-selected) + transient-mode-line-format + '("%e" mode-line-front-space mode-line-buffer-identification)))) + +;; (use-package evil-magit) + +(use-package gitignore-mode) + +(use-package magithub + :disabled + :after magit + :config + (progn (magithub-feature-autoinject t) + (setq magithub-api-timeout 5 + magithub-dir (concat persistent-dir "/magithub")))) + +(use-package git-timemachine) + +(use-package git-gutter-fringe+ + :disabled + :delight git-gutter+-mode + :config + (progn (require 'git-gutter-fringe+) + (git-gutter-fr+-minimal) + (global-git-gutter+-mode))) + +(provide 'module-git) + +;;; module-git.el ends here diff --git a/dots/.emacs.d/modules/module-gitlab.el b/dots/.emacs.d/modules/module-gitlab.el @@ -0,0 +1 @@ +(setq gitlab-host "https://gitlab.com") diff --git a/dots/.emacs.d/modules/module-go.el b/dots/.emacs.d/modules/module-go.el @@ -0,0 +1,123 @@ +;;; module-go.el --- Packages used for golang + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +;; set gopath unless it has already been set +(unless (getenv "GOPATH") + (setenv "GOPATH" (concat (getenv "HOME") "/prog/go"))) + +(use-package go-mode + :bind (:map go-mode-map + ("C-c C-g" . go-goto-imports) + ("C-c C-c" . compile) + ("C-c C-t" . ginkgo-test) + ("C-c C" . go-cover)) + :config + (progn (setq gofmt-command "gofumports") ; use goimports instead of go-fmt + (setq godoc-command "godoc") ; use godoc instead of go doc + (setq tab-width 4) + + (defun go-prog-init () + "if go is install go get all dependencies for emacs go packages" + (interactive) + (if (not (eq (executable-find "go") nil)) + (progn + (mapcar (lambda (pkg) + (let ((cmd (concat "go get -u " pkg))) + (call-process-shell-command cmd nil "*go-get-output*" t))) + '("github.com/nsf/gocode" + "golang.org/x/tools/cmd/goimports" + "github.com/rogpeppe/godef" + "github.com/golang/lint" + "golang.org/x/tools/cmd/gorename" + "golang.org/x/tools/cmd/guru" + "github.com/kisielk/errcheck"))) + (message "go executable not found, install go from https://golang.org/download"))) + + (defun ginkgo-test (package) + "Run ginkgo test suites recursively from a given go package" + (interactive (list (read-directory-name "Package:"))) + (async-shell-command + (concat "ginkgo -r " package) "*Ginkgo Tests*") + + ;; get out of evil insert mode and dont truncate text + (switch-to-buffer "*Ginkgo Tests*") + (local-set-key (kbd "q") 'kill-buffer-and-window) + (evil-motion-state) + (toggle-truncate-lines) + (message nil) + (previous-buffer)) + + (defun go-cover () + (interactive) + (shell-command "go tool cover -html=out.cover")) + + (defun setup-go-mode-compile () + "Customize compile command to run go build" + (if (not (string-match "go" compile-command)) + (set (make-local-variable 'compile-command) + "go build -v && go vet && go test -covermode=count -coverprofile=out.cover"))) + + (add-hook 'go-mode-hook 'setup-go-mode-compile) + (add-hook 'go-mode-hook 'subword-mode) + + ;; format before save + (add-hook 'before-save-hook 'gofmt-before-save))) + +;; go-add-tags provides functions for adding tags to go structs +(use-package go-add-tags + :after go-mode) + +(use-package go-errcheck + :after go-mode) + +(use-package go-stacktracer) + +(use-package go-guru + :after go-mode + :bind (:map go-mode-map + ("M-." . go-guru-definition) + ("C-c d" . go-guru-describe))) + +(use-package company-go + :after (go-mode company) + :config + (progn (add-hook 'go-mode-hook (lambda () + (set (make-local-variable 'company-backends) '(company-go)) + (company-mode))))) + +(use-package go-eldoc + :after (go-mode eldoc) + :config + (progn (add-hook 'go-mode-hook 'go-eldoc-setup))) + +(use-package flycheck-gometalinter + :after (go-mode flycheck-mode) + :config + (progn (flycheck-gometalinter-setup) + (setq flycheck-gometalinter-deadline "10s") + (setq flycheck-gometalinter-fast t) + (setq flycheck-gometalinter-disable-linters '("gotype" "gocyclo")))) + +(provide 'module-go) + +;;; module-go.el ends here diff --git a/dots/.emacs.d/modules/module-god-mode.el b/dots/.emacs.d/modules/module-god-mode.el @@ -0,0 +1,41 @@ +;;; module-god-mode.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package god-mode + :bind (("<escape>" . god-mode-all) + :map god-local-mode-map + ("z" . repeat) + ("i" . god-mode-all)) + :config + (progn (defun my-update-cursor () + (setq cursor-type (if (or god-local-mode buffer-read-only) + 'box + 'bar))) + + (add-hook 'god-mode-enabled-hook 'my-update-cursor) + (add-hook 'god-mode-disabled-hook 'my-update-cursor))) + +(provide 'module-god-mode) + +;;; module-god-mode.el ends here + diff --git a/dots/.emacs.d/modules/module-gruvbox.el b/dots/.emacs.d/modules/module-gruvbox.el @@ -0,0 +1,3 @@ +(use-package gruvbox-theme) + +(provide 'module-gruvbox) diff --git a/dots/.emacs.d/modules/module-haskell.el b/dots/.emacs.d/modules/module-haskell.el @@ -0,0 +1,49 @@ +;;; module-haskell.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package haskell-mode + :bind (:map haskell-mode-map + ("C-c C-c" . haskell-compile) + :map haskell-cabal-mode-map + ("C-c C-c" . haskell-compile)) + :config + (progn (setq haskell-stylish-on-save t) + (setq haskell-doc-prettify-types t) + + (defun haskell-mode-defaults () + (subword-mode +1) + (eldoc-mode +1) + (haskell-indentation-mode +1) + (interactive-haskell-mode +1)) + + (setq haskell-mode-hook 'haskell-mode-defaults) + + (add-hook 'haskell-mode-hook (lambda () + (run-hooks 'haskell-mode-hook))))) + +(use-package flycheck-haskell + :after (haskell-mode flycheck-mode)) + +(provide 'module-haskell) + +;;; module-haskell.el ends here diff --git a/dots/.emacs.d/modules/module-hydra.el b/dots/.emacs.d/modules/module-hydra.el @@ -0,0 +1,84 @@ +;; (use-package hydra +;; :ensure t +;; :bind (("C-c h" . hydra-apropos/body) +;; ("M-p" . hydra-window/body) +;; ("C-x SPC" . hydra-rectangle/body)) +;; :config +;; (progn (defhydra hydra-goto-line (goto-map "" +;; :pre (linum-mode 1) +;; :post (linum-mode -1)) +;; "goto-line" +;; ("g" goto-line "go") +;; ("m" set-mark-command "mark" :bind nil) +;; ("q" nil "quit")) + +;; (defhydra hydra-apropos (:color blue) +;; "Apropos" +;; ("m" man "man") +;; ("a" apropos "apropos") +;; ("c" apropos-command "cmd") +;; ("d" apropos-documentation "doc") +;; ("e" apropos-value "val") +;; ("l" apropos-library "lib") +;; ("o" apropos-user-option "option") +;; ("u" apropos-user-option "option") +;; ("v" apropos-variable "var") +;; ("i" info-apropos "info") +;; ("t" tags-apropos "tags") +;; ("z" hydra-customize-apropos/body "customize")) + +;; (defhydra hydra-customize-apropos (:color blue) +;; "Apropos (customize)" +;; ("a" customize-apropos "apropos") +;; ("f" customize-apropos-faces "faces") +;; ("g" customize-apropos-groups "groups") +;; ("o" customimze-apropos-options "options")) + +;; (defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1) +;; :color pink +;; :hint nil +;; :post (deactivate-mark)) +;; " +;; ^_k_^ _w_ copy _o_pen _N_umber-lines |\\ -,,,--,,_ +;; _h_ _l_ _y_ank _t_ype _e_xchange-point /,`.-'`' .. \-;;,_ +;; ^_j_^ _d_ kill _c_lear _r_eset-region-mark |,4- ) )_ .;.( `'-' +;; ^^^^ _u_ndo _g_ quit ^ ^ '---''(./..)-'(_\_) +;; " +;; ("k" rectangle-previous-line) +;; ("j" rectangle-next-line) +;; ("h" rectangle-backward-char) +;; ("l" rectangle-forward-char) +;; ("d" kill-rectangle) ;; C-x r k +;; ("y" yank-rectangle) ;; C-x r y +;; ("w" copy-rectangle-as-kill) ;; C-x r M-w +;; ("o" open-rectangle) ;; C-x r o +;; ("t" string-rectangle) ;; C-x r t +;; ("c" clear-rectangle) ;; C-x r c +;; ("e" rectangle-exchange-point-and-mark) ;; C-x C-x +;; ("N" rectangle-number-lines) ;; C-x r N +;; ("r" (if (region-active-p) +;; (deactivate-mark) +;; (rectangle-mark-mode 1))) +;; ("u" undo nil) +;; ("g" nil)) ;; ok + +;; (defhydra hydra-window (:color red +;; :columns nil) +;; ;; " +;; ;; ^_k_^ _r_ horiz _a_ balance _s_ swap +;; ;; _h_ _l_ _v_ vertical _t_ transpose _q_ others +;; ;; ^_j_^ _w_ kill _u_ undo _g_ quit" +;; ("h" windmove-left) +;; ("j" windmove-down) +;; ("k" windmove-up) +;; ("l" windmove-right) +;; ("r" split-window-right) +;; ("v" split-window-below) +;; ("t" toggle-window-split) +;; ("q" delete-other-windows :exit t) +;; ("w" delete-window) +;; ("a" balance-windows) +;; ("s" ace-swap-window) +;; ("d" ace-delete-window) +;; ("g" nil) +;; ("u" (progn (winner-undo) (setq this-command 'winner-undo)))))) diff --git a/dots/.emacs.d/modules/module-js.el b/dots/.emacs.d/modules/module-js.el @@ -0,0 +1,34 @@ +;;; module-js.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package js2-mode + :mode (("\\.js\\'" . js2-mode) + ("\\.pac\\'" . js2-mode)) + :init + (progn (add-to-list 'interpreter-mode-alist '("node" . js2-mode)))) + +(use-package json-mode) + +(provide 'module-js) + +;;; module-js.el ends here diff --git a/dots/.emacs.d/modules/module-kubernetes.el b/dots/.emacs.d/modules/module-kubernetes.el @@ -0,0 +1,10 @@ +(use-package kubernetes + :ensure t + :commands (kubernetes-overview)) + +;; If you want to pull in the Evil compatibility package. +(use-package kubernetes-evil + :ensure t + :after kubernetes) + +(provide 'module-kubernetes) diff --git a/dots/.emacs.d/modules/module-ledger.el b/dots/.emacs.d/modules/module-ledger.el @@ -0,0 +1,32 @@ +;;; module-ledger.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package ledger-mode + :mode "\\.ledger\\'") + +(use-package flycheck-ledger + :after (flycheck-mode ledger-mode)) + +(provide 'module-ledger) + +;;; module-ledger.el ends here diff --git a/dots/.emacs.d/modules/module-lsp.el b/dots/.emacs.d/modules/module-lsp.el @@ -0,0 +1,9 @@ +(use-package lsp-mode + :commands lsp) + +(use-package lsp-ui :commands lsp-ui-mode) +(use-package company-lsp :commands company-lsp) + + +(add-hook 'go-mode-hook #'lsp) +(setq lsp-eldoc-render-all nil) diff --git a/dots/.emacs.d/modules/module-lua.el b/dots/.emacs.d/modules/module-lua.el @@ -0,0 +1,31 @@ +;;; module-lua.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package lua-mode) + +(use-package flymake-lua + :after (lua-mode flymake)) + +(provide 'module-lua) + +;;; module-lua.el ends here diff --git a/dots/.emacs.d/modules/module-markdown.el b/dots/.emacs.d/modules/module-markdown.el @@ -0,0 +1,8 @@ +(use-package markdown-mode) + +(use-package gh-md + :disabled) + +(provide 'module-markdown) + +;;; module-markdown.el ends here diff --git a/dots/.emacs.d/modules/module-mastodon.el b/dots/.emacs.d/modules/module-mastodon.el @@ -0,0 +1,3 @@ +(use-package mastodon + :load-path "~/.emacs.d/lisp/mastodon/lisp/mastodon.el" + :config (setq mastodon-instance-url "https://mstdn.io")) diff --git a/dots/.emacs.d/modules/module-multiple-cursors.el b/dots/.emacs.d/modules/module-multiple-cursors.el @@ -0,0 +1,10 @@ +(use-package multiple-cursors + :bind (("C-S-c C-S-c" . mc/edit-lines) + ("C->" . mc/mark-next-like-this) + ("C-<" . mc/mark-previous-like-this) + ("C-c C-<" . mc/mark-all-like-this) + ("C-S-SPC" . set-rectangular-region-anchor) + ("C-S-c C->" . mc/mark-sgml-tag-pair)) + :init (setq mc/list-file (expand-file-name "mc-lists.el" persistent-dir))) + +(provide 'module-multiple-cursors) diff --git a/dots/.emacs.d/modules/module-neotree.el b/dots/.emacs.d/modules/module-neotree.el @@ -0,0 +1,40 @@ +;;; module-neotree.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package neotree + :config + (progn (setq neo-theme 'arrow + neo-show-slash-for-folder nil) + + ;; disable modeline and line numbers + (add-hook 'neotree-mode-hook 'toggle-modeline) + (add-hook 'neotree-mode-hook (lambda () (display-line-numbers-mode 0))) + + (set-face-attribute 'neo-dir-link-face nil :inherit 'dired-directory) + (set-face-attribute 'neo-file-link-face nil :inherit 'fixed-width) + (set-face-attribute 'neo-header-face nil :inherit 'fixed-width :weight 'bold) + (set-face-attribute 'neo-root-dir-face nil :inherit 'fixed-width :weight 'bold))) + +(provide 'module-neotree) + +;;; module-neotree.el ends here diff --git a/dots/.emacs.d/modules/module-notmuch.el b/dots/.emacs.d/modules/module-notmuch.el @@ -0,0 +1,41 @@ +;;; module-notmuch.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package notmuch + :config + (progn (setq user-full-name "Mark Feller") + + (setq message-sendmail-envelope-from 'header) + (add-hook 'message-send-mail-hook 'cg-feed-msmtp) + + (setq notmuch-saved-searches + '((:name "inbox" :query "tag:inbox" :key "i") + (:name "unread" :query "tag:unread" :key "u") + (:name "sent" :query "tag:sent" :key "t") + (:name "drafts" :query "tag:draft" :key "d") + (:name "guix-devel" :query "guix-devel tag:unread" :key "g") + (:name "emacs-devel" :query "emacs-devel tag:unread" :key "e"))))) + +(provide 'module-notmuch) + +;;; module-notmuch.el ends here diff --git a/dots/.emacs.d/modules/module-org.el b/dots/.emacs.d/modules/module-org.el @@ -0,0 +1,119 @@ +;;; module-org.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package org + :bind (("C-c l" . org-store-link) + ("C-c a" . org-agenda) + ("C-c c" . org-capture) + :map org-src-mode-map + ("C-x C-s" . org-edit-src-exit)) + :delight (org-indent-mode nil t) + :config + (progn (require 'org-indent) + (require 'org-src) + + (setq org-startup-indented t) + (setq org-src-tab-acts-natively t) + (setq org-src-fontify-natively t) + (setq org-hide-emphasis-markers t) + + (defun org-summary-todo (n-done n-not-done) + "Switch entry to DONE when all subentries are done, to TODO otherwise." + (let (org-log-done org-log-states) ; turn off logging + (org-todo (if (= n-not-done 0) "DONE" "TODO")))) + (add-hook 'org-after-todo-statistics-hook 'org-summary-todo) + + ;; disable line numbers in org mode + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) + + ;; where I keep all my org files + (setq org-agenda-files + '("~/org/work.org" + "~/org/life.org")) + + ;; personal capture templates + (setq org-capture-templates + '( + ;; unfiled work items + ("w" "Work" entry (file+headline "~/org/work.org" "Unread") + "* TODO %?\n %i\n") + + ;; random thoughts I'd like to capture + ("t" "Thought" entry (file+headline "~/org/work.org" "Thoughts") + "* %?\n %i\n") + + ;; unfiled work items in my life + ("l" "Life" entry (file+headline "~/org/life.org" "Inbox") + "* TODO %?\n %i\n") + + ("j" "Journal" entry (file+datetree "~/org/life.org") + "* TODO %?\n"))) + + ;; when refiling an org header don't search more than 3 levels deep + (setq org-refile-targets + '((nil :maxlevel . 3) + (org-agenda-files :maxlevel . 3))) + + (setq org-todo-keywords + '((sequence "TODO(t)" "BLOCKED(b)" "|" "DONE(d)" "CANCELLED(c)") + (sequence "RECURRING(r)" "|" "DONE(d)"))) + + ;; don't make the title big, I don't like that. Also remove those ugly + ;; checkboxes + (set-face-attribute 'org-document-title nil :height 1) + (set-face-attribute 'org-checkbox nil :box nil))) + +(use-package org-bullets + :config + (progn (setq org-bullets-bullet-list '("●" "○" "◉" "•")) + + ;; bullets on lists + (font-lock-add-keywords + 'org-mode + '(("^ +\\([-*]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))) + +(use-package org-fancy-priorities + :ensure t + :delight (org-fancy-priorities-mode) + :hook (org-mode . org-fancy-priorities-mode) + :config + (progn (setq org-fancy-priorities-list '("⬆" "➡" "⬇" "☕")) + + ;; solarized theme on priorities + (setq org-priority-faces '((65 . "#dc322f") + (66 . "#cb4b16") + (67 . "#859900"))))) + +(use-package deft + :disabled + :config + (progn (setq deft-directory "~/org" + deft-extensions '("md" "org") + deft-recursive t) + + (add-hook 'deft-mode-hook (lambda () (evil-emacs-state))))) + +(provide 'module-org) + +;;; module-org.el ends here diff --git a/dots/.emacs.d/modules/module-pretty.el b/dots/.emacs.d/modules/module-pretty.el @@ -0,0 +1,112 @@ +;;; module-pretty.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(defun unicode-symbol (name) + "Translate a symbolic name for a Unicode character -- e.g., LEFT-ARROW + or GREATER-THAN into an actual Unicode character code. " + (decode-char 'ucs (case name + ;; arrows + ('left-arrow 8592) + ('up-arrow 8593) + ('right-arrow 8594) + ('down-arrow 8595) + ('double-left-arrow 8658) + ;; boxes + ('double-vertical-bar #X2551) + ;; relational operators + ('equal #X003d) + ('not-equal #X2260) + ('identical #X2261) + ('not-identical 2262) + ('not-equal 2260) + ('less-than #X003c) + ('greater-than #X003e) + ('less-than-or-equal-to #X2264) + ('greater-than-or-equal-to #X2265) + ;; logical operators + ('logical-and #X2227) + ('logical-or #X2228) + ('logical-neg #X00AC) + ;; misc + ('nil #X2205) + ('horizontal-ellipsis #X2026) + ('double-exclamation #X203C) + ('prime #X2032) + ('double-prime #X2033) + ('for-all #X2200) + ('there-exists #X2203) + ('element-of #X2208) + ;; mathematical operators + ('square-root #X221A) + ('squared #X00B2) + ('cubed #X00B3) + ;; letters + ('lambda #x03BB) + ('alpha #x03B1) + ('beta #x03B2) + ('gamma #x03B3) + ('delta #x03B4)))) + +(defun substitute-pattern-with-unicode (pattern symbol) + "Add a font lock hook to replace the matched part of PATTERN with the + Unicode symbol SYMBOL looked up with UNICODE-SYMBOL." + (interactive) + (font-lock-add-keywords + nil `((,pattern (0 (progn (compose-region (match-beginning 1) (match-end 1) + ,(unicode-symbol symbol)) + nil)))))) + +(defun substitute-patterns-with-unicode (patterns) + "Call SUBSTITUTE-PATTERN-WITH-UNICODE repeatedly." + (mapcar #'(lambda (x) + (substitute-pattern-with-unicode (car x) + (cdr x))) + patterns)) + +(defun haskell-unicode () + (interactive) + (substitute-patterns-with-unicode + (list (cons "\\(<-\\)" 'left-arrow) + (cons "\\(->\\)" 'right-arrow) + (cons "\\(=>\\)" 'double-left-arrow) + (cons "\\(==\\)" 'identical) + (cons "\\(/=\\)" 'not-equal) + (cons "\\<\\(sqrt\\)\\>" 'square-root) + (cons "\\<\\(not\\)\\>" 'logical-neg) + (cons "\\(>\\)\\[^=\\]" 'greater-than) + (cons "\\(<\\)\\[^=\\]" 'less-than) + (cons "\\(>=\\)" 'greater-than-or-equal-to) + (cons "\\(<=\\)" 'less-than-or-equal-to) + (cons "\\<\\(alpha\\)\\>" 'alpha) + (cons "\\<\\(beta\\)\\>" 'beta) + (cons "\\<\\(gamma\\)\\>" 'gamma) + (cons "\\<\\(delta\\)\\>" 'delta) + (cons "\\(''\\)" 'double-prime) + (cons "\\('\\)" 'prime) + (cons "\\s (?\\(\\\\\\)\\s *\\(\\w\\|_\\).*?\\s *->" 'lambda) + (cons "\\(!!\\)" 'double-exclamation) + (cons "\\(\\.\\.\\)" 'horizontal-ellipsis)))) + +(add-hook 'haskell-mode 'haskell-unicode) + +;;; module-pretty.el ends here diff --git a/dots/.emacs.d/modules/module-projectile.el b/dots/.emacs.d/modules/module-projectile.el @@ -0,0 +1,38 @@ +;;; module-projectile.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package projectile + :delight (projectile-mode) + :config + (progn (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) + (setq projectile-completion-system 'ivy + projectile-cache-file (expand-file-name "projectile-cache" persistent-dir) + projectile-known-projects-file (expand-file-name "projectile-bookmarks.eld" persistent-dir)))) + +(use-package counsel-projectile + :after (counsel projectile) + :config (counsel-projectile-mode)) + +(provide 'module-projectile) + +;;; module-projectile.el ends here diff --git a/dots/.emacs.d/modules/module-protobuf.el b/dots/.emacs.d/modules/module-protobuf.el @@ -0,0 +1,30 @@ +;;; module-protobuf.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package protobuf-mode + :bind (:map protobuf-mode-map + ("C-c C-c" . compile))) + +(provide 'module-protobuf) + +;;; module-protobuf.el ends here diff --git a/dots/.emacs.d/modules/module-python.el b/dots/.emacs.d/modules/module-python.el @@ -0,0 +1,82 @@ +;;; module-python.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package python) + +(use-package elpy + :bind (:map elpy-mode-map + ("C-c C-j" . elpy-goto-definition) + ("M-," . pop-tag-mark)) + :config + (progn (setq elpy-rpc-backend "jedi") + (elpy-enable))) + + +(use-package pip-requirements + :config + (add-hook 'pip-requirements-mode-hook #'pip-requirements-auto-complete-setup)) + +(use-package py-autopep8) + +(use-package pyenv-mode + :disabled + :init + (add-to-list 'exec-path "~/.pyenv/shims") + (setenv "WORKON_HOME" "~/.pyenv/versions/") + :config + (pyenv-mode) + (add-hook 'after-init-hook 'pyenv-init) + (add-hook 'projectile-after-switch-project-hook 'pyenv-activate-current-project) + :bind + ("C-x p e" . pyenv-activate-current-project)) + +(defun pyenv-init() + (setq global-pyenv (replace-regexp-in-string "\n" "" (shell-command-to-string "pyenv global"))) + (message (concat "Setting pyenv version to " global-pyenv)) + (pyenv-mode-set global-pyenv) + (defvar pyenv-current-version nil global-pyenv)) + +(defun pyenv-activate-current-project () + "Automatically activates pyenv version if .python-version file exists." + (interactive) + (f-traverse-upwards + (lambda (path) + (message path) + (let ((pyenv-version-path (f-expand ".python-version" path))) + (if (f-exists? pyenv-version-path) + (progn + (setq pyenv-current-version (s-trim (f-read-text pyenv-version-path 'utf-8))) + (pyenv-mode-set pyenv-current-version) + (pyvenv-workon pyenv-current-version) + (message (concat "Setting virtualenv to " pyenv-current-version)))))))) + + +(setq python-shell-interpreter "ipython" + python-shell-interpreter-args "-i --simple-prompt" + + ;; when there are a bunch of ^G^G^G this fixes it + elpy-shell-echo-output nil) + +(provide 'module-python) + +;;; module-python.el ends here diff --git a/dots/.emacs.d/modules/module-r.el b/dots/.emacs.d/modules/module-r.el @@ -0,0 +1,29 @@ +;;; module-r.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package ess + :ensure t) + +(provide 'module-r) + +;;; module-r.el ends here diff --git a/dots/.emacs.d/modules/module-restclient.el b/dots/.emacs.d/modules/module-restclient.el @@ -0,0 +1,31 @@ +;;; module-restclient.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package restclient) + +(use-package company-restclient + :after (restclient company)) + +(provide 'module-restclient) + +;;; module-restclient.el ends here diff --git a/dots/.emacs.d/modules/module-rust.el b/dots/.emacs.d/modules/module-rust.el @@ -0,0 +1,75 @@ +;;; module-rust.el --- Packages used for rust + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package rust-mode + :bind (:map rust-mode-map + ("C-c C-c" . compile) + ("C-c <tab>" . rust-format-buffer)) + :config + (progn (setq rust-format-on-save t) + + (defun rust-prog-init () + "if cargo is install get all depencies for emacs rust packages" + (interactive) + (if (not (eq (executable-find "cargo") nil)) + (progn + (mapcar (lambda (pkg) + (let ((cmd (concat "cargo install " pkg))) + (call-process-shell-command cmd nil "*cargo-output*" t))) + '("racer"))) + (message "cargo executable not found"))) + + (defun setup-rust-mode-compile () + "Customize compile command to run go build" + (if (not (string-match "cargo" compile-command)) + (set (make-local-variable 'compile-command) + "cargo build"))) + + (add-hook 'rust-mode-hook 'setup-rust-mode-compile))) + + +;; depends on racer install with cargo install racer +(use-package racer + :after (rust-mode) + :delight racer-mode + :bind (:map rust-mode-map + ("TAB" . company-indent-or-complete-common) + ("C-c d" . racer-describe)) + :config + (progn (setq racer-cmd "~/.cargo/bin/racer") ;; Rustup binaries PATH + (setq racer-rust-src-path (concat (getenv "HOME") "/prog/rust/src")) ;; Rust source code PATH + + (add-hook 'rust-mode-hook #'racer-mode) + (add-hook 'racer-mode-hook #'eldoc-mode) + (add-hook 'racer-mode-hook #'company-mode) + + (setq company-tooltip-align-annotations t))) + +(use-package flycheck-rust + :after (flycheck-mode rust-mode) + :config + (progn (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))) + +(provide 'module-rust) + +;;; module-rust.el ends here diff --git a/dots/.emacs.d/modules/module-scheme.el b/dots/.emacs.d/modules/module-scheme.el @@ -0,0 +1,33 @@ +;;; module-scheme.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +;;(use-package guile-scheme) + +(use-package geiser + :config + (progn (setq geiser-repl-history-filename + (concat persistent-dir "geiser_history.guile")))) + +(provide 'module-scheme) + +;;; module-scheme.el ends here diff --git a/dots/.emacs.d/modules/module-solarized.el b/dots/.emacs.d/modules/module-solarized.el @@ -0,0 +1,124 @@ +;;; module-solarized.el --- solarized module for my emacs + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package solarized-theme + :config + (progn (setq solarized-emphasize-indicators nil + solarized-high-contrast-mode-line nil + solarized-scale-org-headlines nil + solarized-use-less-bold t + solarized-use-variable-pitch nil + solarized-distinct-fringe-background nil))) + +(use-package all-the-icons + :demand + :init + (progn (defun -custom-modeline-github-vc () + (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-"))) + (concat + (propertize (format " %s" (all-the-icons-octicon "git-branch")) + 'face `(:height 1 :family ,(all-the-icons-octicon-family)) + 'display '(raise 0)) + (propertize (format " %s" branch)) + (propertize " ")))) + + (defun -custom-modeline-svn-vc () + (let ((revision (cadr (split-string vc-mode "-")))) + (concat + (propertize (format " %s" (all-the-icons-faicon "cloud")) + 'face `(:height 1) + 'display '(raise 0)) + (propertize (format " %s" revision) 'face `(:height 0.9))))) + + (defvar mode-line-my-vc + '(:propertize + (:eval (when vc-mode + (cond + ((string-match "Git[:-]" vc-mode) (-custom-modeline-github-vc)) + ((string-match "SVN-" vc-mode) (-custom-modeline-svn-vc)) + (t (format "%s" vc-mode))))) + face mode-line-directory) + "Formats the current directory.")) + :config + (progn + ;; (setq-default mode-line-format + ;; (list + ;; evil-mode-line-tag + ;; mode-line-front-space + ;; mode-line-mule-info + ;; mode-line-modified + ;; mode-line-frame-identification + ;; mode-line-buffer-identification + ;; " " + ;; mode-line-position + ;; mode-line-my-vc + ;; mode-line-modes)) + ;; (concat evil-mode-line-tag) + )) + + +;; (bind-keys ("C-c tl" . (lambda () (interactive) (load-theme 'solarized-light))) +;; ("C-c td" . (lambda () (interactive) (load-theme 'solarized-dark)))) + +(load-theme 'solarized-light) + +(set-face-attribute 'mode-line nil + :background "#eee8d5" + :foreground "#657b83" + :box '(:line-width 4 :color "#eee8d5") + :overline nil + :underline nil) + +(set-face-attribute 'mode-line-inactive nil + :background "#fdf6e3" + :foreground "#93a1a1" + :box '(:line-width 4 :color "#eee8d5") + :overline nil + :underline nil) + +(define-minor-mode minor-mode-blackout-mode + "Hides minor modes from the mode line." + t) + +(catch 'done + (mapc (lambda (x) + (when (and (consp x) + (equal (cadr x) '("" minor-mode-alist))) + (let ((original (copy-sequence x))) + (setcar x 'minor-mode-blackout-mode) + (setcdr x (list "" original))) + (throw 'done t))) + mode-line-modes)) + +(global-set-key (kbd "C-c m") 'minor-mode-blackout-mode) +;; ;; window dividers +;; (window-divider-mode t) +;; (setq window-divider-default-right-width 2) + +;; (set-face-attribute 'window-divider nil :foreground "#eee8d5") +;; (set-face-attribute 'window-divider-first-pixel nil :foreground "#eee8d5") +;; (set-face-attribute 'window-divider-last-pixel nil :foreground "#eee8d5") + +(provide 'module-solarized) + +;;; module-solarized.el ends here diff --git a/dots/.emacs.d/modules/module-sql.el b/dots/.emacs.d/modules/module-sql.el @@ -0,0 +1,31 @@ +;;; module-sql.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package sql) + +(use-package sql-indent + :after (sql)) + +(provide 'module-sql) + +;;; module-sql.el ends here diff --git a/dots/.emacs.d/modules/module-tex.el b/dots/.emacs.d/modules/module-tex.el @@ -0,0 +1,28 @@ +;;; module-tex.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package auctex) + +(provide 'module-tex) + +;;; module-tex.el ends here diff --git a/dots/.emacs.d/modules/module-toml.el b/dots/.emacs.d/modules/module-toml.el @@ -0,0 +1,28 @@ +;;; module-toml.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package toml-mode) + +(provide 'module-toml) + +;;; module-toml.el ends here diff --git a/dots/.emacs.d/modules/module-undo-tree.el b/dots/.emacs.d/modules/module-undo-tree.el @@ -0,0 +1,6 @@ +(use-package undo-tree + :disabled + :delight undo-tree-mode + :config (global-undo-tree-mode t)) + +(provide 'module-undo-tree) diff --git a/dots/.emacs.d/modules/module-vagrant.el b/dots/.emacs.d/modules/module-vagrant.el @@ -0,0 +1,4 @@ +(use-package vagrant) +(use-package vagrant-tramp) + +(provide 'module-vagrant)+ \ No newline at end of file diff --git a/dots/.emacs.d/modules/module-web.el b/dots/.emacs.d/modules/module-web.el @@ -0,0 +1,28 @@ +;;; module-web.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package web-mode) + +(provide 'module-web) + +;;; module-web.el ends here diff --git a/dots/.emacs.d/modules/module-yaml.el b/dots/.emacs.d/modules/module-yaml.el @@ -0,0 +1,28 @@ +;;; module-yaml.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package yaml-mode) + +(provide 'module-yaml) + +;;; module-yaml.el ends here diff --git a/dots/.emacs.d/modules/module-yasnippet.el b/dots/.emacs.d/modules/module-yasnippet.el @@ -0,0 +1,34 @@ +;;; module-yasnippet.el + +;; Author: Mark Feller <mark.feller@member.fsf.org> + +;; This file is not part of GNU Emacs. + +;; This file 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. + +;; This file 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 file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(use-package yasnippet + :mode ("/\\.emacs\\.d/snippets/" . snippet-mode) + :delight yas-minor-mode + :demand + :config + (progn (yas-load-directory "~/.emacs.d/snippets/") + (yas-global-mode 1))) + +(provide 'module-yasnippet) + +;;; module-yasnippet.el ends here diff --git a/dots/.emacs.d/network-security.data b/dots/.emacs.d/network-security.data @@ -0,0 +1,3 @@ +( + (:id "sha1:4d7e016b7e6ab8f2d757b1c54223bca988091e57" :fingerprint "sha1:78:7a:50:a8:5e:68:70:54:c8:95:91:41:1f:9c:fa:64:49:c7:09:b9" :host "melpa-stable.milkbox.net:443" :conditions (:no-host-match)) +) diff --git a/dots/.emacs.d/snippets/go-mode/append b/dots/.emacs.d/snippets/go-mode/append @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: for append +# key: append +# contributor : @atotto +# -- +$1 = append($1, $0)+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/benchmark b/dots/.emacs.d/snippets/go-mode/benchmark @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: benchmark +# key: bench +# contributor : @atotto +# -- +func Benchmark$1(b *testing.B) { + for i := 0; i < b.N; i++ { + $0 + } +} diff --git a/dots/.emacs.d/snippets/go-mode/case b/dots/.emacs.d/snippets/go-mode/case @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: for switch case +# key: case +# contributor : @atotto +# -- +case $1: + $0+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/constructor b/dots/.emacs.d/snippets/go-mode/constructor @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: for constructor +# key: new +# contributor : @atotto +# -- +// New$1 returns a new $1. +func New$1() *$1 { + $2 := &$1{$0} + return $2 +} diff --git a/dots/.emacs.d/snippets/go-mode/dd b/dots/.emacs.d/snippets/go-mode/dd @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: debug fmt.Printf +# key: dd +# -- +fmt.Printf("%+v\n", $1) // output for debug +$0+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/else b/dots/.emacs.d/snippets/go-mode/else @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: else +# key: el +# contributor : @mjf +# -- +else { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/elseif b/dots/.emacs.d/snippets/go-mode/elseif @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: else if +# key: elif +# contributor : @mjf +# -- +else if $1 { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/error b/dots/.emacs.d/snippets/go-mode/error @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: error +# key: err +# contributor : @atotto +# -- +if err != nil { + return err +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/example b/dots/.emacs.d/snippets/go-mode/example @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: example +# key: example +# contributor : @atotto +# -- +func Example$1() { + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/for b/dots/.emacs.d/snippets/go-mode/for @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for +# key: for +# contributor : @atotto +# -- +for { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/forrange b/dots/.emacs.d/snippets/go-mode/forrange @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for range +# key: range +# contributor : @atotto +# -- +for ${3:key}, ${2:value} := range ${1:target} { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/func b/dots/.emacs.d/snippets/go-mode/func @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: func +# key: f +# -- +// $1 ${4:...} +func ${1:name}(${2:args}) $3 { + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/ginkgo-describe b/dots/.emacs.d/snippets/go-mode/ginkgo-describe @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: ginkgo-describe +# key: gd +# contributor : @mjf +# -- +var _ = Describe("$1", func() { + $0 +})+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/ginkgo-import b/dots/.emacs.d/snippets/go-mode/ginkgo-import @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: ginkgo-import +# key: gimp +# contributor : @mjf +# -- +. "github.com/onsi/ginkgo" +. "github.com/onsi/ginkgo/extensions/table" +. "github.com/onsi/gomega"+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/ginkgo-it b/dots/.emacs.d/snippets/go-mode/ginkgo-it @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: ginkgo-it +# key: gi +# contributor : @mjf +# -- +It("$1", func() { + $0 +})+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/go b/dots/.emacs.d/snippets/go-mode/go @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: go routine +# key: go +# contributor : @mjf +# -- +go func($1) { + $0 +}($2)+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/gomega-equal b/dots/.emacs.d/snippets/go-mode/gomega-equal @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: gomega equals +# key: eq +# contributor : @mjf +# -- +Expect($1).To(Equal($0))+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/gomega-error b/dots/.emacs.d/snippets/go-mode/gomega-error @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: gomega +# key: gerr +# contributor : @mjf +# -- +Expect(err).ToNot(HaveOccurred())+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/gomega-no-error b/dots/.emacs.d/snippets/go-mode/gomega-no-error @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: gomega no error +# key: nerr +# contributor : @mjf +# -- +Expect(err).To(HaveOccurred())+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/if b/dots/.emacs.d/snippets/go-mode/if @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: if +# key: if +# contributor : @mjf +# -- +if $1 { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/import b/dots/.emacs.d/snippets/go-mode/import @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: import +# key: import +# contributor : @atotto +# -- +import ( + "$0" +) diff --git a/dots/.emacs.d/snippets/go-mode/init b/dots/.emacs.d/snippets/go-mode/init @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: init +# key: init +# contributor : @atotto +# -- +func init(){ + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/interface b/dots/.emacs.d/snippets/go-mode/interface @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: interface +# key: i +# -- +interface{}$0+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/it b/dots/.emacs.d/snippets/go-mode/it @@ -0,0 +1,8 @@ + -*- mode: snippet -*- +# name: ginkgo it +# key: it +# contributor : @mjf +# -- +It("$1", func() { + $0 +})+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/main b/dots/.emacs.d/snippets/go-mode/main @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: func main +# key: main +# contributor : @atotto +# -- +func main() { + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/map b/dots/.emacs.d/snippets/go-mode/map @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: map +# key: map +# -- +map[${1:type}]${2:type}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/method b/dots/.emacs.d/snippets/go-mode/method @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: method +# key: m +# contributor: @Kunde21 +# -- +// $2 ${5:...} +func (${1:recv}) ${2:name}(${3:args}) $4 { + $0 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/package b/dots/.emacs.d/snippets/go-mode/package @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: package +# key: pack +# contributor : @atotto +# -- +// +package ${1:main} diff --git a/dots/.emacs.d/snippets/go-mode/printf b/dots/.emacs.d/snippets/go-mode/printf @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: print +# key: printf +# contributor : @atotto +# -- +fmt.Printf("%+v$0\n",$1)+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/struct b/dots/.emacs.d/snippets/go-mode/struct @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: struct +# key: type +# contributor : @atotto +# -- +type $1 struct { + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/switch b/dots/.emacs.d/snippets/go-mode/switch @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: for switch +# key: switch +# -- +switch $1 { +case $2: + $0 +default: +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/test b/dots/.emacs.d/snippets/go-mode/test @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: test +# key: test +# contributor : @atotto +# -- +func Test$1(t *testing.T) { + g := NewGomegaWithT(t) + $0 +} diff --git a/dots/.emacs.d/snippets/go-mode/testmain b/dots/.emacs.d/snippets/go-mode/testmain @@ -0,0 +1,21 @@ +# -*- mode: snippet -*- +# name: testmain +# key: testmain +# contributor : @atotto +# -- +func TestMain(m *testing.M) { + setup() + ret := m.Run() + if ret == 0 { + teardown() + } + os.Exit(ret) +} + +func setup() { + $1 +} + +func teardown() { + $2 +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/tests b/dots/.emacs.d/snippets/go-mode/tests @@ -0,0 +1,17 @@ +# -*- mode: snippet -*- +# name: tests +# key: tests +# contributor : @atotto +# -- +tests := []struct { + expected +}{ + {}, +} + +for n, tt := range tests { + actual := + if tt.expected != actual { + t.Errorf("#%d want %v, got %v", n, tt.expected, actual) + } +} diff --git a/dots/.emacs.d/snippets/go-mode/trun b/dots/.emacs.d/snippets/go-mode/trun @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: runtest +# key: rt +# contributor : @mjf +# -- +t.Run("$1", func(t *testing.T) { + $0 +})+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/go-mode/wrap-error b/dots/.emacs.d/snippets/go-mode/wrap-error @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: wraperror +# key: werr +# contributor : @mjf +# -- +if err != nil { + return errors.Wrap(err, "$0") +}+ \ No newline at end of file diff --git a/dots/.emacs.d/snippets/org-mode/el b/dots/.emacs.d/snippets/org-mode/el @@ -0,0 +1,7 @@ +# -*- mode: org -*- +# name: emacs-lisp +# key: el +# -- +#+begin_src emacs-lisp :tangle ${1:yes} + $2 +#+end_src diff --git a/dots/.emacs.d/theme/poet-fork/LICENSE b/dots/.emacs.d/theme/poet-fork/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Kunal Bhalla + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/dots/.emacs.d/theme/poet-fork/README.md b/dots/.emacs.d/theme/poet-fork/README.md @@ -0,0 +1,68 @@ +# poet [![MELPA](https://melpa.org/packages/poet-theme-badge.svg)](https://melpa.org/#/poet-theme) +A light emacs theme that's well suited for prose: particularly org-mode and markdown-mode; or any mode that works well with `variable-pitch` mode. + +## Motivation +The main idea behind this was to make Emacs more friendly for writing prose instead of code. Highlights include mixing monospace and variable pitch text in markdown and org-modes, making it convenient to write prose and code together. For example, + +![Screenshot](https://github.com/kunalb/poet/raw/master/screenshots.png) + +## Set up +- **Installation**: + - **Melpa**: Make sure [melpa is in your package archives list](https://melpa.org/#/getting-started), and <kbd>M-x</kbd> `package-install poet-theme` + - **Manual**: Download the theme to your `custom-theme-directory` which defaults to `~/emacs.d`. +- **Variable-pitch-mode**: Adding variable pitch mode to text modes will help in rendering mixed fonts every time you edit markdown, org-mode, etc. +``` + (add-hook 'text-mode-hook + (lambda () + (variable-pitch-mode 1))) +``` +- **Custom fonts**: Choose your fonts/font sizes before loading the theme with +``` + (set-face-attribute 'default nil :family "Iosevka" :height 130) + (set-face-attribute 'fixed-pitch nil :family "Iosevka") + (set-face-attribute 'variable-pitch nil :family "Baskerville") +``` +- **Mac OSX Title Bar**: Only for **Emacs 26.1** +``` + (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) + (add-to-list 'default-frame-alist '(ns-appearance . light)) +``` +- **Additional useful modes**: Some modes I like to enable/disable +``` + (olivetti-mode 1) ;; Centers text in the buffer + (flyspell-mode 1) ;; Catch Spelling mistakes + (typo-mode 1) ;; Good for symbols like em-dash + + (blink-cursor-mode 0) ;; Reduce visual noise + (linum-mode 0) ;; No line numbers for prose + + (setq org-bullets-bullet-list + '("◉" "○")) + (org-bullets 1) +``` + +## [Reddit](https://www.reddit.com/r/emacs/comments/9e01wf/share_your_modern_emacs/e5lpfmy/) reviews poet +![Reddit](https://github.com/kunalb/poet/raw/master/reddit.png) + +## Warning +- Exclusively aimed at graphical emacs + +## Next Steps +(No fixed timelines for these, depends on my time and motivation) +- [x] Publish v1 to Melpa. +--- +- [x] Add more screenshots showing off different modes (particularly markdown) +- [x] Evaluate & test github flavoured markdown in markdown-mode. +- [x] Publish v2 to Melpa +--- +- [x] Create a poet-dark mode with a yellow/white/black scheme. +- [ ] Add a dark brown theme +- [ ] Add support for customizing font faces +- [ ] Document support for additional modes. +- [ ] Publish v3 to Melpa. + + +## More Screenshots +![Org](https://github.com/kunalb/poet/raw/master/org.png) +![Markdown 1](https://github.com/kunalb/poet/raw/master/md1.png) +![Markdown 2](https://github.com/kunalb/poet/raw/master/md2.png) diff --git a/dots/.emacs.d/theme/poet-fork/poet-theme.el b/dots/.emacs.d/theme/poet-fork/poet-theme.el @@ -0,0 +1,310 @@ +;;; poet-theme.el --- A theme for prose. + +;; Copyright 2018-now Kunal Bhalla + +;; Author: Kunal Bhalla <bhalla.kunal@gmail.com> +;; URL: https://github.com/kunalb/poet/ +;; Version: 2.0 + +;;; Commentary: + +;; Emacs has very good support for multiple fonts in a single +;; file. Poet uses this support to make it much more convenient to +;; write prose within Emacs, with particular attention paid to +;; org-mode and markdown-mode. Code blocks, tables, etc are +;; formatted in monospace text with the appropriate backgrounds. + +;; Recommended customizations for using this theme +;; +;; - Set up the base fonts you'd like to use in Emacs before loading Poet +;; (set-face-attribute 'default nil :family "Iosevka" :height 130) +;; (set-face-attribute 'fixed-pitch nil :family "Iosevka") +;; (set-face-attribute 'variable-pitch nil :family "Baskerville") +;; On loading this theme captures the default and treats that for fixed-pitch +;; rendering. +;; +;; - Enable variable pitch mode for editing text +;; (add-hook 'text-mode-hook +;; (lambda () +;; (variable-pitch-mode 1)) +;; +;; - Some other modes I like to enable/disable +;; (olivetti-mode 1) ;; Centers text in the buffer +;; (flyspell-mode 1) ;; Catch Spelling mistakes +;; (typo-mode 1) ;; Good for symbols like em-dash +;; (blink-cursor-mode 0) ;; Reduce visual noise +;; (linum-mode 0) ;; No line numbers for prose +;; +;; - And prettier org mode bullets: +;; (setq org-bullets-bullet-list +;; '("◉" "○")) +;; (org-bullets 1) + +;;; Code: + +(defvar poet--monospace-height + (face-attribute 'fixed-pitch :height nil 'default) + "The original height stored as a defvar to stay constant across reloads.") + +(defun poet--height (multiplier) + "Scale up the height according to the MULTIPLIER." + (truncate (* poet--monospace-height multiplier))) + +(deftheme poet + "A prose friendly theme.") + +(let ( + ;; Primary Colors + (fg "#444444") + (bg "#e1d9c2") + + (white-light "#ffffff") + (yellow-light "#fff59d") + (red-light "#ff1744") + + (black "gray0") + (white "gray88") + (yellow "#fff176") + (blue "#0288D1") + (green "#388E3C") + (red "#bf360c") + (purple "#673AB7") + (brown "#8D6E63") + + ;; dark colors + (cyan-dark "#455A64") + (blue-dark "#3f51b5") + (red-dark "#8E3C38") + (purple-dark "#6C3082") + (brown-dark "#4e342e") + ) + (let ( + (emph "gray13") + (sep "gray80") + (hlt "gray93") + (bg-hlt "#fff8e1") + (meta brown-dark) + (link "#303f9f") + (link-underline "#304ffe") + (vlink-underline "#1a237e") + (button "gray27") + (cursor "gray29") + (paren-match-bg red-light) + (paren-match-fg white-light) + (search-fg red) + (search-bg white-light) + (search-fail-bg "#f8bbd0") + (tooltip-fg "#111111") + (tooltip-bg yellow) + (shadow "grey60") + (secondary-bg yellow-light) + (trailing-bg "#ff8a65") + (fci "grey87") + (mode-line-fg "grey7") + (mode-line-hlt white-light) + (mode-line-inactive "#888888") + (header red-dark) + (header-line-bg white) + (builtin red-dark) + (string green) + (function-name "#444444") + (keyword "#444444") + (constant blue) + (type "#444444") + (variable cyan-dark) + + ;; org + (org-meta brown) + (org-document-info brown) + (org-table white) + (org-quote-fg purple-dark) + (org-quote-bg white) + (org-date "#444444") + (org-title red) + (org-title-underline "#aaaaaa") + (org-checkbox "#aaaaaa") + (org-scheduled "#333333") + (org-scheduled-today "#111111") + (org-done green) + (org-todo red) + (org-tag "#777777") + (org-block-line "#d0d0d0") + (org-block-bg white) + (org-agenda-structure-fg "#555555") + (org-agenda-structure-bg white) + (org-agenda-today-fg "#000000") + (org-agenda-today-bg "#eeeeee") + (org-special-keyword "#777777") + (org-sched-prev "#222222") + (org-agenda-done "#777777") + + (hl-line "#efefef") + (linum-hlt "#555555") + (linum "#aaaaaa") + (markdown-markup brown) + (markdown-metadata "#777777") + (markdown-language purple) + (markdown-list "#000000") + (markdown-code-bg white) + (markdown-pre-bg white) + (markdown-header-delimiter brown) + (imenu brown-dark)) + (custom-theme-set-faces 'poet + `(variable-pitch ((t (:family ,(face-attribute 'variable-pitch :family) :height ,(poet--height 1.23))))) + + `(default ((t (:background ,bg :foreground ,fg)))) + `(italic ((t (:foreground ,emph :slant italic)))) + `(highlight ((t (:background ,hlt :overline nil)))) + `(region ((t (:background ,bg-hlt)))) + `(fringe ((t (:background ,bg)))) + `(button ((t (:inherit default :foreground ,button)))) + `(escape-glyph ((t (:foreground ,purple)))) + `(link ((t (:underline (:color ,link-underline :style line) :foreground ,link)))) + `(link-visited ((t (:inherit link :foreground ,link :underline (:color ,vlink-underline :style line))))) + `(cursor ((t (:background ,cursor)))) + `(show-paren-match ((t (:background ,paren-match-fg :foreground ,paren-match-bg)))) + `(isearch ((t (:foreground ,search-fg :background ,search-bg)))) + `(isearch-fail ((t (:background ,search-fail-bg)))) + `(query-replace ((t (:inherit isearch)))) + `(tooltip ((t (:inherit default :foreground ,tooltip-fg :background ,tooltip-bg)))) + `(shadow ((t (:foreground ,shadow)))) + `(secondary-selection ((t (:background ,secondary-bg)))) + `(trailing-whitespace ((t (:background ,trailing-bg)))) + `(lazy-highlight ((t (:foreground ,black :background ,white-light)))) + `(next-error ((t (:inherit region)))) + `(window-divider ((t (:background ,sep :foreground ,sep)))) + `(vertical-border ((t (:background ,sep :foreground ,sep)))) + `(minibuffer-prompt ((t (:inherit fixed-pitch :weight bold :foreground ,meta)))) + + ;; mode line + `(header-line ((t (:overline nil :background ,header-line-bg :box (:line-width 3 :color ,header-line-bg) :underline ,sep :inherit mode-line)))) + `(mode-line ((t (:inherit fixed-pitch :foreground ,mode-line-fg :background ,bg :overline ,sep :box (:line-width 8 :color ,bg))))) + `(mode-line-inactive ((t (:inherit mode-line :background ,bg :foreground ,mode-line-inactive :box (:color ,bg :line-width 8))))) + `(mode-line-buffer-id ((t (:weight bold)))) + `(mode-line-emphasis ((t (:weight bold)))) + `(mode-line-highlight ((t (:background ,mode-line-hlt)))) + + `(error ((t (:inherit fixed-pitch)))) + + ;; primary font lock + `(font-lock-comment-face ((t (:foreground ,shadow :inherit fixed-pitch)))) + `(font-lock-builtin-face ((t (:foreground ,builtin :inherit fixed-pitch)))) + `(font-lock-string-face ((t (:inherit fixed-pitch :foreground ,string)))) + `(font-lock-function-name-face ((t (:inherit fixed-pitch :foreground ,function-name)))) + `(font-lock-keyword-face ((t (:inherit fixed-pitch :weight bold :foreground ,keyword)))) + `(font-lock-comment-delimiter-face ((t (:inherit fixed-pitch :inherit font-lock-comment-face)))) + `(font-lock-constant-face ((t (:inherit fixed-pitch)))) + `(font-lock-doc-face ((t (:inherit fixed-pitch :inherit font-lock-string-face)))) + `(font-lock-preprocessor-face ((t (:inherit fixed-pitch :inherit font-lock-builtin-face)))) + `(font-lock-regexp-grouping-backslash ((t (:inherit fixed-pitch :inherit bold)))) + `(font-lock-regexp-grouping-construct ((t (:inherit fixed-pitch :inherit bold)))) + `(font-lock-type-face ((t (:inherit fixed-pitch)))) + `(font-lock-variable-name-face ((t (:inherit fixed-pitch :foreground ,variable)))) + `(font-lock-warning-face ((t (:inherit error)))) + + ;; Org + `(org-level-1 ((t (:inherit default :foreground ,header :height ,(poet--height 1.5))))) + `(org-level-2 ((t (:inherit default :foreground ,header :height ,(poet--height 1.4))))) + `(org-level-3 ((t (:inherit default :foreground ,header :height ,(poet--height 1.3))))) + `(org-level-4 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) + `(org-level-5 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) + `(org-level-6 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) + `(org-level-7 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) + `(org-level-8 ((t (:inherit default :foreground ,header :height ,(poet--height 1.23))))) + `(org-meta-line ((t (:inherit fixed-pitch :foreground ,org-meta)))) + `(org-document-info-keyword ((t (:inherit fixed-pitch :foreground ,org-document-info)))) + `(org-document-info ((t (:inherit default :foreground ,org-document-info)))) + `(org-verbatim ((t (:inherit fixed-pitch)))) + `(org-table ((t (:inherit fixed-pitch :background ,org-table)))) + `(org-formula ((t (:inherit org-table :height ,(poet--height 1))))) + `(org-quote ((t (:inherit default :foreground ,org-quote-fg :background ,org-quote-bg)))) + `(org-hide ((t (:inherit fixed-pitch :foreground ,bg)))) + `(org-indent ((t (:inherit org-hide)))) + `(org-date ((t (:inherit fixed-pitch :foreground ,org-date :underline nil)))) + `(org-document-title ((t (:inherit default :foreground ,org-title :height ,(poet--height 1.8) :underline (:color ,org-title-underline))))) + `(org-checkbox ((t (:inherit fixed-pitch :weight bold :foreground ,org-checkbox)))) + `(org-scheduled ((t (:foreground ,org-scheduled)))) + `(org-scheduled-today ((t (:foreground ,org-scheduled-today)))) + `(org-done ((t (:inherit fixed-pitch :foreground ,org-done)))) + `(org-todo ((t (:inherit fixed-pitch :foreground ,org-todo)))) + `(org-tag ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,org-tag)))) + `(org-block-begin-line ((t (:inherit fixed-pitch :background ,org-block-line)))) + `(org-block-end-line ((t (:inherit fixed-pitch :background ,org-block-line)))) + `(org-block ((t (:background ,org-block-bg :inherit fixed-pitch)))) + `(org-priority ((t (:inherit fixed-pitch :weight normal)))) + `(org-agenda-structure ((t (:foreground ,org-agenda-structure-fg :background ,org-agenda-structure-bg :overline ,org-agenda-structure-bg :underline ,org-agenda-structure-bg)))) + `(org-agenda-date-weekend ((t (:inherit org-agenda-structure)))) + `(org-agenda-date-today ((t (:foreground ,org-agenda-today-fg :overline ,org-agenda-today-bg :background ,org-agenda-today-bg :underline ,org-agenda-today-bg)))) + `(org-special-keyword ((t (:inherit fixed-pitch :foreground ,org-special-keyword)))) + `(org-scheduled-previously ((t (:foreground ,org-sched-prev)))) + `(org-agenda-done ((t (:foreground ,org-agenda-done)))) + `(org-footnote ((t (:foreground ,link)))) + `(hl-line ((t (:background ,hl-line)))) + + ;; line numbers + `(line-number ((t (:inherit fixed-pitch :foreground ,linum)))) + `(line-number-current-line ((t (:inherit fixed-pitch :foreground ,linum-hlt)))) + + ;; markdown + `(markdown-header-face-1 ((t (:foreground ,header :inherit default :height ,(poet--height 1.5))))) + `(markdown-header-face-2 ((t (:foreground ,header :inherit default :height ,(poet--height 1.4))))) + `(markdown-header-face-3 ((t (:foreground ,header :inherit default :height ,(poet--height 1.3))))) + `(markdown-header-face-4 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) + `(markdown-header-face-5 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) + `(markdown-header-face-6 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) + `(markdown-header-face-7 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) + `(markdown-header-face-8 ((t (:foreground ,header :inherit default :height ,(poet--height 1.23))))) + `(markdown-markup-face ((t (:inherit fixed-pitch :foreground ,markdown-markup)))) + `(markdown-inline-code-face ((t (:inherit fixed-pitch)))) + `(markdown-metadata-key-face ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,markdown-metadata)))) + `(markdown-metadata-value-face ((t (:inherit fixed-pitch :height ,(poet--height 1) :foreground ,fg)))) + `(markdown-language-keyword-face ((t (:foreground ,markdown-language)))) + `(markdown-list-face ((t (:inherit fixed-pitch :foreground ,markdown-list)))) + `(markdown-code-face ((t (:inherit fixed-pitch :foreground ,fg :background ,markdown-code-bg)))) + `(markdown-pre-face ((t (:inherit fixed-pitch :color ,fg :background ,markdown-pre-bg)))) + `(markdown-header-delimiter-face ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter)))) + `(markdown-header-rule-face ((t (:inherit fixed-pitch :foreground ,markdown-header-delimiter)))) + `(markdown-url-face ((t (:inherit fixed-pitch :foreground ,link)))) + + ;; ivy + `(ivy-current-match ((t (:inherit fixed-pitch :background ,hlt)))) + `(ivy-minibuffer-match-face-1 ((t (:inherit fixed-pitch :foreground ,cyan-dark)))) + `(ivy-minibuffer-match-face-2 ((t (:inherit fixed-pitch :foreground ,red-dark)))) + `(ivy-minibuffer-match-face-3 ((t (:inherit fixed-pitch :foreground ,blue-dark)))) + `(ivy-minibuffer-match-face-4 ((t (:inherit fixed-pitch :foreground ,brown-dark)))) + + ;; imenu + `(imenu-list-entry-face-0 ((t (:foreground ,imenu)))) + `(imenu-list-entry-face-1 ((t (:foreground ,imenu)))) + `(imenu-list-entry-face-2 ((t (:foreground ,imenu)))) + `(imenu-list-entry-face-3 ((t (:foreground ,imenu)))) + `(imenu-list-entry-face-4 ((t (:foreground ,imenu)))) + `(imenu-list-entry-face-5 ((t (:foreground ,imenu)))) + + ;; tldr + `(tldr-title ((t (:foreground ,red :weight bold :height 1.9)))) + `(tldr-description ((t (:foreground ,green)))) + `(tldr-code-block ((t ()))) + `(tldr-command-argument ((t ()))) + + ;; evil + `(evil-ex-substitute-replacement ((t (:foreground ,white-light :background ,brown-dark :underline nil)))) + `(evil-goggles-delete-face ((t (:inherit 'lazy-highlight)))) + `(evil-goggles-paste-face ((t (:inherit 'lazy-highlight)))) + `(evil-goggles-yank-face ((t (:inherit 'lazy-highlight)))) + + `(helm-source-header ((t (:height ,(poet--height 1)))))) + + (custom-theme-set-variables 'poet + '(line-spacing 0.4) + `(fci-rule-color ,fci)))) + +;;;###autoload +(when (and (boundp 'custom-theme-load-path) + load-file-name) + (add-to-list 'custom-theme-load-path + (file-name-as-directory + (file-name-directory load-file-name)))) + +(provide-theme 'poet) +;;; poet-theme.el ends here diff --git a/dots/.emacs.d/theme/poet-fork/tests/test.md b/dots/.emacs.d/theme/poet-fork/tests/test.md @@ -0,0 +1,68 @@ +--- +author: Kunal Bhalla +--- + +Test Document +======================== + +Headers +------------ +# Heading 1 +## Heading 2 +### Heading 3 +#### Heading 4 +##### Heading 5 + + +## Bullets +* Some Bullets + * which can be nested + * through multiple levels + +- They + - Can + - Also ++ Be + + Other + + Symbols + +1. Numbered + 2. Bullets + 3. Too! + +## Code +```python +def helloWorld(): + print("Hello, world!") +``` + +Code can also be `inline`. + +## Tables +| Column 1 | Column 2 | +|----------|----------| +| foo | bar | +| baz | qux | +| quux | quuz | + +## Emphasis +Possibly **Strong** +Or *italic* +And can have _underscores_ +Or be ~~deleted~~. + +## Links +[This theme](https://github.com/kunalb/poet) + +## Quotes +> are often misattributed +> -- me + +## Rules +--- +*** +--- + +## Checklists! +- [ ] Do all +- [ ] The Things! diff --git a/dots/.emacs.d/theme/poet-fork/tests/test.org b/dots/.emacs.d/theme/poet-fork/tests/test.org @@ -0,0 +1,33 @@ +#+TITLE: Test Org Document +#+DATE: <2018-03-18 Sun> + +* With Features :tag: +** Lots of different features +Just testing out different behaviours in org mode. + +#+BEGIN_SRC elisp +(like code) +#+END_SRC + +#+BEGIN_EXAMPLE +And examples +#+END_EXAMPLE + +* TODO And plain lists +** TODO Something more +** DONE Something else +CLOSED: [2018-04-18 Wed 23:46] +- Some lists are nice + +* DONE And emphasis +- [ ] With a *checklist* +- [X] And /italics/ +- [ ] And _underlines_ +- [ ] And [[https://github.com/kunalb/poet][links]] + +* [#A] And tables +| Test | Table | +|------+--------| +| With | Values | +| 1 | 2 | +| 3 | 4 | diff --git a/dots/.emacs.d/transient/history.el b/dots/.emacs.d/transient/history.el @@ -0,0 +1 @@ +nil+ \ No newline at end of file