Updated emacs-d and added Remtrail command to vimrc

This commit is contained in:
hellerve
2015-06-15 16:10:45 +02:00
parent d6da2b169d
commit 23636108a1
64 changed files with 3571 additions and 21 deletions

17
.emacs.d/.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
*~
/auto-save-list/
/bak/
/elpa/
/ido.last
/ohai-personal-taste.el
/recentf
/smex-items
/custom.el
/eshell/
/projectile-bookmarks.eld
/.mc-lists.el
/user.el
/var/
/tramp
/url/
/session.*

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

9
.emacs.d/.travis.yml Normal file
View File

@@ -0,0 +1,9 @@
install:
- sudo add-apt-repository -y ppa:ubuntu-elisp/ppa &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs-snapshot
script:
- ln -s . .emacs.d &&
HOME=`pwd` emacs --batch -Q --eval "(load-file \"ohai/ohai-test.el\")"

674
.emacs.d/COPYING Normal file
View File

@@ -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>.

60
.emacs.d/README.org Normal file
View File

@@ -0,0 +1,60 @@
* Ohai Emacs
While it is certainly true that Emacs is the most powerful text editor in the world, your first impression of it may be less favourable, because its default configuration really just isn't all that great.
But now there is Ohai Emacs! Simply install Ohai Emacs as your emacs.d, and you will be ready to bask in the full radiance of Holy Emacs in no time at all.
There is even a configuration [[https://i.chzbgr.com/maxW500/8443050752/h55957A15/][wizard]]!
[[./.ohai-emacs/ohai-emacs.jpg]]
** Installation
If you don't have it installed already, go get a copy of [[http://www.gnu.org/software/emacs/#Obtaining][GNU Emacs]] version 24.4 or later.
If you have an emacs.d already, move it out of the way (~mv ~/.emacs.d ~/.emacs.d.bak~) or get rid of it (~rm -rf ~/.emacs.d~) first.
To download Ohai Emacs as your new emacs.d:
#+begin_src sh
$ git clone https://github.com/bodil/ohai-emacs.git ~/.emacs.d
#+end_src
That's it! Now, the next time you start Emacs, Ohai Emacs will ask you a few questions about how you like things to be, and go on the internets and download some fresh packages for you. In a little while, it will be ready for your emacsing.
** Usage
A full feature list is pending. A quick overview:
- Carefully styled for a fashionable look.
- Improved navigation, editing and code style settings.
- Magit, the premier git frontend.
- Smart autocomplete with company-mode.
- Flycheck.
- Yasnippet.
- Paredit for Emacs Lisp.
- Improved JS and HTML modes with powerful refactoring tools.
- Nyan Cat.
*** Learning From Emacs Lisp
While Ohai Emacs helps you get started quickly and without frustration, you must eventually learn Emacs Lisp in order to become an Emacs Master. The Ohai Emacs source code contains numerous comments designed to explain, often in detail, what it's doing. The best (if not the fastest) way to learn what Ohai Emacs can do for you is to read the source.
Start at ~.emacs.d/init.el~. This sets up the basic environment, and loads each Ohai Emacs module from the ~.emacs.d/modules~ directory in turn. Read through the ~.el~ file in the module directory that are of interest to you, and you will find they explain the changes they make, often pointing you to useful documentation for the more powerful features.
** License
Copyright 2015 Bodil Stokke
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/.

View File

@@ -1,8 +1,8 @@
(1
(ace-window .
[(0 8 1)
[(0 9 0)
((avy
(0 1 0)))
(0 2 0)))
"Quickly switch windows." single
((:url . "https://github.com/abo-abo/ace-window")
(:keywords "window" "location"))])
@@ -271,7 +271,7 @@
((:url . "http://elpa.gnu.org/packages/flylisp.html")
(:keywords))])
(ggtags .
[(0 8 9)
[(0 8 10)
((emacs
(24))
(cl-lib
@@ -348,7 +348,7 @@
((:url . "http://elpa.gnu.org/packages/jumpc.html")
(:keywords))])
(let-alist .
[(1 0 3)
[(1 0 4)
nil "Easily let-bind values of an assoc-list by their names" single
((:url . "http://elpa.gnu.org/packages/let-alist.html")
(:keywords "extensions" "lisp"))])
@@ -447,7 +447,7 @@
((:url . "http://elpa.gnu.org/packages/omn-mode.html")
(:keywords))])
(org .
[(20150525)
[(20150608)
nil "Outline-based notes management and organizer" tar nil])
(osc .
[(0 1)
@@ -459,6 +459,11 @@
nil "Predictive abbreviation expansion" single
((:url . "http://elpa.gnu.org/packages/pabbrev.html")
(:keywords))])
(pinentry .
[(0 1)
nil "GnuPG Pinentry server implementation" single
((:url . "http://elpa.gnu.org/packages/pinentry.html")
(:keywords "gnupg"))])
(poker .
[(0 1)
nil "Texas hold'em poker" single
@@ -519,6 +524,13 @@
nil "Implementation of Sokoban for Emacs." tar
((:keywords "games")
(:url . "http://elpa.gnu.org/packages/sokoban.html"))])
(sotlisp .
[(1 0)
((emacs
(24 1)))
"Write lisp at the speed of thought." single
((:url . "https://github.com/Malabarba/speed-of-thought-lisp")
(:keywords "convenience" "lisp"))])
(spinner .
[(1 3 1)
nil "Add spinners and progress-bars to the mode-line for ongoing operations" single
@@ -656,4 +668,9 @@
[(0 8 0)
nil "Yet another snippet extension for Emacs." tar
((:keywords "convenience" "emulation")
(:url . "http://github.com/capitaomorte/yasnippet"))]))
(:url . "http://github.com/capitaomorte/yasnippet"))])
(ztree .
[(1 0 1)
nil "Text mode directory tree" tar
((:keywords "files" "tools")
(:url . "https://github.com/fourier/ztree"))]))

View File

@@ -1 +1 @@
Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent <elpasign@elpa.gnu.org> (trust undefined) created at 2015-05-26T11:05:02+0200 using DSA
Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent <elpasign@elpa.gnu.org> (trust undefined) created at 2015-06-12T11:05:02+0200 using DSA

View File

