├── .gitignore
├── .nojekyll
├── CNAME
├── Justfile
├── LICENSE.txt
├── LICENSE_GPLv3.txt
├── README.md
├── early-init.el
├── emacs.html
├── emacs.org
├── index.html
├── init.el
├── modules
├── ace-window
│ └── ace-window.el
├── avy
│ └── avy.el
├── cargo.el
├── completion
│ └── completion.el
├── dashboard
│ └── dashboard.el
├── fonts
│ └── fonts.el
├── general
│ └── general.el
├── git.el
├── gptel
│ └── gptel.el
├── just
│ └── just.el
├── latin-words
│ └── latin-words.el
├── lsp
│ └── lsp.el
├── magit
│ └── magit.el
├── markdown
│ └── markdown.el
├── org
│ ├── org-mode-unpackaged.el
│ └── org.el
├── programming.el
├── python
│ └── python.el
├── registers
│ └── registers.el
├── rust
│ └── rust.el
├── s3-publish
│ └── s3-publish.el
├── sql
│ └── sql.el
├── ssh-agent
│ └── ssh-agent.el
├── svelte
│ └── svelte.el
├── text-scale
│ └── text-scale.el
├── theme
│ └── theme.el
├── treesit
│ └── treesit.el
├── vterm
│ └── vterm.el
└── which-key
│ └── which-key.el
└── theme
├── emacs.theme
├── icon
└── emacs.ico
├── simple_dark.css
└── simple_dark.theme
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | /history
3 | /places
4 | /recentf
5 | /elpa/
6 | /eln-cache/
7 | /.org-id-locations
8 | /custom.el
9 | /straight/
10 | /export/
11 | /.git
12 | .gitignore
13 | /export/hello.txt
14 | /transient/
15 | \#*
16 | /.dap-breakpoints
17 | /.lsp-session*
18 | tree-sitter/
19 | /tramp
20 | /.cache/
21 |
--------------------------------------------------------------------------------
/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EnigmaCurry/emacs/0fff807c42c527e3ecc5dfadd3662eff7cccc643/.nojekyll
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | emacs.rymcg.tech
--------------------------------------------------------------------------------
/Justfile:
--------------------------------------------------------------------------------
1 | set export
2 | current_dir := `pwd`
3 |
4 | # Print this help message for the Justfile targets
5 | help:
6 | @just -l
7 |
8 | # Clean pacage cache
9 | clean:
10 | rm -rf straight eln-cache
11 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | License for:
2 | https://emacs.rymcg.tech
3 | https://github.com/EnigmaCurry/emacs
4 |
5 | PUBLIC DOMAIN LICENSE (0BSD)
6 |
7 | Permission to use, copy, modify, and/or distribute this software
8 | for any purpose with or without fee is hereby granted.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 | AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17 | CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.[21]
18 |
19 | Some code in this distribution is specifically identified as being
20 | licensed GPLv3. If these files continue to be reproduced, the license
21 | of this entire distribution is modified to GPLv3:
22 |
23 | GNU GENERAL PUBLIC LICENSE
24 | Version 3, 29 June 2007
25 |
26 | Copyright 2025 EnigmaCurry
27 |
28 | This program is free software: you can redistribute it and/or modify
29 | it under the terms of the GNU General Public License as published by
30 | the Free Software Foundation, either version 3 of the License, or
31 | (at your option) any later version.
32 |
33 | This program is distributed in the hope that it will be useful,
34 | but WITHOUT ANY WARRANTY; without even the implied warranty of
35 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 | GNU General Public License for more details.
37 |
38 | You should have received a copy of the GNU General Public License
39 | along with this program. If not, see .
40 |
--------------------------------------------------------------------------------
/LICENSE_GPLv3.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Modular GNU Emacs Configuration
2 |
3 | For my new config, see [emacs.rymcg.tech](https://emacs.rymcg.tech)
4 |
5 | ## Older configs
6 |
7 | Here's my previous config branch:
8 | [straight](https://github.com/enigmacurry/emacs/tree/straight)
9 |
10 | Here's my old [spacemacs config
11 | branch](https://github.com/EnigmaCurry/emacs/tree/spacemacs)
12 |
13 | Here's my old old [literate config
14 | branch](https://github.com/EnigmaCurry/emacs/blob/literate/config.org)
15 |
16 | If you want to see my old old old config from the late 2000s, see the
17 | [ancient-history
18 | branch](https://github.com/EnigmaCurry/emacs/tree/ancient-history)
19 |
--------------------------------------------------------------------------------
/early-init.el:
--------------------------------------------------------------------------------
1 | ;; Load an initial theme (will be overriden later in modules/theme/theme.el)
2 | (load-theme 'modus-vivendi)
3 | ;; Set a larger default font size (150 = 15 pt size):
4 | (setq my/default-text-height 150)
5 | (set-face-attribute 'default nil :height my/default-text-height)
6 | ;; Turn off GUI distractions:
7 | (menu-bar-mode -1) ; Press F10 to bring up the menu if you still need it.
8 | (tool-bar-mode -1)
9 | (scroll-bar-mode -1)
10 | (setq inhibit-startup-screen t)
11 | ;; Don't resize the frame when adjusting the font size:
12 | (setq window-resize-pixelwise t)
13 | (setq frame-resize-pixelwise t)
14 | ;; Disable package.el in favor of straight.el
15 | (setq package-enable-at-startup nil)
16 |
17 | ;; Debug options:
18 | ;;; Start Emacs with the `--debug-init` argument, to debug errors during startup.
19 | ;;; Enter debugger on specific logger regex (see *Messages* buffer):
20 | ;; (setq debug-on-message "Example log message to trace")
21 | ;;; M-x toggle-debug-on-error
22 | ;;(setq debug-on-error t)
23 | (setq warning-minimum-level :error)
24 |
--------------------------------------------------------------------------------
/emacs.html:
--------------------------------------------------------------------------------
1 | index.html
--------------------------------------------------------------------------------
/emacs.org:
--------------------------------------------------------------------------------
1 | #+TITLE: Modular GNU Emacs Configuration
2 | #+LANGUAGE: en
3 | #+PROPERTY: header-args :results none :eval yes
4 | #+SETUPFILE: theme/emacs.theme
5 | #+SETUPFILE: theme/simple_dark.theme
6 | #+OPTIONS: noweb:t
7 |
8 | * Configure your distribution here :noexport:
9 | :CUSTOM:
10 |
11 | If you are making this config your own, you must personalize all of
12 | the details in this section. There is some redundancy of values here!
13 | Make sure you edit *all* of the forms in this section.
14 |
15 | # Enter your name:
16 | #+AUTHOR: EnigmaCurry
17 | # Enter your URL to the HTML export of this config:
18 | #+LINK: web https://emacs.rymcg.tech
19 | # Enter your public git forge page for this config:
20 | #+LINK: git-repo https://github.com/EnigmaCurry/emacs
21 | # Enter your branch specific file blob URL for this config:
22 | #+LINK: git-blob https://github.com/EnigmaCurry/emacs/blob/literate-new
23 |
24 | (See the GitHub docs for the file blob URL standard:
25 | https://docs.github.com/en/repositories/working-with-files/using-files/getting-permanent-links-to-file)
26 |
27 | Enter your git repository here (again):
28 | #+name: git-repo
29 | #+begin_src
30 | https://github.com/EnigmaCurry/emacs
31 | #+end_src
32 |
33 | Enter just your git username in lower case:
34 | #+name: git-user-name
35 | #+begin_src
36 | enigmacurry
37 | #+end_src
38 |
39 | Enter just the repository name:
40 | #+name: git-repo-name
41 | #+begin_src
42 | emacs
43 | #+end_src
44 |
45 | :END:
46 |
47 | * Goals
48 |
49 | This is a new attempt at writing a depersonalized, copyable, and
50 | modular Emacs config:
51 |
52 | * All Emacs config (elisp) is written in a single Org Mode file:
53 | * Config repository: [[git-repo]]
54 | * Org source file: [[git-blob:/emacs.org?plain=1][emacs.org]]
55 | * You may [[git-repo:/fork][fork this repository]] to make it your own.
56 | * In case this config is already a fork, you may want to start
57 | with the original [[https://emacs.rymcg.tech][emacs.rymcg.tech]] instead.
58 | * Your configuration is displayed (exported) as a single HTML page:
59 | * Config page: [[web]]
60 | * This page is easy to search and requires no JavaScript.
61 | * All Org-Babel code blocks are [[https://orgmode.org/manual/Extracting-Source-Code.html]["tangled"]] into normal elisp files and
62 | published to the git repository:
63 | * [[git-blob:/emacs.org?plain=1][emacs.org]] remains the single "source of truth" of this config.
64 | * However, it is the tangled elisp files ([[git-blob:/init.el][init.el]], [[git-blob:/modules][modules/*]]) that
65 | Emacs loads on startup, not emacs.org.
66 | * All of the other files in the repository will be overwritten each
67 | time emacs.org is re-tangled.
68 | * Code blocks should be of medium size, grouping related functions:
69 | * There should be more code here than prose. Avoid having lots of
70 | little code blocks and excessive explanations.
71 | * All custom elisp functions and variables should have the namespace
72 | prefix =my/= :
73 | * This configuration is non-proprietary to promote code adoption
74 | by others.
75 | * Meme: [[https://ec-share.nyc3.digitaloceanspaces.com/i-made-this-1.jpg]["I made this"]].
76 | * This config should support multiple platforms: Linux
77 | CLI, Wayland, Android...
78 | * Most configuration should be customizable by the user without
79 | needing to edit this file:
80 | * Run =M-x my/custom-settings= to open the configuration menu to
81 | save settings on a per-installation basis in
82 | =~/.emacs.d/custom.el= (and it is =.gitignore= 'd).
83 | * The base config should work without needing to download any third
84 | party libraries:
85 | * The custom variable =my/machine-labels= is used to set
86 | per-machine labels that opt-in to loading additional modules.
87 | * LICENSE
88 |
89 | See [[file:LICENSE.txt]]
90 |
91 | See [[file:LICENSE_GPLv3.txt]]
92 |
93 | This distribution has a *mixed license* (0BSD and GPLv3). Everything
94 | here that has not been identified in the comments as having been taken
95 | from somewhere else, is licensed/dedicated to you as public domain
96 | (0BSD). Some code has been copied from other sources that are licensed
97 | GPLv3 and so these have been identified as such in the code block
98 | comments. As long as these additional sources are included in this
99 | distribution, this repository is effectively (infectively) licensed as
100 | GPLv3.
101 |
102 | #+begin_src text :noweb yes :tangle "LICENSE.txt" :exports none
103 | License for:
104 | https://emacs.rymcg.tech
105 | https://github.com/EnigmaCurry/emacs
106 |
107 | PUBLIC DOMAIN LICENSE (0BSD)
108 |
109 | Permission to use, copy, modify, and/or distribute this software
110 | for any purpose with or without fee is hereby granted.
111 |
112 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
113 | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
114 | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
115 | AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
116 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
117 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
118 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
119 | CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.[21]
120 |
121 | Some code in this distribution is specifically identified as being
122 | licensed GPLv3. If these files continue to be reproduced, the license
123 | of this entire distribution is modified to GPLv3:
124 |
125 | GNU GENERAL PUBLIC LICENSE
126 | Version 3, 29 June 2007
127 |
128 | Copyright 2025 EnigmaCurry
129 |
130 | This program is free software: you can redistribute it and/or modify
131 | it under the terms of the GNU General Public License as published by
132 | the Free Software Foundation, either version 3 of the License, or
133 | (at your option) any later version.
134 |
135 | This program is distributed in the hope that it will be useful,
136 | but WITHOUT ANY WARRANTY; without even the implied warranty of
137 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
138 | GNU General Public License for more details.
139 |
140 | You should have received a copy of the GNU General Public License
141 | along with this program. If not, see .
142 | #+end_src
143 |
144 | * Dependencies
145 | ** Emacs
146 | You will need a recent version of Emacs.
147 |
148 | #+begin_src shell
149 | #e.g., on Fedora:
150 | sudo dnf install emacs
151 | #+end_src
152 |
153 | #+begin_src emacs-lisp :results replace :exports both
154 | (message (emacs-version))
155 | #+end_src
156 |
157 |
158 | ** Build dependencies
159 |
160 | #+begin_src
161 | #e.g., on Fedora:
162 | sudo dnf install cmake libtool openssl-devel
163 | #+end_src
164 |
165 | ** Rustup and Cargo
166 |
167 | [[https://rustup.rs/][Rustup]] is a tool that installs the latest versions of [[https://www.rust-lang.org/][Rust]] and [[https://doc.rust-lang.org/cargo/][Cargo]]
168 | /in your home directory/. Cargo is a user-space source-package manager
169 | for Rust programs and libraries. This config uses Cargo to install the
170 | optional helper programs used by its modules. Once setup, any
171 | user-space packages installed by Cargo are placed in =~/.cargo/bin=.
172 |
173 | You may be able to find the =rustup= tool in your system package
174 | manager and install it that way:
175 |
176 | #+begin_src shell
177 | # e.g., on Fedora:
178 | sudo dnf install rustup
179 | rustup-init
180 | rustup component add rust-analyzer
181 | #+end_src
182 |
183 | But you can also [[https://rustup.rs/][install it]] the "curl bomb" way on most other systems:
184 |
185 | #+begin_src shell
186 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
187 | rustup component add rust-analyzer
188 | #+end_src
189 |
190 | Cargo packages are declared by Emacs modules themselves:
191 |
192 | #+begin_src emacs-lisp
193 | ;; this example declares the "just" crate needs to be installed.
194 | ;; (the actual install is deferred until later):
195 | (my/cargo-dependency "just")
196 | #+end_src
197 |
198 | All of the crates are installed together [[#cargo-install-my-cargo-dependencies][/after/ all of the modules
199 | have been loaded]].
200 |
201 | ** Git
202 |
203 | Install =git= via your package manager:
204 |
205 | #+begin_src shell
206 | #e.g., Fedora:
207 | sudo dnf install git
208 | #+end_src
209 |
210 | Clone this git repository:
211 |
212 | #+begin_src shell :noweb yes
213 | git clone <>.git \
214 | ~/git/vendor/<>/<>
215 | #+end_src
216 |
217 | Switch to the right branch:
218 |
219 | #+begin_src emacs-lisp :results replace :exports results
220 | (message "git checkout %s" (my/emacs-git-branch))
221 | #+end_src
222 | *** Function to get the current git branch :noexport:
223 | #+begin_src emacs-lisp :tangle "modules/git.el" :mkdirp yes
224 | ;;; function to determine the current git branch -- ignore this in context
225 | (defun my/emacs-git-branch ()
226 | (substring (shell-command-to-string "git branch --show-current") 0 -1))
227 | #+end_src
228 | ** Tree-sitter
229 | Tree-sitter is an optional dependency. It adds advanced syntax tree
230 | parser to language modes.
231 |
232 | #+begin_src shell
233 | #on e.g., Fedora
234 | sudo dnf install libtree-sitter
235 | #+end_src
236 |
237 | ** Create your Emacs config directory
238 |
239 | You can try this config out without modifying your existing config.
240 | The following command tells Emacs to load config directly (ignoring
241 | your existing config):
242 |
243 | #+begin_src shell :noweb yes
244 | emacs --init-directory ~/git/vendor/<>/<>
245 | #+end_src
246 |
247 | If you omit =--init-directory=, the default location Emacs looks for
248 | your config is =~/.emacs.d=
249 |
250 | To set this config as the default, symlink the git repository from
251 | =~/.emacs.d= :
252 |
253 | #+begin_src shell :noweb yes
254 | ln -s ~/git/vendor/<>/<> ~/.emacs.d
255 | #+end_src
256 |
257 | Now when you run =emacs= with no arguments it will load the =init.el=
258 | found in the git repository.
259 |
260 | * Early Init
261 |
262 | The [[file:early-init.el]] is the first config file that is loaded on
263 | Emacs startup. It is used to set an initial visual look and feel
264 | before the GUI is initialized, including an initial dark theme.
265 | Additionally, early debug options are set here.
266 |
267 | #+begin_src emacs-lisp :tangle "early-init.el"
268 | ;; Load an initial theme (will be overriden later in modules/theme/theme.el)
269 | (load-theme 'modus-vivendi)
270 | ;; Set a larger default font size (150 = 15 pt size):
271 | (setq my/default-text-height 150)
272 | (set-face-attribute 'default nil :height my/default-text-height)
273 | ;; Turn off GUI distractions:
274 | (menu-bar-mode -1) ; Press F10 to bring up the menu if you still need it.
275 | (tool-bar-mode -1)
276 | (scroll-bar-mode -1)
277 | (setq inhibit-startup-screen t)
278 | ;; Don't resize the frame when adjusting the font size:
279 | (setq window-resize-pixelwise t)
280 | (setq frame-resize-pixelwise t)
281 | ;; Disable package.el in favor of straight.el
282 | (setq package-enable-at-startup nil)
283 |
284 | ;; Debug options:
285 | ;;; Start Emacs with the `--debug-init` argument, to debug errors during startup.
286 | ;;; Enter debugger on specific logger regex (see *Messages* buffer):
287 | ;; (setq debug-on-message "Example log message to trace")
288 | ;;; M-x toggle-debug-on-error
289 | ;;(setq debug-on-error t)
290 | (setq warning-minimum-level :error)
291 | #+end_src
292 |
293 | * Base config
294 |
295 | This is the base config of [[file:init.el]] which is loaded in all
296 | environments. Only Emacs builtins will be allowed here:
297 |
298 | ** Core libraries
299 |
300 | #+begin_src emacs-lisp :tangle "init.el"
301 | ;; core libraries
302 | (require 'cl-lib)
303 | #+end_src
304 |
305 | ** Nice defaults
306 |
307 | #+begin_src emacs-lisp :tangle "init.el"
308 | ;; Nice defaults
309 | (setq-default confirm-kill-emacs #'yes-or-no-p)
310 | (setq-default vc-follow-symlinks t)
311 | (setq-default indicate-empty-lines t)
312 | (setq-default indicate-buffer-boundaries 'left)
313 | (setq-default sentence-end-double-space nil)
314 | (setq-default indent-tabs-mode nil)
315 | (setq-default tab-width 4)
316 | (setq-default visible-bell t)
317 | (setq-default dired-listing-switches "-al --group-directories-first")
318 | (setq-default tramp-default-method "ssh")
319 | (setq-default native-comp-deferred-compilation-deny-list nil)
320 | (setq-default browse-url-browser-function 'browse-url-firefox)
321 | (setq-default require-final-newline t)
322 | (put 'narrow-to-region 'disabled nil)
323 | (put 'downcase-region 'disabled nil)
324 | (put 'upcase-region 'disabled nil)
325 | #+end_src
326 |
327 | ** Configure file backups and auto-saves
328 |
329 | * Store file backups in =~/.emacs.d/backup= rather than being
330 | littered everywhere else. Backups should store a file snapshot
331 | before /every/ save.
332 | * Store auto-saves in =~/.emacs.d/auto-save=. auto-saves helps you to
333 | not to lose your work /before/ you save, by automatically saving
334 | idle buffers into the auto-save directory.
335 |
336 | #+begin_src emacs-lisp :tangle "init.el"
337 | ;; Backups and auto-save
338 | ;; Reference: https://www.emacswiki.org/emacs/BackupDirectory
339 | ;; Reference: https://www.emacswiki.org/emacs/ForceBackups
340 | (setq backup-by-copying t)
341 | (setq backup-directory-alist
342 | `(("." . ,(expand-file-name "backup" user-emacs-directory))))
343 | (setq delete-old-versions t)
344 | (setq kept-new-versions 6)
345 | (setq kept-old-versions 2)
346 | (setq version-control t)
347 | (setq vc-make-backup-files t)
348 | (add-hook 'before-save-hook
349 | (lambda () (setq buffer-backed-up nil)))
350 | ;; autosaves go in a separate directory
351 | (let ((auto-save-dir (expand-file-name "auto-save" user-emacs-directory)))
352 | (make-directory auto-save-dir t)
353 | (setq auto-save-file-name-transforms
354 | `((".*" ,auto-save-dir t))))
355 | #+end_src
356 |
357 | ** Customization
358 |
359 | Emacs has a powerful [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Easy-Customization.html][customization feature]] and this configuration uses
360 | it for all the user and machine specific settings.
361 |
362 | Enter the interactive customization menu for this config: =M-x
363 | my/custom-settings=
364 |
365 | There are several sub-menus of settings for different modules. You can
366 | change the values for any of the settings and then press =C-x C-s=
367 | (custom-save), and it will save the custom values in
368 | =~/.emacs.d/custom.el=. This file is ignored by the git repository,
369 | and it is used to store persistent custom values for a specific
370 | machine only.
371 |
372 | #+begin_src emacs-lisp :tangle "init.el"
373 | ;; Store customizations in custom.el
374 | (setq custom-file (locate-user-emacs-file "custom.el"))
375 | (when (file-exists-p custom-file)
376 | (load custom-file))
377 | ;; Store all customizations under my/custom-settings group
378 | (defgroup my/custom-settings nil
379 | "My custom Emacs settings"
380 | :group 'emacs)
381 | ;; Shortcut to open custom settings:
382 | (defun my/custom-settings ()
383 | "Open the Emacs customization interface for my custom settings."
384 | (interactive)
385 | (customize-group 'my/custom-settings))
386 | (defalias 'my/settings 'my/custom-settings)
387 | #+end_src
388 |
389 | ** Builtin minor modes to activate everywhere
390 |
391 | #+begin_src emacs-lisp :tangle "init.el"
392 | ;; Global minor modes
393 | (column-number-mode)
394 | (save-place-mode t)
395 | (savehist-mode t)
396 | (recentf-mode t)
397 | (electric-pair-mode t)
398 | #+end_src
399 | ** PATH setup
400 | #+begin_src emacs-lisp :tangle "init.el" :mkdirp yes
401 | ;; Function to add a directory to PATH and exec-path
402 | (defun my/add-exec-path (dir)
403 | "Add DIR to the environment PATH and exec-path if not already present."
404 | (unless (member dir exec-path)
405 | (setenv "PATH" (concat dir path-separator (getenv "PATH")))
406 | (add-to-list 'exec-path dir)))
407 | #+end_src
408 | ** Programming mode
409 |
410 | #+begin_src emacs-lisp :tangle "modules/programming.el" :mkdirp yes
411 | ;; Basic programming mode settings
412 | (setq-default display-fill-column-indicator-column 80)
413 | (add-hook 'prog-mode-hook (lambda ()
414 | (setq show-trailing-whitespace t)
415 | (display-fill-column-indicator-mode 1)
416 | (display-line-numbers-mode 1)))
417 |
418 | ;; Edit .env files with shell-script-mode
419 | (add-to-list 'auto-mode-alist '("\\.env\\'" . shell-script-mode))
420 | (add-to-list 'auto-mode-alist '("\\.env_.*\\'" . shell-script-mode))
421 | (add-to-list 'auto-mode-alist '("\\.env-dist\\'" . shell-script-mode))
422 | #+end_src
423 |
424 | ** Shell processes
425 | #+begin_src emacs-lisp :tangle "init.el"
426 | (defun my/shell-execute (command &optional interactive)
427 | "Run a given shell COMMAND in a new buffer and display its output."
428 | (interactive)
429 | (let* ((command-name (car (split-string command)))
430 | (buffer-name (generate-new-buffer-name (concat "*" command-name " Output*")))
431 | (buffer (get-buffer-create buffer-name)))
432 | (with-current-buffer buffer
433 | (erase-buffer)
434 | (insert "## Running shell process ...\n"))
435 | (start-process-shell-command
436 | command
437 | buffer
438 | command)
439 | (pop-to-buffer buffer)))
440 | #+end_src
441 | * Cargo
442 |
443 | [[https://doc.rust-lang.org/cargo/][Cargo]] is used to install some system programs automatically.
444 |
445 | ** Set cargo binary PATH
446 |
447 | Cargo and all of the helper programs you install go in =~/.cargo/bin=.
448 | Ensure that this path is set (because Emacs might not have read
449 | =~/.bashrc=):
450 |
451 | #+begin_src emacs-lisp :tangle "modules/cargo.el" :mkdirp yes
452 | (my/add-exec-path "~/.cargo/bin")
453 | (unless (executable-find "cargo")
454 | (message "cargo binary NOT found."))
455 | #+end_src
456 |
457 | ** Cargo functions
458 |
459 | #+begin_src emacs-lisp :tangle "modules/cargo.el"
460 | (require 'seq)
461 | (require 'comint)
462 |
463 | (defun my/cargo-package-installed-p (package)
464 | "Check if a given cargo PACKAGE is installed.
465 | PACKAGE can be either a string or a cons cell (CRATE . GIT-URL).
466 | In either case, this function uses the crate name for the check."
467 | (let ((pkg (if (consp package) (car package) package)))
468 | (with-temp-buffer
469 | (when (eq 0 (call-process "cargo" nil t nil "install" "--list"))
470 | (goto-char (point-min))
471 | (search-forward pkg nil t)))))
472 | (defun my/cargo-install (programs)
473 | "Install a list of PROGRAMS via `cargo install`, skipping those already installed.
474 | PROGRAMS can be:
475 | - a single string (with space-separated program names),
476 | - a list of strings,
477 | - or a list where some elements are cons cells (CRATE . GIT-REPO).
478 |
479 | For cons cell entries, Cargo is invoked with the --git flag."
480 | (unless programs
481 | (user-error "No programs specified for cargo install"))
482 | ;; If PROGRAMS is a string, split it into a list.
483 | (setq programs (if (stringp programs)
484 | (split-string programs)
485 | programs))
486 | ;; Remove already installed programs.
487 | (setq programs (seq-remove #'my/cargo-package-installed-p programs))
488 | ;; Separate into two groups:
489 | ;; - crates from crates.io (plain strings or cons cells treated as a name only)
490 | ;; - git dependencies (explicit cons cells)
491 | (let ((crate-names (mapcar (lambda (dep)
492 | (if (consp dep)
493 | (car dep)
494 | dep))
495 | (seq-filter (lambda (dep)
496 | (not (consp dep)))
497 | programs)))
498 | (git-deps (seq-filter #'consp programs)))
499 | ;; Install crates from crates.io in one command, if any.
500 | (when crate-names
501 | (let ((command (concat "cargo install " (string-join crate-names " "))))
502 | (my/shell-execute command)))
503 | ;; Install each git dependency separately.
504 | (dolist (dep git-deps)
505 | (let* ((crate (car dep))
506 | (git-repo (cdr dep))
507 | (command (format "cargo install %s --git %s" crate git-repo)))
508 | (my/shell-execute command)))))
509 | (defvar my/cargo-dependencies nil
510 | "A list of Rust crate dependencies to be installed.
511 | Each dependency is either a crate name (a symbol or string) or a cons cell
512 | of the form (CRATE . GIT-REPO).")
513 |
514 | (defun my/cargo-dependency (crate &optional git-repo)
515 | "Add a Rust CRATE to the list of dependencies.
516 | If GIT-REPO is provided, the dependency is stored as (CRATE . GIT-REPO).
517 | Otherwise, only CRATE is stored.
518 | If the dependency (by crate name) already exists, do nothing."
519 | (unless (cl-find crate my/cargo-dependencies
520 | :test (lambda (d c)
521 | (if (consp d)
522 | (equal (car d) c)
523 | (equal d c))))
524 | (push (if git-repo (cons crate git-repo) crate)
525 | my/cargo-dependencies)))
526 | #+end_src
527 | ** Justfile
528 |
529 | [[https://github.com/casey/just][Just]] is better than Make.
530 |
531 | #+begin_src emacs-lisp :tangle "modules/just/just.el" :mkdirp yes
532 | ;; depend on the just crate so its installed automatically
533 | ;; you must add "just" to the list of my/machine-labels for this to work:
534 | (my/cargo-dependency "just")
535 | #+end_src
536 |
537 | This =Justfile= consolidates commands that operate
538 | on this git repository:
539 |
540 | #+begin_src text :tangle Justfile
541 | set export
542 | current_dir := `pwd`
543 |
544 | # Print this help message for the Justfile targets
545 | help:
546 | @just -l
547 |
548 | # Clean pacage cache
549 | clean:
550 | rm -rf straight eln-cache
551 | #+end_src
552 |
553 | |-------------------------------------|
554 | | Clean package cache (shell command) |
555 | | =just clean= |
556 |
557 | * straight.el and use-package
558 |
559 | [[https://github.com/radian-software/straight.el][straight.el]] replaces the builtin package manager of Emacs
560 | ([[https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/package.el][package.el]]). In return, you can install packages directly from git,
561 | and lock dependencies for reproducible installs. [[https://github.com/jwiegley/use-package][use-package]] is an
562 | Emacs builtin macro that enables declarative package configuration.
563 |
564 | ** Lazy-load straight.el
565 |
566 | #+begin_src emacs-lisp :tangle "init.el"
567 | (defun my/bootstrap-straight (&rest _)
568 | "Bootstrap straight.el only if it's not already installed."
569 | (unless (bound-and-true-p straight--build-dir)
570 | (let ((bootstrap-file
571 | (expand-file-name "straight/repos/straight.el/bootstrap.el"
572 | user-emacs-directory))
573 | (bootstrap-version 5))
574 | (unless (file-exists-p bootstrap-file)
575 | (with-current-buffer
576 | (url-retrieve-synchronously
577 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
578 | 'silent
579 | 'inhibit-cookies)
580 | (goto-char (point-max))
581 | (eval-print-last-sexp)
582 | ))
583 | (load bootstrap-file nil 'nomessage)
584 | (setq straight-use-package-by-default t)
585 | (straight-use-package 'use-package))))
586 | ;; Advise `use-package` to initialize straight.el when first called
587 | (advice-add 'use-package :before #'my/bootstrap-straight)
588 | #+end_src
589 | ** Track packages added via use-package
590 |
591 | #+begin_src emacs-lisp :tangle "init.el"
592 | (defvar my/use-package-tracked-list nil
593 | "A list to track the names of packages declared via `use-package`.")
594 | (defun my/use-package-tracked-list ()
595 | "Display the tracked `use-package` packages in a new buffer, one per line.
596 | If the buffer already exists, delete it and recreate it."
597 | (interactive)
598 | (let ((buffer-name "*Tracked Packages*"))
599 | (when (get-buffer buffer-name)
600 | (kill-buffer buffer-name))
601 | (let ((buffer (get-buffer-create buffer-name)))
602 | (with-current-buffer buffer
603 | (erase-buffer)
604 | (insert "# Packages tracked via use-package:\n")
605 | (if my/use-package-tracked-list
606 | (dolist (pkg (sort my/use-package-tracked-list #'string<))
607 | (insert (format "%s\n" pkg)))
608 | (insert "No packages tracked.\n"))
609 | (read-only-mode 1))
610 | (pop-to-buffer buffer))))
611 | (defun my/use-package-advice (orig-fun &rest args)
612 | "Advice around `use-package' to track package names."
613 | (when (symbolp (car args))
614 | (push (symbol-name (car args)) my/use-package-tracked-list)
615 | (setq my/use-package-tracked-list (delete-dups my/use-package-tracked-list)))
616 | (apply orig-fun args))
617 |
618 | (advice-add 'use-package :around #'my/use-package-advice)
619 | #+end_src
620 |
621 | * Configure which modules to load
622 |
623 | A modular Emacs configuration is designed to serve various roles
624 | running in several different environments. The base config is kept
625 | lean, without any third party modules loaded. Each machine may be
626 | labeled with the names of additional modules to load.
627 |
628 | #+begin_src emacs-lisp :tangle "init.el"
629 | ;; Customize which emacs config modules to load on a per-machine basis:
630 | (defcustom my/machine-labels '()
631 | "List of machine-specific labels to configure which modules to load."
632 | :type '(repeat string)
633 | :group 'my/custom-settings)
634 | (defun my/machine-labels ()
635 | "Return the list of machine-specific labels."
636 | (interactive)
637 | my/machine-labels)
638 | (defun my/machine-has-label (label)
639 | "Check if the current machine is labeled with LABEL."
640 | (if (member label my/machine-labels)
641 | t
642 | nil))
643 | (defun my/machine-labels-available ()
644 | "List all available machine labels"
645 | (let ((modules-dir (expand-file-name "modules" user-emacs-directory)))
646 | (cl-sort (mapcar #'file-name-nondirectory
647 | (seq-filter #'file-directory-p
648 | (directory-files modules-dir t "^[^.]" t))) #'string<)))
649 | (defun my/machine-labels-enable-all nil
650 | "Adds ALL existing machine labels to the custom my/machine-labels"
651 | (interactive)
652 | (let ((modules-dir (expand-file-name "modules" user-emacs-directory)))
653 | (when (y-or-n-p (format "Do you want to enable ALL Emacs modules from %s? " modules-dir))
654 | (progn
655 | (customize-set-variable 'my/machine-labels (my/machine-labels-available))
656 | (customize-save-customized)))))
657 | #+end_src
658 |
659 | Here are the [[https://github.com/EnigmaCurry/emacs/tree/literate-new/modules][available modules]]:
660 |
661 | #+begin_src emacs-lisp :results value replace :exports results
662 | (mapconcat (lambda (x) (format "- %s" x)) (my/machine-labels-available) "\n")
663 | #+end_src
664 |
665 | *All modules are disabled by default! You must customize
666 | =my/machine-labels= on each machine you configure.*
667 |
668 | |--------------------------|
669 | | =M-x my/custom-settings= |
670 |
671 | This will open the customization interface allowing you to set the
672 | list named =My Machine Labels=. For example, add each of the labels
673 | you want to enable for the current machine: =general=, =org=,
674 | =markdown=, etc:
675 |
676 | #+begin_src example
677 | ↓ My Machine Labels:
678 | Repeat:
679 | INS DEL String: general
680 | INS DEL String: org
681 | INS DEL String: markdown
682 | INS
683 | State : SAVED and set.
684 | List of machine-specific labels to configure which modules to load.
685 | #+end_src
686 |
687 | When done, press =C-x C-s= to save the settings.
688 |
689 | If you want to enable ALL existing modules, you can run =M-x
690 | my/machine-labels-enable-all= (the result will be saved in
691 | =custom.el=). (If new modules are added to the git repository, they
692 | will not be enabled until you run this again, or by customizing
693 | =my/machine-labels=.)
694 |
695 | You can then remove any of the modules you don't want, the same way as
696 | before: =M-x my/custom-settings=.
697 |
698 | You should restart Emacs to reload the configured modules from
699 | =custom.el=.
700 |
701 | * Modules
702 | ** Registers (label =registers=)
703 |
704 | Registers are storage compartments in Emacs, which can hold several
705 | different types of things: strings, numbers, buffer positions, frame
706 | configs, etc.
707 |
708 | *** Position registers
709 |
710 | [[info:emacs#Position Registers][Position Registers]] store the point position of buffers, so you can
711 | quickly come back to it from anywhere.
712 |
713 | * =C-c j e= jump to the Emacs config file (=emacs.org=)
714 | * =C-c j o= jump to the user Org notes directory (=my/org-notes-directory=)
715 | * =C-c j g= open the user's git directory (You must customize =my/git-user-directory=)
716 | * =C-c j v= open the vendor git directory (You may customize =my/git-vendor-directory=)
717 | * =C-c j d= open the Docker projects directory ([[https://github.com/EnigmaCurry/d.rymcg.tech][d.rymcg.tech]])
718 |
719 | You should change the following values to suit your own environment by
720 | running =M-x my/custom-settings=. Enter the =My Path Settings=
721 | sub-menu, and change the following settings:
722 |
723 | * =my/git-vendor-directory= Set this to where you clone git
724 | repositories (not necessarily your own. e.g., =~/git/vendor=).
725 | * =my/git-user-directory= Set this to the directory where you store
726 | your /personal/ git repositories (e.g.,
727 | =~/git/vendor/YOUR_USERNAME=).
728 |
729 | #+begin_src emacs-lisp :noweb yes :tangle "modules/registers/registers.el" :mkdirp yes
730 | (defgroup my/path-settings nil
731 | "My custom path settings"
732 | :group 'my/custom-settings)
733 | (defcustom my/git-vendor-directory "~/git/vendor"
734 | "My git vendor directory"
735 | :type 'string
736 | :group 'my/path-settings)
737 | (defcustom my/git-user-directory "~/git/vendor/<>"
738 | "My personal git repositories directory"
739 | :type 'string
740 | :group 'my/path-settings)
741 |
742 | (set-register ?e `(file . ,(expand-file-name "emacs.org" user-emacs-directory)))
743 | (set-register ?o `(file . ,my/org-notes-directory))
744 | (set-register ?g `(file . ,my/git-user-directory))
745 | (set-register ?d `(file . ,(expand-file-name "enigmacurry/d.rymcg.tech/" my/git-vendor-directory)))
746 | (set-register ?v `(file . ,my/git-vendor-directory))
747 | #+end_src
748 |
749 | The =F1=, =F2=, =F3=, and =F4= keys store temporary positions:
750 |
751 | * =C-= jump to register stored in the F1 register.
752 | * =C-= jump to register stored in the F2 register.
753 | * =C-= jump to register stored in the F3 register.
754 | * =C-= jump to register stored in the F4 register.
755 | * =M-= store the current point into the F1 register.
756 | * =M-= store the current point into the F2 register.
757 | * =M-= store the current point into the F3 register.
758 | * =M-= store the current point into the F4 register.
759 |
760 | #+begin_src emacs-lisp :tangle "modules/registers/registers.el" :mkdirp yes
761 | (defun my/register-save-f1 () (interactive) (point-to-register 'my/register-f1))
762 | (defun my/register-jump-f1 () (interactive) (jump-to-register 'my/register-f1))
763 | (defun my/register-save-f2 () (interactive) (point-to-register 'my/register-f2))
764 | (defun my/register-jump-f2 () (interactive) (jump-to-register 'my/register-f2))
765 | (defun my/register-save-f3 () (interactive) (point-to-register 'my/register-f3))
766 | (defun my/register-jump-f3 () (interactive) (jump-to-register 'my/register-f3))
767 | (defun my/register-save-f4 () (interactive) (point-to-register 'my/register-f4))
768 | (defun my/register-jump-f4 () (interactive) (jump-to-register 'my/register-f4))
769 | #+end_src
770 |
771 | ** Theme (label =theme=)
772 |
773 | * [[https://github.com/myTerminal/theme-looper][theme-looper]]
774 | * [[https://github.com/hlissner/emacs-solaire-mode][solaire-mode]]
775 | * [[https://github.com/emacsfodder/emacs-deep-thought-theme][deep-thought]]
776 |
777 | You can cycle the current theme via =C-= and =C-=. As you do
778 | this, the theme will be made persistent by automatically customizing
779 | =my/theme= which is loaded on startup.
780 |
781 | #+begin_src emacs-lisp :tangle "modules/theme/theme.el" :mkdirp yes
782 | (defgroup my/theme-settings nil
783 | "My custom theme settings"
784 | :group 'my/custom-settings)
785 | (defcustom my/theme 'deeper-blue
786 | "Emacs Theme"
787 | :type 'symbol
788 | :group 'my/theme-settings)
789 |
790 | (defun my/theme-update (theme-fn)
791 | "Update the `my/theme` variable with the new theme and call THEME-FN."
792 | (let ((current-theme (car custom-enabled-themes)))
793 | (funcall theme-fn)
794 | (customize-set-variable 'my/theme (car custom-enabled-themes))
795 | (customize-save-customized)
796 | (message "Theme changed to: %s" my/theme)))
797 |
798 | ;; Install themes directly from a git repository:
799 | ;;;NOTE: don't use deep-thought-theme it crashes Emacs 29.4!!
800 | ;;;Keeping this here as an example for loading a theme from git:
801 | ;; (use-package
802 | ;; deep-thought-theme
803 | ;; :straight
804 | ;; (deep-thought-theme :type git :repo "https://github.com/emacsfodder/emacs-deep-thought-theme.git"))
805 | (use-package solaire-mode :init (solaire-global-mode +1))
806 | (use-package theme-looper
807 | :general
808 | ("C-" (lambda () (interactive) (my/theme-update 'theme-looper-enable-previous-theme)))
809 | ("C-" (lambda () (interactive) (my/theme-update 'theme-looper-enable-next-theme))))
810 |
811 | (load-theme my/theme t)
812 | #+end_src
813 | ** Fonts (label =fonts=)
814 | *** List installed font families
815 | #+begin_src emacs-lisp :results replace
816 | (mapconcat (lambda (x) (format "- %s" x))
817 | (delete-dups (sort (font-family-list) #'string<)) "\n")
818 | #+end_src
819 |
820 | *** Install font: JetBrains Mono Nerdfont
821 |
822 | [[https://www.jetbrains.com/lp/mono/][JetBrains Mono typeface]]
823 | [[https://www.nerdfonts.com/font-downloads][Nerd Fonts]]
824 |
825 | #+begin_src emacs-lisp :tangle "modules/fonts/fonts.el" :mkdirp yes
826 | ;;; Download JetBrains Mono typeface
827 | (let* ((url "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/JetBrainsMono.zip")
828 | (zip-file (expand-file-name "JetBrainsMono.zip" temporary-file-directory))
829 | (font-dir (expand-file-name "~/.local/share/fonts/JetBrainsMonoNerdFont/"))
830 | (default-directory temporary-file-directory))
831 | (unless (file-directory-p font-dir)
832 | (url-copy-file url zip-file t)
833 | (make-directory font-dir t)
834 | (let ((output-buffer (generate-new-buffer "*unzip-output*")))
835 | (unwind-protect
836 | (call-process "unzip"
837 | nil output-buffer nil "-j" zip-file "-d" font-dir)
838 | (kill-buffer output-buffer)))
839 | (call-process "fc-cache" nil nil nil "-fv")
840 | (delete-file zip-file)
841 | (message "JetBrains Mono Nerd Font installed successfully.")))
842 | #+end_src
843 | *** Set font faces
844 | #+begin_src emacs-lisp :tangle "modules/fonts/fonts.el" :mkdirp yes
845 | ;;; show list of installed fonts:
846 | ;;(font-family-list)
847 | ;;; show default font:
848 | ;;(face-attribute 'default :font)
849 | ;;; Set default font faces:
850 | ;; M-x my/custom-settings :: font-settings group:
851 | (defgroup my/font-settings nil
852 | "My custom font settings"
853 | :group 'my/custom-settings)
854 | (defcustom my/font-family-default "JetBrainsMono Nerd Font"
855 | "Default font family"
856 | :type 'string
857 | :group 'my/font-settings)
858 | (defcustom my/font-size-default 120
859 | "Default font size"
860 | :type 'string
861 | :group 'my/font-settings)
862 | (defun my/font-settings-apply ()
863 | "Set the default font based on
864 | `my/font-family-default` and `my/font-size-default`."
865 | (set-face-attribute 'default nil
866 | :family my/font-family-default
867 | :height my/font-size-default)
868 | t)
869 | (my/font-settings-apply)
870 | (add-hook 'after-init-hook #'my/font-settings-apply)
871 | (advice-add 'custom-save-all :after (lambda ()
872 | "Re-apply custom settings after saving customizations."
873 | (my/font-settings-apply)))
874 |
875 | ;; Use nerd icons
876 | (use-package nerd-icons
877 | :custom
878 | (nerd-icons-font-family "JetBrainsMono Nerd Font"))
879 | #+end_src
880 |
881 | Run =M-x my/custom-settings= and go to the font customize sub-menu.
882 | Choose your default font family and font size for your machine. Use
883 | =M-x describe-char= and =M-x describe-font= to help debug font
884 | selection.
885 |
886 | *** Preview fonts
887 |
888 | * [[https://protesilaos.com/emacs/show-font][show-font]]
889 |
890 | #+begin_src emacs-lisp :tangle "modules/fonts/fonts.el" :mkdirp yes
891 | (use-package show-font)
892 | #+end_src
893 |
894 | #+begin_src emacs-lisp
895 | (setq show-font-pangram
896 | (concat "A wizard’s job is to vex chumps quickly in fog."
897 | "\n\t٩(-̮̮̃-̃)۶ ٩(●̮̮̃•̃)۶ ٩(͡๏̯͡๏)۶ ٩(-̮̮̃•̃)."
898 | "\n\tΣὲ γνωρίζω ἀπὸ τὴν κόψη"))
899 | (show-font-list)
900 | #+end_src
901 | ** General keybindings manager (label =general=)
902 |
903 | * [[https://github.com/noctuid/general.el?tab=readme-ov-file#readme][general.el]]
904 |
905 | #+begin_src emacs-lisp :tangle "modules/general/general.el" :mkdirp yes
906 | (use-package
907 | general
908 | :init
909 | ;; Switch between two most recent buffers:
910 | (fset 'quick-switch-buffer [?\C-x ?b return])
911 | :config
912 | ;;; Custom global bindings:
913 | (general-define-key
914 | "C-h B" 'general-describe-keybindings
915 | "s-b" 'quick-switch-buffer
916 | "s-B" 'buffer-menu-other-window
917 | "C-x B" 'buffer-menu-other-window
918 | "s-o" 'browse-url
919 | "C-;" 'comment-region ; C-u C-; to uncomment
920 | "s-" 'mouse-drag-region-rectangle
921 | "C-x j" 'jump-to-register
922 | "C-c j" 'jump-to-register
923 | "C-" 'my/register-jump-f1
924 | "M-" 'my/register-save-f1
925 | "C-" 'my/register-jump-f2
926 | "M-" 'my/register-save-f2
927 | "C-" 'my/register-jump-f3
928 | "M-" 'my/register-save-f3
929 | "C-" 'my/register-jump-f4
930 | "M-" 'my/register-save-f4
931 | )
932 | ;;; Put the Emacs default keybindings you want included
933 | ;;; in general-describe-keybindings here:
934 | ;;; Its useful to duplicate these simply as a way of documentation:
935 | (general-define-key
936 | "M-SPC" 'cycle-spacing ; If you document it, you will use it.
937 | "M-h" 'mark-paragraph ; C-h B is like your personal cheat sheet.
938 | "C-h b" 'describe-bindings ;; default binding for documentation purpose
939 | "C-x 4 c" 'clone-indirect-buffer-other-window ;; default binding
940 | )
941 | ;;; Define bindings for specific builtin (non use-package) modes:
942 | ;; Emacs Lisp mode bindings:
943 | (general-define-key
944 | :keymaps 'emacs-lisp-mode-map
945 | "s-e" 'eval-defun ;eval top-level form
946 | "M-;" 'paredit-comment-dwim)
947 | ;; Dired mode bindings:
948 | (general-define-key
949 | :keymaps 'dired-mode-map "C-c C-q" 'dired-toggle-read-only))
950 | #+end_src
951 | ** Which key (label =which-key=)
952 |
953 | * [[https://github.com/justbur/emacs-which-key][which-key]]
954 |
955 | #+begin_src emacs-lisp :tangle "modules/which-key/which-key.el" :mkdirp yes
956 | ;; which-key (shows keyboard shortcut completions) :: https://github.com/justbur/emacs-which-key
957 | (use-package which-key :config (which-key-mode))
958 | #+end_src
959 | ** Org mode (label =org=)
960 |
961 | * [[https://orgmode.org/][org-mode]]
962 |
963 | #+begin_src emacs-lisp :tangle "modules/org/org.el"
964 | ;; hydra (rapid fire mnemonic keybindings) :: https://github.com/abo-abo/hydra
965 | (use-package hydra)
966 | (use-package org
967 | :after hydra
968 | :hook ((org-mode . flyspell-mode)
969 | (org-mode . unpackaged/org-export-html-with-useful-ids-mode))
970 | :custom
971 | (org-html-validation-link nil)
972 | (org-html-use-infojs nil)
973 | (org-html-postamble 'auto)
974 | (org-export-with-author t)
975 | (org-export-with-date t)
976 | (org-export-with-creator nil)
977 | (org-export-with-email nil)
978 | (org-export-timestamp-file t)
979 | (org-export-allow-bind-keywords t)
980 | (org-directory "~/Org")
981 | :general
982 | ("s-" 'org-previous-visible-heading)
983 | ("s-" 'org-next-visible-heading)
984 | ("C-c o k" 'org-babel-remove-result)
985 | :config
986 | (setq org-startup-folded t)
987 | (defun my-org-html--translate (original-function keyword info)
988 | "Custom advice to translate the keyword 'Created' to 'Last Modified'."
989 | (if (string-equal keyword "Created")
990 | "Last Modified"
991 | (funcall original-function keyword info)))
992 | (advice-add 'org-html--translate :around #'my-org-html--translate)
993 | (org-babel-do-load-languages
994 | 'org-babel-load-languages
995 | '((python . t) (scheme . t) (shell . t) (ditaa . t)))
996 | :init
997 | (defcustom my/org-notes-directory "~/Org/notes" "My org notes directory")
998 | (defcustom my/org-notes-export-directory "~/Org/export/notes" "My org notes HTML export directory")
999 | ;; Hydra for commonly used org commands:
1000 | (defhydra
1001 | hydra-org
1002 | (global-map "C-c o" :exit t color pink :hint nil)
1003 | "Org commands:"
1004 | ("o" my/org-open-file)
1005 | ("l" org-store-link "store link")
1006 | ("i" org-insert-link "insert link")
1007 | ("a" org-agenda "agenda")
1008 | ("c" org-capture "capture")
1009 | ("m" org-info "read info manual")
1010 | ("e" org-export-dispatch "export")
1011 | ("p" org-preview-html-mode "toggle preview mode")
1012 | ("s" org-insert-source-code-block "insert source code block"))
1013 | )
1014 | (require 'org-tempo) ; required for Structure Templates
1015 | ; See https://orgmode.org/manual/Structure-Templates.html
1016 | (use-package htmlize) ; required for colorized HTML code blocks
1017 | (use-package org-preview-html :after org)
1018 | (use-package ob-async)
1019 | (progn ; electic pairs for org-mode
1020 | (modify-syntax-entry ?/ "\"" org-mode-syntax-table)
1021 | (modify-syntax-entry ?* "\"" org-mode-syntax-table)
1022 | (modify-syntax-entry ?= "\"" org-mode-syntax-table)
1023 | (modify-syntax-entry ?+ "\"" org-mode-syntax-table)
1024 | (modify-syntax-entry ?_ "\"" org-mode-syntax-table)
1025 | (modify-syntax-entry ?~ "\"" org-mode-syntax-table))
1026 | #+end_src
1027 |
1028 | #+begin_src emacs-lisp :tangle "~/Org/notes/.dir-locals.el" :mkdirp yes
1029 | ((org-mode
1030 | . ((org-confirm-babel-evaluate . nil)
1031 | (eval .
1032 | (add-hook 'after-save-hook
1033 | (lambda ()
1034 | (when (and buffer-file-name
1035 | (string= "org" (file-name-extension buffer-file-name)))
1036 | (my/org-babel-tangle buffer-file-name)))
1037 | nil t))))))
1038 | #+end_src
1039 |
1040 | *** Tangle Emacs config and write HTML document
1041 |
1042 | This function tangles this file (=emacs.org=) and exports an HTML page
1043 | (=emacs.html=):
1044 |
1045 | #+begin_src emacs-lisp :tangle "modules/org/org.el" :mkdirp yes
1046 | (defcustom my/org-html-theme "simple_dark" "the name of my custom org theme (CSS)")
1047 | (defun my/emacs-org-tangle ()
1048 | "Tangle all code blocks in 'emacs.org' and export this document to HTML."
1049 | (let* ((org-file (expand-file-name "emacs.org" user-emacs-directory))
1050 | (modules-dir (expand-file-name "modules" user-emacs-directory))
1051 | (export-dir (expand-file-name my/org-notes-export-directory))
1052 | (export-emacs-dir (expand-file-name "emacs" export-dir))
1053 | (export-file (expand-file-name "index.html" user-emacs-directory)))
1054 | (when (file-exists-p org-file)
1055 | (with-current-buffer (find-file-noselect org-file)
1056 | (delete-directory modules-dir t)
1057 | (org-babel-tangle)
1058 | (org-export-to-file 'html export-file)
1059 | (unless (file-directory-p export-dir)
1060 | (make-directory export-dir t))
1061 | (unless (file-directory-p export-emacs-dir)
1062 | (make-directory export-emacs-dir t))
1063 | (my/org-create-theme-file)
1064 | (make-symbolic-link "index.html" "emacs.html" t)
1065 | (make-symbolic-link (expand-file-name "index.html" user-emacs-directory) (expand-file-name "index.html" export-emacs-dir) t)
1066 | (make-symbolic-link (expand-file-name "index.html" user-emacs-directory) (expand-file-name "emacs.html" export-emacs-dir) t)
1067 | (make-symbolic-link (expand-file-name "early-init.el" user-emacs-directory) (expand-file-name "early-init.el" export-emacs-dir) t)
1068 | (make-symbolic-link (expand-file-name "init.el" user-emacs-directory) (expand-file-name "init.el" export-emacs-dir) t)
1069 | (make-symbolic-link (expand-file-name "modules" user-emacs-directory) (expand-file-name "modules" export-emacs-dir) t)
1070 | (make-symbolic-link (expand-file-name "LICENSE.txt" user-emacs-directory) (expand-file-name "LICENSE.txt" export-emacs-dir) t)
1071 | (make-symbolic-link (expand-file-name "LICENSE_GPLv3.txt" user-emacs-directory) (expand-file-name "LICENSE_GPLv3.txt" export-emacs-dir) t)
1072 | (make-symbolic-link (expand-file-name "theme" user-emacs-directory) (expand-file-name "theme" export-dir) t)
1073 | (make-symbolic-link (expand-file-name "theme" user-emacs-directory) (expand-file-name "theme" my/org-notes-directory) t)
1074 | ))))
1075 | (with-eval-after-load 'ox-html
1076 | (defun my/org-html-src-block (orig-fun src-block contents info)
1077 | "Advice for `org-html-src-block' to add a header.
1078 | If a :tangle header is specified (and not \"no\"), it shows the tangle file.
1079 | If the block is a shell block, it prints 'Run in Bash shell:'.
1080 | Otherwise, it prints the code block's language.
1081 | ORIG-FUN is the original function; SRC-BLOCK is the source block;
1082 | INFO is the export options plist."
1083 | (let* ((parameters (org-element-property :parameters src-block))
1084 | (header-args (org-babel-parse-header-arguments parameters))
1085 | (tangle (cdr (assoc :tangle header-args)))
1086 | (lang (org-element-property :language src-block))
1087 | (header (cond
1088 | ((and tangle (not (string= tangle "no")))
1089 | (format "