Clean out the repository

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-06-10 10:34:14 +02:00
parent dfed19f455
commit b673fb12c1
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
227 changed files with 0 additions and 21887 deletions

5
.envrc
View file

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
use flake

10
.gitignore vendored
View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
result
result-*
.direnv/
.terraform
.terraform.lock.hcl

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[submodule "org"]
path = org
url = https://gitea.redalder.org/Magic_RB/org
[submodule "secret"]
path = secret
url = git@github:MagicRB/dotfiles-secret

View file

@ -1,73 +0,0 @@
From 1bc15c644e6e39f268b1d06c343d8a9a4fceab2d Mon Sep 17 00:00:00 2001
From: Magic_RB <magic_rb@redalder.org>
Date: Fri, 31 Mar 2023 23:23:41 +0200
Subject: [PATCH] Allow null in authMountTuneSchema
Signed-off-by: Magic_RB <magic_rb@redalder.org>
---
internal/provider/validators.go | 10 ++++++++++
vault/auth_mount.go | 8 ++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/internal/provider/validators.go b/internal/provider/validators.go
index 15e23212..89a9d7e1 100644
--- a/internal/provider/validators.go
+++ b/internal/provider/validators.go
@@ -39,6 +39,16 @@ func ValidateStringSlug(i interface{}, k string) (s []string, es []error) {
return
}
+func ValidateAllowNull(f func(interface{}, string) ([]string, []error)) (func(interface{}, string) ([]string, []error)) {
+ return func(i interface{}, k string) (s []string, es []error) {
+ if i == nil {
+ return
+ } else {
+ return f(i, k)
+ }
+ };
+}
+
func ValidateDuration(i interface{}, k string) (s []string, es []error) {
v, ok := i.(string)
if !ok {
diff --git a/vault/auth_mount.go b/vault/auth_mount.go
index 2e1854f8..9bb77bc2 100644
--- a/vault/auth_mount.go
+++ b/vault/auth_mount.go
@@ -28,13 +28,13 @@ func authMountTuneSchema() *schema.Schema {
Type: schema.TypeString,
Optional: true,
Description: "Specifies the default time-to-live duration. This overrides the global default. A value of 0 is equivalent to the system default TTL",
- ValidateFunc: provider.ValidateDuration,
+ ValidateFunc: provider.ValidateAllowNull(provider.ValidateDuration),
},
"max_lease_ttl": {
Type: schema.TypeString,
Optional: true,
Description: "Specifies the maximum time-to-live duration. This overrides the global default. A value of 0 are equivalent and set to the system max TTL.",
- ValidateFunc: provider.ValidateDuration,
+ ValidateFunc: provider.ValidateAllowNull(provider.ValidateDuration),
},
"audit_non_hmac_request_keys": {
Type: schema.TypeList,
@@ -52,7 +52,7 @@ func authMountTuneSchema() *schema.Schema {
Type: schema.TypeString,
Optional: true,
Description: "Specifies whether to show this mount in the UI-specific listing endpoint. Valid values are \"unauth\" or \"hidden\". If not set, behaves like \"hidden\".",
- ValidateFunc: validation.StringInSlice([]string{"unauth", "hidden"}, false),
+ ValidateFunc: provider.ValidateAllowNull(validation.StringInSlice([]string{"unauth", "hidden"}, false)),
},
"passthrough_request_headers": {
Type: schema.TypeList,
@@ -70,7 +70,7 @@ func authMountTuneSchema() *schema.Schema {
Type: schema.TypeString,
Optional: true,
Description: "Specifies the type of tokens that should be returned by the mount.",
- ValidateFunc: validation.StringInSlice([]string{"default-service", "default-batch", "service", "batch"}, false),
+ ValidateFunc: provider.ValidateAllowNull(validation.StringInSlice([]string{"default-service", "default-batch", "service", "batch"}, false)),
},
},
},
--
2.39.1

674
COPYING
View file

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser 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
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View file

@ -1,304 +0,0 @@
GNU LESSER 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.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser 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 Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 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>.

View file

@ -1,25 +0,0 @@
This repo contains my dotfiles, you'll find the NixOS configurations for all my machines that are running NixOS and home-manager configs for those that are not. Next you'll find my Emacs configuration and the Hashicorp stack. Lastly there are a few random thingies that aren't big enough to mention, but still cool if you're interested in them.
# Structure
- [nixos/](nixos) - configuration files related to [NixOS](https://nixos.org/) itself
- [hardware/](nixos/hardware) - configuration files specific to the hardware of my physical machines
- [modules/](nixos/modules/) - reusable [NixOS](https://nixos.org/) modules of varying quality
- [profiles/](nixos/profiles) - machine profiles, like `vps` or `workstation`, they apply settings to a group of machines
- [secret-lib/](nixos/secret-lib) - a library bridging the gap between my public and public configuration
- [systems/](nixos/systems) - the actual system configurations
- [nix/](nix) - legacy junk I need to clean up
- [home-manager/](home-manager) - configration files related to [home-manager](https://github.com/nix-community/home-manager)
- [modules/](home-manager/modules) - reusable [home-manager](https://github.com/nix-community/home-manager) modules of varying quality
- [modules/](modules) - [flake-parts](https://github.com/hercules-ci/flake-parts) modules that drive this flake
- [overlays/](overlays) - [nixpkgs](https://github.com/NixOS/nixpkgs) overlays, some are just imports and slight modifications of externals overlays
- [org/](org) - once again legacy junk I need to clean up
- [secret/](secret) - submodule containing the secret parts of my dotfiles
- [terraform/](terraform) - the [Terraform](https://www.terraform.io/) configuration driving the mostly [HashiCorp](https://www.hashicorp.com/) infrastructure in my configuration
# License
This project follows [REUSE](https://reuse.software/) so all files have their own specific license. But as of writing this, the only license in use is `LGPLv3.0`. The project root contains a [COPYING](COPYING) and [COPYING.LESSER](COPYING.LESSER) as required for the proper use of the LGPL license.

View file

@ -1,26 +0,0 @@
# -*- eval: (add-hook 'after-save-hook (lambda () (org-md-export-to-markdown nil)) nil t)-*-
#+OPTIONS: toc:nil ^:{}
#+TITLE: magic_rb's dotfiles
This repo contains my dotfiles, you'll find the NixOS configurations for all my machines that are running NixOS and home-manager configs for those that are not. Next you'll find my Emacs configuration and the Hashicorp stack. Lastly there are a few random thingies that aren't big enough to mention, but still cool if you're interested in them.
* Structure
- [[file:nixos][nixos/]] - configuration files related to [[https://nixos.org/][NixOS]] itself
+ [[file:nixos/hardware][hardware/]] - configuration files specific to the hardware of my physical machines
+ [[file:nixos/modules/][modules/]] - reusable [[https://nixos.org/][NixOS]] modules of varying quality
+ [[file:nixos/profiles][profiles/]] - machine profiles, like ~vps~ or ~workstation~, they apply settings to a group of machines
+ [[file:nixos/secret-lib][secret-lib/]] - a library bridging the gap between my public and public configuration
+ [[file:nixos/systems][systems/]] - the actual system configurations
- [[file:nix][nix/]] - legacy junk I need to clean up
- [[file:home-manager][home-manager/]] - configration files related to [[https://github.com/nix-community/home-manager][home-manager]]
+ [[file:home-manager/modules][modules/]] - reusable [[https://github.com/nix-community/home-manager][home-manager]] modules of varying quality
- [[file:modules][modules/]] - [[https://github.com/hercules-ci/flake-parts][flake-parts]] modules that drive this flake
- [[file:overlays][overlays/]] - [[https://github.com/NixOS/nixpkgs][nixpkgs]] overlays, some are just imports and slight modifications of externals overlays
- [[file:org][org/]] - once again legacy junk I need to clean up
- [[file:secret][secret/]] - submodule containing the secret parts of my dotfiles
- [[file:terraform][terraform/]] - the [[https://www.terraform.io/][Terraform]] configuration driving the mostly [[https://www.hashicorp.com/][HashiCorp]] infrastructure in my configuration
* License
This project follows [[https://reuse.software/][REUSE]] so all files have their own specific license. But as of writing this, the only license in use is ~LGPLv3.0~. The project root contains a [[file:COPYING][COPYING]] and [[file:COPYING.LESSER][COPYING.LESSER]] as required for the proper use of the LGPL license.

View file

@ -1,9 +0,0 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
}
) {
src = ./.;
})
.defaultNix

View file

@ -1 +0,0 @@
*.el

View file

@ -1,18 +0,0 @@
:PROPERTIES:
:ID: e93571d6-ae50-4aca-8b2f-6ada70655be3
:END:
#+title: Avy
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
~avy~ is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also ~ace-jump-mode~ and ~vim-easymotion~ - ~avy~ uses the same idea.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package avy
:straight t)
#+END_SRC

View file

@ -1,12 +0,0 @@
:PROPERTIES:
:header-args:emacs-lisp: :comments link :results none
:ID: d4ebe1b8-db78-42af-a1d8-70060fee6c89
:END:
#+title: C++ Language Support
#+filetags: emacs-load
#+begin_src elisp
(use-package clang-format
:straight t)
#+end_src

View file

@ -1,101 +0,0 @@
:PROPERTIES:
:ID: a4eab1d7-8928-438e-9ccc-1e3a65765534
:END:
#+title: Corfu
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+begin_quote
Corfu enhances completion at point with a small completion popup. The current candidates are shown in a popup below or above the point. Corfu is the minimalistic completion-in-region counterpart of the Vertico minibuffer UI.
#+end_quote
#+begin_src emacs-lisp
(use-package corfu
:straight t
:custom
(corfu-separator ?\s) ;; M-SPC
:general
("C-c c" 'completion-at-point)
:init
(global-corfu-mode))
#+end_src
* Company
#+begin_src emacs-lisp :noweb yes :exports none
(use-package company
:defer t
:init
<<company-global-modes>>)
#+end_src
Disable ~company~ globally, because company enables itself...
#+name: company-init
#+begin_src emacs-lisp
(setq company-global-modes nil)
#+end_src
* LSP Mode
#+begin_src emacs-lisp :noweb yes :exports none
(use-package corfu-lsp-mode
:no-require t
:after (lsp-mode corfu)
:init
<<lsp-completion-provider>>)
#+end_src
Make ~lsp-mode~ not turn on ~company~ first thing after start, so annoying.
#+name: lsp-completion-provider
#+begin_src emacs-lisp :tangle no
(setq lsp-completion-provider :none)
#+end_src
* Cape
~cape~ provides useful ~capfs~, such as file and ispell completion, stuff that ~company~ has built-in.
#+begin_src emacs-lisp :noweb yes :exports none
(use-package cape
:straight t
:after (corfu)
:init
<<cape-hooks>>)
#+end_src
Hook ~cape~ onto both ~text-mode~ and ~prog-mode~.
#+name: cape-hooks
#+begin_src emacs-lisp :tangle no
(defun cape-setup-capf-prog ()
"Setup cape completions for prog-mode"
(cape-setup-capf))
(defun cape-setup-capf-text ()
"Setup cape completions for text-mode"
(add-hook 'completion-at-point-functions #'cape-ispell)
(cape-setup-capf))
(defun cape-setup-capf ()
"Setup cape completions"
(add-hook 'completion-at-point-functions #'cape-file)
(add-hook 'completion-at-point-functions #'cape-tex))
:hook
((prog-mode . cape-setup-capf-prog)
(text-mode . cape-setup-capf-text))
#+end_src
~lsp-mode~ completely wipes ~completion-at-point-functions~, so we need re-add ~cape~ after it removes everything.
#+begin_src emacs-lisp
(use-package cape-lsp-mode
:no-require t
:after (cape lsp-mode)
:hook
((lsp-mode . #'cape-setup-capf)))
#+end_src

View file

@ -1,63 +0,0 @@
:PROPERTIES:
:ID: db1d0122-58d6-4dec-84f6-afcb52937fc7
:END:
#+title: Consult
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
Consult provides practical commands based on the Emacs completion function completing-read. Completion allows you to quickly select an item from a list of candidates.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp :results none
(use-package consult
:straight t
:bind (("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
;; M-s bindings (search-map)
("M-s r" . consult-ripgrep)
("M-s f" . consult-find))
:init
(defun compat-string-width (&rest args)
(apply #'string-width args))
(setq
consult-project-root-function #'projectile-project-root
consult-ripgrep-args "rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --line-number --hidden ."
consult-find-args "find ."))
#+END_SRC
Also enable ~fd~ support, as that ignores paths listed in .gitignore unlike ~find~..
#+begin_src emacs-lisp
(use-package consult-fd
:no-require t
:after (consult)
:init
(defvar consult--fd-command "fd")
(defun consult--fd-builder (input)
(unless consult--fd-command
(setq consult--fd-command
(if (eq 0 (call-process-shell-command "fdfind"))
"fdfind"
"fd")))
(pcase-let* ((`(,arg . ,opts) (consult--command-split input))
(`(,re . ,hl) (funcall consult--regexp-compiler
arg 'extended t)))
(when re
(list :command (append
(list consult--fd-command
"--color=never" "--full-path"
(consult--join-regexps re 'extended))
opts)
:highlight hl))))
(defun consult-fd (&optional dir initial)
(interactive "P")
(let* ((prompt-dir (consult--directory-prompt "Fd" dir))
(default-directory (cdr prompt-dir)))
(find-file (consult--find (car prompt-dir) #'consult--fd-builder initial)))))
#+end_src

View file

@ -1,25 +0,0 @@
:PROPERTIES:
:ID: f4a10ea3-a1df-42cc-b436-08d859272679
:END:
#+title: Daylies
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Daylies, are like scratch buffers, but they are saved. So I can shove stuff in them and they are nicely kept for later reference. Kind of INBOX.
#+begin_src emacs-lisp
(defun point-scratch-to-daylies ()
(save-excursion
(with-current-buffer "*scratch*"
(org-mode)
(set-visited-file-name
(format "~/roam/daylies/%s.org"
(format-time-string "%Y-%m-%d")))
(rename-buffer "*scratch*"))))
(add-hook 'emacs-startup-hook 'point-scratch-to-daylies)
#+end_src

View file

@ -1,14 +0,0 @@
:PROPERTIES:
:ID: 484fd154-6f7c-4313-8f79-7b502b7a1c56
:END:
#+title: Dired
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Dired is inclueded with Emacs since forever, I use a wrapper called [[id:67919dd9-2aa0-4b89-8c96-0441a54e7b03][dirvish]].
#+begin_src emacs-lisp
#+end_src

View file

@ -1,15 +0,0 @@
:PROPERTIES:
:ID: 67919dd9-2aa0-4b89-8c96-0441a54e7b03
:END:
#+title: Dirvish
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+begin_src emacs-lisp
(use-package dirvish
:straight t)
#+end_src

View file

@ -1,82 +0,0 @@
:PROPERTIES:
:ID: a26802fe-8bc3-458e-8f06-7cb856fef2cd
:END:
#+title: Display Settings
#+filetags: emacs-load
Adjust the font, based on the specific host.
#+begin_src emacs-lisp
(use-package isoevka-font
:no-require t
:init
(defvar magic_rb/fixed-width-font "Iosevka Term Extended"
"The font used for fixed width text.")
(defvar magic_rb/variable-pitch-font "Iosevka Aile"
"The font used for variable pitch text.")
(defun magic_rb/apply-fonts ()
(interactive)
(pcase (system-name)
("heater" (set-face-attribute 'default nil :family magic_rb/fixed-width-font :slant 'normal :height 105))
("omen" (set-face-attribute 'default nil :family magic_rb/fixed-width-font :slant 'normal :height 105)))
(set-face-attribute 'fixed-pitch nil :family magic_rb/fixed-width-font :slant 'normal :height 1.0)
(set-face-attribute 'variable-pitch nil :family magic_rb/variable-pitch-font :height 1.0))
:config
(magic_rb/apply-fonts))
#+end_src
Load Modus Vivendi, but change the background color to not-black, it's a bit less depressing and in my opinion nicer
on the eyes.
#+BEGIN_SRC emacs-lisp
(use-package modus-vivendi-semi-black
:no-require t
:init
(setq modus-vivendi-theme-override-colors-alist
'(("bg-main" . "#111519")))
:config
(load-theme 'modus-vivendi t))
#+END_SRC
Enable ~doom-modeline~, much better than the default and unlike ~powerline~ it's usable with TRAMP, so that's great.
#+BEGIN_SRC emacs-lisp
(use-package doom-modeline
:straight t
:config
(doom-modeline-mode))
#+END_SRC
Only show buffer encoding conditionally, there's no reason to have ~LF UTF-8~ down there, rather only show when the
encoding is something we don't expect, like ~CRLF~ or ~UTF-16~. Inspired by [[https://tecosaur.github.io/emacs-config/config.html#theme-modeline][tecosaur]].
#+BEGIN_SRC emacs-lisp
(use-package doom-modeline-conditional-buffer-encoding
:no-require t
:init
(defun tecosaur/doom-modeline-conditional-buffer-encoding ()
"We expect the encoding to be LF UTF-8, so only show the modeline when this is not the case"
(setq-local doom-modeline-buffer-encoding
(unless (or (eq buffer-file-coding-system 'utf-8-unix)
(eq buffer-file-coding-system 'utf-8)))))
:hook
(after-change-major-mode-hook . tecosaur/doom-modeline-conditional-buffer-encoding))
#+END_SRC
Disable GTK decorations, they're not that great looking and I don't really want to have Emacs affected by GTK themes.
#+BEGIN_SRC emacs-lisp
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(menu-bar-mode -1)
(scroll-bar-mode -1)
#+END_SRC
Load ~all-the-icons~, it's required used by ~treemacs~ and ~doom-modeline~. You also must run
~all-the-icons-install-fonts~ if you haven't already.
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:straight t)
#+END_SRC

View file

@ -1,33 +0,0 @@
:PROPERTIES:
:header-args: emacs-lisp: :comments link :results none
:ID: 3ed6a2d6-c84e-439c-aca6-6978dd82bd51
:END:
#+title: El Secretario
#+filetags: emacs-load
#+begin_src emacs-lisp :noweb yes
(use-package el-secretario
:straight (el-secretario :type git :host nil :repo "https://git.sr.ht/~magic_rb/el-secretario")
:defer t
:config
(setq el-secretario-session-end-hook nil)
(setq el-secretario-session-start-hook nil))
#+end_src
#+begin_src emacs-lisp
(defun el-secretario-emacs-lisp-review ()
"Review all Org-Roam nodes tagged as 'emacs-lisp'."
(interactive)
(el-secretario-start-session
(el-secretario-files-make-source
(seq-map #'car
(org-roam-db-query
[:select [nodes:file]
:from tags
:left-join nodes
:on (= tags:node-id nodes:id)
:where (like tag (quote "%\"emacs-load\""))]))
)))
#+end_src

View file

@ -1,21 +0,0 @@
:PROPERTIES:
:ID: 9879bd30-7f42-433a-aaa4-269f5ef110fb
:END:
#+title: Elixir
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
Elixir is a dynamic, functional language for building scalable and maintainable applications.
#+END_QUOTE
First we need a Elixir major mode.
#+BEGIN_SRC emacs-lisp
(use-package elixir-mode
:straight t
:hook (elixir-mode-hook . lsp-deferred))
#+END_SRC

View file

@ -1,61 +0,0 @@
:PROPERTIES:
:header-args:emacs-lisp: :comments link :results none
:ID: 0d92c672-5ac7-44dc-b021-cc58544f8eea
:END:
#+title: Emacs Rofi
#+filetags: emacs-load
It is possible to make a fake rofi, from emacs ~completing-read~. This file facilitates that. First we define some LISP functions.
#+begin_src emacs-lisp
(defun completing-read-frame-popup-file (prompt file width height &rest args)
""
(with-temp-buffer
(insert-file-contents file)
(message "%s" (string-lines (buffer-string)))
(apply #'completing-read-frame-popup prompt (string-lines (substring-no-properties (buffer-string))) args)))
#+end_src
#+begin_src emacs-lisp
(defvar completing-read-frame nil)
(defun completing-read-frame-popup (prompt collection &rest args)
""
(unless completing-read-frame
(setq completing-read-frame
(make-frame `((minibuffer . only)
(name . "emacs-completing-read-float")
(unsplittable . t)
(no-other-frame . t)
(width . ,width)
(height . ,height)
(left . 0.5)
(top . 0.5))))
(make-frame-invisible completing-read-frame))
(make-frame-visible completing-read-frame)
(raise-frame completing-read-frame)
(with-selected-frame completing-read-frame
(unwind-protect
(let ((selection (apply #'completing-read prompt collection args)))
(make-frame-invisible completing-read-frame)
selection)
(make-frame-invisible completing-read-frame))))
#+end_src
Next a bash helper is needed.
#+begin_src shell
function emacs-rofi()
{
tmp=$(mktemp)
tee > $tmp
emacs -Q --batch --eval $"(progn (require 'server) (princ (format \"%s\\n\" (server-eval-at \"server\" '(completing-read-frame-popup-file \"$1\" \"$tmp\" $2 $3)))))"
rm $tmp
}
#+end_src
Which then ought to be used like so.
#+begin_src shell
echo -e "test1\ntest2\ntest3" | emacs-rofi "test"
#+end_src

View file

@ -1,78 +0,0 @@
:PROPERTIES:
:ID: b9c06fb0-a985-4649-8133-14eeeaa708bc
:ROAM_REFS: https://jherrlin.github.io/posts/emacs-mu4e/
:END:
#+title: Email
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Email is a complicated beast, I decided to use *mu4e* and *mbsync*.
* smtpmail
#+BEGIN_SRC emacs-lisp :results none
(require 'smtpmail)
(with-eval-after-load 'smtpmail
(setq smtpmail-debug-info t
message-send-mail-function 'smtpmail-send-it
smtpmail-stream-type 'starttls))
#+END_SRC
* mu4e
:PROPERTIES:
:ID: 9958efaf-51b2-4cee-bf37-c363d1c56055
:END:
#+BEGIN_SRC emacs-lisp :results none
(let*
((mu-path
(file-name-directory (directory-file-name (file-name-directory (executable-find "mu")))))
(mu-load-path (concat mu-path "share/emacs/site-lisp/mu4e/")))
(add-to-list 'load-path mu-load-path))
(require 'mu4e)
(setq auth-sources '((:source "~/.password-store/.authinfo.gpg")))
(setq auth-source-debug t)
(with-eval-after-load 'mu4e
(setq mu4e-get-mail-command "usbs=$(for dev in /sys/bus/usb/devices/* ; do [ -f ${dev}/idVendor ] && [ -f ${dev}/idProduct ] && ( env cat ${dev}/idVendor | tr -d [:space:] ; printf : ; env cat ${dev}/idProduct ); done) ; yubi=0 ; for usb in $usbs ; do [ $usb = \"1050:0407\" ] && yubi=1 ; done ; [ $yubi = 1 ] && mbsync -a || exit 1"
mu4e-update-interval 300
message-kill-buffer-on-exit t)
(defun magic_rb/eval-file (file)
"Execute FILE and return the result of the last expression."
(eval
(ignore-errors
(read-from-whole-string
(with-temp-buffer
(insert-file-contents file)
(buffer-string))))))
(setq mu4e-contexts (magic_rb/eval-file "~/.emacs.d/mu4e-contexts")
;; When Emacs is loading, mu4e will ask for which context to use. Set a default.
mu4e-context-policy 'pick-first)
(add-hook 'after-init-hook (lambda () (mu4e t))))
#+END_SRC
By default, when mu4e is asking for messages (be it unread or inbox) it'll ask for related as well, which means if you have a very long thread in your emails, say 100 message long, then that thread will eat up a 100 message spots in the 500 fetched from the mailbox, that is quite annoying. Change the behavior.
#+begin_src emacs-lisp
(setq mu4e-headers-include-related nil)
#+end_src
* mu4e-alert
#+BEGIN_SRC emacs-lisp
(use-package mu4e-alert
:straight t
:after mu4e
:config
(mu4e-alert-set-default-style 'notifications)
(mu4e-alert-enable-mode-line-display)
(mu4e-alert-enable-notifications))
#+END_SRC

View file

@ -1,24 +0,0 @@
:PROPERTIES:
:ID: d8339d6a-8b2f-43d8-bb08-a1b89db76b02
:END:
#+title: Embark
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
This package provides a sort of right-click contextual menu for Emacs, accessed through the embark-act command (which you should bind to a convenient key), offering you relevant actions to use on a target determined by the context:
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package embark
:straight t
:bind
(("C-." . embark-act)
("C-;" . embark-dwim)
("C-h B" . embark-bindings))
:init
(setq embark-indicators '(embark-minimal-indicator)))
#+END_SRC

View file

@ -1,65 +0,0 @@
:PROPERTIES:
:ID: cfb02bea-f9a2-4c7c-8971-d082feedab22
:END:
#+title: ement.el
#+filetags: emacs-load
#+begin_src emacs-lisp
(use-package password-store
:straight t)
(defun ement-connect-sentinel (process msg)
(when (memq (process-status process) '(exit signal))
(with-current-buffer " *ement-pass*"
(ement-connect
:uri-prefix "http://localhost:8008"
:password (string-trim (substring-no-properties (buffer-string)))
:user-id "@magic_rb:matrix.redalder.org")
(kill-buffer))))
(defun after-init-ement-connect ()
(set-process-sentinel (start-process "ement-pass" " *ement-pass*" "pass" "Matrix/@magic_rb:matrix.redalder.org") #'ement-connect-sentinel))
(use-package ement
:straight '(ement :type git :host github :repo "alphapapa/ement.el")
:after (password-store)
:custom
(ement-save-sessions t)
:config
(remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync)
(add-hook 'after-init-hook #'after-init-ement-connect))
#+end_src
#+begin_src emacs-lisp
(defun ement-send-anyways ()
(interactive)
(when (ement-room-p ement-room)
(let ((ement-room- ement-room)
(ement-session- ement-session))
(save-excursion
(panctl "*panctl-temp-send-anyway*")
(vterm-insert "send-anyways " (ement-user-id (ement-session-user ement-session-)) " " (ement-room-id ement-room-))
(vterm-send-return)
(vterm-send-C-c)))))
#+end_src
Enable message composition in [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] by default.
#+begin_src emacs-lisp
(setq ement-room-send-message-filter #'ement-room-send-org-filter)
#+end_src
Define an interactive command to open [[https://github.com/matrix-org/pantalaimon][pantalaimon]] in Emacs.
#+begin_src emacs-lisp
(defun panctl (&optional name)
(interactive)
(let* ((name- (or name "panctl"))
(buffer (get-buffer name-))
(vterm-shell "panctl"))
(if buffer
(switch-to-buffer buffer)
(vterm name-)
(whitespace-mode -1))))
#+end_src

View file

@ -1,23 +0,0 @@
:PROPERTIES:
:ID: 50d451b0-eddf-4192-afc4-c505a5bb3b20
:END:
#+title: Filling and unfilling paragraphs
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+begin_src emacs-lisp
;;; Stefan Monnier <foo at acm.org>. It is the opposite of fill-paragraph
(defun unfill-paragraph (&optional region)
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive (progn (barf-if-buffer-read-only) '(t)))
(let ((fill-column (point-max))
;; This would override `fill-column' if it's an integer.
(emacs-lisp-docstring-fill-column t))
(fill-paragraph nil region)))
;; Handy key definition
(define-key global-map "\M-Q" 'unfill-paragraph)
#+end_src

View file

@ -1,66 +0,0 @@
:PROPERTIES:
:ID: 334a4188-93e6-4378-b22d-b0c302fc26a1
:END:
#+title: Flycheck
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
* Flycheck Posframe
Display flycheck messages in a posframe.
#+begin_src emacs-lisp :noweb yes
(use-package flycheck-posframe
:straight t
:config
(setq flycheck-posframe-position 'frame-bottom-right-corner)
<<flycheck-display-errors-delay>>
<<lsp-ui-sideline-show-diagnostics>>
:hook (flycheck-mode . flycheck-posframe-mode))
#+end_src
Flycheck calls ~flycheck-display-errors-function~ every ~flycheck-display-errors-delay~.
#+name: flycheck-display-errors-delay
#+begin_src emacs-lisp
(setq flycheck-display-errors-delay 0.1)
#+end_src
Since we get errors and such in a posframe, we don't need them in the sideline.
#+name: lsp-ui-sideline-show-diagnostics
#+begin_src emacs-lisp
(setq lsp-ui-sideline-show-diagnostics nil)
#+end_src
Since flycheck recalls ~flycheck-display-errors-function~ on every point movement, it creates this really ugly flicker and also lags a bit, so if the diagnostic message didn't change, filter out the call.
#+name: flycheck-posframe-change-filter
#+begin_src emacs-lisp
(defvar flycheck-posframe-last-error-list '())
(advice-add
'flycheck-posframe-hidehandler
:override
(lambda (info)
(if (not (equal
(flycheck-overlay-errors-at (point))
flycheck-posframe-last-error-list))
(progn
(setq flycheck-posframe-last-error-list nil)
t)
nil))
'((name . "flycheck-error-display-filter")))
(advice-add
'flycheck-posframe-show-posframe
:before-while
(lambda (diagnostic)
(let ((last-list flycheck-posframe-last-error-list))
(setq flycheck-posframe-last-error-list diagnostic)
(if (equal diagnostic last-list) nil t)))
'((name . "flycheck-error-display-filter")))
#+end_src

View file

@ -1,20 +0,0 @@
:PROPERTIES:
:ID: 1c6981a5-4371-4657-b4ea-435497a80010
:END:
#+title: general.el
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
~general.el~ provides a more convenient method for binding keys in emacs (for both evil and non-evil users). Like
use-package, which provides a convenient, unified interface for managing packages, general.el is intended to provide a
convenient, unified interface for key definitions.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package general
:straight t)
#+END_SRC

View file

@ -1,16 +0,0 @@
:PROPERTIES:
:ID: efc50bb2-7197-4225-b4d2-66aed96a5104
:END:
#+title: Go
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Go is a horrible language, but for some reason all the DevOps things are written in it.
#+begin_src emacs-lisp
(use-package go-mode
:straight t)
#+end_src

View file

@ -1,78 +0,0 @@
:PROPERTIES:
:ID: 22a6cb0e-5466-4edf-b0da-a8b76d879cf9
:END:
#+title: Keybindings
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
This file contains all keybindings of my Emacs configuration. I chose to put them all into one file for easy reference and also cross package consistency is easier to ensure when you have everything on one screen.
First we need to define a new minor mode.
#+begin_src emacs-lisp
(define-minor-mode magic_rb/userbind-mode
"Minor mode for user keybindings of Magic_RB."
:lighter " userbind."
:global t
:keymap (make-sparse-keymap))
#+end_src
Then we hook our minor mode on ~meow-mode-hook~, but only after ~meow-mode~ is loaded.
#+begin_src emacs-lisp
(add-hook 'after-init-hook 'magic_rb/userbind-mode)
#+end_src
#+begin_src emacs-lisp
(general-def
:keymaps '(magic_rb/userbind-mode-map)
:prefix "C-c"
"o f" 'org-roam-node-find
"o i" 'org-roam-node-insert
"o t" 'org-roam-tag-add
"o T" 'org-roam-tag-remove
"o r" 'org-roam-ref-add
"o R" 'org-roam-ref-remove
"o c" 'org-roam-capture
"o b" 'org-roam-buffer-toggle
"o a" 'org-agenda
"j f" 'consult-fd
"j r" 'consult-ripgrep
"j l" 'consult-line
"j b" 'consult-project-buffer
"p v" 'projectile-run-vterm
"p m" 'projectile-vc
"p s" 'projectile-switch-project
"r c" 'popper-cycle
"r p" 'popper-toggle-latest
"r t" 'popper-toggle-type
"w t" 'windmove-left
"w r" 'windmove-up
"w n" 'windmove-down
"w s" 'windmove-right
"w a" 'ace-window
"b i" 'indent-region
"b c" 'comment-dwim
"l l" 'lsp
"l r" 'lsp-workspace-restart
"l e" 'lsp-execute-code-action
"e l" 'ement-list-rooms
"e v" 'ement-view-room
"M-c" 'tempel-insert
:keymaps '(special-mode-map)
:prefix ""
"q" 'nil
"k" 'quit-window)
#+end_src

View file

@ -1,142 +0,0 @@
:PROPERTIES:
:ID: cc668372-8d95-461b-a7c6-3e2b51de3f40
:END:
#+title: LSP
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Disable server downloading suggestions, and other features.
#+begin_src emacs-lisp
(setq lsp-enable-suggest-server-download nil
lsp-enable-snippet nil
lsp-enable-dap-auto-configure nil
lsp-enable-on-type-formatting nil)
#+end_src
* Python
Using the Microsoft language server as it's the best afaik. It's weird because it doesn't lookup the path to itself via PATH but has to be statically set.
#+BEGIN_SRC emacs-lisp
(defun magic_rb/locate-python-executable-lsp-deffered ()
"Locates the python executable available to the current buffer and only then calls `lsp-deferred'."
(lambda ()
(require 'lsp-python-ms)
(envrc-mode)
(setq-local lsp-python-ms-executable (executable-find "python-language-server"))
(lsp-deferred)))
(use-package lsp-python-ms
:straight t
:after (lsp-mode)
:hook (python-mode . magic_rb/locate-python-executable-lsp-deffered)
:config
(defvar-local lsp-python-ms-executable ""))
#+END_SRC
* C/C++
This just requires hooking lsp onto ~c-mode~ and ~c++-mode~.
#+BEGIN_SRC emacs-lisp
(use-package lsp-c++-c
:no-require t
:after (lsp-mode)
:hook ((c-mode-hook c++-mode-hook) . lsp-deferred))
#+END_SRC
* Haskell
Enable ~haskell-mode~, and ~lsp-haskell~
#+BEGIN_SRC emacs-lisp
(use-package haskell-mode
:straight t
:hook
(((haskell-mode haskell-literate-mode) . interactive-haskell-mode)
((heskell-mode haskell-literate-mode) . haskell-indentation-mode))
:config
(setq lsp-haskell-plugin-ghcide-type-lenses-global-on nil
lsp-haskell-plugin-import-lens-code-lens-on nil))
(use-package lsp-haskell
:straight t
:after (haskell-mode lsp-mode)
:hook ((haskell-mode haskell-literate-mode) . lsp-deferred))
#+END_SRC
Disable the ~haskell-stack-ghc~ flycheck checker, it's not used when lsp starts, but it does get loaded just before it. Loading and unloading it is slow and causes Emacs to freeze for a few seconds, so just disable it.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load "flycheck"
(add-to-list 'flycheck-disabled-checkers 'haskell-stack-ghc))
#+END_SRC
* Javascript
Enable ~rjsx-mode~ instead of ~javascript-mode~ or ~js2-mode~ as it properly handles inline HTML.
#+BEGIN_SRC emacs-lisp
(use-package rjsx-mode
:straight t
:config
:mode ("\\.js\\'" . rjsx-mode)
:mode ("\\.jsx\\'" . rjsx-mode)
:hook (rjsx-mode . lsp-deferred)
:init
;; Originally this function exits with a call to `error`, which causes the simple "PATH lookup"
;; scheme to not be tried
(cl-defun lsp--npm-dependency-path (&key package path &allow-other-keys)
"Return npm dependency PATH for PACKAGE."
(let ((path (executable-find
(f-join lsp-server-install-dir "npm" package
(cond ((eq system-type 'windows-nt) "")
(t "bin"))
path))))
(unless (and path (f-exists? path))
nil)
path)))
#+END_SRC
* Typescript
Enable ~typescript-mode~ for =.ts=, =.tsx= and hook ~lsp-mode~ on it. It doesn't specifically support inline HTML,
but aside from minor indentation issues it works fine.
#+BEGIN_SRC emacs-lisp
(use-package typescript-mode
:straight t
:config
:mode ("\\.ts\\'" . typescript-mode)
:mode ("\\.tsx\\'" . typescript-mode)
:hook (typescript-mode . lsp-deferred))
#+END_SRC
* HTML Markup Language
Enable ~web-mode~ for =.html=, =.xhtml= and hook ~lsp-mode~ on it.
#+BEGIN_SRC emacs-lisp
(use-package web-mode
:straight t
:mode ("\\.html\\'" . web-mode)
:mode ("\\.xhtml\\'" . web-mode)
:hook (web-mode . lsp-deferred))
#+END_SRC
* CSS Style Sheet Language
Enable ~css-mode~ for =.css=, =.scss= and hook ~lsp-mode~ on it. Also make ~flycheck~ happy.
#+BEGIN_SRC emacs-lisp
(use-package css-mode
:mode ("\\.css\\'" . css-mode)
:mode ("\\.scss\\'". css-mode)
:hook (css-mode . lsp-deferred)
:config
(with-eval-after-load "flycheck"
(flycheck-add-mode 'javascript-eslint 'web-mode)))
#+END_SRC

View file

@ -1,28 +0,0 @@
:PROPERTIES:
:ID: aa25248c-197c-4bf5-8fc1-aea93008e194
:END:
#+title: Magit
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
~magit~ is literally the best package right after OrgMode of course. Therefore enable it.
#+BEGIN_SRC emacs-lisp
(defun magit-reset-visibility-indicators (frame)
(with-selected-frame frame
(when (display-graphic-p)
(setq magit-section-visibility-indicator
(if (window-system)
'(magit-fringe-bitmap> . magit-fringe-bitmapv)
(cons (if (char-displayable-p ?…) "…" "...")
t)))
(remove-hook 'after-make-frame-functions #'magit-reset-visibility-indicators))))
(use-package magit
:straight t
:config
(add-hook 'after-make-frame-functions #'magit-reset-visibility-indicators))
#+END_SRC

View file

@ -1,22 +0,0 @@
:PROPERTIES:
:ID: 921e105a-01ff-4ab3-9478-4d967a61ff3f
:ROAM_REFS: https://github.com/minad/marginalia
:END:
#+title: Marginalia
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
This package provides marginalia-mode which adds marginalia to the minibuffer completions. Marginalia are marks or annotations placed at the margin of the page of a book or in this case helpful colorful annotations placed at the margin of the minibuffer for your completion candidates.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package marginalia
:straight t
:init
(marginalia-mode))
#+END_SRC

View file

@ -1,130 +0,0 @@
:PROPERTIES:
:ID: b88618f2-258f-4f3a-93f7-46fd45bc833f
:END:
#+title: Meow
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Meow is a modal editing framework, it's a bit like evil but also very different. This keymap is setup for KOY.
#+begin_src emacs-lisp
(defun magic_rb/meow-prev (arg)
"Runs meow-prev except for some specific cases"
(interactive "P")
(pcase major-mode
('ement-room-list-mode (forward-button (* (or arg 1) -1)))
(mode (meow-prev arg))))
(defun magic_rb/meow-next (arg)
"Runs meow-prev except for some specific cases"
(interactive "P")
(pcase major-mode
('ement-room-list-mode (forward-button (or arg 1)))
(mode (meow-next arg))))
;; (add-hook #'ement-room-list-mode-hook (lambda () (unless (button-at (point)) (forward-button 1))))
(defun meow-setup ()
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
(general-def
:keymaps 'meow-insert-state-keymap
"j" (general-key-dispatch 'self-insert-command
:timeout 0.25
"j" 'meow-insert-exit))
(meow-motion-overwrite-define-key
'("r" . magic_rb/meow-prev)
'("n" . magic_rb/meow-next)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC r/n will run the original command in MOTION state.
'("r" . "H-r")
'("n" . "H-n")
;; Use SPC (0-9) for digit arguments.
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet))
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'("d" . meow-reverse)
'("w" . meow-inner-of-thing)
'("m" . meow-bounds-of-thing)
'("z" . meow-beginning-of-thing)
'("f" . meow-end-of-thing)
'("h" . meow-append)
'("H" . meow-open-below)
'("ö" . meow-back-word)
'("Ö" . meow-back-symbol)
'("ä" . meow-change)
'("e" . meow-delete)
'("E" . meow-backward-delete)
'("o" . meow-next-word)
'("O" . meow-next-symbol)
'("i" . meow-find)
'("u" . meow-cancel-selection)
'("U" . meow-grab)
'("c" . meow-insert)
'("C" . meow-open-above)
'("t" . meow-left)
'("T" . meow-left-expand)
'("r" . meow-prev)
'("R" . meow-prev-expand)
'("n" . meow-next)
'("N" . meow-next-expand)
'("s" . meow-right)
'("S" . meow-right-expand)
'("p" . meow-join)
'("b" . meow-search)
'("l" . meow-block)
'("L" . meow-to-block)
'("ß" . meow-clipboard-yank)
'("k" . meow-quit)
'("K" . meow-goto-line)
'("," . meow-replace)
'("" . meow-swap-grab)
'("a" . meow-clipboard-kill)
'("y" . meow-till)
'("g" . meow-undo)
'("G" . meow-undo-in-selection)
'("ü" . avy-goto-char-2)
'("." . meow-mark-word)
'("•" . meow-mark-symbol)
'("q" . meow-line)
'("Q" . meow-goto-line)
'("v" . meow-clipboard-save)
'("V" . meow-sync-grab)
'("x" . meow-pop-selection)
'("D" . repeat)
'("<escape>" . ignore)))
#+end_src
#+begin_src emacs-lisp
(use-package meow
:straight t
:config
(meow-setup)
(meow-global-mode 1))
#+end_src

View file

@ -1,12 +0,0 @@
:PROPERTIES:
:header-args:emacs-lisp: :comments link :results none
:ID: 9f801382-e771-4929-8eb3-f76afde9aba2
:END:
#+title: Native Compilation
#+filetags: emacs-load
When Emacs is native compiling, it'll constantly raised the warning buffer on every message, of which there are a lot. As far as I know, they are harmless and can be safely ignored. Therefore raised the minimum raising level to ~error~.
#+begin_src emacs-lisp
(setq warning-minimum-level :error)
#+end_src

View file

@ -1,21 +0,0 @@
:PROPERTIES:
:ID: 6bbcf471-95ee-4cd5-abee-d412a1eba068
:ROAM_REFS: https://github.com/oantolin/orderless
:END:
#+title: Orderless
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
This package provides an orderless completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order. Each component can match in any one of several ways: literally, as a regexp, as an initialism, in the flex style, or as multiple word prefixes. By default, regexp and literal matches are enabled.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package orderless
:straight t
:config
(setq completion-styles '(orderless)))
#+END_SRC

View file

@ -1,168 +0,0 @@
:PROPERTIES:
:ID: 22d678ce-7a3a-486c-abfb-f6cebdd77f90
:END:
#+title: Org Agenda
#+filetags: :emacs-load:
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Put state changes into the ~LOGBOOK~ section and not into a random spot.
#+BEGIN_SRC emacs-lisp
(setq org-log-into-drawer t)
#+END_SRC
Set priority levels to A, B, and C.
#+BEGIN_SRC emacs-lisp :resutls none
(setq org-highest-priority ?A)
(setq org-default-priority ?B)
(setq org-lowest-priority ?C)
#+END_SRC
* Dynamic Org Agenda using Org Roam DB
#+BEGIN_NOTE
This whole system depends on [[id:a56794cf-b8f9-4537-a390-bd7ee6bb35ae][Vulpea]]
#+END_NOTE
#+BEGIN_SRC emacs-lisp :results none
(with-eval-after-load "vulpea"
#+END_SRC
First we have to exclude the =agenda= tag from inheritance.
#+BEGIN_SRC emacs-lisp :results none
(add-to-list 'org-tags-exclude-from-inheritance "project")
#+END_SRC
Then we need a function to check whether a buffer contains any todo entry.
#+BEGIN_SRC emacs-lisp :results none
(defun vulpea-project-p ()
"Return non-nil if current buffer has any todo entry.
TODO entries marked as done are ignored, meaning the this
function returns nil if current buffer contains only completed
tasks."
(when (eq major-mode 'org-mode)
(org-element-map
(org-element-parse-buffer 'headline)
'headline
(lambda (h)
(eq (org-element-property :todo-type h)
'todo))
nil 'first-match)))
#+END_SRC
Then we need a function which will check whether the current buffer contains any TODOs and if so, then add a roam tag to that file, so that we can easily get a list of all files with TODOs.
#+BEGIN_SRC emacs-lisp :results none
(add-hook 'find-file-hook #'vulpea-project-update-tag)
(add-hook 'before-save-hook #'vulpea-project-update-tag)
(defun vulpea-project-update-tag ()
"Update PROJECT tag in the current buffer."
(when (and (not (active-minibuffer-window))
(vulpea-buffer-p))
(save-excursion
(goto-char (point-min))
(let* ((tags (vulpea-buffer-tags-get))
(original-tags tags))
(if (vulpea-project-p)
(setq tags (cons "project" tags))
(setq tags (remove "project" tags)))
;; cleanup duplicates
(setq tags (seq-uniq tags))
;; update tags if changed
(when (or (seq-difference tags original-tags)
(seq-difference original-tags tags))
(apply #'vulpea-buffer-tags-set tags))))))
(defun vulpea-buffer-p ()
"Return non-nil if the currently visited buffer is a note."
(and buffer-file-name
(or (string-prefix-p
(expand-file-name (file-name-as-directory org-roam-directory))
(file-name-directory buffer-file-name))
(string-prefix-p
(expand-file-name (file-name-as-directory "~/dotfiles/emacs-lisp"))
(file-name-directory buffer-file-name)))))
#+END_SRC
Now for the second last function, we need to actually return the list of files containing the =project= tag, to be consumed by org-agenda.
#+BEGIN_SRC emacs-lisp :results none
(defun vulpea-project-files ()
"Return a list of note files containing 'project' tag." ;
(seq-uniq
(seq-map
#'car
(org-roam-db-query
[:select [nodes:file]
:from tags
:left-join nodes
:on (= tags:node-id nodes:id)
:where (or (like tag '"%project%") (like tag '"%project-forced%"))]))))
#+END_SRC
Finally we can update the list of project files before every =org-agenda= invocation.
#+BEGIN_SRC emacs-lisp :results none
(defun vulpea-agenda-files-update (&rest _)
"Update the value of `org-agenda-files'."
(setq org-agenda-files (vulpea-project-files)))
(advice-add 'org-agenda :before #'vulpea-agenda-files-update)
#+END_SRC
** Migration
To migrate existing org-roam files to this new system, run this elisp code.
#+BEGIN_SRC emacs-lisp :results none :tangle no
(dolist (file (org-roam-list-files))
(message "processing %s" file)
(with-current-buffer (or (find-buffer-visiting file)
(find-file-noselect file))
(vulpea-project-update-tag)
(save-buffer)))
#+END_SRC
#+BEGIN_SRC emacs-lisp :results none :exports none
)
#+END_SRC
* Custom Tags
Define a number of custom tags to ease organisation.
#+BEGIN_SRC emacs-lisp :results none
(defun my/org-match-at-point-p (match)
"Return non-nil if headline at point matches MATCH.
Here MATCH is a match string of the same format used by
`org-tags-view'."
(funcall (cdr (org-make-tags-matcher match))
(org-get-todo-state)
(org-get-tags-at)
(org-reduced-level (org-current-level))))
(defun my/org-agenda-skip-without-match (match)
"Skip current headline unless it matches MATCH.
Return nil if headline containing point matches MATCH (which
should be a match string of the same format used by
`org-tags-view'). If headline does not match, return the
position of the next headline in current buffer.
Intended for use with `org-agenda-skip-function', where this will
skip exactly those headlines that do not match."
(save-excursion
(unless (org-at-heading-p) (org-back-to-heading))
(let ((next-headline (save-excursion
(or (outline-next-heading) (point-max)))))
(if (my/org-match-at-point-p match) nil next-headline))))
#+END_SRC

View file

@ -1,294 +0,0 @@
:PROPERTIES:
:ID: 07d8e392-19ab-44d3-b4dc-cf68d73f64b6
:header-args:emacs-lisp: :comments link :results none
:END:
#+title: Org GTD
#+filetags: emacs-load
So let me preface this file with a little... preface. When I began this file, it was a few hours after I decided it's time to finally take up GTD and step my game up when it comes to organisation. So this file, along with [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] and [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] are the culmination of my efforts.
* End Goal
What I've very quickly, that GTD is only working properly when at no point, you stop to think "What did I want to/was supposed to do", if that ever happens to you, you're doing GTD wrong. With that in mind and me starting university in.. 5 days.. I want to ensure that forgetting an appointment, assignment, homework and forgetting to call a friend or reply to an email are all things of the past. To that end, I'll from now on, capture everything, be it on my phone or at one of my workstations.
** The Phone Thing
What I've learned after crafting my own workflows and using Emacs and Linux for almost 4 years now (WOW!) is that if a workflow isn't reliable, annoyance-free and convenient, I won't succeed in using it long term. Therefore any new workflow I adopt, must fill all those checkboxes or it won't stick. That's why I'm on the look out for [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][handheld computers]] or [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][linux phones]] which would enable me to use Emacs conveniently on the go. I've yet to find any which would be pocket sized or cheap enough that I could afford them. One requirement i have except for the Linux thing is that they must have a physical keyboard if I'm to lug around a second device.
For now, I've decided to make due with Emacs installed in Termux with [[id:3bc7f35e-bcb5-4e55-9ec7-623afa456a98][home-manager]].
* Implementation
So let's start with the entry point to the whole thing. Those would be the ~org-roam-capture-templates~ and ~org-roam-capture-ref-templates~. I've gone with more than just what was shown in [[id:c3b7951f-b8f2-41dc-856d-07373724ef99][Get Things Done with Emacs]] to remove some burden from me when I'm refiling each day. The cognitive overhead created by having to decide on what you're capturing isn't big enough for me to just capture everything into one disorganized heading. At least that's what I think now, we'll see how it goes.
I've split the capturing process into 7 different templates, first we have the resource templates, of which I have 2 currently, one for automatic capturing from a web browser and one for capturing manually from Emacs. Then we have a special ~event~ template, which can be quickly used to capture events and have them immediately show up in you agenda. Next up is a special template for capturing Emacs LISP code, that's mostly used when adding new packages and playing with the configuration. Second to last is a catch all email capturing template and lastly a catch all generic capturing template.
So the process for capturing is to trigger the capture with ~C-c o c~ and then quickly decide between one of the categories, simple enough hopefully.
#+begin_src emacs-lisp
(require 'org-roam-protocol)
(setq org-roam-capture-ref-templates
`(("rw" "Web resource" entry
,(concat "* ${title} :resource:inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":ROAM_REFS: ${ref}\n"
":ID: %(org-id-uuid)\n"
":END:\n\n"
"${body}")
:target (file+olp "inbox.org" ("Resources")))
("s" "Shopping list" entry
,(concat "* ${title} :inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":END:\n\n"
"\n"
"${ref}\n\n"
"${body}")
:target (file+olp "inbox.org" ("Shopping list")))))
(setq org-roam-capture-templates
`(("i" "Inbox" entry
,(concat "* ${title} :inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":ID: %(org-id-uuid)\n"
":END:\n"
"#+setupfile: ~/roam/emacs-lisp/setupfiles/latex-base.org\n\n"
"%?")
:target (file+olp "inbox.org" ("Shopping list")))
("f" "File" plain "%?"
:target (file+head "${slug}.org"
,(concat ":PROPERTIES:\n"
":CREATED: %U\n"
":ID: %(org-id-uuid)\n"
":END:\n"
"#+setupfile: ~/roam/emacs-lisp/setupfiles/latex-base.org\n\n"
"#+title: ${title}\n"
"")))
("@" "Inbox [mu4e]" entry
,(concat "* Process \"%a\" %? :inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":ID: %(org-id-uuid)\n"
":END:\n\n"
"%?")
:target (file+olp "inbox.org" ("All")))
("t" "TODO" entry
,(concat "* TODO ${title} :inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":ID: %(org-id-uuid)\n"
":END:\n\n"
"%?")
:target (file+olp "inbox.org" ("Todo")))
("r" "Resource")
("rw" "Web resource" entry
,(concat "* ${title} :resource:inbox:\n"
":PROPERTIES:\n"
":CREATED: %U\n"
":ROAM_REFS: %(completing-read \"URL for resource: \" nil nil nil nil nil (or (substring-no-properties (car kill-ring)) nil))\n"
":ID: %(org-id-uuid)\n"
":END:\n\n")
:target (file+olp "inbox.org" ("Resources" "Web")))
("E" "Event" entry
,(concat "* ${title} :event:inbox:\n"
":PROPERTIES:\n"
":DATE: %(org-time-stamp nil)\n"
":CREATED: %U\n"
":ID: %(org-id-uuid)\n"
":END:\n\n"
"%?")
:target (file+olp "inbox.org" ("Events")))
("e" "Emacs Lisp" plain "%?"
:target (file+head "emacs-lisp/${slug}.org"
,(concat ":PROPERTIES:\n"
":header-args:emacs-lisp: :comments link :results none\n"
":END:\n"
"#+title: ${title}\n"
"#+filetags: emacs-load"
"")))))
#+end_src
A special version of ~org-refile~ follows. What makes it special is that it first asks you for which [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] node you want to refile to and only then refiles. This eases the workflow quite a lot and also makes refiling snappy is it only needs to parse one file not a few thousand.
#+begin_src emacs-lisp
;; Make the refile completing read prompt also list the file itself in case it's empty
;; and also not require multiple consecutive selections in case of nested headings.
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps nil)
(defun org-roam-refile-incremental ()
(interactive)
(let* ((node (org-roam-node-read))
(org-refile-target-verify-function nil)
(org-refile-targets `((,(org-roam-node-file node) :maxlevel . 9))))
(org-refile-cache-clear)
(call-interactively 'org-refile)))
#+end_src
Please ignore this next block, this is some code that took me way too long to figure out and even longer to realize it's already been implemented upstream.
#+begin_src emacs-lisp :tangle no
(element (org-element-at-point))
(while (not (eq (car element) 'headline))
(setq element (plist-get (car (cdr element)) :parent)))
(setq element (car (cdr element)))
(let ((properties (org-entry-properties
(plist-get element :begin)
'standard)))
(message "%s" properties))
(delete-region
(plist-get element :begin)
(plist-get element :end))
(if (org-roam-node-file node)
(progn)
(org-roam-capture-
:node node
:templates `()
:info `()
:keys ""
:props '(:finalize )))
#+end_src
This little advice cleans up after the ~org-roam-promote-entire-buffer~ function a bit. It leaves the buffer in a state that isn't quite what I want formatting and structure wise, so this just quickly fixes that.
#+begin_src emacs-lisp
(defun magic_rb/org-roam-promote-buffer-cleanup ()
(goto-char 1)
(org-roam-end-of-meta-data)
(delete-region (point) (progn (skip-chars-forward " \t") (point)))
(org-next-visible-heading 1)
(unless (eq (point) (point-max)) (insert "\n\n"))
(whitespace-cleanup)
(org-roam-db-update-file)
(org-roam-tag-remove '(inbox)))
(advice-add 'org-roam-promote-entire-buffer :after #'magic_rb/org-roam-promote-buffer-cleanup)
(defun magic_rb/org-roam-promote-buffer-prepare ()
(org-with-point-at 1
(org-next-visible-heading 1)
;; (when (and (not (org-roam--buffer-promotable-p))
;; (org-roam-get-keyword "filetags")
;; (not (org-get-tags nil t)))
;; )
(org-todo "")
))
(advice-add 'org-roam-promote-entire-buffer :before #'magic_rb/org-roam-promote-buffer-prepare)
#+end_src
Next this function actually fixes a bug and cleans up after the ref capture. As of now [2022-08-31] the ~org-ref-capture~ protocol has a few minor issues:
1. you can't tell it not not create a ~ROAM_REFS~ property
2. it always creates the ~ROAM_REFS~ property at the root of the [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]] node it's capturing into so if you're capturing into a heading for later refilling without an ID, it'll create a ~ROAM_REFS~ property but at the wrong place
3. when you capture into a buffer that already has a ~ROAM_REFS~ it'll break completely, so we must remove it after it adds it
#+begin_src emacs-lisp
(defun magic_rb/clear-roam-refs-if-in-inbox ()
(with-current-buffer (org-capture-get :buffer)
(let* ((target-file (file-name-nondirectory (buffer-file-name))))
(when (and (org-roam-capture-p)
(string-equal target-file "inbox.org"))
(save-excursion
(goto-char (point-min))
(org-entry-delete nil "ROAM_REFS"))))))
(add-hook 'org-capture-after-finalize-hook #'magic_rb/clear-roam-refs-if-in-inbox)
#+end_src
** Agenda
First we define a few functions, which I got from [[https://stackoverflow.com/questions/10074016/org-mode-filter-on-tag-in-agenda-view][Stack Overflow]]. They allow you to filter in [[id:22d678ce-7a3a-486c-abfb-f6cebdd77f90][Org Agenda]] views with the syntax as described in [[info:org#Matching tags and properties][Matching tags and properties]]. They're not used currently, but may come in handy so I just keep them here.
#+BEGIN_SRC emacs-lisp :results none
(defun my/org-match-at-point-p (match)
"Return non-nil if headline at point matches MATCH.
Here MATCH is a match string of the same format used by
`org-tags-view'."
(funcall (cdr (org-make-tags-matcher match))
(org-get-todo-state)
(org-get-tags-at)
(org-reduced-level (org-current-level))))
(defun my/org-agenda-skip-without-match (match)
"Skip current headline unless it matches MATCH.
Return nil if headline containing point matches MATCH (which
should be a match string of the same format used by
`org-tags-view'). If headline does not match, return the
position of the next headline in current buffer.
Intended for use with `org-agenda-skip-function', where this will
skip exactly those headlines that do not match."
(save-excursion
(unless (org-at-heading-p) (org-back-to-heading))
(let ((next-headline (save-excursion
(or (outline-next-heading) (point-max)))))
(if (my/org-match-at-point-p match) nil next-headline))))
#+END_SRC
Now the fun part. I only define one unified agenda view for now. It allows
#+BEGIN_SRC emacs-lisp :results none
(setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "INPROGRESS(i)" "STUCK(s)" "|" "DONE(d)" "CANCELLED(c)"))
org-use-fast-todo-selection t)
(setq org-agenda-custom-commands
'(("g" "Get Things Done (GTD)"
((agenda ""
((org-agenda-skip-function
'(org-agenda-skip-entry-if 'deadline))
(org-deadline-warning-days 0)))
(todo "INPROGRESS"
((org-agenda-skip-function
'(org-agenda-skip-entry-if 'deadline))
(org-agenda-prefix-format " %i %-12:c [%e] ")
(org-agenda-overriding-header "\nTasks started\n")))
(todo "NEXT"
((org-agenda-skip-function
'(org-agenda-skip-entry-if 'deadline))
(org-agenda-prefix-format " %i %-12:c [%e] ")
(org-agenda-overriding-header "\nTasks planned\n")))
(agenda nil
((org-agenda-entry-types '(:deadline))
(org-agenda-format-date "")
(org-deadline-warning-days 21)
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'notregexp "\\* NEXT"))
(org-agenda-overriding-header "\nDeadlines")))
(todo "TODO"
((org-agenda-prefix-format " %?-12t% s")
(org-agenda-skip-function
'(my/org-agenda-skip-without-match "-inbox"))
(org-agenda-overriding-header "\nTo be done\n")))
(tags "inbox"
((org-agenda-prefix-format " %?-12t% s")
(org-agenda-overriding-header "\nInbox\n")))
(tags "CLOSED>=\"<today>\""
((org-agenda-overriding-header "\nCompleted today\n")))))))
#+END_SRC
** Keybindings
#+begin_src emacs-lisp
(defun org-capture-inbox ()
(interactive)
(call-interactively 'org-store-link)
(org-roam-capture nil "i"))
(defun org-capture-mail ()
(interactive)
(call-interactively 'org-store-link)
(org-roam-capture nil "@"))
(setq org-agenda-hide-tags-regexp (regexp-opt '("project" "inbox")))
(general-define-key
:keymaps 'global
"C-c i" 'org-capture-inbox)
(general-define-key
:keymaps '(mu4e-headers-mode-map mu4e-view-mode-map)
"C-c i" 'org-capture-mail)
#+end_src

View file

@ -1,23 +0,0 @@
:PROPERTIES:
:ID: 28f65a55-f6b4-4c42-8b15-3e3a353c7c0a
:ROAM_REFS: https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats
:END:
#+title: Org Habit
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_SRC emacs-lisp :results none
(require 'org-habit)
#+END_SRC
Setup a function which resets any checkboxes under a ~TODO~ which changes state to ~DONE~. Many thanks to [[https://www.reddit.com/user/davidglasser][davidglasser]], who had this exact same issue and solved it on [[https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats/cv9gbj6?utm_source=share&utm_medium=web2x&context=3][Reddit]].
#+BEGIN_SRC emacs-lisp
(defun glasser-org-reset-check-on-repeat ()
(when (and (org-get-repeat) (member org-state org-done-keywords))
(org-reset-checkbox-state-subtree)))
(add-hook 'org-after-todo-state-change-hook 'glasser-org-reset-check-on-repeat)
#+END_SRC

View file

@ -1,211 +0,0 @@
:PROPERTIES:
:ID: 986ca7a5-d225-49bb-9e35-f2dffafe8aee
:END:
#+title: Org Mode
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
I used to respect the 80 column limit, but why waste all the space when it can be dynamic. In this way all of the available screen space is utilized.
#+BEGIN_SRC emacs-lisp :results none
(add-hook 'org-mode-hook 'visual-line-mode)
#+END_SRC
Enable /"fake"/ indentation in =org-mode=, in other words, add indentation using overlays, but on disk the buffer is not indented.
#+BEGIN_SRC emacs-lisp :results none
(add-hook 'org-mode-hook 'org-indent-mode)
#+END_SRC
Increase the size of headings, in my personal opinion this makes the headings stand out a bit more and therefore easier to read.
#+BEGIN_SRC emacs-lisp :results none
(custom-set-faces
'(org-level-1 ((t (:inherit outline-1 :height 1.25))))
'(org-level-2 ((t (:inherit outline-2 :height 1.2))))
'(org-level-3 ((t (:inherit outline-3 :height 1.15))))
'(org-level-4 ((t (:inherit outline-4 :height 1.10))))
'(org-level-5 ((t (:inherit outline-5 :height 1.05)))))
#+END_SRC
Disable element cache for now, it freaks out all the damn time. God forbid I make a tiny syntax error...
#+begin_src emacs-lisp
(setq org-element-use-cache nil)
#+end_src
#+begin_src emacs-lisp
(setf org-blank-before-new-entry '((heading . t) (plain-list-item . nil)))
#+end_src
#+begin_src emacs-lisp
(setq org-src-window-setup 'current-window)
#+end_src
* Org Mark Ring
To go back to the previous mark, very useful with [[id:18476d68-cccb-48f4-aa77-caefe213d8bd][Org Roam]].
#+BEGIN_SRC emacs-lisp :results none
(general-def org-mode-map "C-c b" 'org-mark-ring-goto)
#+END_SRC
* Babel
Enable =tangle on save=, big thanks to Diego Zamboni for his amazing booklet about /[[https://leanpub.com/lit-config/read][Literate Configuration]]/.
#+BEGIN_SRC emacs-lisp :results none
(add-hook 'org-mode-hook
(lambda () (add-hook 'after-save-hook #'org-babel-tangle :append :local)))
#+END_SRC
After executing a source code block with =org-babel=, redisplay inline images, this speeds up the REPL-like workflow a lot.
#+BEGIN_SRC emacs-lisp :results none
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
#+END_SRC
Enable additional babel languages.
#+BEGIN_SRC emacs-lisp :results none
(org-babel-do-load-languages
'org-babel-load-languages
(cl-map 'list (lambda (lang) `(,lang . t))
'(python R shell dot latex plantuml)))
#+END_SRC
* Latex
For previews, create SVGs and not PNGs or something, use the ~dvisvgm-lua~ command.
#+BEGIN_SRC emacs-lisp :results none
(setq org-preview-latex-default-process 'dvisvgm)
#+END_SRC
Actually define ~dvisvgm-lua~.
#+begin_src emacs-lisp :results none
(add-to-list
'org-preview-latex-process-alist
'(dvisvgm-lua
:programs ("dvilualatex" "dvisvgm")
:description "dvi > svg"
:message "you need to install the programs: latex and dvisvgm."
:image-input-type "dvi"
:image-output-type "svg"
:image-size-adjust (1.7 . 1.5)
:latex-compiler ("dvilualatex -interaction nonstopmode -output-directory %o %f")
:image-converter ("dvisvgm %f -n -b min -c %S -o %O")))
#+end_src
Adjust size of LaTeX previews.
#+BEGIN_SRC emacs-lisp :results none
(pcase (system-name)
("heater" (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.75)))
("omen" (setq org-format-latex-options (plist-put org-format-latex-options :scale 0.8))))
#+END_SRC
To support non-breakable whitespace, create a new ~org-entity~.
#+begin_src emacs-lisp
(add-to-list 'org-entities
'("space" "~" nil "&nbsp;" " " " " " "))
#+end_src
Enable fontification for inline LaTeX blocks which convieniently also makes in fixed-width.
#+begin_src emacs-lisp
(setq org-highlight-latex-and-related '(native entities))
#+end_src
** Sliced Previews
Normally a LaTeX preview is just one huge image which makes Emacs really jumpy and makes writing prose a really unpleasant experience. With these two functions, that's fixed. They work using mainly text properties (overlays are still involved but only one per preview, max two) so it should be fast still.
#+begin_src emacs-lisp
;;; -*- lexical-binding: t; -*-
(plist-put org-format-latex-options :background "Transparent")
(defadvice org-clear-latex-preview (after org-prop-img--org-clear-later-preview (beg end) activate)
(save-excursion
(goto-char beg)
(with-silent-modifications
(put-text-property beg end 'read-only nil)
(put-text-property beg end 'display nil)
(put-text-property beg end 'line-height nil))
(font-lock-fontify-region beg end)))
(defun org--make-preview-overlay (beg end image &optional imagetype)
"Build an overlay between BEG and END using IMAGE file.
Argument IMAGETYPE is the extension of the displayed image,
as a string. It defaults to \"png\"."
(let* ((imagetype (or (intern imagetype) 'png))
(image-spec (list 'image :type imagetype :file image :ascent 'center))
(ov (make-overlay beg end)))
(overlay-put ov 'org-overlay-type 'org-latex-overlay)
(overlay-put ov
'modification-hooks
(list (lambda (ov after &rest args)
(when (not after)
(org-clear-latex-preview (overlay-start ov) (overlay-end ov))))))
(if (> (count-lines beg end) 1)
(let ((image-height (cdr (image-size image-spec t)))
(y 0)
(endm (make-marker)))
(set-marker endm end)
(save-excursion
(goto-char beg)
(while (and (<= (point) endm) (< y image-height))
(let* ((dy (line-pixel-height)))
;; loop through and check for empty lines, those will break rendering
(when (= (line-beginning-position) (line-end-position))
(goto-char (line-beginning-position))
(insert "%")
(forward-char -1))
(when (> (* dy 2) (- image-height y))
(setq dy (- image-height y)))
(with-silent-modifications
;; place the image property on the current line
(put-text-property
(line-beginning-position) (line-end-position)
'display
(list
(list 'slice
0 y 1.0 dy)
image-spec))
;; ;; remove any fontification face so the images don't get colored
;; (put-text-property (line-beginning-position) (line-end-position)
;; 'face
;; nil)
)
(forward-line 1)
(setq y (+ y dy))))
(if (not (> (point) endm))
(let ((ov (make-overlay (- (point) 1) endm)))
(overlay-put ov 'org-overlay-type 'org-latex-overlay)
(overlay-put ov 'evaporate t)
(overlay-put ov 'invisible t))))
(set-marker endm nil))
(with-silent-modifications
(put-text-property beg end
'display
(list image-spec))))
(font-lock-fontify-region beg end)
(with-silent-modifications
(put-text-property beg end 'line-height t))))
#+end_src

View file

@ -1,186 +0,0 @@
:PROPERTIES:
:ID: 18476d68-cccb-48f4-aa77-caefe213d8bd
:END:
#+title: Org Roam
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_NOTE
When exporting, running ~(org-id-update-id-locations (directory-files-recursively org-roam-directory ".org"))~
#+END_NOTE
#+BEGIN_SRC emacs-lisp :tangle no :results none
(defun replace-in-string (what with in)
(replace-regexp-in-string (regexp-quote what) with in nil 'literal))
(defun org-html--format-image (source attributes info)
(progn
(setq source (replace-in-string "%20" " " source))
(format "<img src=\"data:image/%s+xml;base64,%s\"%s />"
(or (file-name-extension source) "")
(base64-encode-string
(with-temp-buffer
(insert-file-contents-literally source)
(buffer-string)))
(file-name-nondirectory source))))
#+END_SRC
#+BEGIN_QUOTE
Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem.
#+END_QUOTE
#+BEGIN_WARNING
SQLite3 must be on Emacs' PATH!
#+END_WARNING
#+BEGIN_SRC emacs-lisp :results none
(use-package org-roam
:straight
(org-roam
:type git
:host github
:repo "org-roam/org-roam"
:branch "main")
:init
(setq org-roam-v2-ack t)
:config
(add-hook 'after-init-hook 'org-roam-setup)
;; Add ignore for SyncThing
(setq org-roam-file-exclude-regexp (regexp-opt '(".stversions" ".sync-conflict-" "logseq")))
(setq org-roam-directory "~/roam")
;; Add more informative completion interface
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:30}" 'face 'org-tag)))
(defun magic_rb/org-roam-buffer-hook ()
(when (org-roam-buffer-p)
(make-local-variable 'org-link-frame-setup)
(add-to-list 'org-link-frame-setup '(file . find-file))))
(add-hook 'org-mode-hook 'magic_rb/org-roam-buffer-hook)
(defun magic_rb/org-roam-hook ()
(visual-line-mode))
(add-hook 'org-roam-mode-hook 'magic_rb/org-roam-hook))
(use-package shackle
:straight t
:init
(shackle-mode))
(setq shackle-rules
'((org-roam-mode
:align right
:size 0.25
:popup t)))
#+END_SRC
* Ref Capture
Using ~org-protocol~, one can capture a website from their browser directly into Org Roam.
#+BEGIN_SRC emacs-lisp :tangle no
(with-eval-after-load "org-roam"
(require 'org-roam-protocol)
(setq org-roam-capture-ref-templates
`(("r" "ref" plain "%?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n${body}")
:unnarrowed t))))
#+END_SRC
Then you need a desktop entry for ~org-protocol~. Such as:
#+BEGIN_SRC conf-desktop
[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;
#+END_SRC
or in Nix form:
#+BEGIN_SRC nix
makeDesktopItem {
name = "Org-Protocol";
exec = "emacsclient %u";
comment = "Org protocol";
desktopName = "org-protocol";
type = "Application";
mimeType = "x-scheme-handler/org-protocol";
}
#+END_SRC
Lastly a bookmarklet in Firefox.
#+BEGIN_SRC javascript
javascript:location.href ='org-protocol://roam-ref?template=rw&ref=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title) + '&body=' + encodeURIComponent(window.getSelection())
#+END_SRC
* Export
#+begin_src emacs-lisp :tangle no :results none
(require 'org-roam-export)
(require 'nxml-mode)
(defun magic_rb/org-html-publish-to-html-continue (plist filename pub-dir)
(org-html-publish-to-html plist filename pub-dir))
(defcustom org+-html-embed-svg nil
"Embed SVG images.
You can set this variable in Org files with
,#+HTML_EMBED_SVG: t
or
,#+OPTIONS: html-embed-svg:t"
:type 'boolean
:group 'org-export-html)
(cl-pushnew
'(:html-embed-svg "HTML_EMBED_SVG" "html-embed-svg" org+-html-embed-svg)
(org-export-backend-options (org-export-get-backend 'html)))
(defun org+-html-svg-image-embed (fun source attributes info)
"Make embedding of SVG images possible in org HTML export.
SVG images are embedded if :html-embed-svg is non-nil in the plist INFO.
Otherwise FUN called with SOURCE, ATTRIBUTES, and INFO as arguments.
SOURCE is the file name of the SVG file.
This is an around advice for `org-html--svg-image' as FUN."
(if (and
(member (plist-get info :html-embed-svg) '("yes" "t" t))
(string-equal "svg" (file-name-extension source)))
(with-temp-buffer
(message "embedding svg: %s" source)
(insert-file-contents source)
(with-syntax-table nxml-mode-syntax-table
(while (and (search-forward "<svg") ;; barfs if a "<svg" is not found in code
(nth 8 (syntax-ppss)))))
(delete-region (point-min) (match-beginning 0))
(buffer-string))
(funcall fun (concat "../" source) attributes info)))
(advice-add 'org-html--format-image :around #'org+-html-svg-image-embed)
(setq org-publish-project-alist
`(("org"
:base-directory "~/roam/"
:publishing-function org-html-publish-to-html ;; magic_rb/org-html-publish-to-html-continue
:publishing-directory "~/roam/published"
:exclude "^.*$"
:include ,(seq-map #'car
(org-roam-db-query
[:select [nodes:file]
:from tags
:left-join nodes
:on (= tags:node-id nodes:id)
:where (like tag (quote "%\"public-publish\""))]))
)))
(org-publish "org" t)
#+end_src
https://emacs.stackexchange.com/questions/59149/why-is-latex-preview-and-latex-to-html-export-via-dvisvgm-not-working-in-org-mod

View file

@ -1,20 +0,0 @@
:PROPERTIES:
:ID: 3e36a34a-7038-4466-847a-e4023f1f4827
:END:
#+title: Org Variable Pitch
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Enable ~org-variable-pitch~, it makes ~org-mode~ feel like a proper writing instrument.
#+BEGIN_SRC emacs-lisp
(use-package org-variable-pitch
:straight t
:config
(set-face-attribute 'org-variable-pitch-fixed-face nil
:inherit 'variable-pitch)
:hook (org-mode . org-variable-pitch--enable))
#+END_SRC

View file

@ -1,76 +0,0 @@
:PROPERTIES:
:ID: 45da0115-42c7-4a9a-9288-c5d840a69b92
:END:
#+title: Popper
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Enable ~popper~, a better version of ~popwin~, which might actually work. It groups popups by context and allows you to specify their exact positioning, or even a custom display function. It also seems to be better at restoring the previous layout.
#+NAME: popper
#+BEGIN_SRC emacs-lisp
(use-package popper
:straight (popper :type git :host github :repo "karthink/popper")
:config
(setq popper-reference-buffers
'("\\*Messages\\*"
"\\*Warnings\\*"
"\\*Error\\*"
"Output\\*$"
"\\*HS-Error\\*"
"\\*lsp-help\\*"
"^\\*Ement compose.*\\*$"
haskell-interactive-mode
help-mode
compilation-mode
rustic-compilation-mode
tex-shell))
(popper-mode +1))
#+END_SRC
Add a [[id:db1d0122-58d6-4dec-84f6-afcb52937fc7][consult]] source for popped buffers.
#+begin_src emacs-lisp
(with-eval-after-load 'consult
(setq magic_rb/consult-source-popper
`(:name "popper"
:narrow ?P
:category buffer
:face consult-buffer
:history buffer-name-history
:state consult--buffer-state
:items
(lambda ()
(let ((group-name (when popper-group-function
(with-current-buffer buf (funcall popper-group-function)))))
(mapcar #'buffer-name
(append
(mapcar #'cdr (alist-get group-name popper-buried-popup-alist))
(mapcar #'cdr (alist-get group-name popper-open-popup-alist))))))))
(add-to-list 'consult-buffer-sources 'magic_rb/consult-source-popper 'append))
#+end_src
Force user buffer switching to also obey ~display-buffer-alist~.
#+begin_src emacs-lisp
(setq switch-to-buffer-obey-display-actions t)
#+end_src
Set almost all popups to ~meow-motion-mode~, except for [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] popups and [[id:8fbb19be-bb8d-4fef-8a6a-9d5a3f5d06ec][Vterm]].
#+begin_src emacs-lisp :tangle no
(defun magic_rb/popper-meow-motion (buf &optional _act)
(with-current-buffer buf
(when
(and (popper-popup-p buf)
(not (equal major-mode 'vterm-mode))
(not ement-room-compose-buffer))
(meow-normal-mode) (meow-motion-mode))))
(advice-add 'popper-display-control-p :after 'magic_rb/popper-meow-motion)
#+end_src

View file

@ -1,14 +0,0 @@
:PROPERTIES:
:ID: 3709b269-1b66-44c9-b282-c97f48716c52
:END:
#+title: Racket
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_SRC emacs-lisp
(use-package racket-mode
:straight t)
#+END_SRC

View file

@ -1,16 +0,0 @@
#+latex_header: \usepackage{xcolor}
#+latex_header: \usepackage{algorithm2e}
#+latex_header: \SetKwProg{Fn}{Function}{:}{end}
#+latex_header: \usepackage{cmbright}
#+latex_header: \usepackage{textcomp}
#+latex_header: \usepackage{tikz}
#+latex_header: \usetikzlibrary{shapes.geometric}
#+latex_header: \usepackage{mathtools}
#+latex_header: \usepackage{circuitikz}
#+latex_header: \usepackage{fancyvrb}
#+latex_header: \usepackage{blkarray}
#+latex_header: \usepackage{ifthen}
#+latex_header: \usepackage{array}
#+latex_header: \newenvironment*{dummyenv}{}{}
#+latex_header: \newcommand{\BlankLineEm}{\vskip 1em}
#+startup: latexpreview

View file

@ -1,167 +0,0 @@
:PROPERTIES:
:ID: a0514202-b2ef-41a4-9d77-01efaa7e8d64
:END:
#+title: Tempel
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+begin_quote
Tempel is a tiny template package for Emacs, which uses the syntax of the Emacs Tempo library. Tempo is an ancient
temple of the church of Emacs. It is 27 years old, but still in good shape since it successfully resisted change over
the decades. However it may look a bit dusty here and there. Therefore we present to you, Tempel, a modernized
implementation of Tempo, in the form of three commands.
#+end_quote
#+begin_src emacs-lisp :noweb yes
(use-package tempel
:straight '(tempel :type git :host github :repo "minad/tempel")
:config
<<tempel-path>>
:init
<<tempel-hooks>>
<<tempel-keymaps>>)
#+END_SRC
Set the template file to the result of tangling [[id:3e8f0e02-dbfe-4f34-9b00-8b7ecd0a238d][Tempel - Templates]].
#+name: tempel-path
#+begin_src emacs-lisp
(setq tempel-path (expand-file-name "~/roam/emacs-lisp/templates.lisp"))
#+end_src
Hook ~tempel-capf~ on both ~prog-mode~ and ~text-mode~.
#+name: tempel-hooks
#+begin_src emacs-lisp
(defun tempel-setup-capf ()
(add-hook 'completion-at-point-functions #'tempel-complete -100 'local))
(add-hook 'prog-mode-hook 'tempel-setup-capf)
(add-hook 'text-mode-hook 'tempel-setup-capf)
(add-hook 'lsp-mode-hook 'tempel-setup-capf)
#+end_src
Define keymaps, the defaults are unnecessarily hard to trigger.
#+name: tempel-keymaps
#+begin_src emacs-lisp
(general-define-key
:keymaps '(insert normal)
"C-n" 'nil
"C-p" 'nil)
(general-define-key
:keymaps 'tempel-map
"M-{" nil
"M-}" nil
"C-n" 'tempel-next
"C-p" 'tempel-previous)
#+end_src
Fix LSP not getting notified about changes, can be fixed by notifying it at the end of template expansion.
#+begin_src emacs-lisp
(advice-add
'tempel--disable
:before
(lambda (&rest r)
(when lsp-mode
(let* ((region-start (tempel--beginning))
(region-end (tempel--end)))
(lsp-on-change region-start region-end (- region-end region-start))))))
#+end_src
To setup a post template return point, use ~(tempel-retpoint-here)~ in a template.
#+begin_src emacs-lisp
(defun org-edit-special-latex-preview (&rest _)
(let ((datum (org-element-context)))
(when (and (memq (org-element-type datum) '(latex-environment latex-fragment))
(let ((beg (org-element-property :begin datum))
(end (org-element-property :end datum)))
(when (org-clear-latex-preview beg end)
(setq-local tempel-latex-preview t)))))))
(advice-add
'org-edit-special
:before
#'org-edit-special-latex-preview)
#+end_src
#+begin_src emacs-lisp
(defvar-local tempel-retpoint (make-marker))
(defvar-local tempel-latex-preview nil)
(defun tempel-retpoint-here ()
"Place a marker at `point' to allow for return on tempel exit."
(set-marker tempel-retpoint (point))
"")
(defun tempel-retpoint-goto ()
"Move `point' to `tempel-retpoint'."
(when (marker-position tempel-retpoint)
(goto-char (marker-position tempel-retpoint))
(set-marker tempel-retpoint nil)))
(add-hook
'tempel--disable
#'tempel-retpoint-goto)
(defvar org-src-mode-exit-hook nil)
(defun org-edit-src-exit-run-hooks (&rest _)
"Run hooks from `org-edit-src-exit-hook' upon exiting org-src edit buffer."
(run-hooks 'org-src-mode-exit-hook))
(advice-add
'org-edit-src-exit
:after
#'org-edit-src-exit-run-hooks)
(defun org-edit-src-exit-tempel-retpoint ()
"Return to `tempel-retpoint' if set."
(tempel-retpoint-goto))
(defun org-edit-src-exit-tempel-latex-preview ()
"Toggle LaTeX preview of templated LaTeX fragment."
(when tempel-latex-preview
(org-latex-preview)
(setq-local tempel-latex-preview nil)))
(add-hook
'org-src-mode-exit-hook
#'org-edit-src-exit-tempel-latex-preview)
(add-hook
'org-src-mode-exit-hook
#'org-edit-src-exit-tempel-retpoint)
(defun tempel-post-edit-latex (&optional preview move-back)
"Move `point' back and run `org-edit-special'.
If PREVIEW is non-nil then `org-latex-preview' will be called on
the resulting LaTeX block. Move point that MOVE-BACK lines back to
reach a good spot in the LaTeX block, defaults to `-2'."
(forward-line (or move-back -2))
(end-of-line)
(setq-local tempel-latex-preview preview)
(org-edit-special))
#+end_src
To allow for ~=>~ as template keys, ~'symbol~ won't work, but ~'evil-word~ will.
#+begin_src emacs-lisp
(defun tempel--prefix-bounds ()
"Return prefix bounds."
(if tempel-trigger-prefix
(let ((end (point))
(beg (save-excursion
(search-backward tempel-trigger-prefix
(line-beginning-position) 'noerror))))
(when (and beg (save-excursion
(not (re-search-backward "\\s-" beg 'noerror))))
(cons (+ beg (length tempel-trigger-prefix)) end)))
(bounds-of-thing-at-point 'symbol)))
#+end_src

View file

@ -1,225 +0,0 @@
:PROPERTIES:
:ID: 3e8f0e02-dbfe-4f34-9b00-8b7ecd0a238d
:header-args: :tangle ./templates.lisp
:END:
#+title: Tempel - Templates
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
* Fundamental Mode
#+BEGIN_SRC lisp
fundamental-mode ;; Available everywhere
(today (format-time-string "%Y-%m-%d"))
(heredoc "<<EOF\n" p "EOF\n")
#+END_SRC
* Prog Mode
#+BEGIN_SRC lisp
prog-mode
(fixme (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "FIXME ")
(todo (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "TODO ")
(bug (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "BUG ")
(hack (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "HACK ")
#+END_SRC
* Latex Mode
#+BEGIN_SRC lisp
latex-mode
(begin "\\begin{" (s env) "}" > n> r> "\\end{" (s env) "}")
(frac "\\frac{" p "}{" p "}")
(enumerate "\\begin{enumerate}\n\\item " r> n> "\\end{enumerate}")
(itemize "\\begin{itemize}\n\\item " r> n> "\\end{itemize}")
#+END_SRC
* Emacs List Mode
#+BEGIN_SRC lisp
emacs-lisp-mode
(lambda "(lambda (" p ")" n> r> ")")
(var "(defvar " p "\n \"" p "\")")
(const "(defconst " p "\n \"" p "\")")
(custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")")
(face "(defface " p " '((t :inherit " p "))\n \"" p "\")")
(group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")")
(macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")")
(fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")")
(let "(let (" p ")" n> r> ")")
(star "(let* (" p ")" n> r> ")")
(rec "(letrec (" p ")" n> r> ")")
(command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive)" n> r> ")")
#+END_SRC
* Text Mode
#+BEGIN_SRC lisp
text-mode
(cut "--8<---------------cut here---------------start------------->8---" n r n
"--8<---------------cut here---------------end--------------->8---" n)
(asciibox "+-" (make-string (length str) ?-) "-+" n
"| " (s str) " |" n
"+-" (make-string (length str) ?-) "-+" n)
(rot13 (p "plain text" text) n "----" n (rot13 text))
(calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula)))
#+END_SRC
* Rst Mode
#+BEGIN_SRC lisp
rst-mode
(title (make-string (length title) ?=) n (p "Title: " title) n (make-string (length title) ?=) n)
#+END_SRC
* Java Mode
#+BEGIN_SRC lisp
java-mode
(class "public class " (p (file-name-base (or (buffer-file-name) (buffer-name)))) " {" n> r> n "}")
#+END_SRC
* C Mode
#+BEGIN_SRC lisp
c-mode :condition (re-search-backward "^\\w*$" (line-beginning-position) 'noerror)
(inc "#include <" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) ">")
(incc "#include \"" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) "\"")
#+END_SRC
* Org Mode
#+BEGIN_SRC lisp
org-mode
(title "#+title: " p n "#+author: Richard Brežák" n "#+language: en" n n)
(quote "#+begin_quote" n> r> n> "#+end_quote" n)
(example "#+begin_example" n> r> n> "#+end_example" n)
(center "#+begin_center" n> r> n> "#+end_center" n)
(comment "#+begin_comment" n> r> n> "#+end_comment" n)
(verse "#+begin_verse" n> r> n> "#+end_verse" n)
(src "#+begin_src " p n> r> n> "#+end_src" n
:post (org-edit-src-code))
(export "#+begin_export " p n
n
"#+end_export" n
:post (progn (previous-line) (org-edit-special)))
(elisp "#+begin_src emacs-lisp" n> r> n "#+end_src" n
:post (progn (org-edit-src-code)))
(abs "\\begin{abstract}" n> r> n> "\\end{abstract}" n)
(align "\\begin{align}" n
" " n
"\\end{align}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(align* "\\begin{align*}" n
" " n
"\\end{align*}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(arr "\\begin{array}" n
n
"\\end{array}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(begin "\\begin{" (p "environment" env) "}"
n n
"\\end{" env "}" n
(tempel-retpoint-here) q
:post (tempel-post-edit-latex t))
(bib "\\bibliographystyle{plain}" n "\\bibliography{" s "}" n)
(dm "\\[" n
" ." n
"\\]" q
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(mm "$" p "$ " q
:post (org-latex-preview))
(mmc "$\\textcolor{" p "}{" p "}$ " q
:post (org-latex-preview))
(item "\\begin{itemize}" n p n "\\end{itemize}" n)
(it "\\item " r)
(itd "\\item[" (p "label") "] " r)
(fig "\\begin{figure}[htbp]" n "\\centering" n p n "\\caption{" p "}" n "\\label{" p "}" n "\\end{figure}" n)
(minipage "\\begin{minipage}[" (p "htbp") "]{" (p "1.0") (p "\\linewidth") "}" n
" " n
"\\end{minipage}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(frame "\\begin{frame}{" (p "Frame Title") "}"h n
" " n
"\\end{frame}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(package "#+LATEX_HEADER: \\usepackage[" p "]{" p "}" n)
(ref "\\ref{" p "}")
(table "\\begin{tabular}{" p "}" n
" " n
"\\end{tabular}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(algorithm "\\begin{algorithm}" n
" \\DontPrintSemicolon\\;" n
" " n
"\\end{algorithm}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(function "\\begin{dummyenv}" n
" \\DontPrintSemicolon\\;" n
" \\SetKwFunction{" (p "" function) "}{" function "}" n
" \\begin{algorithm}" n
" \\Fn{\\" function "{" p "}}{"n
" " n
" }" n
" \\end{algorithm}" n
"\\end{dummyenv}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t -4))
org-mode :condition (org-inside-LaTeX-fragment-p)
(frac "\\frac{" p "}{" p "}")
(larrow "\\leftarrow")
(rarrow "\\rightarrow")
(bigo "\\mathcal{O}(" p ")")
#+END_SRC
* Haskell Mode
#+BEGIN_SRC lisp
haskell-mode
(case
"case " (p "x") " of " n>
(p "Data") " -> " (p "undefined") n>
(p "Data") " -> " (p "undefined"))
({-} "{- " p " -}")
(=> (p "Class") " " (p "m") " => ")
(idata "data " (p "Type" ndata) " = " (s ndata) " " (p "Int") n>
"deriving (" (p "Show, Eq") ")")
(newtype "newtype " (p "Type" ndata) " = " (s ndata) " " (p "Int") n>
"deriving (" (p "Show, Eq") ")")
(data "data " (p "Type" ndata) " = " (s ndata) n>
"{ " (p "field") " :: " (p "Type") n>
", " (p "field") " :: " (p "Type") (tempel-retpoint-here) n>
"}" n>
"deriving (" (p "Show, Eq") ")")
(fn (p "f" fname) " :: " (p "a") " -> " (p "b") n
(s fname) " " (p "x") " = " (p "undefined"))
(fnc (p "f" fname) " :: " (p "a") " -> " (p "b") n
(s fname) " " (p "pattern") " = " (p "undefined") n
(s fname) " " (p "pattern") " = " (p "undefined"))
; guarded fn
(<- (p "x") " <- " (p "undefined"))
#+END_SRC

View file

@ -1,174 +0,0 @@
fundamental-mode ;; Available everywhere
(today (format-time-string "%Y-%m-%d"))
(heredoc "<<EOF\n" p "EOF\n")
prog-mode
(fixme (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "FIXME ")
(todo (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "TODO ")
(bug (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "BUG ")
(hack (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "HACK ")
latex-mode
(begin "\\begin{" (s env) "}" > n> r> "\\end{" (s env) "}")
(frac "\\frac{" p "}{" p "}")
(enumerate "\\begin{enumerate}\n\\item " r> n> "\\end{enumerate}")
(itemize "\\begin{itemize}\n\\item " r> n> "\\end{itemize}")
emacs-lisp-mode
(lambda "(lambda (" p ")" n> r> ")")
(var "(defvar " p "\n \"" p "\")")
(const "(defconst " p "\n \"" p "\")")
(custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")")
(face "(defface " p " '((t :inherit " p "))\n \"" p "\")")
(group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")")
(macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")")
(fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")")
(let "(let (" p ")" n> r> ")")
(star "(let* (" p ")" n> r> ")")
(rec "(letrec (" p ")" n> r> ")")
(command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive)" n> r> ")")
text-mode
(cut "--8<---------------cut here---------------start------------->8---" n r n
"--8<---------------cut here---------------end--------------->8---" n)
(asciibox "+-" (make-string (length str) ?-) "-+" n
"| " (s str) " |" n
"+-" (make-string (length str) ?-) "-+" n)
(rot13 (p "plain text" text) n "----" n (rot13 text))
(calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula)))
rst-mode
(title (make-string (length title) ?=) n (p "Title: " title) n (make-string (length title) ?=) n)
java-mode
(class "public class " (p (file-name-base (or (buffer-file-name) (buffer-name)))) " {" n> r> n "}")
c-mode :condition (re-search-backward "^\\w*$" (line-beginning-position) 'noerror)
(inc "#include <" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) ">")
(incc "#include \"" (p (concat (file-name-base (or (buffer-file-name) (buffer-name))) ".h")) "\"")
org-mode
(title "#+title: " p n "#+author: Richard Brežák" n "#+language: en" n n)
(quote "#+begin_quote" n> r> n> "#+end_quote" n)
(example "#+begin_example" n> r> n> "#+end_example" n)
(center "#+begin_center" n> r> n> "#+end_center" n)
(comment "#+begin_comment" n> r> n> "#+end_comment" n)
(verse "#+begin_verse" n> r> n> "#+end_verse" n)
(src "#+begin_src " p n> r> n> "#+end_src" n
:post (org-edit-src-code))
(export "#+begin_export " p n
n
"#+end_export" n
:post (progn (previous-line) (org-edit-special)))
(elisp "#+begin_src emacs-lisp" n> r> n "#+end_src" n
:post (progn (org-edit-src-code)))
(abs "\\begin{abstract}" n> r> n> "\\end{abstract}" n)
(align "\\begin{align}" n
" " n
"\\end{align}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(align* "\\begin{align*}" n
" " n
"\\end{align*}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(arr "\\begin{array}" n
n
"\\end{array}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(begin "\\begin{" (p "environment" env) "}"
n n
"\\end{" env "}" n
(tempel-retpoint-here) q
:post (tempel-post-edit-latex t))
(bib "\\bibliographystyle{plain}" n "\\bibliography{" s "}" n)
(dm "\\[" n
" ." n
"\\]" q
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(mm "$" p "$ " q
:post (org-latex-preview))
(mmc "$\\textcolor{" p "}{" p "}$ " q
:post (org-latex-preview))
(item "\\begin{itemize}" n p n "\\end{itemize}" n)
(it "\\item " r)
(itd "\\item[" (p "label") "] " r)
(fig "\\begin{figure}[htbp]" n "\\centering" n p n "\\caption{" p "}" n "\\label{" p "}" n "\\end{figure}" n)
(minipage "\\begin{minipage}[" (p "htbp") "]{" (p "1.0") (p "\\linewidth") "}" n
" " n
"\\end{minipage}\n" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(frame "\\begin{frame}{" (p "Frame Title") "}"h n
" " n
"\\end{frame}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(package "#+LATEX_HEADER: \\usepackage[" p "]{" p "}" n)
(ref "\\ref{" p "}")
(table "\\begin{tabular}{" p "}" n
" " n
"\\end{tabular}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(algorithm "\\begin{algorithm}" n
" \\DontPrintSemicolon\\;" n
" " n
"\\end{algorithm}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t))
(function "\\begin{dummyenv}" n
" \\DontPrintSemicolon\\;" n
" \\SetKwFunction{" (p "" function) "}{" function "}" n
" \\begin{algorithm}" n
" \\Fn{\\" function "{" p "}}{"n
" " n
" }" n
" \\end{algorithm}" n
"\\end{dummyenv}" n
(tempel-retpoint-here)
:post (tempel-post-edit-latex t -4))
org-mode :condition (org-inside-LaTeX-fragment-p)
(frac "\\frac{" p "}{" p "}")
(larrow "\\leftarrow")
(rarrow "\\rightarrow")
(bigo "\\mathcal{O}(" p ")")
haskell-mode
(case
"case " (p "x") " of " n>
(p "Data") " -> " (p "undefined") n>
(p "Data") " -> " (p "undefined"))
({-} "{- " p " -}")
(=> (p "Class") " " (p "m") " => ")
(idata "data " (p "Type" ndata) " = " (s ndata) " " (p "Int") n>
"deriving (" (p "Show, Eq") ")")
(newtype "newtype " (p "Type" ndata) " = " (s ndata) " " (p "Int") n>
"deriving (" (p "Show, Eq") ")")
(data "data " (p "Type" ndata) " = " (s ndata) n>
"{ " (p "field") " :: " (p "Type") n>
", " (p "field") " :: " (p "Type") (tempel-retpoint-here) n>
"}" n>
"deriving (" (p "Show, Eq") ")")
(fn (p "f" fname) " :: " (p "a") " -> " (p "b") n
(s fname) " " (p "x") " = " (p "undefined"))
(fnc (p "f" fname) " :: " (p "a") " -> " (p "b") n
(s fname) " " (p "pattern") " = " (p "undefined") n
(s fname) " " (p "pattern") " = " (p "undefined"))
; guarded fn
(<- (p "x") " <- " (p "undefined"))

View file

@ -1,25 +0,0 @@
:PROPERTIES:
:ID: ee891758-1259-4af4-aabc-418a1c644d2f
:ROAM_REFS: https://github.com/Alexander-Miller/treemacs
:END:
#+title: Treemacs
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
Treemacs is a file and project explorer similar to NeoTree or vims NerdTree, but largely inspired by the Project Explorer in Eclipse. It shows the file system outlines of your projects in a simple tree layout allowing quick navigation and exploration, while also possessing basic file management utilities.
#+END_QUOTE
Treemacs is really cool.
#+BEGIN_SRC emacs-lisp
(use-package treemacs
:straight t
:after (doom-themes)
:config
;; read input from a minibuffer not a child frame.
(setq treemacs-read-string-input 'from-minibuffer))
#+END_SRC

View file

@ -1,14 +0,0 @@
:PROPERTIES:
:header-args:emacs-lisp: :comments link :results none
:ID: fe60a97d-9dd8-4279-b953-32616158a644
:END:
#+title: Vertico
#+filetags: emacs-load
#+begin_src elisp
(use-package vertico
:straight t
:init
(vertico-mode))
#+end_src

View file

@ -1,19 +0,0 @@
:PROPERTIES:
:ID: 8fbb19be-bb8d-4fef-8a6a-9d5a3f5d06ec
:ROAM_REFS: https://github.com/akermu/emacs-libvterm
:END:
#+title: Vterm
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
Emacs-libvterm (vterm) is fully-fledged terminal emulator inside GNU Emacs based on libvterm, a C library. As a result of using compiled code (instead of elisp), emacs-libvterm is fully capable, fast, and it can seamlessly handle large outputs.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp
(use-package vterm
:straight t)
#+END_SRC

View file

@ -1,19 +0,0 @@
:PROPERTIES:
:ID: a56794cf-b8f9-4537-a390-bd7ee6bb35ae
:END:
#+title: Vulpea
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_QUOTE
A collection of functions for note taking based on org and org-roam. This repository primary goal is to be a tested library for other applications and utilities around note taking.
#+END_QUOTE
#+BEGIN_SRC emacs-lisp :results none
(use-package vulpea
:straight t)
#+END_SRC

View file

@ -1,26 +0,0 @@
:PROPERTIES:
:ID: 8cfa2b1a-9004-4fa0-8ca4-72876ece7d70
:END:
#+title: whitespace.el
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
Highlight trailing whitespace.
#+begin_src emacs-lisp
(use-package whitespace
:config
(setq whitespace-style '(face tabs trailing))
(face-spec-set
'whitespace-tabs
'((t :background "red"))
'face-defface-spec)
(face-spec-set
'whitespace-trailing
'((t :background "red"))
'face-defface-spec)
(global-whitespace-mode))
#+end_src

1280
flake.lock

File diff suppressed because it is too large Load diff

213
flake.nix
View file

@ -1,213 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
inputs = {
nixpkgs-stable.url = "github:NixOS/nixpkgs?ref=nixos-22.11";
nixpkgs.url = "sourcehut:~magic_rb/nixpkgs";
nixpkgs-master.url = "github:NixOS/nixpkgs?ref=master";
nixpkgs-hashicorp.url = "sourcehut:~magic_rb/nixpkgs?ref=nixos-unstable";
nixpkgs-firefox.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
nixpkgs-discord.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
nixinate.url = "github:MagicRB/nixinate";
nixinate.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager?ref=master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.inputs.utils.follows = "flake-utils";
nixng.url = "github:nix-community/NixNG";
nixng.inputs.nixpkgs.follows = "nixpkgs";
poetry2nix.url = "github:nix-community/poetry2nix";
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
poetry2nix.inputs.flake-utils.follows = "flake-utils";
nix.url = "github:NixOS/nix";
nix.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.utils.follows = "flake-utils";
deploy-rs.inputs.flake-compat.follows = "flake-compat";
nomad-driver-containerd-nix.url = "github:MagicRB/nomad-driver-containerd-nix"; # "git+https://gitea.redalder.org/Magic_RB/nomad-driver-containerd-nix";
nomad-driver-containerd-nix.inputs.nixpkgs.follows = "nixpkgs";
nix-gaming.url = "github:fufexan/nix-gaming";
nix-gaming.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.inputs.flake-utils.follows = "flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
dream2nix.url = "github:nix-community/dream2nix";
dream2nix.inputs.nixpkgs.follows = "nixpkgs";
dream2nix.inputs.alejandra.follows = "alejandra";
dream2nix.inputs.pre-commit-hooks.follows = "pre-commit-hooks";
dream2nix.inputs.flake-utils-pre-commit.follows = "flake-utils";
alejandra.url = "github:kamadorueda/alejandra";
alejandra.inputs.nixpkgs.follows = "nixpkgs";
alejandra.inputs.fenix.follows = "fenix";
alejandra.inputs.flakeCompat.follows = "flake-compat";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.inputs.flake-utils.follows = "flake-utils";
nil.url = "github:oxalica/nil";
nil.inputs.nixpkgs.follows = "nixpkgs";
nil.inputs.flake-utils.follows = "flake-utils";
serokell-nix.url = "github:serokell/serokell.nix?ref=magicrb-allow-wildcards-with-no-main";
serokell-nix.inputs.flake-compat.follows = "flake-compat";
serokell-nix.inputs.gitignore-nix.follows = "gitignore-nix";
webcord.url = "github:SpacingBat3/WebCord";
webcord.flake = false;
fenix.url = "github:nix-community/fenix";
fenix.flake = false;
devshell.url = "github:numtide/devshell";
devshell.flake = false;
gomod2nix.url = "github:tweag/gomod2nix";
gomod2nix.flake = false;
mach-nix.url = "github:DavHau/mach-nix";
mach-nix.flake = false;
crane.url = "github:ipetkov/crane";
crane.flake = false;
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
emacs.url = "sourcehut:~magic_rb/emacs";
emacs.flake = false;
vtermModule.url = "github:akermu/emacs-libvterm";
vtermModule.flake = false;
secret.url = "path:///var/empty";
secret.flake = false;
qmk.url = "https://github.com/qmk/qmk_firmware";
qmk.flake = false;
qmk.type = "git";
qmk.ref = "master";
qmk.submodules = true;
bootloadHID.url = "github:whiteneon/bootloadHID";
bootloadHID.flake = false;
hidapitester.url = "github:todbot/hidapitester";
hidapitester.flake = false;
yusdacra-dotfiles.url = "github:yusdacra/nixos-config";
yusdacra-dotfiles.flake = false;
fufexan-dotfiles.url = "github:fufexan/dotfiles";
fufexan-dotfiles.flake = false;
ical2org.url = "git+https://git.sr.ht/~magic_rb/ical2orgpy";
ical2org.flake = false;
udp-over-tcp.url = "github:mullvad/udp-over-tcp";
udp-over-tcp.flake = false;
gitignore-nix.url = "github:hercules-ci/gitignore.nix";
gitignore-nix.flake = false;
uterranix.url = "path:///home/main/uterranix";
uterranix.inputs.flake-parts.follows = "flake-parts";
uterranix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{
self,
flake-parts,
nixpkgs,
nixinate,
...
}:
let
systems = ["x86_64-linux" "aarch64-linux"];
flake =
flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs = {
roots.nixos = ./. + "/nixos";
roots.flake = ./.;
roots.home-manager = ./. + "/home-manager";
};
}
{
inherit systems;
imports = [
inputs.uterranix.flakeModule
./modules
];
uterranix.config = ./terranix/default.nix;
uterranix.terraform = pkgs:
let
hpkgs = inputs.nixpkgs-hashicorp.legacyPackages.${pkgs.stdenv.system};
in
hpkgs.terraform.withPlugins (p:
[
p.consul
((p.nomad.override {
hash = "sha256-oHY+jM4JQgLlE1wd+/H9H8H2g0e9ZuxI6OMlz3Izfjg=";
vendorHash = "sha256-zVU7zhKfWmFLdhsK9oQkSxCW7B7ctzD/B0DvzU+Wnyg=";
mkProviderGoModule =
(args:
hpkgs.buildGoModule (args // {
overrideModAttrs = old: {
preBuild = ''
go get github.com/hashicorp/nomad
go get github.com/hashicorp/nomad/api
'';
postInstall = ''
cp go.mod go.sum $out/
'';
};
}));
}).overrideAttrs (old: {
postConfigure = ''
cp vendor/{go.mod,go.sum} .
'';
}))
p.local
(p.vault.overrideAttrs (old: { patches = [ ./0001-Allow-null-in-authMountTuneSchema.patch ]; }))
p.random
p.null
(hpkgs.terraform.plugins.mkProvider {
owner = "MagicRB";
repo = "terraform-provider-influxdb-v2";
rev = "4f10e465f9526b47d1ef97a8f2e109aa85a7d647";
version = "0.4.6";
hash = "sha256-/IQoA1CwYIafHbHKSZq7pZKFxefgd09fm0lnBW3r11Q=";
vendorHash = "sha256-g7Njs7psHFFSWk44CiV+blLrzpnB+L9HgMTx3lLMA8Q=";
provider-source-address = "registry.terraform.io/MagicRB/influxdb-v2";
})
]
);
};
in
flake // {
apps = nixpkgs.lib.genAttrs systems (system:
(nixinate.nixinate.${system} self)
// flake.apps.${system}
);
};
}

View file

@ -1,39 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.magic_rb.packageCollections."3dPrinting";
in {
options.magic_rb.packageCollections."3dPrinting" = {
enable =
mkEnableOption
''
Enable 3D printing package collection, contains Prusa Slicer,
Cura, OpenSCAD, and inkscape."
'';
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
openscad
cura
inkscape
super-slicer
freecad
];
home.file.".local/share/OpenSCAD/libraries/BOSL2".source =
pkgs.fetchFromGitHub {
owner = "revarbat";
repo = "BOSL2";
rev = "85e6dcd4835d019c8b582c03cf6e41bf83199cd1";
sha256 = "sha256-fuOBp8231ODF4mRzilBfb/JePG+8ANdxkiHbA6a4wts=";
};
};
}

View file

@ -1,565 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
# TERM: rxvt-unicode-256color
TERM: xterm-256color
#window:
# Window dimensions (changes require restart)
#
# Specified in number of columns/lines, not pixels.
# If both are `0`, this setting is ignored.
#dimensions:
# columns: 0
# lines: 0
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
#position:
# x: 0
# y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
#padding:
# x: 0
# y: 0
# Spread additional padding evenly around the terminal content.
#dynamic_padding: false
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background, but no title bar buttons
#decorations: full
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
#startup_mode: Windowed
# Window title
#title: Alacritty
# Window class (Linux/BSD only):
#class:
# Application instance name
#instance: Alacritty
# General application class
#general: Alacritty
# GTK theme variant (Linux/BSD only)
#
# Override the variant of the GTK theme. Commonly supported values are `dark` and `light`.
# Set this to `None` to use the default theme variant.
#gtk_theme_variant: None
#scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
#history: 10000
# Number of lines the viewport will move for every line scrolled when
# scrollback is enabled (history > 0).
#multiplier: 3
# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: SourceCodePro
# The `style` can be specified to pick a specific face.
style: Regular
# Bold font face
bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
family: SourceCodePro
# The `style` can be specified to pick a specific face.
style: Bold
# Italic font face
italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
family: SourceCodePro
# The `style` can be specified to pick a specific face.
style: Italic
# Bold italic font face
bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
family: SourceCodePro
# The `style` can be specified to pick a specific face.
style: Bold Italic
# Point size
size: 10.0
# Offset is the extra space around each character. `offset.y` can be thought of
# as modifying the line spacing, and `offset.x` as modifying the letter spacing.
#offset:
# x: 0
# y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the right,
# increasing `y` moves the glyph upwards.
#glyph_offset:
# x: 0
# y: 0
# Thin stroke font rendering (macOS only)
#
# Thin strokes are suitable for retina displays, but for non-retina screens
# it is recommended to set `use_thin_strokes` to `false`
#
# macOS >= 10.14.x:
#
# If the font quality on non-retina display looks bad then set
# `use_thin_strokes` to `true` and enable font smoothing by running the
# following command:
# `defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO`
#
# This is a global setting and will require a log out or restart to take
# effect.
#use_thin_strokes: true
# If `true`, bold text is drawn using the bright color variants.
#draw_bold_text_with_bright_colors: false
# Colors (Tomorrow Night Bright)
colors:
# Default colors
primary:
background: '#171717'
foreground: '#aaaaaa'
# Bright and dim foreground colors
#
# The dimmed foreground color is calculated automatically if it is not present.
# If the bright foreground color is not set, or `draw_bold_text_with_bright_colors`
# is `false`, the normal foreground color will be used.
#dim_foreground: '#9a9a9a'
#bright_foreground: '#ffffff'
# Cursor colors
#
# Colors which should be used to draw the terminal cursor. If these are unset,
# the cursor color will be the inverse of the cell color.
cursor:
# text: '#000000'
cursor: '#cccccc'
# Selection colors
#
# Colors which should be used to draw the selection area. If selection
# background is unset, selection color will be the inverse of the cell colors.
# If only text is unset the cell text color will remain the same.
#selection:
# text: '#eaeaea'
# background: '#404040'
# Normal colors
normal:
black: '#282a2e'
red: '#c53030'
green: '#b7c52c'
yellow: '#e17a33'
blue: '#4292d4'
magenta: '#aa4aca'
cyan: '#50cebe'
white: '#cccccc'
# Bright colors
bright:
black: '#373b41'
red: '#d14e4e'
green: '#b8c34f'
yellow: '#f4bc4e'
blue: '#6e9cc2'
magenta: '#b37ec3'
cyan: '#72c1b6'
white: '#aaaaaa'
# Dim colors
#
# If the dim colors are not set, they will be calculated automatically based
# on the `normal` colors.
#dim:
# black: '#000000'
# red: '#8c3336'
# green: '#7a8530'
# yellow: '#97822e'
# blue: '#506d8f'
# magenta: '#80638e'
# cyan: '#497e7a'
# white: '#9a9a9a'
# Indexed Colors
#
# The indexed colors include all colors from 16 to 256.
# When these are not set, they're filled with sensible defaults.
#
# Example:
# `- { index: 16, color: '#ff00ff' }`
#
#indexed_colors: []
# Visual Bell
#
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
# rung, the terminal background will be set to white and transition back to the
# default background color. You can control the rate of this transition by
# setting the `duration` property (represented in milliseconds). You can also
# configure the transition function by setting the `animation` property.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
#
# Specifying a `duration` of `0` will disable the visual bell.
#visual_bell:
# animation: EaseOutExpo
# duration: 0
# color: '#ffffff'
# Background opacity
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
background_opacity: 0.9
#selection:
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
#save_to_clipboard: false
# Allow terminal applications to change Alacritty's window title.
#dynamic_title: true
#cursor:
# Cursor style
#
# Values for `style`:
# - ▇ Block
# - _ Underline
# - | Beam
#style: Block
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
#unfocused_hollow: true
# Live config reload (changes require restart)
#live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`.
# Entries in `shell.args` are passed unmodified as arguments to the shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux/BSD) user login shell
# - (Windows) powershell
#shell:
# program: /bin/bash
# args:
# - --login
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
#working_directory: None
# WinPTY backend (Windows only)
#
# Alacritty defaults to using the newer ConPTY backend if it is available,
# since it resolves a lot of bugs and is quite a bit faster. If it is not
# available, the the WinPTY backend will be used instead.
#
# Setting this option to `true` makes Alacritty use the legacy WinPTY backend,
# even if the ConPTY backend is available.
#winpty_backend: false
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true
#mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
#double_click: { threshold: 300 }
#triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
#hide_when_typing: false
#url:
# URL launcher
#
# This program is executed when clicking on a text which is recognized as a URL.
# The URL is always added to the command as the last parameter.
#
# When set to `None`, URL launching will be disabled completely.
#
# Default:
# - (macOS) open
# - (Linux/BSD) xdg-open
# - (Windows) explorer
#launcher:
# program: xdg-open
# args: []
# URL modifiers
#
# These are the modifiers that need to be held down for opening URLs when clicking
# on them. The available modifiers are documented in the key binding section.
#modifiers: None
# Mouse bindings
#
# Mouse bindings are specified as a list of objects, much like the key
# bindings further below.
#
# To trigger mouse bindings when an application running within Alacritty captures the mouse, the
# `Shift` modifier is automatically added as a requirement.
#
# Each mouse binding will specify a:
#
# - `mouse`:
#
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# - `action` (see key bindings)
#
# And optionally:
#
# - `mods` (see key bindings)
#mouse_bindings:
# - { mouse: Middle, action: PasteSelection }
# Key bindings
#
# Key bindings are specified as a list of objects. For example, this is the
# default paste binding:
#
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Each key binding will specify a:
#
# - `key`: Identifier of the key pressed
#
# - A-Z
# - F1-F24
# - Key0-Key9
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number. This command will allow you to display the hex scancodes
# for certain keys:
#
# `showkey --scancodes`.
#
# Then exactly one of:
#
# - `chars`: Send a byte sequence to the running application
#
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences. To find escape codes for bindings
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
# of tmux. Note that applications use terminfo to map escape sequences back
# to keys. It is therefore required to update the terminfo when changing an
# escape sequence.
#
# - `action`: Execute a predefined action
#
# - Copy
# - Paste
# - PasteSelection
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# - Hide
# - Minimize
# - Quit
# - ToggleFullscreen
# - SpawnNewInstance
# - ClearLogNotice
# - ReceiveChar
# - None
#
# (macOS only):
# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space
#
# - `command`: Fork and execute a specified command plus arguments
#
# The `command` field must be a map containing a `program` string and an
# `args` array of command line parameter strings. For example:
# `{ program: "alacritty", args: ["-e", "vttest"] }`
#
# And optionally:
#
# - `mods`: Key modifiers to filter binding actions
#
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this:
# `mods: Control|Shift`.
# Whitespace and capitalization are relevant and must match the example.
#
# - `mode`: Indicate a binding for only specific terminal reported modes
#
# This is mainly used to send applications the correct escape sequences
# when in different modes.
#
# - AppCursor
# - AppKeypad
# - Alt
#
# A `~` operator can be used before a mode to apply the binding whenever
# the mode is *not* active, e.g. `~Alt`.
#
# Bindings are always filled by default, but will be replaced when a new
# binding with the same triggers is defined. To unset a default binding, it can
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
# a no-op if you do not wish to receive input characters for that binding.
#
# If the same trigger is assigned to multiple actions, all of them are executed
# at once.
#key_bindings:
# (Windows, Linux, and BSD only)
#- { key: V, mods: Control|Shift, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Add, mods: Control, action: IncreaseFontSize }
#- { key: Subtract, mods: Control, action: DecreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
# (Windows only)
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only)
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Add, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: K, mods: Command, action: ClearHistory }
#- { key: K, mods: Command, chars: "\x0c" }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: H, mods: Command, action: Hide }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: Paste, action: Paste }
#- { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, chars: "\x0c" }
#- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt }
#- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt }
#- { key: Home, mods: Shift, action: ScrollToTop, mode: ~Alt }
#- { key: End, mods: Shift, action: ScrollToBottom, mode: ~Alt }
#debug:
# Display the time it takes to redraw each frame.
#render_timer: false
# Keep the log file after quitting Alacritty.
#persistent_logging: false
# Log level
#
# Values for `log_level`:
# - None
# - Error
# - Warn
# - Info
# - Debug
# - Trace
#log_level: Warn
# Print all received window events.
#print_events: false

View file

@ -1,26 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.magic_rb.programs.alacritty;
in {
options.magic_rb.programs.alacritty = {
enable = mkEnableOption "Enable the alacritty terminal emulator";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
alacritty
];
home.file = {
".config/alacritty/alacritty.yaml".source = ./alacritty.yaml;
};
};
}

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
source $HOME/.bashrc

View file

@ -1,141 +0,0 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
[[ -e /etc/profile.d/nix.sh ]] && . /etc/profile.d/nix.sh
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ $DISPLAY ]] && shopt -s checkwinsize
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
## Enable color on grep
alias grep='grep --color=auto'
## Replace ls and cat with exa and bat respectively
alias ls='@exa@/bin/exa'
alias cat='@bat@/bin/bat'
if [ -z "${SHLVL_INIT+x}" ]; then
export SHLVL_INIT=1 SHLVL=1
fi
if [ "$SHLVL" = 1 ]; then
export PS1="\u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
else
export PS1="$SHLVL: \u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
fi
emacsclient() {
if [[ -e "$HOME/.ssh/emacs-server" ]] && \
nc -Uz "$HOME/.ssh/emacs-server" >/dev/null 2>&1 && \
[[ ! -z ${INSIDE_EMACS+x} ]] ; then
params=()
sudo=0
nowait=0
host=$(echo $SSH_CONNECTION | cut -d' ' -f3)
port=$(echo $SSH_CONNECTION | cut -d' ' -f4)
for p in "${@}"; do
if [[ "${p}" == "-s" || "${p}" == "--sudo" ]]; then
sudo=1
elif [[ "${p}" == "-n" || "${p}" == "--no-wait" ]]; then
params+=( "-nowait" )
else
if [[ ${sudo} -eq 1 ]]; then
params+=( "-file /ssh:${USER}@${host}#${port}|sudo::"$(realpath -m "${p}") )
else
params+=( "-file /ssh:${USER}@${host}#${port}:"$(realpath "${p}") )
fi
fi
done
if [[ ${nowait} -eq 0 ]] ; then
printf 'Waiting for Emacs...\n'
fi
echo "${params[@]}" | nc -U "$HOME/.ssh/emacs-server" >/dev/null 2>&1
else
sudo=0
args=()
for p in "${@}"; do
if [[ "${p}" == "-s" || "${p}" == "--sudo" ]]; then
sudo=1
else
args+=( "${p}" )
fi
done
if [[ ${sudo} -eq 1 ]]; then
echo env emacsclient "/sudo::${args[0]}" "${args[@]:1}"
env emacsclient "/sudo::${args[0]}" "${args[@]:1}"
else
env emacsclient "${@}"
fi
fi
}
alias e='emacsclient'
alias E='emacsclient -s'
## Set prompt
export EDITOR="emacsclient"
export BROWSER="firefox-nightly"
## Clear scrollback for vterm
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
function clear(){
vterm_printf "51;Evterm-clear-scrollback";
tput clear;
}
fi
if [[ "$INSIDE_EMACS" = 'vterm' ]] \
&& [[ -n ${EMACS_VTERM_PATH} ]] \
&& [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then
source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh
fi
if [[ "@direnvEnabled@" == "true" ]] ; then
eval "$(direnv hook bash)"
fi
alias zlist="zfs list -r -o name,used,avail,refer,compression,compressratio,recordsize,snapdir,sharenfs,mountpoint"
function loadenv()
{
function passhead()
{
pass $1 | tail -n +2
}
export \
$(passhead Infrastructure/Nomad) \
$(passhead Infrastructure/Vault) \
$(passhead Infrastructure/Consul) \
$(passhead Infrastructure/Influx)
}
function yaml2nix()
{
input_file="$1"
output_file="$2"
if [ "${input_file}" = "${output_file}" ] ; then
remarshal -if yaml -of json -i "${input_file}" -o /dev/stdout | nix eval --impure --expr 'builtins.fromJSON (builtins.readFile "/dev/stdin")' > "${input_file}.tmp"
mv "${input_file}.tmp" "${output_file}"
else
remarshal -if yaml -of json -i "${input_file}" -o /dev/stdout | nix eval --impure --expr 'builtins.fromJSON (builtins.readFile "/dev/stdin")' > "${output_file}"
fi
nixfmt "${output_file}"
}

View file

@ -1,53 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.magic_rb.programs.bash;
in {
options.magic_rb.programs.bash = {
enable = mkEnableOption "Enable bash, the shell";
emacsclient-remote = mkOption {
description = "Enable emacsclient-remote and associated aliases";
type = types.bool;
default = true;
};
enableDirenv = mkEnableOption "Enable direnv";
};
config = mkIf cfg.enable {
home.packages = mkMerge [
(mkIf cfg.emacsclient-remote [
pkgs.magic_rb.emacsclient-remote
])
(mkIf cfg.enableDirenv [
pkgs.direnv
])
];
programs.direnv.enable = mkIf cfg.enableDirenv true;
programs.direnv.nix-direnv.enable = mkIf cfg.enableDirenv true;
home.file = {
".bash_profile".source = ./bash_profile;
".bashrc".source = pkgs.writeSubstitutedFile {
name = ".bashrc";
file = ./bashrc;
substitutes = {
"exa" = "${pkgs.exa}";
"bat" = "${pkgs.bat}";
"direnvEnabled" =
if cfg.enableDirenv
then "true"
else "false";
};
};
};
};
}

View file

@ -1,64 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.packageCollections.cmdline;
ffmpegSpecial =
pkgs.ffmpeg_5-full.override
{
svt-av1 =
pkgs.svt-av1.overrideAttrs
(old: rec
{
version = "1.1.0";
src = pkgs.fetchFromGitHub {
owner = "AOMediaCodec";
repo = "SVT-AV1";
rev = "v${version}";
sha256 = "sha256-A8PVrPQcsCx+cY0DKuvQ5g//1Iqk9+1Uvz6cN+Jc2E8=";
};
});
# ffmpeg = pkgs.ffmpeg_5.overrideAttrs
# (old: rec
# { version = "5.1.0";
# src = pkgs.fetchFromGitHub {
# owner = "FFmpeg";
# repo = "FFmpeg";
# rev = "9222965fdd9594ff9e921d4ad25beac4eefa2373";
# sha256 = "sha256-MVCRynpG03pTDfSw7vhCxjDErSh84a7V5iM+zqr7P94=";
# };
# });
};
in {
options.magic_rb.packageCollections.cmdline = {
enable =
mkEnableOption
''
A package collection containing command line programs, specifically zip, unzip, unrar (unfree), git, and htop.
'';
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
obs-studio
zip
unzip
unrar
git
htop
# ffmpegSpecial
lm_sensors
cryptsetup
emacs-rofi
];
};
}

View file

@ -1,22 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{roots, ...}: {
imports = [
./alacritty
./bash
./ssh
./emacs
./xmonad
./3d-printing.nix
./cmdline-utils.nix
./gpg.nix
./graphical-programs.nix
./multimc.nix
./optimisation.nix
./pantalaimon.nix
./webdev.nix
./wine.nix
(roots.flake + "/nixos/secret-lib")
];
}

View file

@ -1,136 +0,0 @@
; SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
;
; SPDX-License-Identifier: LGPL-3.0-or-later
;;; package --- Summary
;;; Commentary:
;;; Code:
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auth-source-save-behavior nil)
'(custom-enabled-themes '())
'(custom-safe-themes
'("2f1518e906a8b60fac943d02ad415f1d8b3933a5a7f75e307e6e9a26ef5bf570" default))
'(package-selected-packages
'()))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(setq backup-directory-alist `(("." . "~/.emacs.d/saves")))
(setq vc-follow-symlinks t)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(add-to-list 'load-path "~/.emacs.d/lisp/org-task-dump")
(straight-use-package 'use-package)
(straight-thaw-versions)
;; load general early for now
(use-package general
:straight t)
(use-package org
:straight t)
(defun magic_rb/org-transclusion-babel-load (&optional narrowed)
"Call `org-babel-load-file` on all transcludes in the current file."
(interactive "P")
(save-restriction
(let ((marker (move-marker (make-marker) (point)))
(load-link (lambda ()
(let* ((keyword-plist (org-transclusion-keyword-string-to-plist))
(link (org-transclusion-wrap-path-to-link
(plist-get keyword-plist :link)))
(link-raw (org-element-property :raw-link link))
(link-type (org-element-property :type link)))
(when (string-equal link-type "id")
(message "RB Loading: %s" (org-id-find-id-file link-raw))
(org-babel-load-file (org-id-find-id-file link-raw)))))))
(unless narrowed (widen))
(goto-char (point-min))
;; Handle inactive transclusions
(let ((regexp "^[ \t]*#\\+TRANSCLUDE:"))
(while (re-search-forward regexp nil t)
;; Don't transclude if within a transclusion to avoid infinite
;; recursion
(unless (or (org-transclusion-within-transclusion-p)
(plist-get (org-transclusion-keyword-string-to-plist)
:disable-auto))
(funcall load-link))))
;; Handle active transclusions
(while (setq match (text-property-search-forward 'org-transclusion-type))
(goto-char (prop-match-beginning match))
(org-transclusion-remove)
(funcall load-link)
(org-transclusion-add))
(goto-char marker)
(move-marker marker nil) ; point nowhere for GC
t)))
(require 'cl-lib)
(use-package org-roam
:straight t
:demand t
:init
(setq org-roam-v2-ack t
org-roam-directory "~/roam"))
(defvar magic_rb/org-init-files
(cl-concatenate
'list
(directory-files "~/.emacs.d/org" t "\\.org$")
(seq-map #'car
(org-roam-db-query
[:select [nodes:file]
:from tags
:left-join nodes
:on (= tags:node-id nodes:id)
:where (like tag (quote "%\"emacs-load\""))])))
"List of org files, which should be tangled and loaded.")
(defvar magic_rb/org-el-init-files
(cl-map 'list
(lambda (file) (concat (file-name-sans-extension file) ".el"))
magic_rb/org-init-files)
"List of generated elisp files from magic_rb/org-init-files.")
(defun magic_rb/delete-file-maybe (file)
"If FILE exists, delete it."
(when (file-exists-p file)
(delete-file file)))
(mapc #'magic_rb/delete-file-maybe magic_rb/org-el-init-files)
(mapc #'org-babel-load-file magic_rb/org-init-files)
(provide '.emacs)
;;; .emacs ends here

View file

@ -1,305 +0,0 @@
;;; man-preview.el --- preview nroff man file source
; Copyright 2008, 2009, 2010, 2011, 2013, 2015 Kevin Ryde
; SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
;
; SPDX-License-Identifier: LGPL-3.0-or-later
;; man-preview.el is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the
;; Free Software Foundation; either version 3, or (at your option) any later
;; version.
;;
;; man-preview.el 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 can get a copy of the GNU General Public License online at
;; <http://www.gnu.org/licenses/>.
;;; Commentary:
;; M-x man-preview displays a formatted preview of man nroff source using
;; "man -l". The best feature is that when re-previewing the same file or
;; buffer the existing position in the preview is preserved, so if you've
;; changed the source only a little you should still be quite close to where
;; you were in the preview, to see how the change has come out.
;;
;; M-x man with "-l filename" does almost the same as this, but depends on
;; having a disk copy of a buffer, so can't work out of tar-mode members
;; etc.
;;; Emacsen:
;;
;; Designed for Emacs 21 and up. Works in XEmacs 21.
;;; Install:
;;
;; Put man-preview.el in one of your `load-path' directories, and to make
;; M-x man-preview available add to your .emacs
;;
;; (autoload 'man-preview "man-preview" nil t)
;;
;; You can also bind it to a key, for example f8 in nroff-mode,
;;
;; (eval-after-load "nroff-mode"
;; '(define-key nroff-mode-map [f8] 'man-preview))
;;
;; There's an autoload cookie for `man-preview' if you install via
;; `M-x package-install' or know `update-file-autoloads'. Then bind it to a
;; key as desired.
;;; History:
;;
;; Version 1 - the first version
;; Version 2 - break out the save-display and errorfile bits for clarity
;; Version 3 - xemacs21 switch-to-buffer-other-window only takes one arg
;; Version 4 - tighter compilation-find-file hack
;; Version 5 - use pipe rather than pty for subprocess
;; Version 6 - delete errors window when no errors
;; Version 7 - undo defadvice on unload-feature
;; Version 8 - express dependency on 'advice
;; Version 9 - compilation-find-file args by number, so not depend on names
;; Version 10 - macros not needed after byte compiling
;;; Code:
(require 'man)
;; Explicit dependency on advice.el since `man-preview-unload-function'
;; needs `ad-find-advice' macro when running not byte compiled, and that
;; macro is not autoloaded.
(require 'advice)
;; xemacs compatibility
(eval-and-compile
(defalias 'man-preview--make-temp-file
(if (eval-when-compile (fboundp 'make-temp-file))
'make-temp-file ;; emacs
;; xemacs21
(autoload 'mm-make-temp-file "mm-util") ;; from gnus
'mm-make-temp-file)))
(defconst man-preview-buffer "*man-preview*"
"The name of the buffer for `man-preview' output.")
(defconst man-preview-error-buffer "*man-preview-errors*"
"The name of the buffer for `man-preview' error messages.")
(defvar man-preview-origin nil
"The name of the input buffer being displayed in `man-preview-buffer'.")
(eval-when-compile
(defmacro man-preview--with-saved-display-position (&rest body)
"An internal part of man-preview.el.
This macro does not exist when running byte compiled.
Save `window-start' and point positions as line/column.
The use of line/column means BODY can erase and rewrite the
buffer contents."
;; (declare (debug t)) ;; emacs22,xemacs21, or 'cl
`(let ((point-column (current-column))
(point-line (count-lines (point-min) (line-beginning-position)))
(window-line (count-lines (point-min) (window-start))))
,@body
(goto-char (point-min)) (forward-line window-line)
;; Don't let window-start be the very end of the buffer, since that
;; would leave it completely blank.
(if (= (point) (point-max))
(forward-line -1))
(set-window-start (selected-window) (point))
(goto-char (point-min)) (forward-line point-line)
(move-to-column point-column))))
(eval-when-compile
(defmacro man-preview--with-errorfile (&rest body)
"An internal part of man-preview.el.
This macro does not exist when running byte compiled.
Create an `errorfile' for use by the BODY forms.
An `unwind-protect' ensures the file is removed no matter what
BODY does."
;; (declare (debug t)) ;; emacs22,xemacs21, or 'cl
`(let ((errorfile (man-preview--make-temp-file "man-preview-")))
(unwind-protect
(progn ,@body)
(delete-file errorfile)))))
;;;###autoload
(defun man-preview ()
"Preview man page nroff source in the current buffer.
The buffer is put through \"man -l\" and the formatted result
displayed in a buffer.
Errors from man or nroff are shown in a `compilation-mode' buffer
and `next-error' (\\[next-error]) can step through them to see
the offending parts of the source.
------
For reference, the non-ascii situation is roughly as follows.
Traditionally roff input is supposed to be ascii with various
escape directives for further characters and inked accenting to
be rendered on the phototypesetter. Groff (version 1.18) takes
8-bit input, as latin-1 by default but in principle configurable.
It doesn't, however, have a utf8 input mode, so that should be
avoided (though it can operate on unicode chars internally if
given by escape directives).
man-db 2.5 (October 2007) and up can convert input codings to
latin1 for groff, from a charset given either with an Emacs style
\"coding:\" cookie in the file, or a subdir name like
/usr/share/man/fr.UTF-8/man1, or guessing the content bytes. The
coding cookie is probably best for `man-preview' (since it only
sends to man's stdin, there's no subdir name for man to follow).
On the output side groff can be asked to produce either latin1 or
utf8 (though how well it matches up inked overprinting to output
chars is another matter).
In any case `man-preview' sends per `buffer-file-coding-system',
the same as if man was run directly on the file. Output from man
is requested as -Tlatin1 if the input coding is latin-1, or
-Tutf8 for anything else (and if the running Emacs has utf-8).
------
The man-preview home page is
URL `http://user42.tuxfamily.org/man-preview/index.html'"
(interactive)
;; Zap existing `man-preview-error-buffer'.
;; Turn off any compilation-mode there so that mode won't attempt to parse
;; the contents (until later when they've been variously munged).
(with-current-buffer (get-buffer-create man-preview-error-buffer)
(fundamental-mode)
(setq buffer-read-only nil)
(erase-buffer))
(let ((origin-buffer (current-buffer))
(T-option "-Tlatin1")
(T-coding 'iso-8859-1)
(directory default-directory))
;; Running man with either "-Tlatin1" or "-Tutf8" makes it print
;; overstrikes and underscores for bold and italics, which
;; `Man-fontify-manpage' (below) crunches into fontification.
;;
;; It might be that those -T options make man-db 2.5 lose its input
;; charset detection ("manconv"), though it seems ok with 2.5.2.
;;
(when (and (not (eq buffer-file-coding-system 'iso-8859-1))
(memq 'utf-8 (coding-system-list)))
(setq T-option "-Tutf8")
(setq T-coding 'utf-8))
(switch-to-buffer man-preview-buffer)
(setq buffer-read-only nil)
;; default-directory set from the source buffer, so that find-file or
;; whatever offers the same default as the source buffer. This is
;; inherited on initial creation of the preview buffer, but has to be
;; set explicitly when previewing a new source buffer with a different
;; default-directory.
(setq default-directory directory)
;; if previewing a different buffer then erase here so as not to restore
;; point+window position into a completely different document
(if (not (equal man-preview-origin (buffer-name origin-buffer)))
(erase-buffer))
(setq man-preview-origin (buffer-name origin-buffer))
(man-preview--with-errorfile ;; compilation output
(man-preview--with-saved-display-position
(erase-buffer)
(with-current-buffer origin-buffer
(let ((coding-system-for-write buffer-file-coding-system)
(coding-system-for-read T-coding)
(process-connection-type nil)) ;; pipe
(call-process-region (point-min) (point-max) "man"
nil ;; don't delete input
(list man-preview-buffer errorfile)
nil ;; don't redisplay
T-option "-l" "-")))
;; show errors in a window, but only if there are any
(save-selected-window
(with-current-buffer man-preview-error-buffer
(insert-file-contents errorfile)
;; emacs21 compilation regexps don't like "<standard input>" as a
;; filename, so mung that (which is easier than adding to the
;; patterns)
(goto-char (point-min))
(while (re-search-forward "^<standard input>:" nil t)
(replace-match "standardinput:" t t))
(if (= (point-min) (point-max))
(progn
;; No errors, kill buffer and window. Killing the window
;; prevents something unrelated showing in a small window
;; which can be annoying for buffer cycling etc.
(delete-windows-on (current-buffer))
(kill-buffer nil))
;; emacs21 ignores the first two lines of a compilation-mode
;; buffer, so add in dummies
(goto-char (point-min))
(insert "man-preview\n\n")
;; switch to display error buffer
(let ((existing-window (get-buffer-window (current-buffer))))
(condition-case nil
;; emacs two args
(switch-to-buffer-other-window (current-buffer)
t) ;; no-record
(error
;; xemacs one arg
(switch-to-buffer-other-window (current-buffer))))
;; if newly displaying an error window then shrink to what's
;; needed, don't want a half screen if there's only a couple
;; of lines
(if (not existing-window)
(shrink-window-if-larger-than-buffer
(get-buffer-window (current-buffer)))))
(compilation-mode))))
(if (eval-when-compile (fboundp 'Man-mode))
;; emacs21 and emacs22
(progn
(Man-fontify-manpage)
(Man-mode))
;; xemacs21
(Manual-nuke-nroff-bs)
(Manual-mode))))))
(defadvice compilation-find-file (around man-preview activate)
"Use `man-preview-origin' buffer for its man/nroff errors."
;; args: (compilation-find-file MARKER FILENAME DIRECTORY &rest FORMATS)
(if (let ((marker (ad-get-arg 0))
(filename (ad-get-arg 1)))
(and (equal filename
"standardinput")
(equal (buffer-name (marker-buffer marker))
man-preview-error-buffer)))
(setq ad-return-value man-preview-origin)
ad-do-it))
(defun man-preview-unload-function ()
"Remove defadvice from `compilation-find-file'.
This is called by `unload-feature'."
(when (ad-find-advice 'compilation-find-file 'around 'man-preview)
(ad-remove-advice 'compilation-find-file 'around 'man-preview)
(ad-activate 'compilation-find-file))
nil) ;; and do normal unload-feature actions too
;; LocalWords: roff groff Groff nroff latin Tlatin Tutf db subdir usr fr stdin filename ascii utf unicode codings charset
(provide 'man-preview)
;;; man-preview.el ends here

View file

@ -1,125 +0,0 @@
;;; org-alert.el --- Notify org deadlines via notify-send
; Copyright (C) 2015 Stephen Pegoraro
; SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
;
; SPDX-License-Identifier: LGPL-3.0-or-later
;; Author: Stephen Pegoraro <spegoraro@tutive.com>
;; Version: 0.1.0
;; Package-Requires: ((s "1.10.0") (dash "2.11.0") (alert "1.2"))
;; Keywords: org, org-mode, notify, notifications, calendar
;; URL: https://github.com/groksteve/org-alert
;; 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:
;; This package provides functions to display system notifications for
;; any org-mode deadlines that are due in your agenda. To perform a
;; one-shot check call (org-alert-deadlines). To enable repeated
;; checking call (org-alert-enable) and to disable call
;; (org-alert-disable). You can set the checking interval by changing
;; the org-alert-interval variable to the number of seconds you'd
;; like.
;;; Code:
(require 's)
(require 'dash)
(require 'org-agenda)
(defvar org-alert-interval 300
"Interval in seconds to recheck and display deadlines.")
(defvar org-alert-notification-title "*org*"
"Title to be sent with notify-send.")
(defvar org-alert-headline-regexp "\\(Sched.+:.+\\|Deadline:.+\\)"
"Regexp for headlines to search in agenda buffer.")
(defun org-alert--strip-prefix (headline)
"Remove the scheduled/deadline prefix from HEADLINE."
(replace-regexp-in-string ".*:\s+" "" headline))
(defun org-alert--unique-headlines (regexp agenda)
"Return unique headlines from the results of REGEXP in AGENDA."
(let ((matches (-distinct (-flatten (s-match-strings-all regexp agenda)))))
(--map (org-alert--strip-prefix it) matches)))
(defun org-alert--get-headlines ()
"Return the current org agenda as text only."
(with-temp-buffer
(let ((org-agenda-sticky nil)
(org-agenda-buffer-tmp-name (buffer-name)))
(ignore-errors (org-agenda-list 1))
(org-alert--unique-headlines org-alert-headline-regexp
(buffer-substring-no-properties (point-min) (point-max))))))
(defun org-alert--headline-complete? (headline)
"Return whether HEADLINE has been completed."
(--any? (s-starts-with? it headline) org-done-keywords-for-agenda))
(defun org-alert--filter-active (deadlines)
"Remove any completed headings from the provided DEADLINES."
(-remove 'org-alert--headline-complete? deadlines))
(defun org-alert--strip-states (deadlines)
"Remove the todo states from DEADLINES."
(--map (s-trim (s-chop-prefixes org-todo-keywords-for-agenda it)) deadlines))
(defun org-alert-check ()
"Check for active, due deadlines and initiate notifications."
(interactive)
;; avoid interrupting current command.
(unless (minibufferp)
(save-window-excursion
(save-excursion
(save-restriction
(let ((active (org-alert--filter-active (org-alert--get-headlines))))
(dolist (dl (org-alert--strip-states active))
(notifications-notify :title dl))))))
(when (get-buffer org-agenda-buffer-name)
(ignore-errors
(with-current-buffer org-agenda-buffer-name
(org-agenda-redo t))))))
(defun org-alert-enable ()
"Enable the notification timer. Cancels existing timer if running."
(interactive)
(org-alert-disable)
(run-at-time 0 org-alert-interval 'org-alert-check))
(defun org-alert-disable ()
"Cancel the running notification timer."
(interactive)
(dolist (timer timer-list)
(if (eq (elt timer 5) 'org-alert-check)
(cancel-timer timer))))
(provide 'org-alert)
;;; org-alert.el ends here

View file

@ -1,341 +0,0 @@
As per https://www.c0t0d0s0.de/otdl/otdl.html.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey 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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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.

View file

@ -1,26 +0,0 @@
;;
;; $Id: org-task-dump-logs-as-csv.el,v 196a830a575e 2016/04/16 15:26:31 pkgs $
;;
(load "org-task-dump-logs.el")
(defun hmw/csv-formatter(log-entry)
"Format a 3-tuple into comma separated values."
(insert (format "%s,%s,%s\n" (car log-entry)
(cadr log-entry)
(mapconcat 'identity (cddr log-entry) " "))))
(defun hmw/org-task-dump-logs-as-csv(csv-file-name &optional with-header)
"Generate a CSV file of the state changes of a given task. The
data is saved in CSV-FILE-NAME. An optional CSV file header can
be generated by calling this function with the prefix argument or
by setting the optional WITH-HEADER parameter."
(interactive "FSave as CSV file: \nP")
(let ((log-entries (hmw/org-task-retrieve-logs)))
(with-temp-buffer
(if with-header (insert "FromState,ToState,Timestamp\n"))
(mapc (lambda(e)(hmw/csv-formatter e)) (cdr log-entries))
(write-file csv-file-name))))
(provide 'org-task-dump-logs-as-csv)

View file

@ -1,52 +0,0 @@
;;
;; $Id: org-task-dump-logs.el,v 1a9aa8013f28 2016/04/18 10:20:04 pkgs $
;;
(defun hmw/org-task-retrieve-logs(&optional date-formatter pom)
"Retrieve all state change notes for a given task and return
them as a list of 3-tuples. Each tuple consists of the old state,
the new state and the timestamp of the state change. The
timestamp is formatted by the optional function DATE-FORMATTER.
The very first element of the returned list is not a 3-tuple, but a
string holding the heading of the processed task.
Optionally the point can be set to POM programmatically."
(save-excursion
(unless date-formatter (setq date-formatter 'identity))
(if pom (goto-char pom))
(org-back-to-heading t)
(let* ((end (org-entry-end-position))
(reversed org-log-states-order-reversed)
(search (if reversed 're-search-forward 're-search-backward))
(limit (if reversed end (point)))
(re (format
"^[ \t]*-[ \t]+\\(?:State \"%s\"\s+from\s+\"%s\".*%s%s\\)"
org-todo-regexp
org-todo-regexp
org-ts-regexp-inactive
(let ((value (cdr (assq 'done org-log-note-headings))))
(if (not value) ""
(concat "\\|"
(org-replace-escapes
(regexp-quote value)
`(("%d" . ,org-ts-regexp-inactive)
("%D" . ,org-ts-regexp)
("%s" . "\"\\S-+\"")
("%S" . "\"\\S-+\"")
("%t" . ,org-ts-regexp-inactive)
("%T" . ,org-ts-regexp)
("%u" . ".*?")
("%U" . ".*?"))))))))
log-entries)
(unless reversed (goto-char end))
(while (funcall search re limit t)
(push (list (org-match-string-no-properties 2)
(org-match-string-no-properties 1)
(funcall date-formatter (org-match-string-no-properties 3)))
log-entries))
(push (org-no-properties (org-get-heading)) log-entries)
log-entries)))
(provide 'org-task-dump-logs)

View file

@ -1,103 +0,0 @@
;;
;; $Id: org-task-generate-calendar-view.el,v 08890e87177e 2016/04/18 10:24:19 pkgs $
;;
(load "org-task-dump-logs.el")
(load "org-task-svg.el")
(defun hmw/generate-calendar-view(file-name year heading statechanges)
"Generate a calendar view for the given YEAR and colours the dates
according to the given STATECHANGES. The view is annotated with a
HEADING and a legend. It is saved in FILE-NAME in SVG format.
If the list contains several state changes for a given date, CANCELLED has precedence over DONE over OPEN."
(with-temp-buffer
(hmw/svg-header 650 170)
(hmw/svg-text 10 20 (format "Statistics for %s for %s" heading year))
;; Month names
(let ((xpos 40)
(ypos 40))
(dotimes (i 12)
(hmw/svg-text xpos ypos (elt calendar-month-abbrev-array i))
(setq xpos (+ 40 (* (ceiling (/ (calendar-day-number (list (+ 2 i) 1 year)) 7.0)) 11)))))
;; Day names
(let ((xpos 10)
(ypos 60))
(dotimes (i 7)
(hmw/svg-text xpos ypos (elt calendar-day-abbrev-array
(% (+ i calendar-week-start-day) 7)))
(setq ypos (+ ypos 11))))
;; Boxes
(let ((xpos 40)
(ypos 50)
(colour)
(el)
(free (% (+ (calendar-day-of-week (list 1 1 year)) 6) 7)))
(setq ypos (+ ypos (* free 11)))
(dotimes (i (calendar-day-number (list 12 31 year)))
(setq els (cl-remove-if-not (lambda (e) (equal (elt e 2) (1+ i))) statechanges))
(setq el
(car
(or
(cl-remove-if-not (lambda (e) (equal (elt e 1) "CANCELLED")) els)
(cl-remove-if-not (lambda (e) (equal (elt e 1) "DONE")) els)
(cl-remove-if-not (lambda (e) (equal (elt e 1) "OPEN")) els))))
(cond
((equal el nil)
(hmw/svg-rect xpos ypos 10 10 "#646464"))
((equal (elt el 1) "OPEN")
(hmw/svg-rect xpos ypos 10 10 "#0000ff"))
((equal (elt el 1) "DONE")
(hmw/svg-rect xpos ypos 10 10 "#00ff00"))
((equal (elt el 1) "CANCELLED")
(hmw/svg-rect xpos ypos 10 10 "#ff0000")))
;; Jump to the next column
(if (= (% (+ free 1 i) 7) 0)
(progn
(setq ypos 50)
(setq xpos (+ xpos 11)))
(setq ypos (+ ypos 11)))))
;; Legend
(hmw/svg-text 10 150 "OPEN")
(hmw/svg-rect 45 141 10 10 "#0000ff")
(hmw/svg-text 70 150 "DONE")
(hmw/svg-rect 105 141 10 10 "#00ff00")
(hmw/svg-text 130 150 "CANCELLED")
(hmw/svg-rect 195 141 10 10 "#ff0000")
(hmw/svg-footer)
(write-file file-name)))
(defun hmw/date-formatter(d year)
"Converts a date D in ORG date format into the day number. As a side
effect all dates that are not in YEAR are filtered."
(let ((date (org-date-to-gregorian d)))
(if (equal (elt date 2) year)
(calendar-day-number date)
nil)))
(defun hmw/org-task-generate-calendar-view(svg-file-name year)
"Generate a calendar view of the state changes of a given task. The
calendar view is generated for YEAR and saved in SVG-FILE-NAME in
SVG format."
(interactive "FSave as SVG file: \nnGenerate view for year (YYYY): ")
(let ((log-entries (hmw/org-task-retrieve-logs
(lambda (d) (hmw/date-formatter d year)))))
(hmw/generate-calendar-view svg-file-name year
(car log-entries) (cdr log-entries))))
(provide 'org-task-generate-calendar-view)

View file

@ -1,42 +0,0 @@
;;
;; $Id: svg.el,v f0c325fe1142 2016/04/16 12:48:31 pkgs $
;;
(defun hmw/svg-header (width height)
(insert (format "<?xml version=\"1.0\"?>
<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"%s\" height=\"%s\" >
<g style=\"fill-opacity:1.0; stroke:black; stroke-width:1;\">" width height)))
(defun hmw/svg-footer ()
(insert "\n </g>\n</svg>"))
(defun hmw/svg-text(x y str)
(insert (format "
<text x=\"%s\" y=\"%s\"
font-size=\"10.000000\"
fill=\"#000000\"
font-family=\"Helvetica\"
font-weight=\"normal\"
text-anchor=\"start\"
stroke=\"none\">
%s
</text>" x y str)))
(defun hmw/svg-line(x1 y1 x2 y2)
(insert (format "
<line x1=\"%s\" y1=\"%s\"
x2=\"%s\" y2=\"%s\"
style=\"stroke:#000000;stroke-width:1.000000\"/>" x1 y1 x2 y2)))
(defun hmw/svg-rect(x y width height col)
(insert (format "
<rect x=\"%s\" y=\"%s\"
height=\"%s\" width=\"%s\"
style=\"fill:%s;stroke:none\"/>" x y height width col)))
(provide 'org-task-svg)

View file

@ -1,107 +0,0 @@
; SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
;
; SPDX-License-Identifier: LGPL-3.0-or-later
;; -*- lexical-binding: t -*-
;;; ytplay.el --- search for and play a YT video
;;; Commentary:
(require 'cl-lib)
(defvar ytplay-youtube-dl-commmad "/nix/store/g0656rl1hplb6w35xs6nc79r6rdm8gzp-python3.8-youtube-dl-2020.12.22/bin/youtube-dl")
(defvar ytplay-process nil)
(defvar ytplay-buffer (get-buffer-create " yt-play process buffer"))
(defvar ytplay-callback nil)
(defvar ytplay-fail-callback nil)
(defvar ytplay-command-queue (list))
(defun ytplay--run-yt-dl (args callback fail-callback)
(if (or ytplay-callback ytplay-process ytplay-fail-callback)
(push (list args callback fail-callback) ytplay-command-queue)
(setq ytplay-callback callback)
(setq ytplay-fail-callback fail-callback)
(with-current-buffer ytplay-buffer (erase-buffer))
(let ((command (append (list ytplay-youtube-dl-commmad) args)))
(setq ytplay-process
(make-process
:name "youtube-dl"
:command command
:buffer ytplay-buffer
:sentinel 'ytplay--sentinel)))))
(defun ytplay--sentinel (process event)
(let ((result (string-trim (with-current-buffer ytplay-buffer (buffer-string))))
(callback ytplay-callback)
(fail-callback ytplay-fail-callback)
(event (string-trim event)))
(with-current-buffer ytplay-buffer (erase-buffer))
(setq ytplay-process nil)
(setq ytplay-callback nil)
(setq ytplay-fail-callback nil)
(if (string-equal event "finished")
(funcall callback result)
(funcall fail-callback)))
(when-let ((command (pop ytplay-command-queue)))
(ytplay--run-yt-dl (nth 0 command) (nth 1 command) (nth 2 command))))
(defun ytplay--run-yt-dl-seq (args-list callback)
(let ((acc (list))
(target-count (length args-list))
(completed 0))
(cl-loop for args in args-list
do (ytplay--run-yt-dl
args
(lambda (results)
(setq completed (+ completed 1))
(push results acc)
(when (eq target-count completed) (funcall callback acc)))
(lambda ()
(setq completed (+ completed 1))
(when (eq target-count completed) (funcall callback acc)))))))
(defun ytplay--reset ()
(interactive)
(setq ytplay-process nil)
(setq ytplay-buffer (get-buffer-create " yt-play process buffer"))
(setq ytplay-callback nil)
(setq ytplay-fail-callback nil)
(setq ytplay-command-queue (list)))
;; (defun ytplay--ivy-builder (acc rest)
;; (if-let ((vid-id (pop rest)))
;; (ytplay--run-yt-dl
;; (list "--get-title" "--" vid-id)
;; (lambda (results vid-id acc rest)
;; (push `(,(string-trim results) . ,vid-id) acc)
;; (ytplay--ivy-builder acc rest)))
;; (let ((vid-id (completing-read "Select a result: " acc)))
;; )))
;; (results (split-string results))
(defun ytplay--ivy-callback (vid-ids)
(let* ((vid-ids (split-string vid-ids))
(sequence (cl-loop for vid-id in vid-ids
collect (list "--get-title" "--" vid-id))))
(ytplay--run-yt-dl-seq
sequence
(lambda (titles)
(let* ((videos (cl-pairlis titles vid-ids))
(vid-id (completing-read "Select a result: " videos)))
(make-process
:name "xdg-open"
:command (list
"xdg-open"
(format
"https://www.youtube.com/watch?v=%s"
(cdr (assoc vid-id videos))))))))))
(defun ytplay-search (search-term)
(interactive "MSearch term: ")
(ytplay--run-yt-dl
(list (format "ytsearch10:%s" search-term) "--get-id")
'ytplay--ivy-callback
(lambda () (message "ytplay.el failure!"))))

View file

@ -1,414 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+STARTUP: content
#+TITLE: Magic_RB's Emacs configuration
* Stuff That Needs Work
** TODO Spell checking
** TODO Calc mode
** TODO Org Agenda
*** Make it work on my phone
** TODO Org Roam
** TODO org-evil moving stuff, left, right with M-j M-; instead of M-h M-l
** Org Web Tools
https://github.com/alphapapa/org-web-tools
* Stuff
#+NAME: base
#+BEGIN_SRC emacs-lisp
(use-package pdf-tools
:straight t
:hook (('TeX-mode-hook . visual-line-mode))
:config
;; initialise
(pdf-tools-install)
(setq TeX-PDF-mode 1)
;; open pdfs scaled to fit page
(setq-default pdf-view-display-size 'fit-page)
;; automatically annotate highlights
(setq pdf-annot-activate-created-annotations t))
#+END_SRC
Enable =all-the-icons=, it's used by =treemacs= and =doom-modeline=.
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:straight t)
#+END_SRC
Set ispell program to hunspell, this is very much a TODO, since the spelling configuration is rather minimal at this
point in time.
#+BEGIN_SRC emacs-lisp
(setq ispell-program-name "hunspell")
#+END_SRC
Fetch the ~SSH_AUTH_PATH~ from ~.profile~.
#+BEGIN_SRC emacs-lisp
(setenv "SSH_AUTH_SOCK" (shell-command-to-string ". ~/.profile && printf $SSH_AUTH_SOCK"))
#+END_SRC
* Language
** Nix Expression Language
Enable ~nix-mode~.
#+begin_src emacs-lisp
(use-package lsp-nix
:no-require t
:after (lsp-mode)
:custom
(lsp-nix-nil-formatter ["nixpkgs-fmt"]))
(use-package nix-mode
:hook (nix-mode . lsp-deferred)
:ensure t)
#+end_src
** HashiCorp
*** HashiCorp Configuration Language
#+BEGIN_SRC emacs-lisp
(use-package hcl-mode
:straight t)
#+END_SRC
*** Terraform Configuration Language
#+BEGIN_SRC emacs-lisp
(use-package terraform-mode
:straight t)
#+END_SRC
** YAML Configuration Language
Enable ~yaml-mode~.
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
:straight t
:mode ("\\.yml\\'" . yaml-mode)
:mode ("\\.yaml\\'" . yaml-mode))
#+END_SRC
** Dockerfile Configuration Language
Enable ~dockerfile-mode~
#+BEGIN_SRC emacs-lisp
(use-package dockerfile-mode
:straight t
:mode ("Dockerfile\\'" . dockerfile-mode))
#+END_SRC
** SCAD Programming Language
Enable ~scad-mode~
#+BEGIN_SRC emacs-lisp
(use-package scad-mode
:straight t)
#+END_SRC
** Rust Programming Language
Enable ~rustic~ and more feature-full alternative to ~rust-mode~, actually a rather distant fork of it.
Also hook ~lsp-mode~ on it.
#+NAME: rust
#+BEGIN_SRC emacs-lisp
(use-package rustic
:straight t
:hook (rustic-mode . lsp-mode)
:mode ("\\.rs\\'" . rustic-mode))
#+END_SRC
* LSP
** envrc
Enable ~envrc~, which changes ENVs on a per buffer basis.
#+BEGIN_SRC emacs-lisp
(use-package envrc
:straight t
:init
(envrc-global-mode))
#+END_SRC
** lsp-mode
Increase GC threshold to avoid random freezes on garbage collection.
#+NAME: gc-cons-threshold
#+BEGIN_SRC emacs-lisp :tangle no
(setq gc-cons-threshold 100000000)
#+END_SRC
Increase the amount of data Emacs reads from a process in one go, default is 4KB, but some LSP servers produce responses up to 3MB.
#+NAME: read-process-output-max
#+BEGIN_SRC emacs-lisp :tangle no
(setq read-process-output-max (* (* 1024 1024) 3))
#+END_SRC
Switch completion provider to =capf=, even though it should be the default, but just to make sure it. =company-lsp=
is what =lsp-mode= switched away from.
#+NAME: lsp-completion-provider
#+BEGIN_SRC emacs-lisp :tangle no
(setq lsp-completion-provider :capf)
#+END_SRC
Set the minimum delay between LSP refreshes, should help with performance when typing really fast.
#+NAME: lsp-idle-delay
#+BEGIN_SRC emacs-lisp :tangle no
(setq lsp-idle-delay 0.500) ;; adjust me
#+END_SRC
Setup rustic to prefer ~rust-analyzer~ instead of ~rls~ and also don't format on save, it's really annoying.
#+NAME: lsp-rustic
#+BEGIN_SRC emacs-lisp :tangle no
(setq rustic-lsp-server 'rust-analyzer)
(setq rustic-compile-command "cargo build")
(setq rustic-format-trigger nil);'on-save
#+END_SRC
Enable inline type hints and disable chaining and parameter hints for Rust.
#+NAME: lsp-rust-analyzer
#+BEGIN_SRC emacs-lisp :tangle no
(setq lsp-rust-analyzer-display-chaining-hints nil)
(setq lsp-rust-analyzer-display-parameter-hints nil)
(setq lsp-rust-analyzer-server-display-inlay-hints t)
#+END_SRC
Finally enable ~lsp-mode~.
#+BEGIN_SRC emacs-lisp :noweb yes
(use-package lsp-mode
:straight t
:after (envrc)
:config
(setq lsp-prefer-flymake nil)
(setq lsp-ui-doc-enable nil)
:config
<<lsp-rustic>>
;; <<lsp-rust-analyzer>>
<<gc-cons-threshold>>
<<read-process-output-max>>
<<lsp-completion-provider>>
;; <<lsp-idle-delay>>
<<lsp-typescript-tramp>>
<<lsp-scala-tramp>>)
#+END_SRC
** lsp-pyright
Enable ~lsp-pyright~, the best Python language server, all of them are a bit lackluster, this one is the best
option.
#+BEGIN_SRC emacs-lisp
(use-package lsp-pyright
:straight t
:hook (python-mode . lsp))
#+END_SRC
** lsp-ui
Enable ~lsp-ui~, it adds doc frames, code actions at the side and other cool things, some of them are annoying and
need disabling.
#+BEGIN_SRC emacs-lisp
(use-package lsp-ui
:straight t
:after (company-box)
:config
;; disable focus on mouse over
(push '(no-accept-focus . t) lsp-ui-doc-frame-parameters)
(push '(no-accept-focus . t) company-box-frame-parameters)
(add-to-list 'lsp-ui-doc-frame-parameters '(no-accept-focus . t))
(add-to-list 'company-box-frame-parameters '(no-accept-focus . t))
(setq mouse-autoselect-window nil))
#+END_SRC
** flycheck
Enable ~flycheck~ for in-buffer hints and errors and warning and things.
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:straight t
:init (global-flycheck-mode))
#+END_SRC
** origami
Enable ~origami~. It allows one to fold and unfold a section with =zc= and =zo= in ~evil-mode~. Hook it on both ~conf-mode~ and ~prog-mode~;
#+BEGIN_SRC emacs-lisp
(use-package origami
:straight t
:hook ((prog-mode . origami-mode)
(conf-mode . origami-mode)))
#+END_SRC
Enable ~origami-lsp~. Some LSP servers specify these folding ranges and this package makes ~origami~ understand that
and work with it.
#+BEGIN_SRC emacs-lisp
(use-package lsp-origami
:straight t
:hook (lsp-after-open-hook lsp-origami-try-enable))
#+END_SRC
* hledger
For hledger, it's possible to use =ledger-mode= instead of =hledger-mode=. We'll see how it goes. It does require some convincing though.
#+BEGIN_SRC emacs-lisp
(use-package ledger-mode
:straight t
:config
(setq ledger-binary-path "hledger")
(setq ledger-mode-should-check-version nil)
(add-to-list 'auto-mode-alist '("\\.\\(h?ledger\\|journal\\|j\\)$" . ledger-mode))
(setq ledger-report-balance
(list "bal" (concat ledger-binary-path " --strict -f %(ledger-file) bal")))
(setq ledger-report-reg
(list "reg" (concat ledger-binary-path " --strict -f %(ledger-file) reg")))
(setq ledger-report-payee
(list "payee" (concat ledger-binary-path " --strict -f %(ledger-file) reg @%(payee)")))
(setq ledger-report-account
(list "account" (concat ledger-binary-path " --strict -f %(ledger-file) reg %(account)")))
(setq ledger-reports
(list ledger-report-balance
ledger-report-reg
ledger-report-payee
ledger-report-account)))
#+END_SRC
* Projectile
Enable ~projectile~.
#+BEGIN_SRC emacs-lisp
(use-package projectile
:straight t
:config
(projectile-mode +1)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
#+END_SRC
* Random Bits and Bobs
Set keystrokes echo to something really low, it's useful to know what you're typing.
#+BEGIN_SRC emacs-lisp
(setq echo-keystrokes 0.01)
#+END_SRC
Set default major mode to org mode, it's much more useful than fundamental.
#+BEGIN_SRC emacs-lisp
(setq-default major-mode 'org-mode)
#+END_SRC
Delete files by moving to trash.
#+BEGIN_SRC emacs-lisp
(setq-default delete-by-moving-to-trash t)
#+END_SRC
Equalize windows after split.
#+BEGIN_SRC emacs-lisp
(setq-default window-combination-resize t)
#+END_SRC
Increase undo limit to 80MB and enable fine undo, Evil will no longer chunk all edits in =INSERT= mode into one big
undo blob.
#+BEGIN_SRC emacs-lisp
(setq undo-limit 80000000
evil-want-fine-undo t)
#+END_SRC
For now, don't autosave. Because editing on remote disks, not TRAMP, but just NFS or CIFS, becomes extremely painful.
#+BEGIN_SRC emacs-lisp :tangle no
(setq auto-save-default t)
#+END_SRC
Enable line numbers for both programming buffers (Rust, C, and such) and configuration buffers (Nix, Yaml, Json, and
such) and Org mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'conf-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+END_SRC
Improve scrolling by:
1. disabling acceleration
2. making it so that the window under the pointer is scroller no matter the focused window
3. changing default scroll amount to 5 lines and 1 when shift is pressed
#+BEGIN_SRC emacs-lisp
(setq mouse-wheel-scroll-amount '(5 ((shift) . 1)))
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't)
#+END_SRC
Enable perentheses highlighting and pairing.
#+BEGIN_SRC emacs-lisp
(show-paren-mode 1)
(electric-pair-mode)
#+END_SRC
Set fill colum, horizontal indicator, for both =fill-paragraph=(=M-q=) and the visual horizontal indicator.
#+BEGIN_SRC emacs-lisp
(setq-default display-fill-column-indicator-column 120
fill-column 120)
#+END_SRC
Start Emacs server, unless it's already running. Starting a new Emacs instance while debugging and getting an error
about a server already running can be a bit annoying.
#+BEGIN_SRC emacs-lisp
(load "server")
(unless (server-running-p) (server-start))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "backups"))))
#+END_SRC
** Windows
As [[https://github.com/tecosaur/][tecosaur]] has it in his [[https://tecosaur.github.io/emacs-config/config.html#windows][configuration]], I was to be asked which window to should be brought up when I split a
window in Emacs. So create a new advice which will run after evil split commands and brings up the buffer selector.
#+BEGIN_SRC emacs-lisp
(defadvice evil-window-vsplit (after activate compile)
(counsel-switch-buffer))
(defadvice evil-window-split (after activate compile)
(counsel-switch-buffer))
#+END_SRC
** PGTK neo2 fix
#+BEGIN_SRC emacs-lisp
(put 'none 'modifier-value 0)
(setq x-hyper-keysym 'none)
#+END_SRC

View file

@ -1,35 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
* EmacsWebkit
#+BEGIN_SRC emacs-lisp :tangle no
(straight-use-package
'(webkit :type git :host github :repo "akirakyle/emacs-webkit" :branch "main"
:files (:defaults "*.js" "*.css" "*.h" "*.c" "Makefile")
:build (("nix-shell" "-p" "gtk3" "gcc" "glib" "pkg-config" "webkit" "--command" "'make debug'"))))
(use-package webkit
:straight t
:bind ("s-b" . 'webkit) ;; Bind to whatever global key binding you want if you want
:init
(setq webkit-search-prefix "https://duckduckgo.com/search?q=")
; (setq webkit-ace-chars "aoeuidhtns") ;; More convienent if you use dvorak
;; (setq webkit-history-filename "~/path/to/webkit-history") ;; If you want history saved in a different place
;; (setq webkit-history-filename nil) ;; If you don't want history saved to file (will stay in memory)
;; (setq webkit-own-window t) ;; See above explination; must be set before webkit.el is loaded
;; (setq browse-url-browser-function 'webkit-browse-url) ; Set as the default browse-url browser
;; (setq webkit-browse-url-force-new t) ; Always open a new session instead of reusing a current one
:config
(setq webkit-own-window nil)
;; (add-hook 'webkit-new-hook #'webkit-enable-javascript)
)
#+END_SRC
** Evil integration
#+BEGIN_SRC emacs-lisp
(use-package evil-collection-webkit
:straight t
:disabled t
:config
(evil-collection-xwidget-setup))
#+END_SRC

View file

@ -1,77 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
* EXVM
** Moving workspace
Theoretically it's possible to move workspace N to monitor M, by binding \s-C-[0-9], like many people do in i3. All that needs to be done is that a suitable plist needs to be build:
#+NAME: workspace-plist
#+BEGIN_SRC emacs-lisp :tangle no
(setq exwm-randr-workspace-output-plist `(1 "HDMI-0" 2 "HDMI-1" 3 "HDMI-1"))
#+END_SRC
And then this function must be called for EXWM to pick up any changes made
#+NAME:
#+BEGIN_SRC emacs-lisp :tangle no
(exwm-randr-refresh)
#+END_SRC
** Autostart
#+BEGIN_SRC emacs-lisp :tangle no
(call-interactively '(lambda (command)
(interactive (list (read-shell-command "$ ")))
(message "%s" command)
(apply 'start-process (nth 0 command) nil (nth 0 command) '(nthcdr 1 command))))
#+END_SRC
#+NAME: exwm
#+BEGIN_SRC emacs-lisp :noweb yes
(if (string= (getenv "EXWM") "1")
(use-package exwm
:straight t
:after hydra
:init
(require 'exwm-config)
(exwm-config-default)
(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist '(0 "HDMI-0" 1 "HDMI-0" 2 "HDMI-1"))
(add-hook 'exwm-randr-screen-change-hook
(lambda ()
(start-process-shell-command
"xrandr" nil "xrandr --output HDMI-1 --right-of HDMI-0 --auto")))
(setq exwm-input-global-keys
`(([?\s-r] . exwm-reset)
([?\s-w] . exwm-workspace-switch)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))
([?\s-\)] . (lambda () (nteractive) (exwm-workspace-move-window 0)))
([?\s-!] . (lambda () (interactive) (exwm-workspace-move-window 1)))
([?\s-@] . (lambda () (interactive) (exwm-workspace-move-window 2)))
([?\s-#] . (lambda () (interactive) (exwm-workspace-move-window 3)))
([?\s-$] . (lambda () (interactive) (exwm-workspace-move-window 4)))
([?\s-%] . (lambda () (interactive) (exwm-workspace-move-window 5)))
([?\s-^] . (lambda () (interactive) (exwm-workspace-move-window 6)))
([?\s-&] . (lambda () (interactive) (exwm-workspace-move-window 7)))
([?\s-8] . (lambda () (interactive) (exwm-workspace-move-window 8)))
([?\s-*] . (lambda () (interactive) (exwm-workspace-move-window 9)))
([<print>] . (call-process-shell-command "screenshot select &" nil 0))
([?\s-d] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(message "%s" command)
(start-process-shell-command command nil command)))))
;; Make focus follow mouse
;;(setq mouse-autoselect-window t
;; focus-follows-mouse t)
(setq exwm-workspace-number 3)
(exwm-randr-enable)
))
#+END_SRC

View file

@ -1,26 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
* Treemacs
#+begin_src emacs-lisp
#+end_src
#+NAME: treemacs
#+BEGIN_SRC emacs-lisp :tangle no
(use-package treemacs
:straight t
:config
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
(treemacs-load-theme 'doom-colors))
(use-package treemacs-evil
:after (treemacs evil)
:straight t)
(use-package lsp-treemacs
:straight t
:after (lsp-mode treemacs)
:config
(lsp-treemacs-sync-mode 1))
#+END_SRC

View file

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# key: /box
# --
${1:$(format "┌-%s-┐" (make-string (length yas-text) ?-))}
| $1 |
${1:$(format "└-%s-┘" (make-string (length yas-text) ?-))}

View file

@ -1,4 +0,0 @@
# -*- mode: snipper -*-
# key: cb
# --
^3 $0

View file

@ -1,6 +0,0 @@
# -*- mode: snipper -*-
# key: dm
# --
\[
$1
.\] $0

View file

@ -1,4 +0,0 @@
# -*- mode: snippet -*-
# key: mk
# --
$$1$${2:$(unless (string-match-p "\\\\`[,\\\\.? \\\\-].*" yas-text) " ")}$2 $0

View file

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# key: cbr
# --
#+BEGIN_SRC R :file r-img/$1.png :result file graphics
$2
#+END_SRC
$0

View file

@ -1,4 +0,0 @@
# -*- mode: snippet -*-
# key: sr
# --
^2 $0

View file

@ -1,155 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
config,
lib,
secret,
...
}:
with lib; let
cfg = config.magic_rb.programs.emacs;
in {
options.magic_rb.programs.emacs = {
enable = mkEnableOption "Enable emacs with my config";
enableMu4e = mkEnableOption "Enable mu4e in emacs. WARNING: requires secrets";
package = mkOption {
description = "Which emacs package to use.";
type = types.package;
default = let
# gensymb is not here, dont add
tex = with pkgs;
texlive.combine
{
inherit
(texlive)
scheme-full
;
};
r = with pkgs;
rWrapper.override
{packages = with rPackages; [ggplot2];};
in
(pkgs.emacs-magicrb.override
{
pkgs.emacs = pkgs.emacs.overrideAttrs
(old:
{
# patches = [ ./native-comp-driver-options.patch ];
});
march = config.magic_rb.optimisation.march;
hunspell.enable = true;
hunspell.dictionaries = with pkgs.hunspellDicts; [en_US];
environment = {
MU4E_CONTEXTS = mkIf cfg.enableMu4e secret.emacs.mu4eContexts;
};
additionalPackages =
[
tex
r
]
++ (with pkgs; [
krita
ripgrep
mu
isync
exa
fd
nil
graphviz
]);
})
.bundle;
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
cfg.package
(makeDesktopItem {
name = "Org-Protocol";
exec = "emacsclient %u";
comment = "Org protocol";
desktopName = "org-protocol";
type = "Application";
mimeTypes = ["x-scheme-handler/org-protocol"];
})
fira-code
(iosevka-bin.override {variant = "aile";})
(iosevka-bin.override {variant = "etoile";})
(iosevka-bin.override {variant = "";})
emacs-all-the-icons-fonts
];
fonts.fontconfig.enable = true;
home.activation.emacsStraightVerions =
config.lib.dag.entryAfter
["writeBoundary"] ''
mkdir -p ~/.emacs.d/straight/versions
ln -sfn ~/dotfiles/home-manager/modules/emacs/straight-versions.el ~/.emacs.d/straight/versions/default.el
'';
systemd.user.services.emacs = {
Unit = {
After = "graphical-session.target";
PartOf = "graphical-session.target";
X-RestartIfChanged = false;
};
Service = {
Type = "notify";
ExecStart = ''${pkgs.runtimeShell} -l -c "${lib.getExe cfg.package} --fg-daemon"'';
# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.
SuccessExitStatus = 15;
Restart = "on-failure";
};
Install = {
WantedBy = [
"graphical-session.target"
];
};
};
home.file = {
".emacs".source = ./.emacs;
".mbsyncrc" = mkIf cfg.enableMu4e {
source = secret.emacs.mbsyncrc;
};
".emacs.d/org" = {
source = ./.emacs.d/org;
recursive = true;
};
".emacs.d/lisp" = {
source = ./.emacs.d/lisp;
recursive = true;
};
".emacs.d/mu4e-contexts" = mkIf cfg.enableMu4e {
source = secret.emacs.mu4eContexts;
};
".emacs.d/tree-sitter" = {
source =
pkgs.linkFarm "grammars"
(map
(drv:
let
name = lib.strings.getName drv;
in
{
name = "lib" +
(lib.strings.removeSuffix "-grammar" name)
+ ".so";
path = "${drv}/parser";
}
)
(builtins.attrValues pkgs.tree-sitter.builtGrammars));
};
};
};
}

View file

@ -1,104 +0,0 @@
(("ace-window" . "77115afc1b0b9f633084cf7479c767988106c196")
("alert" . "c762380ff71c429faf47552a83605b2578656380")
("all-the-icons.el" . "f75c1130b72c718bfaf18b56c445c4b58efc714f")
("avy" . "be612110cb116a38b8603df367942e2bb3d9bdbe")
("cape" . "db3059af52718c7f55485ef183bdad3e40f58df9")
("cfrs" . "f3a21f237b2a54e6b9f8a420a9da42b4f0a63121")
("clang-format" . "e48ff8ae18dc7ab6118c1f6752deb48cb1fc83ac")
("compat" . "b3b18044f9ca99a53ade91794226d71968b3e14f")
("consult" . "aadb912e126a143c60e6ece92b163a7356bd4730")
("corfu" . "2e066448df9cc8b16e75f3bc22e6fb5a8d1c065d")
("dash.el" . "96eaba028ac069ea0e5cc70de15b0229126a054a")
("dirvish" . "4b63cd2e5ba994f8e674388db7035de1a8f0343f")
("dockerfile-mode" . "52c6c00da1d31c0b6c29c74335b3af63ed6bf06c")
("doom-modeline" . "3612082bc5cba712c07860ce37865f938beb9002")
("el-get" . "22c83206bab10100fdee03cb2d5b97c8c24eff0e")
("el-secretario" . "93f9b1bd2e381354a6ae799fed3e4a8313f24e11")
("elisp" . "3497ffd763cadcc1f507aae88c3c7a84007ccfbd")
("emacs-elixir" . "7641373f0563cab67cc5459c34534a8176b5e676")
("emacs-hcl-mode" . "751b79247f326ab52e00032e805775c37ad9f080")
("emacs-libvterm" . "94e2b0b2b4a750e7907dacd5b4c0584900846dd1")
("emacs-which-key" . "bd34ede7bf77ad3988330b37207f3978e7342c79")
("emacsmirror-mirror" . "606c3dcfc57ee47a9969b4d9f3d87408f14ebffb")
("emacsql" . "64012261f65fcdd7ea137d1973ef051af1dced42")
("embark" . "10ac6b7260c82e3a59a33ea93e7027692b228e5f")
("ement.el" . "5be1e0700288fea0762b4fc9311e0b05d6c78cc0")
("envrc" . "15af96080772af415a56b680acdd7d2010a68ffa")
("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6")
("f.el" . "af7d37c619010b576fd22b50c62c71ff33093f3c")
("flycheck" . "5f2ef177cb21ae8b73714575802beef04abd0f5e")
("flycheck-posframe" . "19896b922c76a0f460bf3fe8d8ebc2f9ac9028d8")
("general.el" . "7ce8db297e3de258ec43802269438ac7f1918707")
("gntp.el" . "767571135e2c0985944017dc59b0be79af222ef5")
("gnu-elpa-mirror" . "eda4c968f0400750e17a013bb80832088dab12d1")
("go-mode.el" . "166dfb1e090233c4609a50c2ec9f57f113c1da72")
("haskell-mode" . "20d4e2300302a9af673e82d0185d3f489bfb0f59")
("hercules" . "557da39878d0637395fdded91243b340c37eff7b")
("ht.el" . "3c1677f1bf2ded2ab07edffb7d17def5d2b5b6f6")
("hydra" . "317e1de33086637579a7aeb60f77ed0405bf359b")
("inheritenv" . "2102ed2d105a5c9f366cb6503d04794600985598")
("js2-mode" . "7d928272bc311b1dd6f38d3f6365c18153e28636")
("ledger-mode" . "7bed9b468bf7d2cd4dafa30b067bb576263f8e0c")
("let-alist" . "021fc10df2e44faba4728d849ee767cf890aa51a")
("log4e" . "737d275eac28dbdfb0b26d28e99da148bfce9d16")
("lsp-haskell" . "3249cde75fb411f95fe173c222b848182fd0b752")
("lsp-mode" . "cf30718ed5128753565452f476385dac1f7821d6")
("lsp-origami" . "7df9c91a309aa4229bec41f109920b37c4197618")
("lsp-pyright" . "54a2acddfdd7c3d31cb804a042305a3c6e60cf81")
("lsp-python-ms" . "f8e7c4bcaefbc3fd96e1ca53d17589be0403b828")
("lsp-ui" . "295d8984da06a745b0a36c56e28ce915bc389adb")
("magit" . "6067f92c0195616707b25e23c2d4c0dd81928fd8")
("map" . "a0e501aede34f183a8baa5d3d41610a3ffa1728e")
("marginalia" . "3ddd2b7fa09e1e84112749ffbdcb6bd8900bfc26")
("markdown-mode" . "5d98592fe516748034d8baf92d7c0ba045e1f87a")
("melpa" . "86ca8d06599c8d7d9067ce92ae5dde3b122f6796")
("meow" . "07ccf112fc1a56ddd96cfc39967957be7dc8dd5f")
("mu4e-alert" . "3c9af8c7994df0a1a4f0703552ea3beffb485ace")
("nongnu-elpa" . "0120f3dfe80cffe0c3016080d9205d12be3b741d")
("openscad" . "31670fc8bbde97f47f050f1837de093ecee89e1e")
("orderless" . "e6784026717a8a6a7dcd0bf31fd3414f148c542e")
("org" . "080710797ad25e76c4556d2b03cc0aa5313cd187")
("org-ql" . "2c098540cab6a0ee7d82abe2327d524a171edd1e")
("org-roam" . "5c06471c3a11348342719fd9011486455adeb701")
("org-super-agenda" . "f4f528985397c833c870967884b013cf91a1da4a")
("origami.el" . "e558710a975e8511b9386edc81cd6bdd0a5bda74")
("ov" . "c5b9aa4e1b00d702eb2caedd61c69a22a5fa1fab")
("password-store" . "28cec11f1dbe6c4273d30370af45b69c9f408386")
("pdf-tools" . "7ff6293a25baaae65651b3e1c54b61208279a7ef")
("peg" . "5d4ed356ca89acdf52a3e7e7f8e2408b808552c4")
("persist" . "c10835478d9f916534a07fad0174d497adf85729")
("pfuture" . "19b53aebbc0f2da31de6326c495038901bffb73c")
("pkg-info" . "76ba7415480687d05a4353b27fea2ae02b8d9d61")
("plz" . "205e8284340ff10bc7a8468f8af0c50eb0e97c60")
("popper" . "e3991202234e4dc10dbfae8e13b27c590dd52fb5")
("posframe" . "3b97dc180b03498103cfcc7f44e64150df440bf0")
("project" . "33511939473551b5cfa42de9a12d606b3d60a2cf")
("projectile" . "271007c6611fcb08ddd326d7de9727c2ad5ef265")
("racket-mode" . "c2fe266c18bb6e55a13c7ba795b0a5f7372b6c13")
("rjsx-mode" . "b697fe4d92cc84fa99a7bcb476f815935ea0d919")
("rust-mode" . "e443ccf2884028d3b6cc550ff20e7c92dadccb68")
("rustic" . "39423d1cf4fa054c36bf9577356451f4c06ee148")
("s.el" . "dda84d38fffdaf0c9b12837b504b402af910d01d")
("shackle" . "f1467db75a8fa5d51c676181fb308ccbf7b05e6f")
("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41")
("spinner" . "634529bb3173e09b37499f636de70abf29d9fa8a")
("straight.el" . "039e5c9a9b5c00749602afb41341e9e77ba09429")
("svg-lib" . "31085bbf247f0467e2f6af948085610248fce6c5")
("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9")
("taxy" . "b222226f9e1057490150c1a8a98e8b471df88302")
("taxy-magit-section" . "00e1e41341cbc71fcc8f4d4c98b2cc5c371c4f54")
("tempel" . "94afb9b916a711c56f23183da93a103338e9f84e")
("terraform-mode" . "56f19abae95afb7e13e48ec3e6aeba3820d31307")
("transient" . "af7fe42bd46e24ca7852e73bd1691015c5bd2151")
("treemacs" . "983ea5a66801a5c1f6e32e3d515bd48761677ac6")
("ts.el" . "552936017cfdec89f7fc20c254ae6b37c3f22c5b")
("typescript.el" . "4fcb4594819caf472ae42ea068a1c7795cf07f46")
("use-package" . "a6e856418d2ebd053b34e0ab2fda328abeba731c")
("vertico" . "dd8eb3aa3d0d048cc0e1bc455f42a12a4162f5bb")
("vulpea" . "f4d3448b6ccdb314c5fe3defea66e750e1371a10")
("web-mode" . "57856ba64b9382811b35df0d9ab0a24aede0c1f0")
("with-editor" . "df74385b455cd7687232ad189acfea16cb44dd04")
("xref" . "420511e20187d0c6c8680c0e63ae8810f84dee00")
("xterm-color" . "2ad407c651e90fff2ea85d17bf074cee2c022912")
("yaml-mode" . "b153150e0e77b4ec462d741cdb16956c6ae270d6"))
:gamma

View file

@ -1,57 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.magic_rb.programs.gpg;
in {
options.magic_rb.programs.gpg = {
enable =
mkEnableOption
''
Enable gpg and gpg-key.
'';
pinentryFlavor = mkOption {
description = "Which pinentry flavor should be used.";
type = types.enum [
"curses"
"emacs"
"mac"
"gtk2"
"qt"
"gnome"
];
default = "gtk2";
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
gpg-key-rb
gnupg
pass
yubikey-manager
];
home.file.".gpg-agent.conf".text = ''
enable-ssh-support
pinentry-program ${pkgs.pinentry.${cfg.pinentryFlavor}}/bin/pinentry
'';
home.file.".profile".text = ''
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
'';
home.activation.gnupghome = config.lib.dag.entryAfter ["writeBoundary"] ''
if [[ ! -e ~/.gnupg/gpg-agent.conf ]] && [[ -d /mnt/key/gnupg ]]
then
ln -sf ~/.gpg-agent.conf /mnt/key/gnupg/gpg-agent.conf
fi
'';
};
}

View file

@ -1,39 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
inputs,
...
}:
with lib; let
cfg = config.magic_rb.packageCollections.graphical;
in {
options.magic_rb.packageCollections.graphical = {
enable =
mkEnableOption
''
Enable graphical package collection, contains GIMP, Firefox, mpv, and Discord.
'';
};
config = mkIf cfg.enable {
programs.librewolf = {
enable = true;
settings = {
"webgl.disabled" = false;
};
};
home.packages = with pkgs; [
gimp
mpv
slack
schildichat-desktop
inputs.nixpkgs-discord.legacyPackages.${stdenv.system}.armcord
pavucontrol
];
};
}

View file

@ -1,22 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.programs.multimc;
in {
options.magic_rb.programs.multimc = {
enable = mkEnableOption "Enable MultiMC Minecraft launcher.";
};
config = mkIf cfg.enable {
home.packages = [
pkgs.prismlauncher
];
};
}

View file

@ -1 +0,0 @@
../../nixos/modules/optimisation.nix

View file

@ -1,50 +0,0 @@
{ pkgs, ... }:
{
services.pantalaimon =
{
# enable = true;
package = (pkgs.pantalaimon.override (old: {
matrix-nio = old.matrix-nio.overridePythonAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "codemonium";
repo = "matrix-nio";
rev = "1ba34112ca221adf0ed1d9e5028d5a7f3a4a72ca";
hash = "sha256-T8wFJlUMQVwJHNzIZiQ4M/uImTvIqW5PGJoWV0kbHkA=";
};
disabledTests = old.disabledTests ++ [
"test_room_invite"
"test_account_loading"
"test_olm_session_load"
"test_store_versioning"
];
});
})).overridePythonAttrs
(old:
{
src = pkgs.fetchFromGitHub {
owner = "codemonium";
repo = "pantalaimon";
rev = "25d415fac4ad653da1e427bc05beed2d21bc169f";
hash = "sha256-U+dSlfYx2ADin+zbEPNIHkjytMUmZ6QkklU0bCyt/Pg=";
};
});
settings =
{
Default =
{
LogLevel = "Info";
SSL = true;
};
local-matrix =
{
Homeserver = "https://matrix.redalder.org";
ListenAddress = "127.0.0.1";
ListenPort = 8008;
UseKeyring = false;
IgnoreVerification = true;
SSL = false;
};
};
};
}

View file

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
default-sample-format = float32le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 2
default-fragment-size-msec = 125
resample-method = soxr-vhq
enable-lfe-remixing = no
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 9
rlimit-rtprio = 9
daemonize = no

View file

@ -1,13 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
...
}:
throw "Disabled needs rework!!!!"
# {
# home.file.".config/pulse/daemon.conf".source = ./daemon.conf;
# }

View file

@ -1,14 +0,0 @@
Host *
ControlMaster auto
ControlPath ~/.ssh/controlmasters/%r@%h:%p
ControlPersist 300s
ServerAliveInterval 30
Host 192.168.0.250
Port 2222
Host *redalder.org 10.64.1.* 10.64.0.*
ExitOnForwardFailure yes
SendEnv INSIDE_EMACS
RemoteForward /home/main/.ssh/emacs-server /run/user/1000/emacs/server

View file

@ -1,35 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.magic_rb.programs.ssh;
in {
options.magic_rb.programs.ssh = {
enable = mkEnableOption "Enable ssh_config";
};
config = mkIf cfg.enable {
programs.ssh = {
enable = true;
controlMaster = "auto";
controlPath = "~/.ssh/controlmasters/%r@%h:%p";
controlPersist = "300s";
serverAliveInterval = 30;
matchBlocks = {
"Host *redalder.org 10.64.1.* 10.64.0.*".extraOptions = {
ExitOnForwardFailure = "yes";
SendEnv = "INSIDE_EMACS";
RemoteForward = "/home/main/.ssh/emacs-server /run/user/1000/emacs/server";
};
};
};
home.activation."ssh-controlmasters" = config.lib.dag.entryAfter ["writeBoundary"] ''
mkdir -p ~/.ssh/controlmasters
'';
};
}

View file

@ -1,27 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.packageCollections.webdev;
in {
options.magic_rb.packageCollections.webdev = {
enable =
mkEnableOption
''
Enable webdev package collection, contains yarn and wasm-pack.
'';
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
yarn
wasm-pack
];
};
}

View file

@ -1,36 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.packageCollections.wine;
combineWines = wines:
map (
wine:
pkgs.writeShellScriptBin wine.name
''
${wine}/bin/wine "$@"
''
)
wines;
in {
options.magic_rb.packageCollections.wine = {
enable = mkEnableOption "Enable wine package collection, contains wine-staging and winetricks";
};
config = mkIf cfg.enable {
home.packages = with pkgs;
[
winetricks
]
++ combineWines (with pkgs; [
wineWowPackages.staging
]);
};
}

View file

@ -1,147 +0,0 @@
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.programs.xmonad;
in {
options.magic_rb.programs.xmonad = {
enable = mkEnableOption "Enable xmonad config";
enableDunst = mkOption {
description = "Enable dunst";
type = types.bool;
default = true;
};
enablePicom = mkOption {
description = "Enable picom";
type = types.bool;
default = true;
};
enableKeynav = mkOption {
description = "Enable keynav";
type = types.bool;
default = true;
};
picomExperimentalBackends = mkOption {
description = "Enable experimental backends in picom";
type = types.bool;
default = true;
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
powerline-fonts
font-awesome
dejavu_fonts
];
home.file.".keynavrc".source = ./keynavrc;
home.file.".xmonad/xmonad.hs".source = pkgs.writeSubstitutedFile {
name = "xmonad.hs";
file = ./xmonad.hs;
substitutes = {
"screenshot" = lib.getExe pkgs.magic_rb.screenshot;
"emacs-rofi" = lib.getExe pkgs.emacs-rofi;
"notify" = lib.getExe pkgs.libnotify;
"playerctl" = lib.getExe pkgs.playerctl;
"reload" = pkgs.writeShellScript "xmonad-reload"
''
${lib.getExe pkgs.libnotify} -t 5000 "recompiling xmonad"
if xmonad --recompile
then
${lib.getExe pkgs.libnotify} -t 5000 "compilation succeeded"
xmonad --restart
else
${lib.getExe pkgs.libnotify} -t 5000 "compilation failed"
fi
'';
"auxmenu" = pkgs.writeShellScript "auxmenu"
''
export SUDO_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
_options="toggle-mic\ntoggle-radio\nscreenshot-all\nscreenshot-select\nscreenshot-focused\nsuspend\nreboot\nkexec\npoweroff\nlogout\nnmtui"
_option="$(echo -e $_options | emacs-rofi "command: " 90 30 | awk '{print $1}' | tr -d '\r\n')"
if [ ''${#_option} -gt 0 ]
then
case $_option in
toggle-mic)
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
;;
toggle-radio)
if [ "$(nmcli radio wifi)" = "enabled" ]
then
nmcli radio wifi off
else
nmcli radio wifi on
fi
;;
screenshot-all)
${lib.getExe pkgs.magic_rb.screenshot} screen
;;
screenshot-select)
${lib.getExe pkgs.magic_rb.screenshot} select
;;
screenshot-focused)
${lib.getExe pkgs.magic_rb.screenshot} focused
;;
suspend)
systemctl suspend
;;
reboot)
systemctl reboot
;;
poweroff)
systemctl poweroff
;;
kexec)
sudo -A kexec -l /run/current-system/kernel --initrd=/run/current-system/initrd --reuse-cmdline
systemctl kexec
;;
logout)
loginctl terminate-session $XDG_SESSION_ID
;;
nmtui)
alacritty -e nmtui
;;
*)
;;
esac
fi
'';
"dmenu_run" = "${pkgs.dmenu}/bin/dmenu_run";
"polybar" = pkgs.writeShellScript "polybar"
''
monitors=$(polybar --list-monitors | cut -f 1 -d':')
MONITOR=''${monitors[$1]} ${lib.getExe pkgs.polybarFull} -c ${./polybar.ini} top
'';
"dunst" = lib.getExe pkgs.dunst;
"dunstConfig" = ./dunstrc;
"picom" = lib.getExe pkgs.picom;
"picomConfig" = ./picom.conf;
"picomArgs" =
if cfg.picomExperimentalBackends
then "--experimental-backends"
else "";
"keynav" = lib.getExe pkgs.keynav;
"lightLocker" = lib.getExe pkgs.lightlocker;
"lightLockerCommand" = "${pkgs.lightlocker}/bin/light-locker-command";
"brightnessctl" = lib.getExe pkgs.brightnessctl;
};
};
};
}

View file

@ -1,464 +0,0 @@
# -*- mode: conf -*-
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
# See dunst(5) for all configuration options
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = none
### Geometry ###
# dynamic width from 0 to 300
# width = (0, 300)
# constant width of 300
width = 300
# The maximum height of a single notification, excluding the frame.
height = 50
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 0x15
# Scale factor. It is auto-detected if value is 0.
scale = 0
# Maximum number of notification (0 means no limit)
notification_limit = 20
### Progress bar ###
# Turn on the progess bar. It appears when a progress hint is passed with
# for example dunstify -h int:value:12
progress_bar = true
# Set the progress bar height. This includes the frame, so make sure
# it's at least twice as big as the frame width.
progress_bar_height = 10
# Set the frame width of the progress bar
progress_bar_frame_width = 1
# Set the minimum width for the progress bar
progress_bar_min_width = 150
# Set the maximum width for the progress bar
progress_bar_max_width = 300
# Corner radius for the progress bar. 0 disables rounded corners.
progress_bar_corner_radius = 0
# Corner radius for the icon image.
icon_corner_radius = 0
# Show how many messages are currently hidden (because of
# notification_limit).
indicate_hidden = yes
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.). (X11 only)
transparency = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
# If gap_size is greater than 0, this setting will be ignored.
separator_height = 1
# Padding between text and separator.
padding = 1
# Horizontal padding.
horizontal_padding = 4
# Padding between text and icon.
text_icon_padding = 0
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 1
# Defines color of the frame around the notification window.
frame_color = "#555555"
# Size of gap to display between notifications - requires a compositor.
# If value is greater than 0, separator_height will be ignored and a border
# of size frame_width will be drawn around each notification instead.
# Click events on gaps do not currently propagate to applications below.
gap_size = 0
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
# A client can set the 'transient' hint to bypass this. See the rules
# section for how to disable this if necessary
# idle_threshold = 120
### Text ###
font = Fixed 8
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
line_height = 0
# Possible values are:
# full: Allow a small subset of html markup in notifications:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <https://docs.gtk.org/Pango/pango_markup.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "%a: <b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Vertical alignment of message text and icon.
# Possible values are "top", "center" and "bottom".
vertical_alignment = center
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = middle
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = true
# Hide the count of stacked notifications with the same content
hide_duplicate_count = false
# Display indicators for URLs (U) and actions (A).
show_indicators = yes
### Icons ###
# Recursive icon lookup. You can set a single theme, instead of having to
# define all lookup paths.
enable_recursive_icon_lookup = true
# Set icon theme (only used for recursive icon lookup)
icon_theme = Adwaita
# You can also set multiple icon themes, with the leftmost one being used first.
# icon_theme = "Adwaita, breeze"
# Align icons left/right/top/off
icon_position = off
# Scale small icons up to this size, set to 0 to disable. Helpful
# for e.g. small files or high-dpi screens. In case of conflict,
# max_icon_size takes precedence over this.
min_icon_size = 32
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 128
# Paths to default icons (only neccesary when not using recursive icon lookup)
icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
### History ###
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = yes
# Maximum amount of notifications kept in history
history_length = 20
### Misc/Advanced ###
# dmenu path.
dmenu = /usr/bin/dmenu -p dunst:
# Browser for opening urls in context menu.
browser = /usr/bin/xdg-open
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = Dunst
# Define the class of the windows spawned by dunst
class = Dunst
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 0
# Ignore the dbus closeNotification message.
# Useful to enforce the timeout set by dunst configuration. Without this
# parameter, an application may close the notification sent before the
# user defined timeout.
ignore_dbusclose = false
### Wayland ###
# These settings are Wayland-specific. They have no effect when using X11
# Uncomment this if you want to let notications appear under fullscreen
# applications (default: overlay)
# layer = top
# Set this to true to use X11 output on Wayland.
force_xwayland = false
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.
# This setting is provided for compatibility with older nVidia drivers that
# do not support RandR and using it on systems that support RandR is highly
# discouraged.
#
# By enabling this setting dunst will not be able to detect when a monitor
# is connected or disconnected which might break follow mode if the screen
# layout changes.
force_xinerama = false
### mouse
# Defines list of actions for each mouse event
# Possible values are:
# * none: Don't do anything.
# * do_action: Invoke the action determined by the action_name rule. If there is no
# such action, open the context menu.
# * open_url: If the notification has exactly one url, open it. If there are multiple
# ones, open the context menu.
# * close_current: Close current notification.
# * close_all: Close all notifications.
# * context: Open context menu for the notification.
# * context_all: Open context menu for all notifications.
# These values can be strung together for each mouse event, and
# will be executed in sequence.
mouse_left_click = close_current
mouse_middle_click = do_action, close_current
mouse_right_click = close_all
# Experimental features that may or may not work correctly. Do not expect them
# to have a consistent behaviour across releases.
[experimental]
# Calculate the dpi to use on a per-monitor basis.
# If this setting is enabled the Xft.dpi value will be ignored and instead
# dunst will attempt to calculate an appropriate dpi value for each monitor
# using the resolution and physical size. This might be useful in setups
# where there are multiple screens with very different dpi values.
per_monitor_dpi = false
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#000000"
foreground = "#FFFFFF"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_normal]
background = "#000000"
foreground = "#FFFFFF"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_critical]
background = "#000000"
foreground = "#FFFFFF"
frame_color = "#FF0000"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#default_icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#
# Messages can be matched by
# appname (discouraged, see desktop_entry)
# body
# category
# desktop_entry
# icon
# match_transient
# msg_urgency
# stack_tag
# summary
#
# and you can override the
# background
# foreground
# format
# frame_color
# fullscreen
# new_icon
# set_stack_tag
# set_transient
# set_category
# timeout
# urgency
# icon_position
# skip_display
# history_ignore
# action_name
# word_wrap
# ellipsize
# alignment
# hide_text
#
# Shell-like globbing will get expanded.
#
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
# GLib based applications export their desktop-entry name. In comparison to the appname,
# the desktop-entry won't get localized.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
# match_transient = yes
# set_transient = no
#
# Make the handling of transient notifications more strict by making them not
# be placed in history.
#[transient_history_ignore]
# match_transient = yes
# history_ignore = yes
# fullscreen values
# show: show the notifications, regardless if there is a fullscreen window opened
# delay: displays the new notification, if there is no fullscreen window active
# If the notification is already drawn, it won't get undrawn.
# pushback: same as delay, but when switching into fullscreen, the notification will get
# withdrawn from screen again and will get delayed like a new notification
#[fullscreen_delay_everything]
# fullscreen = delay
#[fullscreen_show_critical]
# msg_urgency = critical
# fullscreen = show
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# skip_display = true
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[skip-display]
# # This notification will not be displayed, but will be included in the history
# summary = "foobar"
# skip_display = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
#
# vim: ft=cfg

View file

@ -1,32 +0,0 @@
# -*- mode: text -*-
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
clear
ctrl+s start, grid 3x3
Escape end
u end
g warp, click 1, end
c warp, click 3, end
d warp, click 4
b warp, click 5
l warp, end
t move-left
r move-up
n move-down
s move-right
period cell-select 1x1
o cell-select 2x1
comma cell-select 3x1
a cell-select 1x2
e cell-select 2x2
i cell-select 3x2
q cell-select 1x3
adiaeresis cell-select 2x3
udiaeresis cell-select 3x3

Some files were not shown because too many files have changed in this diff Show more