@@ -895,7 +895,7 @@
[(1 4)
nil "pattern matching for elisp" single])
(shackle .
[(0 3 0)
[(0 6 0)
((cl-lib
(0 5)))
"Enforce rules for popups" single])
@@ -1362,7 +1362,7 @@
[(0 0 1)
nil "get stuff from pinboard" single])
(picpocket .
[(11)
[(14)
nil "Image viewer" single])
(pickup .
[(0 0 3)
@@ -2068,7 +2068,7 @@
(1 2 0)))
"completing-read over all files in Git" single])
(magit .
[(1 4 1)
[(1 4 2)
((cl-lib
(0 5))
(git-commit-mode
@@ -2947,7 +2947,7 @@
(0 2 3)))
"Utility functions for working with fonts" single])
(fold-this .
[(0 1 0)
[(0 3 0)
nil "Just fold this region please" single])
(fold-dwim-org .
[(0 5)
@@ -3111,7 +3111,7 @@
(0 15)))
"A flycheck checker for Haskell using hdevtools" single])
(flycheck-haskell .
[(0 6)
[(0 7)
((flycheck
(0 22))
(haskell-mode
@@ -3188,7 +3188,7 @@
[(0)
nil "Resize a frame. In particular, fit a frame to its buffers." single])
(firestarter .
[(0 1 3)
[(0 2 2)
nil "Execute (shell) commands on save" single])
(fiplr .
[(0 1 3)
@@ -3259,9 +3259,11 @@
(2 2 0)))
"Modern API for working with files and directories" single])
(eyebrowse .
[(0 4 5)
[(0 6 1)
((dash
(2 7 0)))
(2 7 0))
(emacs
(24 3 1)))
"Easy window config switching" single])
(extend-dnd .
[(0 5)
@@ -3776,7 +3778,7 @@
[(2 10 0)
nil "A modern list library for Emacs" single])
(dart-mode .
[(0 12)
[(0 13)
((cl-lib
(0 5))
(dash
@@ -3823,7 +3825,7 @@
[(0 1 1)
nil "Table component for Emacs Lisp" single])
(csharp-mode .
[(0 8 9)
[(0 8 10)
nil "C# mode derived mode" tar])
(cryptol-mode .
[(0 1 0)
@@ -4398,7 +4400,7 @@
(1 11 5)))
"Space align various Clojure forms" single])
(alchemist .
[(0 14 0)
[(0 16 1)
((emacs
(24)))
"Elixir tooling integration into Emacs" tar])

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -1,2 +1,78 @@
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")))
;;; -*- lexical-binding: t -*-
;;; init.el --- This is where all emacs start.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Do an Emacs version check before going any further.
(when (or (< emacs-major-version 24)
(and (= emacs-major-version 24) (< emacs-minor-version 4)))
(x-popup-dialog
t `(,(format "Sorry, you need GNU Emacs version 24.4 or higher
to run Ohai Emacs.
Your installed Emacs reports:
%s" (emacs-version))
("OK :(" . t)))
(save-buffers-kill-emacs t))
;; We start off by telling Emacs where we intend to keep things, and some
;; other basic system setup.
;; Skip the default splash screen.
(setq inhibit-startup-message t)
;; Figure out the current hostname.
(setq hostname (replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" (with-output-to-string (call-process "hostname" nil standard-output))))
;; Figure out the path to our .emacs.d by getting the path part of the
;; current file (`init.el`).
(setq dotfiles-dir (file-name-directory
(or (buffer-file-name) (file-chase-links load-file-name))))
;; We need to tell Emacs where to find Ohai Emacs's library packages.
(add-to-list 'load-path (concat dotfiles-dir "ohai"))
;; We'll keep the various parts of our configuration in the `modules` subfolder
;; of our .emacs.d. We'll need to add that to the system load path so Emacs can
;; find our modules when we ask for them.
(add-to-list 'load-path (concat dotfiles-dir "modules"))
;; Define where we want to keep `loaddefs.el` (our autoload declarations) and
;; `custom.el` (our user settings file).
(setq autoload-file (concat dotfiles-dir "loaddefs.el"))
(setq custom-file (concat dotfiles-dir "custom.el"))
;; Load the user settings from `custom.el`.
(load custom-file 'noerror)
;; Load the Ohai Emacs fundamentals.
(require 'ohai-lib)
(require 'ohai-package)
(require 'ohai-module-index)
(require 'ohai-module-selector)
(require 'ohai-update)
(require 'ohai-personal-taste)
(require 'ohai-startup-wizard)
;; Load the enabled modules.
(when (not (boundp 'ohai/wizard-did-run)) (ohai/load-modules))
;; Load the user's config, if it exists.
(load (concat dotfiles-dir "user.el") 'noerror)

View File

@@ -0,0 +1,198 @@
;;; -*- lexical-binding: t -*-
;;; ohai-appearance.el --- Fashion and aesthetics.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-personal-taste)
(require 'term)
;; Get rid of the training wheels, if you're ready for it.
(when (not ohai-personal-taste/training-wheels)
(dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
(when (fboundp mode) (funcall mode -1))))
;; Configure the light colour scheme.
(defun ohai-appearance/light ()
(interactive)
(load-theme 'leuven)
(set-face-attribute 'mode-line nil
:foreground "#cccccc"
:background "#000000"
:box nil
:weight 'bold)
(set-face-attribute 'mode-line-buffer-id nil
:foreground "white"
:weight 'bold)
(set-face-foreground 'which-func "#3cb64a")
(set-face-attribute 'linum nil :height 0.7)
(set-face-foreground 'term-color-black "#ffffff")
(set-face-foreground 'term-color-red "#f5666d")
(set-face-foreground 'term-color-green "#3cb64a")
(set-face-foreground 'term-color-yellow "#ce5c00")
(set-face-foreground 'term-color-blue "#00578e")
(set-face-foreground 'term-color-magenta "#d020f0")
(set-face-foreground 'term-color-cyan "#6799cc")
(set-face-foreground 'term-color-white "#000000")
(run-hooks 'ohai-appearance/hook)
(run-hooks 'ohai-appearance/light-hook))
;; Configure the dark colour scheme.
(defun ohai-appearance/dark ()
(interactive)
(load-theme 'wombat)
(set-face-background 'region "#374186")
(set-face-background 'fringe "#191919")
(set-face-attribute 'linum nil :background nil :height 0.7)
(set-face-foreground 'which-func "#7f9f7f")
(set-face-foreground 'term-color-black "#3f3f3f")
(set-face-foreground 'term-color-red "#cc9393")
(set-face-foreground 'term-color-green "#7f9f7f")
(set-face-foreground 'term-color-yellow "#f0dfaf")
(set-face-foreground 'term-color-blue "#8cd0d3")
(set-face-foreground 'term-color-magenta "#dc8cc3")
(set-face-foreground 'term-color-cyan "#93e0e3")
(set-face-foreground 'term-color-white "#dcdccc")
(run-hooks 'ohai-appearance/hook)
(run-hooks 'ohai-appearance/dark-hook))
;; Setup hooks to re-run after all modules have loaded, allowing
;; other modules to tweak the theme without having to wait
;; until they're loaded to switch to it.
(add-hook
'ohai/modules-loaded-hook
(lambda ()
(run-hooks 'ohai-appearance/hook)
(cond
((equal ohai-personal-taste/style 'dark)
(run-hooks 'ohai-appearance/dark-hook))
((equal ohai-personal-taste/style 'light)
(run-hooks 'ohai-appearance/light-hook)))))
;; Maximise the Emacs frame if that's how you like it.
(if (equal ohai-personal-taste/window-state 'maximised)
(set-frame-parameter nil 'fullscreen 'maximized))
;; Don't defer screen updates when performing operations.
(setq redisplay-dont-pause t)
;; When not in a terminal, configure a few window system specific things.
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
(tooltip-mode -1)
(mouse-wheel-mode t)
(blink-cursor-mode -1))
;; Show line numbers in buffers.
(global-linum-mode t)
(setq linum-format (if (not window-system) "%4d " "%4d"))
;; Show column numbers in modeline.
(setq column-number-mode t)
;; Show current function in modeline.
(which-function-mode)
;; Ensure linum-mode is disabled in certain major modes.
(setq linum-disabled-modes
'(term-mode slime-repl-mode magit-status-mode help-mode nrepl-mode
mu4e-main-mode mu4e-headers-mode mu4e-view-mode
mu4e-compose-mode))
(defun linum-on ()
(unless (or (minibufferp) (member major-mode linum-disabled-modes))
(linum-mode 1)))
;; Highlight matching braces.
(show-paren-mode 1)
;; Engage Nyan Cat!
(package-require 'nyan-mode)
(nyan-mode 1)
(setq nyan-bar-length 16
nyan-wavy-trail t)
;; Unclutter the modeline
(package-require 'diminish)
(eval-after-load "yasnippet" '(diminish 'yas-minor-mode))
(eval-after-load "ethan-wspace" '(diminish 'ethan-wspace-mode))
(eval-after-load "eldoc" '(diminish 'eldoc-mode))
(eval-after-load "rainbow-mode" '(diminish 'rainbow-mode))
(eval-after-load "paredit" '(diminish 'paredit-mode))
(eval-after-load "autopair" '(diminish 'autopair-mode))
(eval-after-load "abbrev" '(diminish 'abbrev-mode))
(eval-after-load "company" '(diminish 'company-mode))
(eval-after-load "js2-highlight-vars" '(diminish 'js2-highlight-vars-mode))
(eval-after-load "projectile" '(diminish 'projectile-mode))
(eval-after-load "mmm-mode" '(diminish 'mmm-mode))
(eval-after-load "skewer-html" '(diminish 'skewer-html-mode))
(eval-after-load "skewer-mode" '(diminish 'skewer-mode))
(eval-after-load "auto-indent-mode" '(diminish 'auto-indent-minor-mode))
(eval-after-load "highlight-parentheses" '(diminish 'highlight-parentheses-mode))
;; (eval-after-load "subword" '(diminish 'subword-mode))
(eval-after-load "anzu" '(diminish 'anzu-mode))
(eval-after-load "cider" '(diminish 'cider-mode))
(eval-after-load "smartparens" '(diminish 'smartparens-mode))
(eval-after-load "git-gutter" '(diminish 'git-gutter-mode))
(eval-after-load "magit" '(diminish 'magit-auto-revert-mode))
(eval-after-load "js2-mode"
'(defadvice js2-mode (after js2-rename-modeline activate)
(setq mode-name "JS+")))
(eval-after-load "clojure-mode"
'(defadvice clojure-mode (after clj-rename-modeline activate)
(setq mode-name "Clj")))
(eval-after-load "typescript"
'(defadvice typescript-mode (after typescript-rename-modeline activate)
(setq mode-name "TS")))
(eval-after-load "nxhtml-mode"
'(defadvice nxhtml-mode (after nxhtml-rename-modeline activate)
(setq mode-name "HTML")))
(eval-after-load "js"
'(defadvice js-mode (after js-rename-modeline activate)
(setq mode-name "JS")))
(defadvice emacs-lisp-mode (after elisp-rename-modeline activate)
(setq mode-name "ELisp"))
;; Display incremental search stats in modeline.
(package-require 'anzu)
(global-anzu-mode 1)
;; Install the colour scheme according to personal taste.
(defun ohai-appearance/apply-style ()
(interactive)
(cond
((equal ohai-personal-taste/style 'dark)
(ohai-appearance/dark))
((equal ohai-personal-taste/style 'light)
(ohai-appearance/light))))
(ohai-appearance/apply-style)
(provide 'ohai-appearance)
;;; ohai-appearance.el ends here

View File

@@ -0,0 +1,97 @@
;;; -*- lexical-binding: t -*-
;;; ohai-clojure.el --- If you like your parentheses Java flavoured.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(package-require 'clojure-mode)
;; We'll be using Monroe, a simple nREPL client. To use it, you'll need
;; to start an nREPL somewhere (running `lein repl' in your project should
;; do the trick) and run `M-x monroe' to connect to it and open a REPL
;; buffer.
(package-require 'monroe)
;; We'll also be using clj-refactor for refactoring support. The features
;; which require CIDER won't work with Monroe.
(package-require 'clj-refactor)
;; We might need Paredit too if that's how you like it.
(package-require 'paredit)
;; Setup
(add-hook
'clojure-mode-hook
(lambda ()
(when ohai-personal-taste/paredit (paredit-mode))
(clj-refactor-mode 1)
(require 'monroe)
(clojure-enable-monroe)))
(with-eval-after-load "clojure-mode"
;; Rebind C-x C-e to eval through nREPL in clojure-mode buffers.
(define-key clojure-mode-map (kbd "C-x C-e")
'monroe-eval-expression-at-point)
;; Define the keybinding prefix for clj-refactor commands.
;; From there, see https://github.com/clojure-emacs/clj-refactor.el#usage
(cljr-add-keybindings-with-prefix "C-c C-m"))
;; Monroe doesn't offer any completion support. Let's build on it to
;; add a company-mode backend which queries the connected nREPL for
;; completions.
(with-eval-after-load "clojure-mode"
(with-eval-after-load "company"
(defun monroe-eval-string (s callback)
(monroe-send-eval-string
s
(lambda (response)
(monroe-dbind-response
response (id ns value err out ex root-ex status)
(when ns (setq monroe-buffer-ns ns))
(when value (funcall callback nil value))
(when status
(when (member "eval-error" status) (funcall callback ex nil))
(when (member "interrupted" status) (funcall callback status nil))
(when (member "need-input" status) (monroe-handle-input))
(when (member "done" status) (remhash id monroe-requests)))))))
(defun monroe-get-completions (word callback)
(interactive)
(monroe-eval-string
(format "(complete.core/completions \"%s\")" word)
(lambda (err s)
(when (not err) (funcall callback (read-from-whole-string s))))))
(defun company-monroe (command &optional arg &rest ignored)
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'company-monroe))
(prefix (and (eq major-mode 'clojure-mode)
(get-buffer "*monroe-connection*")
(company-grab-symbol)))
(candidates
(cons :async
(lambda (callback)
(monroe-get-completions arg callback))))))
(add-to-list 'company-backends 'company-monroe)))
(provide 'ohai-clojure)
;;; ohai-clojure.el ends here

View File

@@ -0,0 +1,78 @@
;;; -*- lexical-binding: t -*-
;;; ohai-codestyle.el --- This is where you apply your OCD.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Tab indentation is a disease; a cancer of this planet.
;; Turn it off and let's never talk about this default again.
(set-default 'indent-tabs-mode nil)
;; The fact that we have to do this is also quite embarrassing.
(setq sentence-end-double-space nil)
;; Always indent after a newline.
(define-key global-map (kbd "RET") 'newline-and-indent)
;; Strict whitespace with ethan-wspace: highlight bad habits,
;; and automatically clean up your code when saving.
;; Use C-c c to instantly clean up your file.
;; Read more about ethan-wspace: https://github.com/glasserc/ethan-wspace
(package-require 'ethan-wspace)
(setq mode-require-final-newline nil)
(setq require-final-newline nil)
(global-ethan-wspace-mode 1)
(global-set-key (kbd "C-c c") 'ethan-wspace-clean-all)
;; Set default indentation for various languages (add your own!)
(setq-default tab-width 4)
;; Javascript
(setq-default js2-basic-offset 2)
;; JSON
(setq-default js-indent-level 2)
;; Coffeescript
(setq coffee-tab-width 2)
;; Typescript
(setq typescript-indent-level 2
typescript-expr-indent-offset 2)
;; Python
(setq-default py-indent-offset 2)
;; XML
(setq-default nxml-child-indent 2)
;; C
(setq-default c-basic-offset 2)
;; HTML etc with web-mode
(setq-default web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2
web-mode-style-padding 2
web-mode-script-padding 2)
;; Set the default formatting styles for various C based modes.
;; Particularly, change the default style from GNU to Java.
;; rms, I love you, but your formatting style makes my eyes bleed.
(setq c-default-style
'((awk-mode . "awk")
(other . "java")))
(provide 'ohai-codestyle)

View File

@@ -0,0 +1,69 @@
;;; -*- lexical-binding: t -*-
;;; ohai-complete.el --- All cool IDEs have IntelliSense.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-appearance)
(package-require 'company)
;; Use C-\ to activate the Company autocompleter.
(require 'company)
(global-company-mode)
(global-set-key (kbd "C-\\") 'company-complete)
(setq company-global-modes '(not term-mode))
(setq company-minimum-prefix-length 2
company-selection-wrap-around t
company-show-numbers t
company-tooltip-align-annotations t
company-require-match nil
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil)
;; Sort completion candidates that already occur in the current
;; buffer at the top of the candidate list.
(setq company-transformers '(company-sort-by-occurrence))
;; Show documentation where available for selected completion
;; after a short delay.
(package-require 'company-quickhelp)
(setq company-quickhelp-delay 1)
(company-quickhelp-mode 1)
;; Company's default colours look OK with the light scheme,
;; but hideous with the dark one, so let's pick something nicer.
(add-hook
'ohai-appearance/dark-hook
(lambda ()
(set-face-foreground 'company-tooltip "#000")
(set-face-background 'company-tooltip "#ddd")
(set-face-background 'company-scrollbar-bg "#fff")
(set-face-background 'company-scrollbar-fg "#999")
(set-face-background 'company-tooltip-selection "#aaa")
(set-face-foreground 'company-tooltip-common "#9a0000")
(set-face-foreground 'company-tooltip-common-selection "#9a0000")
(set-face-foreground 'company-tooltip-annotation "#00008e")))
(provide 'ohai-complete)

View File

@@ -0,0 +1,73 @@
;;; -*- lexical-binding: t -*-
;;; ohai-dired.el --- Directory manipulation like an Emacs Master.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; dired+ is an enhanced version of the built-in Emacs directory editor.
;; Learn about how it extends Dired: http://www.emacswiki.org/emacs/DiredPlus
(setq diredp-hide-details-initially-flag nil)
(package-require 'dired+)
(require 'dired+)
(set-face-foreground 'diredp-file-name nil)
;; Keep dired buffers updated when the file system changes.
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)
;; A function for deleting the file being edited.
;; This one is a bit dangerous, even with the yes/no question, so
;; it's not bound to any key by default.
;; Run it using M-x delete-current-buffer-file.
(defun delete-current-buffer-file ()
"Removes file connected to current buffer and kills buffer."
(interactive)
(let ((filename (buffer-file-name))
(buffer (current-buffer))
(name (buffer-name)))
(if (not (and filename (file-exists-p filename)))
(ido-kill-buffer)
(when (yes-or-no-p "Are you sure you want to remove this file? ")
(delete-file filename)
(kill-buffer buffer)
(message "File '%s' successfully removed" filename)))))
;; And a function for renaming the file being edited, bound to C-x C-r.
(defun rename-current-buffer-file ()
"Renames current buffer and file it is visiting."
(interactive)
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not (and filename (file-exists-p filename)))
(error "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " filename)))
(if (get-buffer new-name)
(error "A buffer named '%s' already exists!" new-name)
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil)
(message "File '%s' successfully renamed to '%s'"
name (file-name-nondirectory new-name)))))))
(global-set-key (kbd "C-x C-r") 'rename-current-buffer-file)
(provide 'ohai-dired)
;;; ohai-dired.el ends here

View File

@@ -0,0 +1,137 @@
;;; -*- lexical-binding: t -*-
;;; ohai-editing.el --- Configure your editing style.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Multiple cursors!
;; Use <insert> to place a cursor on the next match for the current selection.
;; Use S-<insert> to place one on the previous match.
;; Use C-' to use extended mark mode, giving you more control.
;; Use C-" to place cursors on all matches.
;; Select a region and C-M-' to place cursors on each line of the selection.
;; Bonus: <insert> key no longer activates overwrite mode.
;; What is that thing for anyway?
(package-require 'multiple-cursors)
(global-set-key (kbd "<insert>") 'mc/mark-next-like-this)
(global-set-key (kbd "S-<insert>") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-'") 'mc/mark-more-like-this-extended)
(global-set-key (kbd "C-\"") 'mc/mark-all-like-this-dwim)
(global-set-key (kbd "C-M-'") 'mc/edit-lines)
;; Use C-= to select the innermost logical unit your cursor is on.
;; Keep hitting C-= to expand it to the next logical unit.
;; Protip: this goes really well with multiple cursors.
(package-require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
;; Remap join-line to M-j where it's easier to get to.
;; join-line will join the line you're on with the line above it
;; in a reasonable manner for the type of file you're editing.
(global-set-key (kbd "M-j") 'join-line)
;; Hit C-c <tab> to auto-indent the entire buffer you're in.
(defun indent-buffer ()
(interactive)
(indent-region (point-min) (point-max)))
(global-set-key (kbd "C-c <tab>") 'indent-buffer)
;; Automatically insert matching braces and do other clever
;; things pertaining to braces and such.
(electric-pair-mode 1)
;; Duplicate start of line or region with C-M-<end>.
;; From http://www.emacswiki.org/emacs/DuplicateStartOfLineOrRegion
(defun duplicate-start-of-line-or-region ()
(interactive)
(if mark-active
(duplicate-region)
(duplicate-start-of-line)))
(defun duplicate-start-of-line ()
(if (bolp)
(progn
(end-of-line)
(duplicate-start-of-line)
(beginning-of-line))
(let ((text (buffer-substring (point)
(beginning-of-thing 'line))))
(forward-line)
(push-mark)
(insert text)
(open-line 1))))
(defun duplicate-region ()
(let* ((end (region-end))
(text (buffer-substring (region-beginning) end)))
(goto-char end)
(insert text)
(push-mark end)
(setq deactivate-mark nil)
(exchange-point-and-mark)))
(global-set-key (kbd "C-M-<end>") 'duplicate-start-of-line-or-region)
;; Hack for setting a fixed wrap column in visual-line-mode.
(defun set-visual-wrap-column (new-wrap-column &optional buffer)
"Force visual line wrap at NEW-WRAP-COLUMN in BUFFER (defaults
to current buffer) by setting the right-hand margin on every
window that displays BUFFER. A value of NIL or 0 for
NEW-WRAP-COLUMN disables this behavior."
(interactive (list (read-number "New visual wrap column, 0 to disable: " (or visual-wrap-column fill-column 0))))
(if (and (numberp new-wrap-column)
(zerop new-wrap-column))
(setq new-wrap-column nil))
(with-current-buffer (or buffer (current-buffer))
(visual-line-mode t)
(set (make-local-variable 'visual-wrap-column) new-wrap-column)
(add-hook 'window-configuration-change-hook 'update-visual-wrap-column nil t)
(let ((windows (get-buffer-window-list)))
(while windows
(when (window-live-p (car windows))
(with-selected-window (car windows)
(update-visual-wrap-column)))
(setq windows (cdr windows))))))
(defun update-visual-wrap-column ()
(if (not visual-wrap-column)
(set-window-margins nil nil)
(let* ((current-margins (window-margins))
(right-margin (or (cdr current-margins) 0))
(current-width (window-width))
(current-available (+ current-width right-margin)))
(if (<= current-available visual-wrap-column)
(set-window-margins nil (car current-margins))
(set-window-margins nil (car current-margins)
(- current-available visual-wrap-column))))))
;; A function for easily editing a file as root through TRAMP.
(defun sudo-edit (&optional arg)
(interactive "p")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(if (fboundp 'helm-read-file-name)
(helm-read-file-name "File: ")
(ido-read-file-name "File: "))))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
;; A key for intelligently shrinking whitespace.
;; See https://github.com/jcpetkovich/shrink-whitespace.el for details.
(package-require 'shrink-whitespace)
(global-set-key (kbd "C-c DEL") 'shrink-whitespace)
(provide 'ohai-editing)

View File

@@ -0,0 +1,59 @@
;;; -*- lexical-binding: t -*-
;;; ohai-elisp.el --- Making your lisp sound more pleasant.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-personal-taste)
;; If you're ready for Paredit, let's do Paredit!
;; Learn Paredit: http://pub.gajendra.net/src/paredit-refcard.pdf
(when ohai-personal-taste/paredit
(package-require 'paredit)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode))
;; Setup C-c v to eval whole buffer in all lisps.
(define-key lisp-mode-shared-map (kbd "C-c v") 'eval-buffer)
;; Highlight the sexp under the cursor.
(package-require 'highlight-parentheses)
(add-hook 'emacs-lisp-mode-hook 'highlight-parentheses-mode)
;; When saving an elisp file, remove its compiled version if
;; there is one, as you'll want to recompile it.
(defun remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))))
(add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
;; Enable eldoc mode, which provides context based documentation
;; in the minibuffer.
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
;; Use M-. to jump to the definition of the symbol under the cursor.
(define-key emacs-lisp-mode-map (kbd "M-.") 'find-function-at-point)
(provide 'ohai-elisp)

View File

@@ -0,0 +1,66 @@
;;; -*- lexical-binding: t -*-
;;; ohai-elixir.el --- Elixir language support.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Set up the basic Elixir mode.
(package-require 'elixir-mode)
;; Alchemist offers integration with the Mix tool.
(package-require 'alchemist)
(with-eval-after-load "elixir-mode"
(add-hook 'elixir-mode-hook 'alchemist-mode))
;; Bind some Alchemist commands to more commonly used keys.
(with-eval-after-load "alchemist"
(define-key alchemist-mode-map
(kbd "C-c C-l")
(lambda () (interactive)
(save-buffer)
(alchemist-iex-compile-this-buffer)))
(define-key alchemist-mode-map
(kbd "C-x C-e") 'alchemist-iex-send-current-line))
;; A Flycheck checker that uses Mix, so it finds project deps.
;; From https://github.com/ananthakumaran/dotfiles/blob/master/.emacs.d/init-elixir.el#L25-L42
(with-eval-after-load "flycheck"
(flycheck-define-checker elixir-mix
"An Elixir syntax checker using the Elixir interpreter.
See URL `http://elixir-lang.org/'."
:command ("mix"
"compile"
source)
:error-patterns
((error line-start "** (" (zero-or-more not-newline) ") "
(zero-or-more not-newline) ":" line ": " (message) line-end)
(warning line-start
(one-or-more (not (syntax whitespace))) ":"
line ": "
(message)
line-end))
:modes elixir-mode)
(add-to-list 'flycheck-checkers 'elixir-mix))
(provide 'ohai-elixir)
;;; ohai-elixir.el ends here

View File

@@ -0,0 +1,82 @@
;;; -*- lexical-binding: t -*-
;;; ohai-erlang.el --- Things for working with erlang.
;; Copyright (C) 2015 Bodil Stokke
;; Curated and improved by Bernard Notarianni
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Let's use the regular erlang-mode
(package-require 'erlang)
(defun stripwhite (str)
"Remove any whitespace from STR."
(let ((s (if (symbolp str) (symbol-name str) str)))
(replace-regexp-in-string "[ \t\n]*" "" s)))
(defun erlang-move-to-export-insertion ()
(interactive)
(goto-char (point-max))
(if (search-backward-regexp "^-export" 0 t)
(end-of-line)
(search-backward-regexp "^-" 0 t)
(end-of-line)))
(defun erlang-export (fun-arity)
(interactive
(list (read-no-blanks-input "function/arity: " (erlang-current-function))))
(save-excursion
(erlang-move-to-export-insertion)
(newline)
(insert (format "-export ([%s])." fun-arity))))
;; Find the name of the function under the cursor.
(defun erlang-current-function ()
(save-excursion
(if (not (equal (point) (point-max))) (forward-char))
(erlang-beginning-of-function)
(let ((beg (point))
(fun-name)
(fun-arity)
(result '()))
(search-forward "(")
(backward-char)
(setq fun-name (stripwhite (buffer-substring beg (point))))
(if (char-equal (char-after) ?\))
(setq fun-arity 0)
(forward-char)
(setq fun-arity 0)
(while (not (char-equal (char-after) ?\)))
(erlang-forward-arg)
(setq fun-arity (+ fun-arity 1))))
(format "%s/%d" fun-name fun-arity))))
(defun erlang-forward-arg ()
(forward-sexp))
;; Setup C-c e to add an export clause for the function under cursor.
(add-hook 'erlang-mode-hook (lambda () (local-set-key "\C-ce" 'erlang-export)))
;; Avoid Warning about final newline with Erlang mode
(add-hook 'erlang-mode-hook
(lambda ()
(setq require-final-newline nil)
(setq mode-require-final-newline nil)))
(provide 'ohai-erlang)

View File

@@ -0,0 +1,81 @@
;;; -*- lexical-binding: t -*-
;;; ohai-flycheck.el --- Spot all the errors.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Install Flycheck.
(package-require 'flycheck)
;; Start it automatically for all modes except ELisp mode,
;; where the linter is just designed to make you mad.
(add-hook 'find-file-hook
(lambda ()
(when (not (equal 'emacs-lisp-mode major-mode))
(flycheck-mode))))
;; Jump between current errors with M-n and M-p.
(global-set-key (kbd "M-n") 'next-error)
(global-set-key (kbd "M-p") 'previous-error)
;; Turn the modeline red when Flycheck has errors.
(package-require 'flycheck-color-mode-line)
;; Configure the theme.
(with-eval-after-load "flycheck"
(setq flycheck-highlighting-mode 'symbols)
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
(add-hook
'ohai-appearance/dark-hook
(lambda ()
(with-eval-after-load "flycheck"
(set-face-background 'flycheck-error "#660000")
(set-face-foreground 'flycheck-error nil)
(set-face-background 'flycheck-warning "#331800")
(set-face-foreground 'flycheck-warning nil)
(require 'flycheck-color-mode-line)
(set-face-background 'flycheck-color-mode-line-error-face "#440000")
(set-face-background 'flycheck-color-mode-line-warning-face "#553300")
(set-face-background 'flycheck-color-mode-line-info-face nil)
(set-face-foreground 'flycheck-color-mode-line-error-face "#ffffff")
(set-face-foreground 'flycheck-color-mode-line-warning-face "#ffffff")
(set-face-foreground 'flycheck-color-mode-line-info-face nil))))
(add-hook
'ohai-appearance/light-hook
(lambda ()
(with-eval-after-load "flycheck"
(set-face-background 'flycheck-error "#ff8888")
(set-face-foreground 'flycheck-error nil)
(set-face-background 'flycheck-warning "#ffcc88")
(set-face-foreground 'flycheck-warning nil)
(require 'flycheck-color-mode-line)
(set-face-background 'flycheck-color-mode-line-error-face "#ff0000")
(set-face-foreground 'flycheck-color-mode-line-error-face "#ffffff")
(set-face-background 'flycheck-color-mode-line-warning-face "#886600")
(set-face-foreground 'flycheck-color-mode-line-warning-face "#ffffff")
(set-face-background 'flycheck-color-mode-line-info-face nil)
(set-face-foreground 'flycheck-color-mode-line-info-face nil))))
(provide 'ohai-flycheck)

View File

@@ -0,0 +1,47 @@
;;; -*- lexical-binding: t -*-
;;; ohai-fonts.el --- On-the-fly font size adjustment.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-lib)
(defun ohai-fonts/spec-to-list (spec)
(s-split "-" spec))
(defun ohai-fonts/list-to-spec (spec)
(s-join "-" spec))
(defun ohai-fonts/update-font-spec-size (spec increment)
(ohai-fonts/list-to-spec
(-update-at 7 (lambda (i) (number-to-string
(+ (string-to-number i) increment)))
(ohai-fonts/spec-to-list spec))))
(defun ohai-fonts/update-font-size (increment)
(set-frame-font
(ohai-fonts/update-font-spec-size (frame-parameter nil 'font) increment)))
(global-set-key (kbd "C-M--") (lambda () (interactive)
(ohai-fonts/update-font-size -1)))
(global-set-key (kbd "C-M-=") (lambda () (interactive)
(ohai-fonts/update-font-size 1)))
(provide 'ohai-fonts)
;;; ohai-fonts.el ends here

View File

@@ -0,0 +1,55 @@
;;; -*- lexical-binding: t -*-
;;; ohai-general.el --- Setting up the basics.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Make sure we always use UTF-8.
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(load-library "iso-transl")
;; Always ask for y/n keypress instead of typing out 'yes' or 'no'
(defalias 'yes-or-no-p 'y-or-n-p)
;; Emacs writes backup files to `filename~` by default. This is messy,
;; so let's tell it to write them to `~/.emacs.d/bak` instead.
;; If you have an accident, check this directory - you might get lucky.
(setq backup-directory-alist
`(("." . ,(expand-file-name (concat dotfiles-dir "bak")))))
;; Automatically save buffers before launching M-x compile and friends,
;; instead of asking you if you want to save.
(setq compilation-ask-about-save nil)
;; Make the selection work like most people expect.
(delete-selection-mode t)
(transient-mark-mode t)
;; Automatically update unmodified buffers whose files have changed.
(global-auto-revert-mode 1)
;; If available, use `xdg-open' to open URLs.
(when (ohai/is-exec "xdg-open")
(setq-default
browse-url-browser-function (quote browse-url-generic)
browse-url-generic-program "xdg-open"))
(provide 'ohai-general)

View File

@@ -0,0 +1,41 @@
;;; -*- lexical-binding: t -*-
;;; ohai-git.el --- Things for working with Git.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Invoke Magit by typing C-x g, and you can thank me later.
;; See http://magit.github.io/ for instructions.
(package-require 'magit)
(global-set-key (kbd "C-x g") 'magit-status)
;; Use M-x gist-buffer or M-x gist-region to create a gist
;; directly from the current buffer or selection.
(package-require 'gist)
;; Mark uncommitted changes in the fringe.
(package-require 'git-gutter-fringe)
(require 'git-gutter-fringe)
(global-git-gutter-mode t)
(provide 'ohai-git)

View File

@@ -0,0 +1,80 @@
;;; -*- lexical-binding: t -*-
;;; ohai-haskell.el --- FIRE ALL MONAD TRANSFORMERS
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(package-require 'haskell-mode)
;; Setup haskell-mode hooks
(with-eval-after-load "haskell-mode"
(custom-set-variables
'(haskell-mode-hook
'(turn-on-haskell-indentation
turn-on-haskell-doc))))
;; Setup haskell-interactive-mode keybindings. Get started by using C-c C-z from
;; a buffer visiting a file in your Haskell project.
(with-eval-after-load "haskell-mode"
;; Switch to the current REPL buffer, starting a session if needed.
(define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
;; Switch between REPL sessions.
(define-key haskell-mode-map (kbd "C-c b") 'haskell-session-change)
;; Load the current buffer into the REPL.
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
;; Infer the type of the thing at point.
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
;; Display info (in the REPL) about the thing at point.
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
;; Insert the inferred type of the function at point into the code.
(define-key haskell-mode-map (kbd "C-c C-s") (lambda () (interactive) (haskell-process-do-type t)))
;; Run `cabal test' in a compile buffer.
(define-key haskell-mode-map (kbd "C-c C-,") 'ohai-haskell/run-test-suite))
;; Change some ASCII art syntax into their corresponding Unicode characters.
;; Rebind the same Unicode characters to insert their ASCII art versions
;; if entered from the keyboard.
;; This is very much a matter of taste, feel free to disable it. Or better yet,
;; if you're into that sort of thing, see https://wiki.haskell.org/Unicode-symbols
;; for native Unicode support.
(with-eval-after-load "haskell-mode"
(ohai/font-lock-replace-symbol 'haskell-mode "\\(->\\)" "")
(ohai/font-lock-replace-symbol 'haskell-mode "\\(<-\\)" "")
(ohai/font-lock-replace-symbol 'haskell-mode "\\(=>\\)" "")
(define-key haskell-mode-map (kbd "") (lambda () (interactive) (insert "->")))
(define-key haskell-mode-map (kbd "") (lambda () (interactive) (insert "<-")))
(define-key haskell-mode-map (kbd "") (lambda () (interactive) (insert "=>"))))
;; A function for launching a compile buffer with `cabal test'.
(defun ohai-haskell/run-test-suite ()
(interactive)
(require 'compile)
(projectile-with-default-dir (projectile-project-root)
(compile "cabal test")))
;; Flycheck addons
(package-require 'flycheck-haskell)
(with-eval-after-load "flycheck"
(with-eval-after-load "haskell"
(add-hook 'flycheck-mode-hook #'flycheck-haskell-setup)))
(provide 'ohai-haskell)
;;; ohai-haskell.el ends here

View File

@@ -0,0 +1,54 @@
;;; -*- lexical-binding: t -*-
;;; ohai-helm.el --- The Grand Emacs Incremental Narrowing Thingy.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(package-require 'helm)
(require 'helm-config)
(require 'helm)
(helm-mode 1)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-g") 'helm-do-grep)
(global-set-key (kbd "C-x b") 'helm-buffers-list)
(global-set-key (kbd "C-x c g") 'helm-google-suggest)
(with-eval-after-load "ohai-project"
(package-require 'helm-projectile)
(global-set-key (kbd "C-c C-f") 'helm-projectile-find-file-dwim))
(helm-autoresize-mode 1)
(setq-default helm-display-header-line nil
helm-autoresize-min-height 10
helm-autoresize-max-height 35
helm-split-window-in-side-p t
helm-M-x-fuzzy-match t
helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t
helm-apropos-fuzzy-match t)
(set-face-attribute 'helm-source-header nil :height 0.75)
(provide 'ohai-helm)
;;; ohai-helm.el ends here

View File

@@ -0,0 +1,40 @@
;;; -*- lexical-binding: t -*-
;;; ohai-help.el --- It's dangerous to go alone! Take this.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(package-require 'guide-key)
(setq-default guide-key/guide-key-sequence t
guide-key/recursive-key-sequence-flag t
guide-key/idle-delay 2
guide-key/popup-window-position 'bottom
guide-key/text-scale-amount -2)
(guide-key-mode 1)
;; Get an instant cheat sheet for your current major mode
;; with C-h C-m.
(package-require 'discover-my-major)
(global-set-key (kbd "C-h C-m") 'discover-my-major)
(provide 'ohai-help)

View File

@@ -0,0 +1,58 @@
;;; -*- lexical-binding: t -*-
;;; ohai-html.el --- Dealing with the W3C.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-editing)
;; web-mode is a special mode for HTML which copes with embedded JS/CSS,
;; JSX, various templating systems, etc.
;; Learn about web-mode: http://web-mode.org/
(package-require 'web-mode)
;; We'd like to use web-mode for HTML, instead of the default html-mode.
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;; Let's add some extensions from the web-mode docs too.
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
;; Highlight the element under the cursor.
(setq-default web-mode-enable-current-element-highlight t)
;; Key for renaming tags
(with-eval-after-load "web-mode"
(define-key web-mode-map (kbd "C-c C-r") 'mc/mark-sgml-tag-pair))
;; Colourise colour names in certain modes.
(package-require 'rainbow-mode)
(dolist (mode '(css-mode less-css-mode html-mode web-mode))
(add-hook (intern (concat (symbol-name mode) "-hook"))
(lambda () (rainbow-mode))))
(provide 'ohai-html)

View File

@@ -0,0 +1,118 @@
;;; -*- lexical-binding: t -*-
;;; ohai-ido.el --- Make minibuffer selection tolerable.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Enable ido-mode.
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-use-url-at-point t
ido-max-prospects 10
ido-use-virtual-buffers t)
;; Make sure ido is really everywhere.
(package-require 'ido-ubiquitous)
(ido-ubiquitous-mode)
;; Use smex to provide ido-like interface for M-x
(package-require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is the old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
;; Vertical ido.
(package-require 'ido-vertical-mode)
(ido-vertical-mode)
;; Improved fuzzy matching.
(package-require 'flx-ido)
(flx-ido-mode 1)
(setq ido-enable-flex-matching t
ido-use-faces nil
gc-cons-threshold 20000000)
;; Bind C-t to use ido to jump to a symbol in the current buffer.
(require 'imenu)
(defun ido-imenu ()
"Update the imenu index and then use ido to select a symbol to navigate to.
Symbols matching the text at point are put first in the completion list."
(interactive)
(imenu--make-index-alist)
(let ((name-and-pos '())
(symbol-names '()))
(flet ((addsymbols (symbol-list)
(when (listp symbol-list)
(dolist (symbol symbol-list)
(let ((name nil) (position nil))
(cond
((and (listp symbol) (imenu--subalist-p symbol))
(addsymbols symbol))
((listp symbol)
(setq name (car symbol))
(setq position (cdr symbol)))
((stringp symbol)
(setq name symbol)
(setq position (get-text-property 1 'org-imenu-marker symbol))))
(unless (or (null position) (null name))
(add-to-list 'symbol-names name)
(add-to-list 'name-and-pos (cons name position))))))))
(addsymbols imenu--index-alist))
;; If there are matching symbols at point, put them at the beginning of `symbol-names'.
(let ((symbol-at-point (thing-at-point 'symbol)))
(when symbol-at-point
(let* ((regexp (concat (regexp-quote symbol-at-point) "$"))
(matching-symbols (delq nil (mapcar (lambda (symbol)
(if (string-match regexp symbol) symbol))
symbol-names))))
(when matching-symbols
(sort matching-symbols (lambda (a b) (> (length a) (length b))))
(mapc (lambda (symbol) (setq symbol-names (cons symbol (delete symbol symbol-names))))
matching-symbols)))))
(let* ((selected-symbol (ido-completing-read "Symbol? " symbol-names))
(position (cdr (assoc selected-symbol name-and-pos))))
(goto-char position))))
(set-default 'imenu-auto-rescan t)
(global-set-key (kbd "C-t") 'ido-imenu)
;; Bind `~` to go to homedir when in ido-find-file.
;; From http://whattheemacsd.com/setup-ido.el-02.html
(add-hook 'ido-setup-hook
(lambda ()
;; Go straight home
(define-key ido-file-completion-map
(kbd "~")
(lambda ()
(interactive)
(if (looking-back "/")
(insert "~/")
(call-interactively 'self-insert-command))))))
(provide 'ohai-ido)

View File

@@ -0,0 +1,77 @@
;;; -*- lexical-binding: t -*-
;;; ohai-javascript.el --- Everybody's favourite personal hell.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-lib)
;; If npm is installed, add its local prefix to the executable
;; search path, which helps Emacs find linters etc.
;; This isn't Windows compatible, but then neither is npm, really.
(-when-let (npm-prefix (ohai/exec-if-exec "npm" "config get prefix"))
(setenv "PATH" (concat npm-prefix "/bin:" (getenv "PATH"))))
;; Install js2-mode, which improves on Emacs's default JS mode
;; tremendously.
(package-require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.es6\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.ejs\\'" . js2-mode))
;; But for JSON files, it's better to stick with plain old js-mode.
(add-to-list 'auto-mode-alist '("\\.json$" . js-mode))
;; Configure js2-mode good.
(setq-default
js2-mode-indent-ignore-first-tab t
js2-strict-inconsistent-return-warning nil
js2-global-externs
'("module" "require" "__dirname" "process" "console" "JSON" "$" "_"))
;; js2-show-parse-errors nil
;; js2-strict-var-hides-function-arg-warning nil
;; js2-strict-missing-semi-warning nil
;; js2-strict-trailing-comma-warning nil
;; js2-strict-cond-assign-warning nil
;; js2-strict-var-redeclaration-warning nil
;; Use Tern for smarter JS.
(package-require 'tern)
(add-hook 'js2-mode-hook (lambda () (tern-mode t)))
;; Locate the Tern binary by querying the system search path, which
;; should now include the local npm prefix.
(setq tern-command (list (or (ohai/resolve-exec "tern") "tern")))
;; Setup Tern as an autocomplete source.
(with-eval-after-load "company"
(package-require 'company-tern)
(require 'company-tern)
(add-to-list 'company-backends 'company-tern))
;; Leverage js2-mode to get some refactoring support through js2-refactor.
(package-require 'js2-refactor)
(add-hook 'js2-mode-hook
(lambda ()
(js2r-add-keybindings-with-prefix "C-c C-m")))
(provide 'ohai-javascript)

View File

@@ -0,0 +1,32 @@
;;; -*- lexical-binding: t -*-
;;; ohai-markdown.el --- That text format that's everywhere org-mode should be.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Install Markdown support.
(package-require 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
(provide 'ohai-markdown)

View File

@@ -0,0 +1,71 @@
;;; -*- lexical-binding: t -*-
;;; ohai-navigation.el --- Moving around.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Make PgUp/Dn move the point.
(setq scroll-error-top-bottom t)
;; Avy is a quick way to jump around your buffers.
;; https://github.com/abo-abo/avy
(package-require 'avy)
(global-set-key (kbd "C-;") 'avy-goto-word-1)
(global-set-key (kbd "C-:") 'avy-goto-char)
(with-eval-after-load "isearch"
(define-key isearch-mode-map (kbd "C-;") 'avy-isearch))
;; Smart home key.
(defun smart-beginning-of-line ()
"Move point to first non-whitespace character or beginning-of-line."
(interactive "^")
(let ((oldpos (point)))
(back-to-indentation)
(and (= oldpos (point))
(beginning-of-line))))
(global-set-key (kbd "<home>") 'smart-beginning-of-line)
(global-set-key (kbd "C-a") 'smart-beginning-of-line)
;; Consider CamelCase chunks as words when navigating.
(global-subword-mode 1)
;; Swap buffers in open windows with C-x C-o.
(package-require 'swap-buffers)
(global-set-key (kbd "C-x C-o") 'swap-buffers)
;; Enhance C-x o when more than two windows are open.
(package-require 'ace-window)
(global-set-key (kbd "C-x o") 'ace-window)
;; Use C-x M-p to kill the buffer in the other window, revealing
;; the next buffer in the stack.
(global-set-key
(kbd "C-x M-p")
(lambda () (interactive)
(save-excursion
(other-window 1)
(quit-window))))
;; Display incremental search stats in the modeline.
(package-require 'anzu)
(global-anzu-mode 1)
(provide 'ohai-navigation)

View File

@@ -0,0 +1,46 @@
;;; -*- lexical-binding: t -*-
;;; ohai-orgmode.el --- Your personal everything manager.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Stop org-mode from highjacking shift-cursor keys.
(setq org-replace-disputed-keys t)
;; Always use visual-line-mode in org-mode, and wrap it at column 80.
(add-hook
'org-mode-hook
(lambda ()
(visual-line-mode 1)
(set-visual-wrap-column 80)))
;; Fancy bullet rendering.
(package-require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
;; Insert links from clipboard.
(package-require 'org-cliplink)
(with-eval-after-load "org"
(define-key org-mode-map (kbd "C-c M-l") 'org-cliplink))
(provide 'ohai-orgmode)

View File

@@ -0,0 +1,35 @@
;;; -*- lexical-binding: t -*-
;;; ohai-project.el --- Your personal everything manager.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Install Projectile and activate it for all things.
;; Learn about Projectile: http://batsov.com/projectile/
(package-require 'projectile)
(projectile-global-mode)
;; Use C-c C-f to find a file anywhere in the current project.
(global-set-key (kbd "C-c C-f") 'projectile-find-file)
(provide 'ohai-project)

View File

@@ -0,0 +1,76 @@
;;; -*- lexical-binding: t -*-
;;; ohai-purescript.el --- Settings for editing PureScript.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-lib)
(require 'ohai-project)
(require 'ohai-javascript)
;; Install purescript-mode.
(package-require 'purescript-mode)
(require 'purescript-mode)
(add-to-list 'auto-mode-alist '("\\.purs$" . purescript-mode))
(add-hook 'purescript-mode-hook 'turn-on-purescript-indentation)
;; Change some ASCII art syntax into their corresponding Unicode characters.
;; Rebind the same Unicode characters to insert their ASCII art versions
;; if entered from the keyboard.
(with-eval-after-load "purescript-mode"
(ohai/font-lock-replace-symbol 'purescript-mode "\\(->\\)" "")
(ohai/font-lock-replace-symbol 'purescript-mode "\\(<-\\)" "")
(ohai/font-lock-replace-symbol 'purescript-mode "\\(=>\\)" "")
(define-key purescript-mode-map (kbd "") (lambda () (interactive) (insert "->")))
(define-key purescript-mode-map (kbd "") (lambda () (interactive) (insert "<-")))
(define-key purescript-mode-map (kbd "") (lambda () (interactive) (insert "=>"))))
;; Define a Flycheck checker for running the PureScript compiler through Pulp.
(with-eval-after-load "flycheck"
(flycheck-define-checker
pulp
"Use Pulp to flycheck PureScript code."
:command ("pulp" "--monochrome" "build")
:error-patterns
((error line-start
(or (and "Error at " (file-name) " line " line ", column " column ":"
(zero-or-more " "))
(and "\"" (file-name) "\" (line " line ", column " column "):"))
(message (one-or-more (not (in "*"))))
line-end))
:modes purescript-mode)
(add-to-list 'flycheck-checkers 'pulp))
;; A function for generating a likely module name from the current file path.
;; We use this in the `ps.module' snippet.
(defun purescript-module-name-from-current-buffer-file ()
(let ((path (f-split (f-relative
(f-base (buffer-file-name))
(f-join (projectile-project-root) "src"))))
(testpath (f-split (f-relative
(f-base (buffer-file-name))
(f-join (projectile-project-root) "test")))))
(if (string= ".." (car path))
(if (string= ".." (car testpath)) "Main" (s-join "." (cons "Test" testpath)))
(s-join "." path))))
(provide 'ohai-purescript)
;;; ohai-purescript.el ends here

View File

@@ -0,0 +1,38 @@
;;; -*- lexical-binding: t -*-
;;; ohai-snippets.el --- Where there is boilerplate, there must be snippets.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; The s.el package contains a lot of functions useful in snippets.
(package-require 's)
(require 's)
;; Install yasnippet and make it available globally.
;; Read about it here: http://capitaomorte.github.io/yasnippet/
(package-require 'yasnippet)
(require 'yasnippet)
(yas-global-mode 1)
(provide 'ohai-snippets)
;;; ohai-snippets.el ends here

View File

@@ -0,0 +1,152 @@
;;; -*- lexical-binding: t -*-
;;; ohai-splash.el --- Customise the scratch buffer.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
(require 'ohai-personal-taste)
(setq ohai-splash/sources
(cond
((equal ohai-personal-taste/splash 'emergency-puppy)
'(ohai-splash/emergency-puppy))
((equal ohai-personal-taste/splash 'daily-otter)
'(ohai-splash/daily-otter))))
(package-require 'dash)
(package-require 's)
(package-require 'web)
(require 'dash)
(require 's)
(require 'web)
(defun ohai-splash/load-and-map (url map-fn cb)
(web-http-get
(lambda (con header data)
(funcall cb (funcall map-fn data header)))
:url url))
(defun ohai-splash/load-and-match (url regex format-str cb)
(ohai-splash/load-and-map
url
(lambda (data header)
(-when-let (m (s-match regex data))
(s-format format-str 'elt m)))
cb))
(defun ohai-splash/pick-first (fetchers cb)
(-if-let (fetcher (car fetchers))
(if (stringp fetcher) (funcall cb fetcher)
(funcall fetcher
(lambda (url)
(if url (funcall cb url)
(ohai-splash/pick-first (cdr fetchers) cb)))))
(funcall cb nil)))
(defun ohai-splash/load-image (url cb)
(web-http-get
(lambda (con header data)
(funcall cb (create-image (string-to-unibyte data) nil t)))
:url url))
(defun ohai-splash/dilbert (cb)
(ohai-splash/load-and-match "http://dilbert.com/"
"/dyn/str_strip/[0-9/]+\.strip\\(\.sunday\\)?\.gif"
"http://dilbert.com$0" cb))
(defun ohai-splash/imgur (search-term)
(lambda (cb)
(ohai-splash/load-and-match
(s-concat "http://imgur.com/search/score/day?q_size_px=med&q_size_mpx=med&q="
(url-hexify-string search-term))
"<div id=\"\\([0-9a-zA-Z]+\\)\" class=\"post\""
"http://i.imgur.com/$1.jpg" cb)))
(defun ohai-splash/placepuppy (cb)
(cb "http://placepuppy.it/600/400"))
(defun ohai-splash/emergency-puppy (cb)
(ohai-splash/load-and-match
"https://twitter.com/EmergencyPuppy/media"
"<img class=\"TwitterPhoto-mediaSource\"\n* *src=\"\\([^\"]*\\):large\""
"$1" cb))
(defun ohai-splash/daily-otter (cb)
(ohai-splash/load-and-match
"http://dailyotter.org/"
"<img class=\"aligncenter wp-image-.*src=\"\\([^\"]*\\)\""
"$1" cb))
(defun ohai-splash/run (sources cb)
(ohai-splash/pick-first
(or sources ohai-splash/sources)
(lambda (url)
(ohai-splash/load-image url cb))))
(defun ohai-splash/inject-help-text ()
(with-current-buffer (get-buffer "*scratch*")
(end-of-buffer)
(delete-region 1 (point))
(insert ";; Blessed art thou, who hath come to the One True Editor.
;; If you are currently experiencing panic and need to get out, you can exit
;; by typing C-x C-c. That is, press Control+X, then Control+C.
;; If you are new to GNU Emacs, you should start the interactive tutorial by
;; typing C-h t. That is, Control+H, then the letter T.
;; This is your scratch buffer. You can enter temporary notes here, or you
;; can write Emacs Lisp commands and evaluate them (C-x C-e) from this buffer.
;; To get straight to work, press C-x C-f to open or create a file.
")))
(defun ohai-splash/inject-spinner ()
(with-current-buffer (get-buffer "*scratch*")
(insert "Downloading internets... ")))
(defun ohai-splash/inject-picture (img)
(with-current-buffer (get-buffer "*scratch*")
(end-of-buffer)
(move-beginning-of-line nil)
(kill-line)
(insert-image img "ohai")
(move-beginning-of-line nil)
(mark-word)
(delete-other-windows)))
(defun ohai-splash/go ()
(ohai-splash/inject-help-text)
(when (and (online?) ohai-splash/sources)
(ohai-splash/inject-spinner)
(ohai-splash/run nil (lambda (img) (ohai-splash/inject-picture img))))
t)
(when window-system
(setq initial-buffer-choice 'ohai-splash/go))
;; A hack here to force the splash screen after the first run wizard's
;; module selection, as `initial-buffer-choice' will already have run.
(when (boundp 'ohai/wizard-did-run)
(ohai-splash/go))
(provide 'ohai-splash)

View File

@@ -0,0 +1,28 @@
;;; -*- lexical-binding: t -*-
;;; ohai-swiper.el --- Improved incremental search.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(package-require 'swiper)
(global-set-key (kbd "C-s") 'swiper)
(provide 'ohai-swiper)
;;; ohai-swiper.el ends here

91
.emacs.d/ohai/ohai-lib.el Normal file
View File

@@ -0,0 +1,91 @@
;;; -*- lexical-binding: t -*-
;;; ohai-lib.el --- Utility functions for use elsewhere.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-package)
;; Ensure the New Standard Library is installed and always available.
;; f.el - files and paths https://github.com/rejeep/f.el
;; s.el - strings https://github.com/magnars/s.el
;; dash.el - lists https://github.com/magnars/dash.el
(package-require 'f)
(require 'f)
(package-require 's)
(require 's)
(package-require 'dash)
(require 'dash)
(defun ohai/font-lock-replace-symbol (mode reg sym)
"Given a major mode `mode', replace the regular expression `reg' with
the symbol `sym' when rendering."
(font-lock-add-keywords
mode `((,reg
(0 (progn (compose-region (match-beginning 1) (match-end 1)
,sym 'decompose-region)))))))
(defun ohai/exec (command)
"Run a shell command and return its output as a string, whitespace trimmed."
(s-trim (shell-command-to-string command)))
(defun ohai/is-exec (command)
"Returns true if `command' is an executable on the system search path."
(f-executable? (s-trim (shell-command-to-string (s-concat "which " command)))))
(defun ohai/resolve-exec (command)
"If `command' is an executable on the system search path, return its absolute path.
Otherwise, return nil."
(-let [path (s-trim (shell-command-to-string (s-concat "which " command)))]
(when (f-executable? path) path)))
(defun ohai/exec-if-exec (command args)
"If `command' satisfies `ohai/is-exec', run it with `args' and return its
output as per `ohai/exec'. Otherwise, return nil."
(when (ohai/is-exec command) (ohai/exec (s-concat command " " args))))
(defun ohai/getent (user)
"Get the /etc/passwd entry for the user `user' as a list of strings,
or nil if there is no such user. Empty fields will be represented as nil,
as opposed to empty strings."
(-let [ent (ohai/exec (s-concat "getent passwd " user))]
(when (not (s-blank? ent))
(-map (lambda (i) (if (s-blank? i) nil i))
(s-split ":" ent)))))
(defun ohai/user-full-name ()
"Guess the user's full name. Returns nil if no likely name could be found."
(or (ohai/exec-if-exec "git" "config --get user.name")
(elt (ohai/getent (getenv "USER")) 4)))
(defun ohai/user-email ()
"Guess the user's email address. Returns nil if none could be found."
(or (ohai/exec-if-exec "git" "config --get user.email")
(getenv "EMAIL")))
(provide 'ohai-lib)
;;; ohai-lib.el ends here

View File

@@ -0,0 +1,66 @@
;;; -*- lexical-binding: t -*-
;;; ohai-module-index.el --- The index of available Ohai Emacs modules.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(setq
ohai/available-modules
'((ohai-appearance "how Emacs looks" :recommended)
(ohai-fonts "adjust font size on the fly" :recommended)
(ohai-general "basic editor settings" :recommended)
(ohai-splash "enhance your scratch buffer" :recommended)
(ohai-ido "improved file selector etc" :recommended)
(ohai-navigation "moving around better" :recommended)
(ohai-editing "editing improvements (multiple cursors etc)" :recommended)
(ohai-complete "auto completion" :recommended)
(ohai-snippets "snippet management" :recommended)
(ohai-codestyle "code formatting, whitespace management" :recommended)
(ohai-dired "enhanced file manager" :recommended)
(ohai-project "manage projects with Projectile" :recommended)
(ohai-flycheck "run linters automatically with Flycheck" :recommended)
(ohai-git "Git tools" :recommended)
(ohai-orgmode "your personal everything manager" :recommended)
(ohai-swiper "improved incremental search" :recommended)
(ohai-help "ways to get more help" :recommended)
(ohai-elisp "Emacs Lisp" :recommended)
(ohai-helm "advanced selection and narrowing" :optional)
(ohai-html "HTML, CSS and friends" :optional)
(ohai-markdown "Markdown support" :optional)
(ohai-javascript "JavaScript language support" :optional)
(ohai-purescript "PureScript language support" :optional)
(ohai-clojure "Clojure language support" :optional)
(ohai-erlang "Erlang language support" :optional)
(ohai-elixir "Elixir language support" :optional)
(ohai-haskell "Haskell language support" :optional)))
(require 'cl)
(defcustom ohai/modules (mapcar #'car
(remove-if-not
(lambda (i) (equal :recommended (caddr i)))
ohai/available-modules))
"Your choice of Ohai Emacs modules.")
(defun ohai/load-modules ()
(interactive)
(dolist (module ohai/modules) (require module))
(run-hooks 'ohai/modules-loaded-hook))
(provide 'ohai-module-index)
;;; ohai-module-index.el ends here

View File

@@ -0,0 +1,95 @@
;;; -*- lexical-binding: t -*-
;;; ohai-module-selector.el --- Interface for choosing Ohai Emacs modules.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-lib)
(require 'widget)
(require 'cus-edit)
(defun ohai/select-modules ()
"Select the modules Ohai Emacs should load on startup."
(interactive)
(switch-to-buffer "*Ohai Emacs Modules*")
(kill-all-local-variables)
(-let [inhibit-read-only t] (erase-buffer))
(remove-overlays)
(setq-local selected-modules ohai/modules)
(-let ((save-settings
(lambda (&rest ignore)
(interactive)
(customize-save-variable 'ohai/modules selected-modules)
(package-refresh-contents)
(ohai/load-modules)
(kill-buffer))))
(widget-insert (propertize "Ohai Emacs Modules" 'face 'custom-group-tag))
(widget-insert "\n")
(widget-insert "
This menu allows you to select feature modules for your Ohai Emacs.
Navigate between checkboxes using <tab> and S-<tab>, or use the cursor
keys to move around. Hit <return> to toggle checkboxes, or to press the
buttons. When you're done, press the `Save' or `Cancel' buttons, or just
save the buffer (C-x C-s).
You can also use your mouse, but you must resist the urge to do this.
An Emacs Master does not use mice.
")
(widget-insert "\n ")
(widget-create 'push-button
:tag "Save"
:notify save-settings)
(widget-insert " ")
(widget-create 'push-button :tag "Cancel"
:notify (lambda (&rest ignore) (kill-buffer)))
(widget-insert "\n\n ")
(apply 'widget-create 'checklist
:indent 2
:greedy t
:value selected-modules
:notify (lambda (this &rest ignore)
(setq-local selected-modules (widget-value this)))
(-map (lambda (mod)
(-let [(sym desc) mod]
`(item :tag ,(s-concat (s-pad-right 24 " " (symbol-name sym)))
:doc ,desc
:value ,sym
:format "%t %d")))
ohai/available-modules))
(widget-insert "\n")
(use-local-map (copy-keymap widget-keymap))
(local-set-key (kbd "C-x C-s") save-settings)
(widget-setup)
(widget-forward 1)))
(provide 'ohai-module-selector)
;;; ohai-module-selector.el ends here

View File

@@ -0,0 +1,65 @@
;;; -*- lexical-binding: t -*-
;;; ohai-package.el --- Package system configuration.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; `(online?)` is a function that tries to detect whether you are online.
;; We want to refresh our package list on Emacs start if we are.
(require 'cl)
(defun online? ()
(if (and (functionp 'network-interface-list)
(network-interface-list))
(some (lambda (iface) (unless (equal "lo" (car iface))
(member 'up (first (last (network-interface-info
(car iface)))))))
(network-interface-list))
t))
;; Emacs comes with a package manager for installing more features.
;; The default package repository doesn't contain much, so we tell it
;; to use a few more: MELPA and Marmalade.
(setq package-user-dir (concat dotfiles-dir "elpa"))
(require 'package)
(dolist (source '(("melpa" . "http://melpa.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
(add-to-list 'package-archives source t))
;; To get the package manager going, we invoke its initialise function.
(package-initialize)
;; If we're online, we attempt to fetch the package directories if
;; we don't have a local copy already. This lets us start installing
;; packages right away from a clean install.
(when (online?)
(unless package-archive-contents (package-refresh-contents)))
;; We're going to try to declare the packages each feature needs as we
;; define it. To do this, we define a function `(package-require)`
;; which will fetch and install a package from the repositories if it
;; isn't already installed. Eg. to ensure the hypothetical package
;; `ponies` is installed, you'd call `(package-require 'ponies)`.
(defun package-require (pkg)
"Install a package only if it's not already installed."
(when (not (package-installed-p pkg))
(package-install pkg)))
(provide 'ohai-package)

View File

@@ -0,0 +1,68 @@
;;; -*- lexical-binding: t -*-
;;; ohai-personal-taste.el --- Ohai Emacs preferences.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(defgroup ohai-emacs nil
"Your personal taste in Ohai Emacs."
:prefix "ohai-personal-taste/")
(defcustom ohai-personal-taste/run-wizard t
"Should we run the Ohai Emacs startup wizard on the next startup?"
:group 'ohai-emacs
:type '(choice (const :tag "Yes" t)
(const :tag "No" nil)))
(defcustom ohai-personal-taste/window-state 'normal
"Should Emacs maximise its frame on startup, or leave it alone?"
:group 'ohai-emacs
:type '(choice (const :tag "Normal" normal)
(const :tag "Maximise" maximised)))
(defcustom ohai-personal-taste/style 'light
"Light or dark colour scheme?"
:group 'ohai-emacs
:type '(choice (const :tag "Light" light)
(const :tag "Dark" dark)))
(defcustom ohai-personal-taste/splash nil
"What sort of image to load into the initial scratch buffer."
:group 'ohai-emacs
:type '(choice (const :tag "Emergency Puppy" emergency-puppy)
(const :tag "Daily Otter" daily-otter)
(const :tag "Nothing" nil)))
(defcustom ohai-personal-taste/paredit nil
"Do you want Paredit in Emacs Lisp buffers?"
:group 'ohai-emacs
:type '(choice (const :tag "Yes, please" t)
(const :tag "I'm not ready for that" nil)))
(defcustom ohai-personal-taste/training-wheels nil
"Would you prefer an Emacs experience without the clutter of the menu bar,
toolbar and scrollbar?"
:group 'ohai-emacs
:type '(choice (const :tag "Yes, please" t)
(const :tag "I'm not ready for that" nil)))
(provide 'ohai-personal-taste)
;;; ohai-personal-taste.el ends here

View File

@@ -0,0 +1,119 @@
;;; -*- lexical-binding: t -*-
;;; ohai-startup-wizard.el --- Ask questions and configure on first run.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
(require 'ohai-personal-taste)
(defun ohai-startup-wizard/get-window-state ()
(x-popup-dialog
t '("Normal or maximised window?"
("Normal" . normal)
("Maximised" . maximised))))
(defun ohai-startup-wizard/get-style ()
(x-popup-dialog
t '("Light or dark background?"
("Light" . light)
("Dark" . dark))))
(defun ohai-startup-wizard/get-splash ()
(x-popup-dialog
t '("What is your favourite animal?
We will put it on your splash screen for you, a fresh picture
every day, because your Emacs loves you.
This won't work if you're running Emacs in a terminal. Sorry.
Don't do that unless you really have to."
("Puppies" . emergency-puppy)
("The noble otter" . daily-otter)
("I hate animals" . nil))))
(defun ohai-startup-wizard/get-paredit ()
(x-popup-dialog
t '("Do you want to enable Paredit style editing for
the Emacs Lisp mode?
This will add a slight learning curve to your Elisp
journey, but trust me, it will be worth it."
("OK, let's paredit" . t)
("Not right now" . nil))))
(defun ohai-startup-wizard/get-training-wheels ()
(x-popup-dialog
t '("Would you like to get rid of the toolbar,
menu bar and scrollbar?
This is how adult emacsen roll, but you
might want to get comfortable with being
emacs before you assume your final form.
This is OK too; no pressure yet."
("I'm ready" . nil)
("Wait, I'm scared" . t))))
(defun ohai-startup-wizard ()
(interactive)
(x-popup-dialog
t '("Welcome to the Church of Emacs, my child!
This is the first time you've run it, so let's
start off by asking you some basic questions
about how you like to emacs.
If you change your mind about any of these
decisions, you can re-run this wizard with
`M-x ohai-startup-wizard` (that is Alt+X
ohai-startup-wizard <enter> to non-native
speakers)."
("I am ready to emacs" . t)) t)
(customize-save-variable
'ohai-personal-taste/window-state
(ohai-startup-wizard/get-window-state))
(customize-save-variable
'ohai-personal-taste/style
(ohai-startup-wizard/get-style))
(customize-save-variable
'ohai-personal-taste/splash
(ohai-startup-wizard/get-splash))
(customize-save-variable
'ohai-personal-taste/paredit
(ohai-startup-wizard/get-paredit))
(customize-save-variable
'ohai-personal-taste/training-wheels
(ohai-startup-wizard/get-training-wheels))
(customize-save-variable 'ohai-personal-taste/run-wizard nil)
(setq ohai/wizard-did-run t)
(ohai/select-modules))
(when ohai-personal-taste/run-wizard
(ohai-startup-wizard))
(provide 'ohai-startup-wizard)

View File

@@ -0,0 +1,35 @@
;;; -*- lexical-binding: t -*-
;;; ohai-test.el --- Test environment for ohai-emacs.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; 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/>.
;;; Code:
;; Should be run from the repo with HOME=`pwd`.
(load-file "$HOME/ohai/ohai-module-index.el")
(setq ohai-personal-taste/paredit t
ohai-personal-taste/run-wizard nil
ohai/modules (mapcar #'car ohai/available-modules))
(load-file "$HOME/init.el")
(kill-emacs 0)
;;; ohai-test.el ends here

View File

@@ -0,0 +1,37 @@
;;; -*- lexical-binding: t -*-
;;; ohai-update.el --- Update your ohai-emacs installation.
;; Copyright (C) 2015 Bodil Stokke
;; Author: Bodil Stokke <bodil@bodil.org>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Hello world!
;;; Code:
(defun ohai/update ()
(interactive)
(let ((default-directory dotfiles-dir)
(buf (get-buffer-create "*ohai-emacs update*")))
(switch-to-buffer-other-window buf)
(shell-command "git pull --ff-only --stat" buf)
(end-of-buffer)
(insert "\nRun `M-x ohai/select-modules' to review and install new modules.\n")
(local-set-key (kbd "q") 'quit-window)))
(provide 'ohai-update)
;;; ohai-update.el ends here

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: elixir.do
# key: do
# binding: M-[
# --
do
$0
end

View File

@@ -0,0 +1,34 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: elisp.filetemplate
# key: doc
# --
;;; -*- lexical-binding: t -*-
;;; ${1:`(f-base (buffer-file-name))`}.el --- ${2:This is an Emacs Lisp file with Emacs Lisp code.}
;; Copyright (C) `(format-time-string "%Y")` `(ohai/user-full-name)`
;; Author: `(ohai/user-full-name)` <`(ohai/user-email)`>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; ${3:Hello world!}
;;; Code:
$0
(provide '$1)
;;; $1.el ends here

View File

@@ -0,0 +1 @@
js-mode

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: flow.importType
# key: impt
# binding: direct-keybinding
# --
import type { ${1:Type} } from "${2:module}";$0

View File

@@ -0,0 +1,18 @@
# -*- mode: snippet -*-
# name: html.document
# key: doc
# --
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>$1</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/screen.css">
</head>
<body>
$0
</body>
</html>

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: commonjs.require
# key: req
# --
var ${3:${1:$(s-lower-camel-case (file-name-nondirectory yas/text))}} = require("${1:module}")$2;$0

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: es6.import
# key: imp
# binding: direct-keybinding
# --
import ${3:${1:$(s-lower-camel-case (file-name-nondirectory yas/text))}} from "${1:module}";$0

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: js.exportedfunction
# key: xf
# --
function $1($2) {$0};
module.exports.$1 = $1;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: js.exportedvar
# key: xv
# --
var $1 = module.exports.$1 = $0;

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: js.function
# key: fn
# --
function($1) {$0}

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: org.header
# key: doc
# --
#+TITLE: $1
#+AUTHOR: Bodil Stokke
#+EMAIL: bodil@bodil.org
$0

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ps.eff
# key: eff
# --
Eff (${2:${1:$(lower-camel-case yas-text)}} :: ${1:DOM} | e)

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ps.foreign
# key: ffi
# --
foreign import ${1:unsafePerformIO} """
function $1($3) {
$0
}""" :: $2

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ps.module
# key: mod
# --
module ${1:`(purescript-module-name-from-current-buffer-file)`} where
$0

View File

@@ -0,0 +1 @@
html-mode