Merge branch 'develop' of https://github.com/hlissner/doom-emacs into add-lsp-command-map

This commit is contained in:
James Ravn 2020-05-04 10:04:23 +01:00
commit fb3c6f9d78
No known key found for this signature in database
GPG key ID: 52C372C72159D6EE
205 changed files with 2592 additions and 1819 deletions

View file

@ -15,12 +15,13 @@ labels: is:update re:packages
> >
> OR, if multiple packages are bumped in one commit: > OR, if multiple packages are bumped in one commit:
> >
> Bump package1, package2 & package 3 > Bump :tools lsp
> >
> emacs-lsp/lsp-mode@91e37a6 -> emacs-lsp/lsp-mode@c8188ef > emacs-lsp/lsp-mode@91e37a6 -> emacs-lsp/lsp-mode@c8188ef
> emacs-lsp/lsp-ui@cf6906c -> emacs-lsp/lsp-ui@582e153 > emacs-lsp/lsp-ui@cf6906c -> emacs-lsp/lsp-ui@582e153
> >
> (Commit hashes should be limited to 7 characters) > Commit hashes should be limited to 7 characters. Include additional
> commentary after the list of commit changes.
> >
> 4. You've included links to relevant issues, if any > 4. You've included links to relevant issues, if any
> 5. You've deleted this template > 5. You've deleted this template

366
README.md
View file

@ -1,185 +1,253 @@
<a href="http://doomemacs.org"> <div align="center">
<img src="https://img.shields.io/github/tag/hlissner/doom-emacs.svg?label=release&color=orange&style=for-the-badge" alt="Made with Doom Emacs">
</a> # Doom Emacs
<a href="https://emacs.org">
<img src="https://img.shields.io/badge/Supports-26.1_--_27.0.50-blueviolet.svg?style=for-the-badge&logo=GNU%20Emacs&logoColor=white" alt="Supports Emacs 26.x - 27.0.50"> [Install](#install) • [Documentation] • [FAQ] • [Screenshots] • [Contribute](#contribute)
</a>
<a href="https://github.com/hlissner/doom-emacs/actions"> ![Made with Doom Emacs](https://img.shields.io/github/tag/hlissner/doom-emacs.svg?style=flat-square&label=release&color=58839b)
<img src="https://github.com/hlissner/doom-emacs/workflows/CI/badge.svg" alt="Build status: develop"> ![Supports Emacs 26-27](https://img.shields.io/badge/Supports-Emacs_26.1_--_27.x-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white)
</a> ![Latest commit](https://img.shields.io/github/last-commit/hlissner/doom-emacs/develop?style=flat-square)
<a href="https://discord.gg/qvGgnVx"> ![Build status: develop](https://img.shields.io/github/workflow/status/hlissner/doom-emacs/CI/develop?style=flat-square)
<img src="https://img.shields.io/badge/Discord-blue.svg?logo=discord&label=join&style=for-the-badge" alt="Join our discord server" align="right"> [![Discord Server](https://img.shields.io/discord/406534637242810369?color=blue&label=Discord%20Chat&logo=discord&logoColor=white&style=flat-square)][Discord]
</a>
<br><br>
![Doom Emacs Screenshot](https://raw.githubusercontent.com/hlissner/doom-emacs/screenshots/main.png) ![Doom Emacs Screenshot](https://raw.githubusercontent.com/hlissner/doom-emacs/screenshots/main.png)
<p align="center"> </div>
<b><a href="/../../tree/screenshots">Screenshots</a></b>
|
<b><a href="docs/getting_started.org">Get started</a></b>
|
<b><a href="docs/contributing.org">Contribute</a></b>
|
<b><a href="docs/index.org">Documentation</a></b>
|
<b><a href="docs/faq.org">FAQ</a></b>
</p>
--- ---
**Quick start** ### Table of Contents
- [Introduction](#introduction)
1. **Install Emacs 26.1+**. 27 is recommended. _28+ is not supported_.
2. Install [ripgrep](https://github.com/BurntSushi/ripgrep) 11.0+.
3. Windows and BSD users will need GNU Find.
4. Clone Doom and run its installer:
```bash
git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.emacs.d/bin/doom install
```
Find more detailed install instructions [in the
documentation](docs/getting_started.org#install).
**Table of Contents**
- [What is Doom Emacs](#what-is-doom-emacs)
- [Doom's mantras](#dooms-mantras)
- [Features](#features) - [Features](#features)
- [Getting Help](#getting-help) - [Prerequisites](#prerequisites)
- [Community](#community) - [Install](#install)
- [Troubleshooting](#troubleshooting) - [Roadmap](#roadmap)
- [Getting help](#getting-help)
- [Contributing](#contributing) - [Contributing](#contributing)
# What is Doom Emacs
# Introduction
<a href="http://ultravioletbat.deviantart.com/art/Yay-Evil-111710573"> <a href="http://ultravioletbat.deviantart.com/art/Yay-Evil-111710573">
<img src="https://github.com/hlissner/doom-emacs/raw/screenshots/cacochan.png" align="right" /> <img src="https://raw.githubusercontent.com/hlissner/doom-emacs/screenshots/cacochan.png" align="right" />
</a> </a>
It is a story as old as time. A stubborn, shell-dwelling, and melodramatic > It is a story as old as time. A stubborn, shell-dwelling, and melodramatic
vimmer -- envious of the features of modern text editors -- spirals into despair > vimmer—envious of the features of modern text editors—spirals into
before succumbing to the [dark side][url:evil-mode]. This is his config. > despair before he succumbs to the [dark side][evil-mode]. This is his config.
Doom is a configuration framework for [GNU Doom is a configuration framework for [GNU Emacs] tailored for Emacs bankruptcy
Emacs](https://www.gnu.org/software/emacs/) tailored for Emacs bankruptcy veterans who want less framework in their frameworks, a modicum of stability
veterans who want less framework in their frameworks and the performance of a (and reproducibility) from their package manager, and the performance of a hand
hand rolled config (or better). It can be a foundation for your own config or a rolled config (or better). It can be a foundation for your own config or a
resource for Emacs enthusiasts to learn more about our favorite OS. resource for Emacs enthusiasts to learn more about our favorite operating
system.
## Doom's mantras Its design is guided by these mantras:
- **Gotta go fast.** Startup and run-time performance are priorities. Doom goes + **Gotta go fast.** Startup and run-time performance are priorities. Doom goes
beyond lazy loading packages by modifying them to be snappier and load lazier! beyond by modifying packages to be snappier and load lazier.
- **Close to metal.** There's less between you and vanilla Emacs by design. + **Close to metal.** There's less between you and vanilla Emacs by design.
There's less to grok, on top of Emacs. That's less to grok and less to work around when you tinker. Internals ought
- **Readability counts.** Internals ought to be written as if reading them were to be written as if reading them were part of Doom's UX, and it is!
part of the user experience, and it is! Modules should be syntactically sweet. + **Opinionated, but not stubborn.** Doom is about reasonable defaults and
Backend logic should be functional (as much as elisp permits), abstraction curated opinions, but use as little or as much of it as you like.
light and (hopefully) documented. + **Your system, your rules.** You know better. At least, Doom hopes so! It
- **Opinionated, but not stubborn.** Doom is a bundle of reasonable defaults and won't *automatically* install system dependencies (and will force plugins not
curated opinions, but all of it should be optional. Use as little or as much to either). Rely on `doom doctor` to tell you what's missing.
of it as you like. + **Nix/Guix was a great idea!** The Emacs ecosystem is temperamental. Things
- **Your system, your rules.** There are more ways to set up your development break and they break often. Disaster recovery should be a priority! Doom's
environment than there are dislikes on Youtube Rewind '18, so Doom leaves it package management should be declarative and your private config reproducible,
to you. Doom will not *automatically* install system dependencies (and will and comes with a means to roll back releases and updates (still a WIP).
coerce its plugins not to do so either). Use `doom doctor` to figure out
what's missing.
## Features Check out [the FAQ][FAQ] for answers to common questions about the project.
# Features
- Minimalistic good looks inspired by modern editors. - Minimalistic good looks inspired by modern editors.
- A modular architecture that can be extended to your own configs.
- A standard library suited to simplifying your config.
- A declarative [package management system][doom:packages] (powered by
[straight.el][url:straight]) with a command line interface. Install packages
from anywhere, not just (M)ELPA.
- (Optional) Vim-emulation powered by [evil-mode][url:evil-mode], including
ports of popular vim plugins and functionality.
- Curated and sane defaults for many packages, (major) OSes, and Emacs itself. - Curated and sane defaults for many packages, (major) OSes, and Emacs itself.
- A modular organizational structure for separating concerns in your config.
- A standard library designed to simplify your elisp bike shedding.
- A declarative [package management system][package-management] (powered by
[straight.el]) with a command line interface. Install packages from anywhere,
not just (M)ELPA, and pin them to any commit.
- Optional vim emulation powered by [evil-mode], including ports of popular vim
plugins like [vim-sneak], [vim-easymotion], [vim-unimpaired] and
[more][ported-vim-plugins]!
- Opt-in LSP integration for many languages, using [lsp-mode].
- Support for *many* programming languages. Includes syntax highlighting, - Support for *many* programming languages. Includes syntax highlighting,
linters/checker integration, inline code evaluation, code completion (where linters/checker integration, inline code evaluation, code completion (where
possible), REPLs, documentation lookups, snippets, and more! possible), REPLs, documentation lookups, snippets, and more!
- Support for *many* tools, like docker, pass, ansible, terraform, and more. - Support for *many* tools, like docker, pass, ansible, terraform, and more.
- A Spacemacs-esque [keybinding scheme][doom:bindings], centered around leader - A Spacemacs-esque [keybinding scheme][bindings], centered around leader
and localleader prefix keys (<kbd>SPC</kbd> and <kbd>SPC</kbd><kbd>m</kbd>, by and localleader prefix keys (<kbd>SPC</kbd> and <kbd>SPC</kbd><kbd>m</kbd> for
default). evil users, <kbd>C-c</kbd> and <kbd>C-c l</kbd> for vanilla users).
- A rule-based [popup management system][doom:popups] to control how temporary - A rule-based [popup manager][popup-system] to control how temporary buffers
or disposable buffers are displayed (and disposed of). are displayed (and disposed of).
- Automatic indentation detection and [editorconfig][url:editorconfig] - Per-file indentation style detection and [editorconfig] integration. Let
integration. Let someone else argue about tabs vs **\_\***spaces**\*\_**. someone else can argue about tabs vs **_spaces_**.
- Project-management tools and framework-specific minor modes with their own - Project-management tools and framework-specific minor modes with their own
snippets libraries. snippets libraries.
- Project search (and replace) utilities, powered by [ripgrep][url:ripgrep]. - Project search (and replace) utilities, powered by [ripgrep] and [ivy] or
[helm].
- Isolated and persistent workspaces (also substitutes for vim tabs). - Isolated and persistent workspaces (also substitutes for vim tabs).
- An envvar file generator that captures a snapshot of your shell environment - Support for Chinese and Japanese input systems.
for Doom to load at startup. No more struggling to get Emacs to inherit your - Save a snapshot of your shell environment to a file for Emacs to load at
`PATH`, among other things. startup. No more struggling to get Emacs to inherit your `PATH`, among other
things.
# Getting Help
## Community # Prerequisites
+ Git 2.23+
+ Emacs 26.1+ (*27 is recommended*) with GNUTLS support
+ [ripgrep] 11.0+
+ GNU `find`
+ *OPTIONAL:* [fd] 7.3.0+ (improves file indexing performance for some commands)
We have [a Discord server][url:discord]! Hop on and say hi! Doom is comprised of [~150 optional modules][Modules], some of which may have
additional dependencies. [Visit their documentation][Modules] or run `bin/doom
doctor` to check for any that you may have missed.
## Troubleshooting
Encountered a problem? Here are some things to try before shooting off that bug # Install
report: ``` sh
git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.emacs.d/bin/doom install
```
- Run `bin/doom sync`. This ensures Doom is properly set up and its autoloads Then [read our Getting Started guide][getting-started] to be walked through
files are up-to-date. installing, configuring and maintaining Doom Emacs.
- Folks who have byte-compiled their config (with `bin/doom compile`) should run
`bin/doom clean` to rule out stale bytecode. Never debug with a byte-compiled It's a good idea to add `~/.emacs.d/bin` to your `PATH`! Other `bin/doom`
config. It makes your job harder. commands you should know about:
- Run `bin/doom doctor` to detect common issues in your development environment
and missing third party dependencies. + `doom sync` to synchronize your private config with Doom. Installs new
- Search [Doom's issue tracker][github:issues] in case your issue was already packages, removes orphaned packages and regenerates caches. Run this whenever
you modify your private `init.el` or `packages.el`, or install/remove an Emacs
package through your OS package manager (e.g. mu4e or agda).
+ `doom upgrade` to update Doom to the latest release & all installed packages.
+ `doom doctor` to diagnose common issues with your system and config.
+ `doom env` to dump a snapshot of your shell environment to a file that Doom
will load at startup. This allows Emacs to inherit your `PATH`, among other
things.
+ `doom build` to recompile all installed packages (use this if you up/downgrade
Emacs).
# Roadmap
Doom is an active and ongoing project. To make that development more
transparent, its roadmap (and other concerns) are published across three github
project boards and a newsletter:
+ [Development Roadmap](https://github.com/hlissner/doom-emacs/projects/3):
roughly outlines our goals between release milestones and their progress.
+ [Plugins under review](https://github.com/hlissner/doom-emacs/projects/2):
lists plugins we are watching and considering for inclusion, and what their
status for inclusion is. Please consult this list before requesting new
packages/features.
+ [Upstream bugs](https://github.com/hlissner/doom-emacs/projects/5): lists
issues that originate from elsewhere, and whether or not we have local
workarounds or temporary fixes for them.
+ ~~Doom's newsletter~~ (not finished) will contain changelogs in between
releases.
# Getting help
Emacs is no journey of a mere thousand miles. You _will_ run into problems and
mysterious errors. When you do, here are some places you can look for help:
+ [Our documentation][documentation] covers many use cases.
+ [The Configuration section][configuration] covers how to configure Doom and
its packages.
+ [The Package Management section][package-management] covers how to install
and disable packages.
+ [This section][bin/doom] explains the `bin/doom` script's most important
commands.
+ [This section][common-mistakes] lists some common configuration mistakes new
users make, when migrating a config from another distro or their own.
+ [This answer][change-theme] shows you how to add your own themes to your
private config.
+ [This answer][change-font] shows you how to change the default font.
+ Your issue may be documented in the [FAQ].
+ With Emacs built-in help system documentation is a keystroke away:
+ For functions: <kbd>SPC h f</kbd> or <kbd>C-h f</kbd>
+ For variables: <kbd>SPC h v</kbd> or <kbd>C-h v</kbd>
+ For a keybind: <kbd>SPC h k</kbd> or <kbd>C-h k</kbd>
+ To search available keybinds: <kbd>SPC h b b</kbd> or <kbd>C-h b b</kbd>
+ Run `bin/doom doctor` to detect common issues with your development
environment and private config.
+ Check out the [FAQ], in case your question has already been answered.
+ Search [Doom's issue tracker](/issues) in case your issue was already
reported. reported.
- [Visit our FAQ][docs:faq] to see if your issue is listed. + Hop on [our Discord server][discord]; it's active and friendly! Keep an eye on
the #announcements channel, where I announce breaking updates and releases.
If all else fails, [file that bug report][github:new-issue]! **Please do not
ignore the issue template!** It's a great help if you can [include a backtrace
with errors][docs:backtrace].
## Contributing
Doom (and my Emacs work in general) is a labor of love and incurable madness,
done on my spare time. If you'd like to support my work, there are many things
you can do to help. I welcome contributions!
- I love pull requests and bug reports. Check out the [Contributing
Guidelines][docs:contributing] to find out how you can help out.
- I welcome Elisp pointers! Don't hesitate to [tell me my Elisp-fu
sucks][github:new-issue] (but please tell me why).
- Hop on [our Discord server][url:discord] and say hi! Help others out, hang out
or talk to me about Emacs, or gamedev, or programming, machine learning,
physics, pixel art, anime, gaming -- anything you like. Nourish this lonely
soul!
- If you'd like to support my work financially, consider buying me a drink
through [liberapay][url:liberapay] or [paypal][url:paypal]. Donations are a
great help. My work here contends with studies, ventures in indie gamedev, and
my freelance work.
[docs:wiki]: docs/index.org # Contribute
[docs:wiki-quickstart]: docs/getting_started.org [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[docs:wiki-modules]: docs/index.org#Module%20List [![Elisp styleguide](https://img.shields.io/badge/elisp-style%20guide-purple?style=flat-square)](https://github.com/bbatsov/emacs-lisp-style-guide)
[docs:wiki-customization]: docs/getting_started.org#Customize [![Donate on liberapay](https://img.shields.io/badge/liberapay-donate-1.svg?style=flat-square&logo=liberapay&color=blue)][liberapay]
[docs:contributing]: docs/contributing.org [![Donate on paypal](https://img.shields.io/badge/paypal-donate-1?style=flat-square&logo=paypal&color=blue)][paypal]
[docs:faq]: docs/faq.org
[docs:backtrace]: https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#how-to-extract-a-backtrace-from-an-error Doom is a labor of love and incurable madness, but I'm only one guy. Doom
[github:new-issue]: https://github.com/hlissner/doom-emacs/issues/new wouldn't be where it is today without your help. I welcome contributions of any
[github:issues]: https://github.com/hlissner/doom-emacs/issues kind!
[doom:bindings]: modules/config/default/+evil-bindings.el
[doom:packages]: core/autoload/packages.el + I :heart: pull requests and bug reports (see the [Contributing
[doom:popups]: modules/ui/popup/README.org Guidelines][contribute])!
[url:discord]: https://discord.gg/qvGgnVx + Don't hesitate to [tell me my Elisp-fu
[url:liberapay]: https://liberapay.com/hlissner/donate sucks](https://github.com/hlissner/doom-emacs/issues/new), but please tell me
[url:paypal]: https://paypal.me/henriklissner/10 why.
[url:editorconfig]: http://editorconfig.org/ + Hop on [our Discord server][Discord] and say hi! Help others, hang out or talk
[url:evil-mode]: https://github.com/emacs-evil/evil to me about Emacs, gamedev, programming, physics, pixel art, anime, gaming --
[url:ripgrep]: https://github.com/BurntSushi/ripgrep anything you like. Nourish this lonely soul.
[url:straight]: https://github.com/raxod502/straight.el + If you'd like to support my work financially, buy me a drink through
[liberapay] or [paypal]. My work contends with studies, adventures in indie
gamedev and freelance work. Donations help me allocate more time to my Emacs
and OSS capers.
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/0)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/0)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/1)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/1)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/2)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/2)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/3)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/3)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/4)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/4)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/5)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/5)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/6)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/6)
[![](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/images/7)](https://sourcerer.io/fame/hlissner/hlissner/doom-emacs/links/7)
[contribute]: docs/contributing.org
[discord]: https://discord.gg/qvGgnVx
[documentation]: docs/index.org
[faq]: docs/faq.org
[getting-started]: docs/getting_started.org
[install]: docs/getting_started.org#install
[backtrace]: docs/getting_started.org#how-to-extract-a-backtrace-from-an-error
[configuration]: docs/getting_started.org#configuring-doom
[package-management]: docs/getting_started.org#package-management
[bin/doom]: docs/getting_started.org#the-bindoom-utility
[common-mistakes]: docs/getting_started.org#common-mistakes-when-configuring-doom-emacs
[change-theme]: docs/faq.org#how-do-i-change-the-theme
[change-font]: docs/faq.org#how-do-i-change-the-fonts
[modules]: docs/modules.org
[popup-system]: modules/ui/popup/README.org
[screenshots]: #screenshots
[bindings]: modules/config/default/+evil-bindings.el
[editorconfig]: http://editorconfig.org/
[evil-mode]: https://github.com/emacs-evil/evil
[fd]: https://github.com/sharkdp/fd
[gnu emacs]: https://www.gnu.org/software/emacs/
[helm]: https://github.com/emacs-helm/helm
[ivy]: https://github.com/abo-abo/swiper
[lsp-mode]: https://github.com/emacs-lsp/lsp-mode
[nix]: https://nixos.org
[ported-vim-plugins]: modules/editor/evil/README.org#ported-vim-plugins
[ripgrep]: https://github.com/BurntSushi/ripgrep
[straight.el]: https://github.com/raxod502/straight.el
[vim-easymotion]: https://github.com/easymotion/vim-easymotion
[vim-lion]: https://github.com/tommcdo/vim-lion
[vim-sneak]: https://github.com/justinmk/vim-sneak
[vim-unimpaired]: https://github.com/tpope/vim-unimpaired
[liberapay]: https://liberapay.com/hlissner/donate
[paypal]: https://paypal.me/henriklissner/10

View file

@ -1,95 +0,0 @@
;;; core/autoload/cache.el -*- lexical-binding: t; -*-
;; This little library thinly wraps around persistent-soft (which is a pcache
;; wrapper, how about that). It has three purposes:
;;
;; + To encapsulate the cache backend (persistent-soft/pcache in this case), in
;; case it needs to change.
;; + To provide `doom-cache-persist': a mechanism for easily persisting
;; variables across Emacs sessions.
;; + To lazy-load persistent-soft until it is really needed.
;;
;; Like persistent-soft, caches assume a 2-tier structure, where all caches are
;; namespaced by location.
(defvar doom-cache-alists '(t)
"An alist of alists, containing lists of variables for the doom cache library
to persist across Emacs sessions.")
(defvar doom-cache-location 'doom
"The default location for cache files. This symbol is translated into a file
name under `pcache-directory' (by default a subdirectory under
`doom-cache-dir'). One file may contain multiple cache entries.")
(defun doom-save-persistent-cache-h ()
"Hook to run when an Emacs session is killed. Saves all persisted variables
listed in `doom-cache-alists' to files."
(dolist (alist (butlast doom-cache-alists 1))
(cl-loop with key = (car alist)
for var in (cdr alist)
if (symbol-value var)
do (doom-cache-set var it nil key))))
(add-hook 'kill-emacs-hook #'doom-save-persistent-cache-h)
;;
;; Library
;;;###autoload
(defmacro with-cache! (location &rest body)
"Runs BODY with a different default `doom-cache-location'."
(declare (indent defun))
`(let ((doom-cache-location ',location))
,@body))
;;;###autoload
(defun doom-cache-persist (location variables)
"Persist VARIABLES (list of symbols) in LOCATION (symbol).
This populates these variables with cached values, if one exists, and saves them
to file when Emacs quits.
Warning: this is incompatible with buffer-local variables."
(dolist (var variables)
(when (doom-cache-exists var location)
(set var (doom-cache-get var location))))
(setf (alist-get location doom-cache-alists)
(append variables (cdr (assq location doom-cache-alists)))))
;;;###autoload
(defun doom-cache-desist (location &optional variables)
"Unregisters VARIABLES (list of symbols) in LOCATION (symbol) from
`doom-cache-alists', thus preventing them from being saved between sessions.
Does not affect the actual variables themselves or their values."
(if variables
(setf (alist-get location doom-cache-alists)
(cl-set-difference (cdr (assq location doom-cache-alists))
variables))
(delq (assq location doom-cache-alists)
doom-cache-alists)))
;;;###autoload
(defun doom-cache-get (key &optional location)
"Retrieve KEY from LOCATION (defaults to `doom-cache-location'), if it exists
and hasn't expired."
(persistent-soft-fetch
key (symbol-name (or location doom-cache-location))))
;;;###autoload
(defun doom-cache-set (key value &optional ttl location)
"Set KEY to VALUE in the cache. TTL is the time (in seconds) until this cache
entry expires. LOCATION is the super-key to store this cache item under; the
default is `doom-cache-location'. "
(persistent-soft-store
key value
(symbol-name (or location doom-cache-location)) ttl))
;;;###autoload
(defun doom-cache-exists (key &optional location)
"Returns t if KEY exists at LOCATION (defaults to `doom-cache-location')."
(persistent-soft-exists-p key (or location doom-cache-location)))
;;;###autoload
(defun doom-cache-clear (&optional location)
"Clear a cache LOCATION (defaults to `doom-cache-location')."
(persistent-soft-flush (or location doom-cache-location)))

View file

@ -76,7 +76,7 @@ Runs `doom-reload-hook' afterwards."
(interactive) (interactive)
(require 'core-cli) (require 'core-cli)
(when (and IS-WINDOWS (file-exists-p doom-env-file)) (when (and IS-WINDOWS (file-exists-p doom-env-file))
(warn "Can't regenerate envvar file from within Emacs. Run 'doom env' from the console")) (message "Can't regenerate envvar file from within Emacs. Run 'doom env' from the console"))
;; In case doom/reload is run before incrementally loaded packages are loaded, ;; In case doom/reload is run before incrementally loaded packages are loaded,
;; which could cause odd load order issues. ;; which could cause odd load order issues.
(mapc #'require (cdr doom-incremental-packages)) (mapc #'require (cdr doom-incremental-packages))
@ -136,6 +136,6 @@ imported into Emacs."
(defun doom/upgrade () (defun doom/upgrade ()
"Run 'doom upgrade' then prompt to restart Emacs." "Run 'doom upgrade' then prompt to restart Emacs."
(interactive) (interactive)
(doom--if-compile (format "%s upgrade" doom-bin) (doom--if-compile (format "%s -y upgrade" doom-bin)
(when (y-or-n-p "You must restart Emacs for the upgrade to take effect.\n\nRestart Emacs?") (when (y-or-n-p "You must restart Emacs for the upgrade to take effect.\n\nRestart Emacs?")
(doom/restart-and-restore)))) (doom/restart-and-restore))))

View file

@ -46,10 +46,7 @@ ready to be pasted in a bug report on github."
(require 'core-packages) (require 'core-packages)
(let ((default-directory doom-emacs-dir) (let ((default-directory doom-emacs-dir)
(doom-modules (doom-modules))) (doom-modules (doom-modules)))
(cl-letf (letf! (defun sh (&rest args) (cdr (apply #'doom-call-process args)))
(((symbol-function 'sh)
(lambda (&rest args)
(cdr (apply #'doom-call-process args)))))
`((emacs `((emacs
(version . ,emacs-version) (version . ,emacs-version)
(features ,@system-configuration-features) (features ,@system-configuration-features)

View file

@ -203,52 +203,29 @@ single file or nested compound statement of `and' and `or' statements."
;; ;;
;;; Helpers ;;; Helpers
(defun doom--forget-file (path) (defun doom--update-files (&rest files)
"Ensure `recentf', `projectile' and `save-place' forget OLD-PATH." "Ensure FILES are updated in `recentf', `magit' and `save-place'."
(let (toplevels)
(dolist (file files)
(when (featurep 'vc)
(vc-file-clearprops file)
(when-let (buffer (get-file-buffer file))
(with-current-buffer buffer
(vc-refresh-state))))
(when (featurep 'magit)
(when-let (default-directory (magit-toplevel (file-name-directory file)))
(cl-pushnew default-directory toplevels)))
(unless (file-readable-p file)
(when (bound-and-true-p recentf-mode) (when (bound-and-true-p recentf-mode)
(recentf-remove-if-non-kept path)) (recentf-remove-if-non-kept file))
(when (and (bound-and-true-p projectile-mode) (when (and (bound-and-true-p projectile-mode)
(doom-project-p) (doom-project-p)
(projectile-file-cached-p path (doom-project-root))) (projectile-file-cached-p file (doom-project-root)))
(projectile-purge-file-from-cache path)) (projectile-purge-file-from-cache file))))
(dolist (default-directory toplevels)
(magit-refresh))
(when (bound-and-true-p save-place-mode) (when (bound-and-true-p save-place-mode)
(save-place-forget-unreadable-files))) (save-place-forget-unreadable-files))))
(defun doom--update-file (path)
(when (featurep 'vc)
(vc-file-clearprops path)
(vc-resynch-buffer path nil t))
(when (featurep 'magit)
(when-let (default-directory (magit-toplevel (file-name-directory path)))
(magit-refresh))))
(defun doom--copy-file (old-path new-path &optional force-p)
(let* ((new-path (expand-file-name new-path))
(old-path (file-truename old-path))
(new-path (apply #'expand-file-name
(if (or (directory-name-p new-path)
(file-directory-p new-path))
(list (file-name-nondirectory old-path) new-path)
(list new-path))))
(new-path-dir (file-name-directory new-path))
(project-root (doom-project-root))
(short-new-name (if (and project-root (file-in-directory-p new-path project-root))
(file-relative-name new-path project-root)
(abbreviate-file-name new-path))))
(unless (file-directory-p new-path-dir)
(make-directory new-path-dir t))
(when (buffer-modified-p)
(save-buffer))
(cond ((file-equal-p old-path new-path)
(throw 'status 'overwrite-self))
((and (file-exists-p new-path)
(not force-p)
(not (y-or-n-p (format "File already exists at %s, overwrite?" short-new-name))))
(throw 'status 'aborted))
((file-exists-p old-path)
(copy-file old-path new-path t)
short-new-name)
(short-new-name))))
;; ;;
@ -256,73 +233,67 @@ single file or nested compound statement of `and' and `or' statements."
;;;###autoload ;;;###autoload
(defun doom/delete-this-file (&optional path force-p) (defun doom/delete-this-file (&optional path force-p)
"Delete FILENAME (defaults to the file associated with current buffer) and "Delete PATH, kill its buffers and expunge it from vc/magit cache.
kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
If PATH is not specified, default to the current buffer's file.
If FORCE-P, delete without confirmation."
(interactive (interactive
(list (file-truename (buffer-file-name)) (list (buffer-file-name (buffer-base-buffer))
current-prefix-arg)) current-prefix-arg))
(let* ((fbase (file-name-sans-extension (file-name-nondirectory path))) (let* ((path (or path (buffer-file-name (buffer-base-buffer))))
(buf (current-buffer))) (short-path (abbreviate-file-name path)))
(cond ((not (file-exists-p path)) (unless (and path (file-exists-p path))
(user-error "Buffer is not visiting any file"))
(unless (file-exists-p path)
(error "File doesn't exist: %s" path)) (error "File doesn't exist: %s" path))
((not (or force-p (y-or-n-p (format "Really delete %s?" fbase)))) (unless (or force-p (y-or-n-p (format "Really delete %S?" short-path)))
(message "Aborted") (user-error "Aborted"))
nil) (let ((buf (current-buffer)))
((unwind-protect (unwind-protect
(progn (delete-file path) t) (progn (delete-file path) t)
(let ((short-path (file-relative-name path (doom-project-root))))
(if (file-exists-p path) (if (file-exists-p path)
(error "Failed to delete %s" short-path) (error "Failed to delete %S" short-path)
;; Ensures that windows displaying this buffer will be switched ;; Ensures that windows displaying this buffer will be switched to
;; to real buffers (`doom-real-buffer-p') ;; real buffers (`doom-real-buffer-p')
(doom/kill-this-buffer-in-all-windows buf t) (doom/kill-this-buffer-in-all-windows buf t)
(doom--forget-file path) (doom--update-files path)
(doom--update-file path) (message "Deleted %S" short-path))))))
(message "Successfully deleted %s" short-path))))))))
;;;###autoload ;;;###autoload
(defun doom/copy-this-file (new-path &optional force-p) (defun doom/copy-this-file (new-path &optional force-p)
"Copy current buffer's file to NEW-PATH. If FORCE-P, overwrite the destination "Copy current buffer's file to NEW-PATH.
file if it exists, without confirmation."
If FORCE-P, overwrite the destination file if it exists, without confirmation."
(interactive (interactive
(list (read-file-name "Copy file to: ") (list (read-file-name "Copy file to: ")
current-prefix-arg)) current-prefix-arg))
(pcase (catch 'status (unless (and buffer-file-name (file-exists-p buffer-file-name))
(when-let (dest (doom--copy-file (buffer-file-name) new-path force-p)) (user-error "Buffer is not visiting any file"))
(doom--update-file new-path) (let ((old-path (buffer-file-name (buffer-base-buffer)))
(message "File successfully copied to %s" dest))) (new-path (expand-file-name new-path)))
(`overwrite-self (error "Cannot overwrite self")) (make-directory (file-name-directory new-path) 't)
(`aborted (message "Aborted")) (copy-file old-path new-path (or force-p 1))
(_ t))) (doom--update-files old-path new-path)
(message "File copied to %S" (abbreviate-file-name new-path))))
;;;###autoload ;;;###autoload
(defun doom/move-this-file (new-path &optional force-p) (defun doom/move-this-file (new-path &optional force-p)
"Move current buffer's file to NEW-PATH. If FORCE-P, overwrite the destination "Move current buffer's file to NEW-PATH.
file if it exists, without confirmation."
If FORCE-P, overwrite the destination file if it exists, without confirmation."
(interactive (interactive
(list (read-file-name "Move file to: ") (list (read-file-name "Move file to: ")
current-prefix-arg)) current-prefix-arg))
(pcase (catch 'status (unless (and buffer-file-name (file-exists-p buffer-file-name))
(let ((old-path (buffer-file-name)) (user-error "Buffer is not visiting any file"))
(let ((old-path (buffer-file-name (buffer-base-buffer)))
(new-path (expand-file-name new-path))) (new-path (expand-file-name new-path)))
(when-let (dest (doom--copy-file old-path new-path force-p)) (make-directory (file-name-directory new-path) 't)
(doom--forget-file old-path) (rename-file old-path new-path (or force-p 1))
(when (file-exists-p old-path) (set-visited-file-name new-path t t)
(delete-file old-path)) (doom--update-files old-path new-path)
(mapc #'doom--update-file (message "File moved to %S" (abbreviate-file-name new-path))))
(delq
nil (list (if (ignore-errors
(file-equal-p (doom-project-root old-path)
(doom-project-root new-path)))
nil
old-path)
new-path)))
(kill-current-buffer)
(find-file new-path)
(message "File successfully moved to %s" dest))))
(`overwrite-self (error "Cannot overwrite self"))
(`aborted (message "Aborted"))
(_ t)))
(defun doom--sudo-file-path (file) (defun doom--sudo-file-path (file)
(let ((host (or (file-remote-p file 'host) "localhost"))) (let ((host (or (file-remote-p file 'host) "localhost")))

View file

@ -3,9 +3,6 @@
(defvar doom--help-major-mode-module-alist (defvar doom--help-major-mode-module-alist
'((dockerfile-mode :tools docker) '((dockerfile-mode :tools docker)
(agda2-mode :lang agda) (agda2-mode :lang agda)
(haxor-mode :lang assembly)
(mips-mode :lang assembly)
(nasm-mode :lang assembly)
(c-mode :lang cc) (c-mode :lang cc)
(c++-mode :lang cc) (c++-mode :lang cc)
(objc++-mode :lang cc) (objc++-mode :lang cc)
@ -41,6 +38,7 @@
(LaTeX-mode :lang latex) (LaTeX-mode :lang latex)
(ledger-mode :lang ledger) (ledger-mode :lang ledger)
(lua-mode :lang lua) (lua-mode :lang lua)
(moonscript-mode :lang lua)
(markdown-mode :lang markdown) (markdown-mode :lang markdown)
(gfm-mode :lang markdown) (gfm-mode :lang markdown)
(nim-mode :lang nim) (nim-mode :lang nim)
@ -48,6 +46,7 @@
(taureg-mode :lang ocaml) (taureg-mode :lang ocaml)
(org-mode :lang org) (org-mode :lang org)
(perl-mode :lang perl) (perl-mode :lang perl)
(raku-mode :lang perl)
(php-mode :lang php) (php-mode :lang php)
(hack-mode :lang php) (hack-mode :lang php)
(plantuml-mode :lang plantuml) (plantuml-mode :lang plantuml)
@ -56,7 +55,9 @@
(restclient-mode :lang rest) (restclient-mode :lang rest)
(ruby-mode :lang ruby) (ruby-mode :lang ruby)
(rust-mode :lang rust) (rust-mode :lang rust)
(rustic-mode :lang rust)
(scala-mode :lang scala) (scala-mode :lang scala)
(scheme-mode :lang scheme)
(sh-mode :lang sh) (sh-mode :lang sh)
(swift-mode :lang swift) (swift-mode :lang swift)
(web-mode :lang web) (web-mode :lang web)
@ -134,7 +135,8 @@ selection of all minor-modes, active or not."
(list (or (+org-get-global-property "TITLE") (list (or (+org-get-global-property "TITLE")
(file-relative-name (buffer-file-name))))) (file-relative-name (buffer-file-name)))))
path path
(list (replace-regexp-in-string org-link-any-re "\\4" text))) (when text
(list (replace-regexp-in-string org-link-any-re "\\4" text))))
" > ") " > ")
tags) tags)
" ") " ")

View file

@ -101,11 +101,10 @@ If DIR is not a project, it will be indexed (but not cached)."
(unless (file-readable-p dir) (unless (file-readable-p dir)
(error "Directory %S isn't readable" dir)) (error "Directory %S isn't readable" dir))
(let* ((default-directory (file-truename (expand-file-name dir))) (let* ((default-directory (file-truename (expand-file-name dir)))
(project-root (doom-project-root default-directory)) (projectile-project-root (doom-project-root default-directory))
(projectile-project-root default-directory)
(projectile-enable-caching projectile-enable-caching)) (projectile-enable-caching projectile-enable-caching))
(cond ((and project-root (file-equal-p project-root projectile-project-root)) (cond ((and projectile-project-root (file-equal-p projectile-project-root default-directory))
(unless (doom-project-p projectile-project-root) (unless (doom-project-p default-directory)
;; Disable caching if this is not a real project; caching ;; Disable caching if this is not a real project; caching
;; non-projects easily has the potential to inflate the projectile ;; non-projects easily has the potential to inflate the projectile
;; cache beyond reason. ;; cache beyond reason.

View file

@ -130,8 +130,11 @@
(interactive "P") (interactive "P")
(setq doom-autosave-session nil) (setq doom-autosave-session nil)
(doom/quicksave-session) (doom/quicksave-session)
(save-some-buffers nil t)
(letf! ((#'save-buffers-kill-emacs #'kill-emacs)
(confirm-kill-emacs))
(restart-emacs (restart-emacs
(append (if debug (list "--debug-init")) (append (if debug (list "--debug-init"))
(when (boundp 'chemacs-current-emacs-profile) (when (boundp 'chemacs-current-emacs-profile)
(list "--with-profile" chemacs-current-emacs-profile)) (list "--with-profile" chemacs-current-emacs-profile))
(list "--restore")))) (list "--restore")))))

142
core/autoload/store.el Normal file
View file

@ -0,0 +1,142 @@
;;; core/autoload/cache.el -*- lexical-binding: t; -*-
;; This little library abstracts the process of writing arbitrary elisp values
;; to a 2-tiered file store (in `doom-store-dir'/`doom-store-location').
(defvar doom-store-dir (concat doom-etc-dir "store/")
"Directory to look for and store data accessed through this API.")
(defvar doom-store-persist-alist '(t)
"An alist of alists, containing lists of variables for the doom cache library
to persist across Emacs sessions.")
(defvar doom-store-location "default"
"The default location for cache files. This symbol is translated into a file
name under `pcache-directory' (by default a subdirectory under
`doom-store-dir'). One file may contain multiple cache entries.")
(defvar doom--store-table (make-hash-table :test 'equal))
(defvar doom--inhibit-flush nil)
(defun doom-save-persistent-store-h ()
"Hook to run when an Emacs session is killed. Saves all persisted variables
listed in `doom-store-persist-alist' to files."
(let (locations)
(let ((doom--inhibit-flush t))
(dolist (alist (butlast doom-store-persist-alist 1))
(cl-loop with location = (car alist)
for var in (cdr alist)
do (doom-store-put var (symbol-value var) nil location)
and do (cl-pushnew location locations))))
(mapc #'doom--store-flush locations)))
(add-hook 'kill-emacs-hook #'doom-save-persistent-store-h)
;;
;; Library
;;;###autoload
(defun doom-store-persist (location variables)
"Persist VARIABLES (list of symbols) in LOCATION (symbol).
This populates these variables with cached values, if one exists, and saves them
to file when Emacs quits. This cannot persist buffer-local variables."
(dolist (var variables)
(when (doom-store-member-p var location)
(set var (doom-store-get var location))))
(setf (alist-get location doom-store-persist-alist)
(append variables (alist-get location doom-store-persist-alist))))
;;;###autoload
(defun doom-store-desist (location &optional variables)
"Unregisters VARIABLES (list of symbols) in LOCATION (symbol).
Variables to persist are recorded in `doom-store-persist-alist'. Does not affect
the actual variables themselves or their values."
(if variables
(setf (alist-get location doom-store-persist-alist)
(cl-set-difference (cdr (assq location doom-store-persist-alist))
variables))
(delq! location doom-store-persist-alist 'assoc)))
(defun doom--store-init (location)
(or (gethash location doom--store-table)
(let* ((file-name-handler-alist nil)
(location-path (expand-file-name location doom-store-dir)))
(if (file-exists-p location-path)
(puthash location
(with-temp-buffer
(set-buffer-multibyte nil)
(setq buffer-file-coding-system 'binary)
(insert-file-contents-literally location-path)
(read (current-buffer)))
doom--store-table)
(puthash location (make-hash-table :test 'equal)
doom--store-table)))))
(defun doom--store-get (key location &optional default-value)
(let* ((location-data (doom--store-init location))
(data (gethash key location-data default-value)))
(if (and (not (eq data default-value))
(or (null (car data))
(not (time-less-p (car data) (current-time)))))
(cdr data)
default-value)))
(defun doom--store-put (key value location &optional ttl)
(puthash key (cons (if ttl (time-add (current-time) ttl)) value)
(doom--store-init location))
(doom--store-flush location))
(defun doom--store-flush (location)
(unless doom--inhibit-flush
(let ((file-name-handler-alist nil)
(coding-system-for-write 'binary)
(write-region-annotate-functions nil)
(write-region-post-annotation-function nil)
(data (doom--store-init location)))
(make-directory doom-store-dir 'parents)
(with-temp-file (expand-file-name location doom-store-dir)
(prin1 data (current-buffer)))
data)))
;;;###autoload
(defun doom-store-get (key &optional location default-value)
"Retrieve KEY from LOCATION (defaults to `doom-store-location').
If it doesn't exist or has expired, DEFAULT_VALUE is returned."
(doom--store-get key (or location doom-store-location) default-value))
;;;###autoload
(defun doom-store-put (key value &optional ttl location)
"Set KEY to VALUE in the store at LOCATION.
KEY can be any lisp object that is comparable with `equal'. TTL is the time (in
seconds) until this cache entry expires. LOCATION is the super-key to store this
cache item under. It defaults to `doom-store-location'."
(doom--store-put key value (or location doom-store-location) ttl))
;;;###autoload
(defun doom-store-rem (key &optional location)
"Clear a cache LOCATION (defaults to `doom-store-location')."
(let ((location (or location doom-store-location)))
(remhash key (doom--store-init location))
(let ((table (doom--store-init "default")))
(remhash 'test table)
table)
(doom--store-flush location)))
;;;###autoload
(defun doom-store-member-p (key &optional location)
"Return t if KEY in LOCATION exists.
LOCATION defaults to `doom-store-location'."
(let ((nil-value (format "--nilvalue%s--" (current-time))))
(not (equal (doom-store-get key location nil-value)
nil-value))))
;;;###autoload
(defun doom-store-clear (&optional location)
"Clear the store at LOCATION (defaults to `doom-store-location')."
(let* ((location (or location doom-store-location))
(path (expand-file-name location doom-store-dir)))
(remhash location doom--store-table)
(when (file-exists-p path)
(delete-file path)
t)))

View file

@ -32,7 +32,9 @@ one wants that.")
(cl-check-type file string) (cl-check-type file string)
(and (print! (start "Generating core autoloads...")) (and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads (doom-cli--write-autoloads
file (doom-cli--generate-autoloads file
(doom-cli--generate-emacs-version-check)
(doom-cli--generate-autoloads
(cl-loop for dir (cl-loop for dir
in (append (list doom-core-dir) in (append (list doom-core-dir)
(cdr (doom-module-load-path 'all-p)) (cdr (doom-module-load-path 'all-p))
@ -105,6 +107,12 @@ one wants that.")
(print! "M-x doom/restart") (print! "M-x doom/restart")
(print! "M-x doom/reload"))) (print! "M-x doom/reload")))
(defun doom-cli--generate-emacs-version-check ()
`((unless (equal emacs-major-version (eval-when-compile emacs-major-version))
(signal 'doom-error
(list "Your installed (major) version of Emacs has changed"
"Run 'doom sync && doom build' to bring Doom up to speed")))))
(defun doom-cli--generate-var-cache (vars) (defun doom-cli--generate-var-cache (vars)
`((setq ,@(cl-loop for var in vars `((setq ,@(cl-loop for var in vars
append `(,var ',(symbol-value var)))))) append `(,var ',(symbol-value var))))))

View file

@ -123,11 +123,8 @@ in."
"both is rarely intentional; you should one or the other.")) "both is rarely intentional; you should one or the other."))
;; Check for fonts ;; Check for fonts
(if (not (fboundp 'find-font)) (if (not (executable-find "fc-list"))
(progn (warn! "Warning: unable to detect fonts because fontconfig isn't installed")
(warn! "Warning: unable to detect font")
(explain! "The `find-font' function is missing. This could indicate the incorrect "
"version of Emacs is being used!"))
;; all-the-icons fonts ;; all-the-icons fonts
(when (and (pcase system-type (when (and (pcase system-type
(`gnu/linux (concat (or (getenv "XDG_DATA_HOME") (`gnu/linux (concat (or (getenv "XDG_DATA_HOME")

View file

@ -113,10 +113,11 @@ default, on Linux, this is '$SHELL -ic /usr/bin/env'. Variables in
"# run 'doom sync'. To create a safe-to-edit envvar file use:\n#\n" "# run 'doom sync'. To create a safe-to-edit envvar file use:\n#\n"
"# doom env -o ~/.doom.d/myenv\n#\n" "# doom env -o ~/.doom.d/myenv\n#\n"
"# And load it with (doom-load-envvars-file \"~/.doom.d/myenv\").\n") "# And load it with (doom-load-envvars-file \"~/.doom.d/myenv\").\n")
(concat "# This file is safe to edit by hand, but needs to be loaded manually with:\n#\n" (concat "# This file is safe to edit by hand, but remember to preserve the null bytes at\n"
"# the end of each line! needs to be loaded manually with:\n#\n"
"# (doom-load-envvars-file \"path/to/this/file\")\n#\n" "# (doom-load-envvars-file \"path/to/this/file\")\n#\n"
"# Use 'doom env -o path/to/this/file' to regenerate it.")) "# Use 'doom env -o path/to/this/file' to regenerate it."))
"# ---------------------------------------------------------------------------\n\n")) "# ---------------------------------------------------------------------------\n\0\n"))
;; We assume that this noninteractive session was spawned from the ;; We assume that this noninteractive session was spawned from the
;; user's interactive shell, therefore we just dump ;; user's interactive shell, therefore we just dump
;; `process-environment' to a file. ;; `process-environment' to a file.
@ -124,7 +125,7 @@ default, on Linux, this is '$SHELL -ic /usr/bin/env'. Variables in
(if (cl-find-if (doom-rpartial #'string-match-p (car (split-string env "="))) (if (cl-find-if (doom-rpartial #'string-match-p (car (split-string env "=")))
doom-env-ignored-vars) doom-env-ignored-vars)
(print! (info "Ignoring %s") env) (print! (info "Ignoring %s") env)
(insert env "\n"))) (insert env "\0\n")))
(print! (success "Successfully generated %S") (print! (success "Successfully generated %S")
(path env-file)) (path env-file))
t)))))) t))))))

View file

@ -258,7 +258,7 @@ BODY will be run when this dispatcher is called."
(print! "%2s) %s" (1+ (length options)) (print! "%2s) %s" (1+ (length options))
(if (cl-find-if (doom-rpartial #'string-match-p desc) (if (cl-find-if (doom-rpartial #'string-match-p desc)
doom--cli-straight-discard-options) doom--cli-straight-discard-options)
(concat desc " (Recommended)") (green (concat desc " (Recommended)"))
desc)))) desc))))
(terpri) (terpri)
(let* ((options (let* ((options

View file

@ -174,6 +174,8 @@ possible."
(push '("/LICENSE\\'" . text-mode) auto-mode-alist) (push '("/LICENSE\\'" . text-mode) auto-mode-alist)
(push '("\\.log\\'" . text-mode) auto-mode-alist) (push '("\\.log\\'" . text-mode) auto-mode-alist)
(push '("rc\\'" . conf-mode) auto-mode-alist)
(push '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode) auto-mode-alist)
;; ;;
@ -291,10 +293,7 @@ possible."
`pp' can be expensive for longer lists, and there's no reason to prettify cache `pp' can be expensive for longer lists, and there's no reason to prettify cache
files, so we replace calls to `pp' with the much faster `prin1'." files, so we replace calls to `pp' with the much faster `prin1'."
:around #'save-place-alist-to-file :around #'save-place-alist-to-file
(cl-letf (((symbol-function #'pp) #'prin1)) (letf! ((#'pp #'prin1)) (funcall orig-fn))))
(funcall orig-fn)))
(save-place-mode +1))
(use-package! server (use-package! server
@ -392,18 +391,14 @@ files, so we replace calls to `pp' with the much faster `prin1'."
`nim-mode'. This prevents them from leaving Emacs in a broken state." `nim-mode'. This prevents them from leaving Emacs in a broken state."
:around #'dtrt-indent-mode :around #'dtrt-indent-mode
(let ((dtrt-indent-run-after-smie dtrt-indent-run-after-smie)) (let ((dtrt-indent-run-after-smie dtrt-indent-run-after-smie))
(cl-letf* ((old-smie-config-guess (symbol-function 'smie-config-guess)) (letf! ((defun symbol-config--guess (beg end)
(old-smie-config--guess (symbol-function 'symbol-config--guess)) (funcall symbol-config--guess beg (min end 10000)))
((symbol-function 'symbol-config--guess) (defun smie-config-guess ()
(lambda (beg end) (condition-case e (funcall smie-config-guess)
(funcall old-smie-config--guess beg (min end 10000))))
((symbol-function 'smie-config-guess)
(lambda ()
(condition-case e (funcall old-smie-config-guess)
(error (setq dtrt-indent-run-after-smie t) (error (setq dtrt-indent-run-after-smie t)
(message "[WARNING] Indent detection: %s" (message "[WARNING] Indent detection: %s"
(error-message-string e)) (error-message-string e))
(message "")))))) ; warn silently (message ""))))) ; warn silently
(funcall orig-fn arg))))) (funcall orig-fn arg)))))
@ -419,8 +414,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
(defun doom-use-helpful-a (orig-fn &rest args) (defun doom-use-helpful-a (orig-fn &rest args)
"Force ORIG-FN to use helpful instead of the old describe-* commands." "Force ORIG-FN to use helpful instead of the old describe-* commands."
(cl-letf (((symbol-function #'describe-function) #'helpful-function) (letf! ((#'describe-function #'helpful-function)
((symbol-function #'describe-variable) #'helpful-variable)) (#'describe-variable #'helpful-variable))
(apply orig-fn args))) (apply orig-fn args)))
(after! apropos (after! apropos
@ -484,7 +479,8 @@ files, so we replace calls to `pp' with the much faster `prin1'."
(defun doom-init-smartparens-in-minibuffer-maybe-h () (defun doom-init-smartparens-in-minibuffer-maybe-h ()
"Enable `smartparens-mode' in the minibuffer, during `eval-expression', "Enable `smartparens-mode' in the minibuffer, during `eval-expression',
`pp-eval-expression' or `evil-ex'." `pp-eval-expression' or `evil-ex'."
(when (memq this-command '(eval-expression pp-eval-expression evil-ex)) (and (memq this-command '(eval-expression pp-eval-expression evil-ex))
smartparens-global-mode
(smartparens-mode)))) (smartparens-mode))))
;; You're likely writing lisp in the minibuffer, therefore, disable these ;; You're likely writing lisp in the minibuffer, therefore, disable these

View file

@ -77,7 +77,8 @@ all hooks after it are ignored.")
:init :init
;; Convenience aliases ;; Convenience aliases
(defalias 'define-key! #'general-def) (defalias 'define-key! #'general-def)
(defalias 'unmap! #'general-unbind)) (defalias 'undefine-key! #'general-unbind))
;; HACK `map!' uses this instead of `define-leader-key!' because it consumes ;; HACK `map!' uses this instead of `define-leader-key!' because it consumes
;; 20-30% more startup time, so we reimplement it ourselves. ;; 20-30% more startup time, so we reimplement it ourselves.
@ -108,7 +109,7 @@ all hooks after it are ignored.")
(general--concat t doom-leader-key ,key) (general--concat t doom-leader-key ,key)
,desc)))))))) ,desc))))))))
(macroexp-progn (macroexp-progn
(cons `(after! which-key ,@(nreverse wkforms)) (append (and wkforms `((after! which-key ,@(nreverse wkforms))))
(nreverse forms))))) (nreverse forms)))))
(defmacro define-leader-key! (&rest args) (defmacro define-leader-key! (&rest args)
@ -220,16 +221,6 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
else do (error "not a valid state: %s" l))) else do (error "not a valid state: %s" l)))
;; Register keywords for proper indentation (see `map!')
(put :after 'lisp-indent-function 'defun)
(put :desc 'lisp-indent-function 'defun)
(put :leader 'lisp-indent-function 'defun)
(put :localleader 'lisp-indent-function 'defun)
(put :map 'lisp-indent-function 'defun)
(put :mode 'lisp-indent-function 'defun)
(put :prefix 'lisp-indent-function 'defun)
(put :prefix-map 'lisp-indent-function 'defun)
;; specials ;; specials
(defvar doom--map-forms nil) (defvar doom--map-forms nil)
(defvar doom--map-fn nil) (defvar doom--map-fn nil)

View file

@ -1,8 +1,5 @@
;;; core-lib.el -*- lexical-binding: t; -*- ;;; core-lib.el -*- lexical-binding: t; -*-
(require 'cl-lib)
(require 'subr-x)
;; ;;
;;; Helpers ;;; Helpers
@ -85,6 +82,60 @@ Accepts the same arguments as `message'."
format-string) format-string)
,@args)))) ,@args))))
(defun doom-try-run-hook (hook)
"Run HOOK (a hook function) with better error handling.
Meant to be used with `run-hook-wrapped'."
(doom-log "Running doom hook: %s" hook)
(condition-case e
(funcall hook)
((debug error)
(signal 'doom-hook-error (list hook e))))
;; return nil so `run-hook-wrapped' won't short circuit
nil)
(defun doom-load-autoloads-file (file &optional noerror)
"Tries to load FILE (an autoloads file).
Return t on success, nil otherwise (but logs a warning)."
(condition-case e
;; Avoid `file-name-sans-extension' for premature optimization reasons.
;; `string-remove-suffix' is much cheaper (because it does no file sanity
;; checks during or after; just plain ol' string manipulation).
(load (string-remove-suffix ".el" file) noerror 'nomessage)
(doom-error
(signal (car e) (cdr e)))
((debug error)
(message "Autoload file error: %s -> %s" (file-name-nondirectory file) e)
nil)))
(defun doom-load-envvars-file (file &optional noerror)
"Read and set envvars from FILE.
If NOERROR is non-nil, don't throw an error if the file doesn't exist or is
unreadable. Returns the names of envvars that were changed."
(if (null (file-exists-p file))
(unless noerror
(signal 'file-error (list "No envvar file exists" file)))
(when-let
(env
(with-temp-buffer
(save-excursion
(insert "\0\n") ; to prevent off-by-one
(insert-file-contents file))
(save-match-data
(when (re-search-forward "\0\n *\\([^#= \n]*\\)=" nil t)
(setq
env (split-string (buffer-substring (match-beginning 1) (point-max))
"\0\n"
'omit-nulls))))))
(setq process-environment (append (nreverse env) process-environment)
exec-path (append (split-string (getenv "PATH") path-separator t)
(list exec-directory))
shell-file-name (or (getenv "SHELL") shell-file-name))
env)))
;;
;;; Functional library
(defalias 'doom-partial #'apply-partially) (defalias 'doom-partial #'apply-partially)
(defun doom-rpartial (fn &rest args) (defun doom-rpartial (fn &rest args)
@ -119,6 +170,11 @@ aliases."
(call-interactively command)))) (call-interactively command))))
(defalias 'lambda!! 'λ!!) (defalias 'lambda!! 'λ!!)
(defun dir! ()
"Returns the directory of the emacs lisp file this macro is called from."
(when-let (path (file!))
(directory-file-name (file-name-directory path))))
(defun file! () (defun file! ()
"Return the emacs lisp file this macro is called from." "Return the emacs lisp file this macro is called from."
(cond ((bound-and-true-p byte-compile-current-file)) (cond ((bound-and-true-p byte-compile-current-file))
@ -128,10 +184,129 @@ aliases."
(buffer-file-name) (buffer-file-name)
((error "Cannot get this file-path")))) ((error "Cannot get this file-path"))))
(defun dir! () (defmacro letenv! (envvars &rest body)
"Returns the directory of the emacs lisp file this macro is called from." "Lexically bind ENVVARS in BODY, like `let' but for `process-environment'."
(when-let (path (file!)) (declare (indent 1))
(directory-file-name (file-name-directory path)))) `(let ((process-environment (copy-sequence process-environment)))
(dolist (var (list ,@(cl-loop for (var val) in envvars
collect `(cons ,var ,val))))
(setenv (car var) (cdr var)))
,@body))
(defmacro letf! (bindings &rest body)
"Temporarily rebind function and macros in BODY.
BINDINGS is either a) a list of, or a single, `defun' or `defmacro'-ish form, or
b) a list of (PLACE VALUE) bindings as `cl-letf*' would accept.
TYPE is either `defun' or `defmacro'. NAME is the name of the function. If an
original definition for NAME exists, it can be accessed as a lexical variable by
the same name, for use with `funcall' or `apply'. ARGLIST and BODY are as in
`defun'.
\(fn ((TYPE NAME ARGLIST &rest BODY) ...) BODY...)"
(declare (indent defun))
(setq body (macroexp-progn body))
(when (memq (car bindings) '(defun defmacro))
(setq bindings (list bindings)))
(dolist (binding (nreverse bindings) body)
(let ((type (car binding))
(rest (cdr binding)))
(setq
body (pcase type
(`defmacro `(cl-macrolet ((,(car rest) ,(cadr rest) ,@(cddr rest))) ,body))
(`defun `(cl-letf* ((,(car rest) (symbol-function #',(car rest)))
((symbol-function #',(car rest))
(lambda ,(cadr rest) ,@(cddr rest))))
,body))
(_
(when (eq (car-safe type) 'function)
(setq type `(symbol-function ,type)))
`(cl-letf ((,type ,@rest)) ,body)))))))
(defmacro quiet! (&rest forms)
"Run FORMS without generating any output.
This silences calls to `message', `load-file', `write-region' and anything that
writes to `standard-output'."
`(cond (doom-debug-mode ,@forms)
((not doom-interactive-mode)
(letf! ((standard-output (lambda (&rest _)))
(defun load-file (file) (load-file nil t))
(defun message (&rest _))
(defun write-region (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(funcall write-region start end filename append visit lockname mustbenew)))
,@forms))
((let ((inhibit-message t)
(save-silently t))
(prog1 ,@forms (message ""))))))
(defmacro if! (cond then &rest body)
"Expands to THEN if COND is non-nil, to BODY otherwise.
COND is checked at compile/expansion time, allowing BODY to be omitted
entirely when the elisp is byte-compiled. Use this for forms that contain
expensive macros that could safely be removed at compile time."
(declare (indent 2))
(if (eval cond)
then
(macroexp-progn body)))
(defmacro when! (cond &rest body)
"Expands to BODY if CONDITION is non-nil at compile/expansion time.
See `if!' for details on this macro's purpose."
(declare (indent 1))
(when (eval cond)
(macroexp-progn body)))
;;; Mutation
(defmacro appendq! (sym &rest lists)
"Append LISTS to SYM in place."
`(setq ,sym (append ,sym ,@lists)))
(defmacro setq! (&rest settings)
"A stripped-down `customize-set-variable' with the syntax of `setq'.
Use this instead of `setq' when you know a variable has a custom setter (a :set
property in its `defcustom' declaration). This trigger setters. `setq' does
not."
(macroexp-progn
(cl-loop for (var val) on settings by 'cddr
collect (list (or (get var 'custom-set) #'set)
(list 'quote var)
val))))
(defmacro delq! (elt list &optional fetcher)
"`delq' ELT from LIST in-place.
If FETCHER is a function, ELT is used as the key in LIST (an alist)."
`(setq ,list
(delq ,(if fetcher
`(funcall ,fetcher ,elt ,list)
elt)
,list)))
(defmacro pushnew! (place &rest values)
"Push VALUES sequentially into PLACE, if they aren't already present.
This is a variadic `cl-pushnew'."
(let ((var (make-symbol "result")))
`(dolist (,var (list ,@values) (with-no-warnings ,place))
(cl-pushnew ,var ,place :test #'equal))))
(defmacro prependq! (sym &rest lists)
"Prepend LISTS to SYM in place."
`(setq ,sym (append ,@lists ,sym)))
;;; Loading
(defmacro add-load-path! (&rest dirs)
"Add DIRS to `load-path', relative to the current file.
The current file is the file from which `add-to-load-path!' is used."
`(let ((default-directory ,(dir!))
file-name-handler-alist)
(dolist (dir (list ,@dirs))
(cl-pushnew (expand-file-name dir) load-path))))
(defmacro after! (package &rest body) (defmacro after! (package &rest body)
"Evaluate BODY after PACKAGE have loaded. "Evaluate BODY after PACKAGE have loaded.
@ -183,58 +358,84 @@ This is a wrapper around `eval-after-load' that:
(setq body `((after! ,next ,@body)))) (setq body `((after! ,next ,@body))))
(car body)))))) (car body))))))
(defmacro setq! (&rest settings) (defun doom--handle-load-error (e target path)
"A stripped-down `customize-set-variable' with the syntax of `setq'. (let* ((source (file-name-sans-extension target))
(err (cond ((not (featurep 'core))
(cons 'error (file-name-directory path)))
((file-in-directory-p source doom-core-dir)
(cons 'doom-error doom-core-dir))
((file-in-directory-p source doom-private-dir)
(cons 'doom-private-error doom-private-dir))
((cons 'doom-module-error doom-emacs-dir)))))
(signal (car err)
(list (file-relative-name
(concat source ".el")
(cdr err))
e))))
Use this instead of `setq' when you know a variable has a custom setter (a :set (defmacro load! (filename &optional path noerror)
property in its `defcustom' declaration). This trigger setters. `setq' does "Load a file relative to the current executing file (`load-file-name').
not."
(macroexp-progn
(cl-loop for (var val) on settings by 'cddr
collect `(funcall (or (get ',var 'custom-set) #'set)
',var ,val))))
(defmacro pushnew! (place &rest values) FILENAME is either a file path string or a form that should evaluate to such a
"Push VALUES sequentially into PLACE, if they aren't already present. string at run time. PATH is where to look for the file (a string representing a
This is a variadic `cl-pushnew'." directory path). If omitted, the lookup is relative to either `load-file-name',
(let ((var (make-symbol "result"))) `byte-compile-current-file' or `buffer-file-name' (checked in that order).
`(dolist (,var (list ,@values) (with-no-warnings ,place))
(cl-pushnew ,var ,place :test #'equal))))
(defmacro prependq! (sym &rest lists) If NOERROR is non-nil, don't throw an error if the file doesn't exist."
"Prepend LISTS to SYM in place." (let* ((path (or path
`(setq ,sym (append ,@lists ,sym))) (dir!)
(error "Could not detect path to look for '%s' in"
filename)))
(file (if path
`(expand-file-name ,filename ,path)
filename)))
`(condition-case-unless-debug e
(let (file-name-handler-alist)
(load ,file ,noerror 'nomessage))
(doom-error (signal (car e) (cdr e)))
(error (doom--handle-load-error e ,file ,path)))))
(defmacro appendq! (sym &rest lists) (defmacro defer-until! (condition &rest body)
"Append LISTS to SYM in place." "Run BODY when CONDITION is true (checks on `after-load-functions'). Meant to
`(setq ,sym (append ,sym ,@lists))) serve as a predicated alternative to `after!'."
(declare (indent defun) (debug t))
`(if ,condition
(progn ,@body)
,(let ((fn (intern (format "doom--delay-form-%s-h" (sxhash (cons condition body))))))
`(progn
(fset ',fn (lambda (&rest args)
(when ,(or condition t)
(remove-hook 'after-load-functions #',fn)
(unintern ',fn nil)
(ignore args)
,@body)))
(put ',fn 'permanent-local-hook t)
(add-hook 'after-load-functions #',fn)))))
(defmacro delq! (elt list &optional fetcher) (defmacro defer-feature! (feature &optional fn)
"`delq' ELT from LIST in-place. "Pretend FEATURE hasn't been loaded yet, until FEATURE-hook or FN runs.
If FETCHER is a function, ELT is used as the key in LIST (an alist)." Some packages (like `elisp-mode' and `lisp-mode') are loaded immediately at
`(setq ,list startup, which will prematurely trigger `after!' (and `with-eval-after-load')
(delq ,(if fetcher blocks. To get around this we make Emacs believe FEATURE hasn't been loaded yet,
`(funcall ,fetcher ,elt ,list) then wait until FEATURE-hook (or MODE-hook, if FN is provided) is triggered to
elt) reverse this and trigger `after!' blocks at a more reasonable time."
,list))) (let ((advice-fn (intern (format "doom--defer-feature-%s-a" feature)))
(fn (or fn feature)))
`(progn
(setq features (delq ',feature features))
(advice-add #',fn :before #',advice-fn)
(defun ,advice-fn (&rest _)
;; Some plugins (like yasnippet) will invoke a fn early to parse
;; code, which would prematurely trigger this. In those cases, well
;; behaved plugins will use `delay-mode-hooks', which we can check for:
(when (and ,(intern (format "%s-hook" fn))
(not delay-mode-hooks))
;; ...Otherwise, announce to the world this package has been loaded,
;; so `after!' handlers can react.
(provide ',feature)
(advice-remove #',fn #',advice-fn))))))
(defmacro letenv! (envvars &rest body)
"Lexically bind ENVVARS in BODY, like `let' but for `process-environment'."
(declare (indent 1))
`(let ((process-environment (copy-sequence process-environment)))
(dolist (var (list ,@(cl-loop for (var val) in envvars
collect `(cons ,var ,val))))
(setenv (car var) (cdr var)))
,@body))
(defmacro add-load-path! (&rest dirs)
"Add DIRS to `load-path', relative to the current file.
The current file is the file from which `add-to-load-path!' is used."
`(let ((default-directory ,(dir!))
file-name-handler-alist)
(dolist (dir (list ,@dirs))
(cl-pushnew (expand-file-name dir) load-path))))
;;; Hooks ;;; Hooks
(defvar doom--transient-counter 0) (defvar doom--transient-counter 0)
@ -360,106 +561,8 @@ If N and M = 1, there's no benefit to using this macro over `remove-hook'.
in (doom--setq-hook-fns hooks vars 'singles) in (doom--setq-hook-fns hooks vars 'singles)
collect `(remove-hook ',hook #',fn)))) collect `(remove-hook ',hook #',fn))))
(defmacro load! (filename &optional path noerror)
"Load a file relative to the current executing file (`load-file-name').
FILENAME is either a file path string or a form that should evaluate to such a
string at run time. PATH is where to look for the file (a string representing a
directory path). If omitted, the lookup is relative to either `load-file-name',
`byte-compile-current-file' or `buffer-file-name' (checked in that order).
If NOERROR is non-nil, don't throw an error if the file doesn't exist."
(let* ((path (or path
(dir!)
(error "Could not detect path to look for '%s' in"
filename)))
(file (if path
`(expand-file-name ,filename ,path)
filename)))
`(condition-case-unless-debug e
(let (file-name-handler-alist)
(load ,file ,noerror 'nomessage))
(doom-error (signal (car e) (cdr e)))
(error
(let* ((source (file-name-sans-extension ,file))
(err (cond ((not (featurep 'core))
(cons 'error (file-name-directory path)))
((file-in-directory-p source doom-core-dir)
(cons 'doom-error doom-core-dir))
((file-in-directory-p source doom-private-dir)
(cons 'doom-private-error doom-private-dir))
((cons 'doom-module-error doom-emacs-dir)))))
(signal (car err)
(list (file-relative-name
(concat source ".el")
(cdr err))
e)))))))
(defmacro defer-until! (condition &rest body)
"Run BODY when CONDITION is true (checks on `after-load-functions'). Meant to
serve as a predicated alternative to `after!'."
(declare (indent defun) (debug t))
`(if ,condition
(progn ,@body)
,(let ((fn (intern (format "doom--delay-form-%s-h" (sxhash (cons condition body))))))
`(progn
(fset ',fn (lambda (&rest args)
(when ,(or condition t)
(remove-hook 'after-load-functions #',fn)
(unintern ',fn nil)
(ignore args)
,@body)))
(put ',fn 'permanent-local-hook t)
(add-hook 'after-load-functions #',fn)))))
(defmacro defer-feature! (feature &optional fn)
"Pretend FEATURE hasn't been loaded yet, until FEATURE-hook or FN runs.
Some packages (like `elisp-mode' and `lisp-mode') are loaded immediately at
startup, which will prematurely trigger `after!' (and `with-eval-after-load')
blocks. To get around this we make Emacs believe FEATURE hasn't been loaded yet,
then wait until FEATURE-hook (or MODE-hook, if FN is provided) is triggered to
reverse this and trigger `after!' blocks at a more reasonable time."
(let ((advice-fn (intern (format "doom--defer-feature-%s-a" feature)))
(fn (or fn feature)))
`(progn
(setq features (delq ',feature features))
(advice-add #',fn :before #',advice-fn)
(defun ,advice-fn (&rest _)
;; Some plugins (like yasnippet) will invoke a fn early to parse
;; code, which would prematurely trigger this. In those cases, well
;; behaved plugins will use `delay-mode-hooks', which we can check for:
(when (and ,(intern (format "%s-hook" fn))
(not delay-mode-hooks))
;; ...Otherwise, announce to the world this package has been loaded,
;; so `after!' handlers can react.
(provide ',feature)
(advice-remove #',fn #',advice-fn))))))
(defmacro quiet! (&rest forms)
"Run FORMS without generating any output.
This silences calls to `message', `load-file', `write-region' and anything that
writes to `standard-output'."
`(cond (doom-debug-mode ,@forms)
((not doom-interactive-mode)
(let ((old-fn (symbol-function 'write-region)))
(cl-letf ((standard-output (lambda (&rest _)))
((symbol-function 'load-file) (lambda (file) (load file nil t)))
((symbol-function 'message) (lambda (&rest _)))
((symbol-function 'write-region)
(lambda (start end filename &optional append visit lockname mustbenew)
(unless visit (setq visit 'no-message))
(funcall old-fn start end filename append visit lockname mustbenew))))
,@forms)))
((let ((inhibit-message t)
(save-silently t))
(prog1 ,@forms (message ""))))))
;;
;;; Definers ;;; Definers
(defmacro defadvice! (symbol arglist &optional docstring &rest body) (defmacro defadvice! (symbol arglist &optional docstring &rest body)
"Define an advice called SYMBOL and add it to PLACES. "Define an advice called SYMBOL and add it to PLACES.

View file

@ -211,13 +211,15 @@ those directories. The first returned path is always `doom-private-dir'."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(append (list doom-private-dir) (append (list doom-private-dir)
(if module-dirs (if module-dirs
(mapcar (lambda (m) (doom-module-locate-path (car m) (cdr m)))
(doom-files-in (if (listp module-dirs) (doom-files-in (if (listp module-dirs)
module-dirs module-dirs
doom-modules-dirs) doom-modules-dirs)
:map #'doom-module-from-path
:type 'dirs :type 'dirs
:mindepth 1 :mindepth 1
:depth 1) :depth 1))
(cl-loop for plist being the hash-values of (doom-modules) (cl-loop for plist being the hash-values of doom-modules
collect (plist-get plist :path))) collect (plist-get plist :path)))
nil)) nil))
@ -481,39 +483,6 @@ WARNINGS:
(lambda () ,@body) (lambda () ,@body)
'append))) 'append)))
(defmacro require! (category module &rest flags)
"Loads the CATEGORY MODULE module with FLAGS.
CATEGORY is a keyword, MODULE is a symbol and FLAGS are symbols.
(require! :lang php +lsp)
This is for testing and internal use. This is not the correct way to enable a
module."
`(let ((doom-modules (or ,doom-modules (doom-modules)))
(module-path (doom-module-locate-path ,category ',module)))
(doom-module-set
,category ',module
(let ((plist (doom-module-get ,category ',module)))
,(when flags
`(plist-put plist :flags `,flags))
(unless (plist-member plist :path)
(plist-put plist :path ,(doom-module-locate-path category module)))
plist))
(if (directory-name-p module-path)
(condition-case-unless-debug ex
(let ((doom--current-module ',(cons category module))
(doom--current-flags ',flags))
(load! "init" module-path :noerror)
(load! "config" module-path :noerror))
('error
(lwarn 'doom-modules :error
"%s in '%s %s' -> %s"
(car ex) ,category ',module
(error-message-string ex))))
(warn 'doom-modules :warning "Couldn't find module '%s %s'"
,category ',module))))
(defmacro featurep! (category &optional module flag) (defmacro featurep! (category &optional module flag)
"Returns t if CATEGORY MODULE is enabled. "Returns t if CATEGORY MODULE is enabled.
@ -538,18 +507,5 @@ CATEGORY and MODULE can be omitted When this macro is used from inside a module
(memq category (doom-module-get (car module) (cdr module) :flags))))) (memq category (doom-module-get (car module) (cdr module) :flags)))))
t)) t))
;; DEPRECATED
(defmacro def-package! (&rest args)
"Do not use this macro. Use `use-package!' instead."
(warn "`def-package!' is deprecated and was renamed to `use-package!'")
`(use-package! ,@args))
(make-obsolete 'def-package! 'use-package! "2.0.9")
(defmacro def-package-hook! (&rest args)
"Do not use this macro. Use `use-package!' instead."
(warn "`def-package-hook!' is deprecated and was renamed to `use-package-hook!'")
`(use-package-hook! ,@args))
(make-obsolete 'def-package-hook! 'use-package-hook! "2.0.9")
(provide 'core-modules) (provide 'core-modules)
;;; core-modules.el ends here ;;; core-modules.el ends here

View file

@ -269,9 +269,13 @@ elsewhere."
recipe recipe
;; Expand :local-repo from current directory ;; Expand :local-repo from current directory
(when local-repo (when local-repo
(plist-put! plist :recipe (plist-put!
plist :recipe
(plist-put recipe :local-repo (plist-put recipe :local-repo
(expand-file-name local-repo ,(dir!))))))) (let ((local-path (expand-file-name local-repo ,(dir!))))
(if (file-directory-p local-path)
local-path
local-repo)))))))
(error (error
(signal 'doom-package-error (signal 'doom-package-error
(cons ,(symbol-name name) (cons ,(symbol-name name)

View file

@ -15,9 +15,6 @@ Emacs.")
"fd") "fd")
"name of `fd-find' executable binary") "name of `fd-find' executable binary")
(defvar doom-projectile-cache-timer-file (concat doom-cache-dir "projectile.timers")
"Where to save project file cache timers.")
;; ;;
;;; Packages ;;; Packages
@ -43,6 +40,16 @@ Emacs.")
:config :config
(projectile-mode +1) (projectile-mode +1)
;; REVIEW Resolve the project root once, when the file/buffer is opened. This
;; speeds up projectile's project root resolution by leaps, but does
;; put you at risk of having a stale project root.
(setq-hook! '(change-major-mode-after-body-hook
;; In case the user saves the file to a new location
after-save-hook
;; ...or makes external changes then returns to Emacs
focus-in-hook)
projectile-project-root (if default-directory (doom-project-root)))
;; Projectile runs four functions to determine the root (in this order): ;; Projectile runs four functions to determine the root (in this order):
;; ;;
;; + `projectile-root-local' -> checks the `projectile-project-root' variable ;; + `projectile-root-local' -> checks the `projectile-project-root' variable
@ -139,7 +146,7 @@ c) are not valid projectile projects."
;; .gitignore. This is recommended in the projectile docs. ;; .gitignore. This is recommended in the projectile docs.
((executable-find doom-projectile-fd-binary) ((executable-find doom-projectile-fd-binary)
(setq projectile-generic-command (setq projectile-generic-command
(format "%s . --color=never --type f -0 -H -E .git" (format "%s . -0 -H -E .git --color=never --type file --type symlink --follow"
doom-projectile-fd-binary) doom-projectile-fd-binary)
projectile-git-command projectile-generic-command projectile-git-command projectile-generic-command
projectile-git-submodule-command nil projectile-git-submodule-command nil
@ -149,9 +156,11 @@ c) are not valid projectile projects."
;; Otherwise, resort to ripgrep, which is also faster than find ;; Otherwise, resort to ripgrep, which is also faster than find
((executable-find "rg") ((executable-find "rg")
(setq projectile-generic-command (setq projectile-generic-command
(concat "rg -0 --files --color=never --hidden" (concat "rg -0 --files --follow --color=never --hidden"
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
concat (format " --glob '!%s'" dir))) concat " --glob "
concat (shell-quote-argument (concat "!" dir)))
(if IS-WINDOWS " --path-separator /"))
projectile-git-command projectile-generic-command projectile-git-command projectile-generic-command
projectile-git-submodule-command nil projectile-git-submodule-command nil
;; ensure Windows users get rg's benefits ;; ensure Windows users get rg's benefits

View file

@ -54,6 +54,9 @@ examples.
It is recommended you don't set specify a font-size, as to inherit `doom-font's It is recommended you don't set specify a font-size, as to inherit `doom-font's
size.") size.")
(defvar doom-unicode-extra-fonts nil
"Fonts to inject into the unicode charset before `doom-unicode-font'.")
;; ;;
;;; Custom hooks ;;; Custom hooks
@ -85,48 +88,51 @@ size.")
(defvar doom--last-frame nil) (defvar doom--last-frame nil)
(defun doom-run-switch-window-hooks-h () (defun doom-run-switch-window-hooks-h ()
(let ((gc-cons-threshold most-positive-fixnum))
(unless (or doom-inhibit-switch-window-hooks (unless (or doom-inhibit-switch-window-hooks
(eq doom--last-window (selected-window)) (eq doom--last-window (selected-window))
(minibufferp)) (minibufferp))
(let ((doom-inhibit-switch-window-hooks t) (let ((gc-cons-threshold most-positive-fixnum)
(doom-inhibit-switch-window-hooks t)
(inhibit-redisplay t)) (inhibit-redisplay t))
(run-hooks 'doom-switch-window-hook) (run-hooks 'doom-switch-window-hook)
(setq doom--last-window (selected-window)))))) (setq doom--last-window (selected-window)))))
(defun doom-run-switch-frame-hooks-h (&rest _) (defun doom-run-switch-frame-hooks-h (&rest _)
(unless (or doom-inhibit-switch-frame-hooks (unless (or doom-inhibit-switch-frame-hooks
(eq doom--last-frame (selected-frame)) (eq doom--last-frame (selected-frame))
(frame-parameter nil 'parent-frame)) (frame-parameter nil 'parent-frame))
(let ((doom-inhibit-switch-frame-hooks t)) (let ((gc-cons-threshold most-positive-fixnum)
(doom-inhibit-switch-frame-hooks t))
(run-hooks 'doom-switch-frame-hook) (run-hooks 'doom-switch-frame-hook)
(setq doom--last-frame (selected-frame))))) (setq doom--last-frame (selected-frame)))))
(defun doom-run-switch-buffer-hooks-a (orig-fn buffer-or-name &rest args) (defun doom-run-switch-buffer-hooks-a (orig-fn buffer-or-name &rest args)
(let ((gc-cons-threshold most-positive-fixnum))
(if (or doom-inhibit-switch-buffer-hooks (if (or doom-inhibit-switch-buffer-hooks
(eq (current-buffer) (get-buffer buffer-or-name)) (and buffer-or-name
(eq (current-buffer)
(get-buffer buffer-or-name)))
(and (eq orig-fn #'switch-to-buffer) (car args))) (and (eq orig-fn #'switch-to-buffer) (car args)))
(apply orig-fn buffer-or-name args) (apply orig-fn buffer-or-name args)
(let ((doom-inhibit-switch-buffer-hooks t) (let ((gc-cons-threshold most-positive-fixnum)
(doom-inhibit-switch-buffer-hooks t)
(inhibit-redisplay t)) (inhibit-redisplay t))
(when-let (buffer (apply orig-fn buffer-or-name args)) (when-let (buffer (apply orig-fn buffer-or-name args))
(with-current-buffer (if (windowp buffer) (with-current-buffer (if (windowp buffer)
(window-buffer buffer) (window-buffer buffer)
buffer) buffer)
(run-hooks 'doom-switch-buffer-hook)) (run-hooks 'doom-switch-buffer-hook))
buffer))))) buffer))))
(defun doom-run-switch-to-next-prev-buffer-hooks-a (orig-fn &rest args) (defun doom-run-switch-to-next-prev-buffer-hooks-a (orig-fn &rest args)
(let ((gc-cons-threshold most-positive-fixnum))
(if doom-inhibit-switch-buffer-hooks (if doom-inhibit-switch-buffer-hooks
(apply orig-fn args) (apply orig-fn args)
(let ((doom-inhibit-switch-buffer-hooks t) (let ((gc-cons-threshold most-positive-fixnum)
(doom-inhibit-switch-buffer-hooks t)
(inhibit-redisplay t)) (inhibit-redisplay t))
(when-let (buffer (apply orig-fn args)) (when-let (buffer (apply orig-fn args))
(with-current-buffer buffer (with-current-buffer buffer
(run-hooks 'doom-switch-buffer-hook)) (run-hooks 'doom-switch-buffer-hook))
buffer))))) buffer))))
(defun doom-protect-fallback-buffer-h () (defun doom-protect-fallback-buffer-h ()
"Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."
@ -278,9 +284,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(setq indicate-buffer-boundaries nil (setq indicate-buffer-boundaries nil
indicate-empty-lines nil) indicate-empty-lines nil)
;; remove continuation arrow on right fringe
(delq! 'continuation fringe-indicator-alist 'assq)
;; ;;
;;; Windows/frames ;;; Windows/frames
@ -303,7 +306,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(add-to-list 'default-frame-alist '(tool-bar-lines . 0)) (add-to-list 'default-frame-alist '(tool-bar-lines . 0))
(add-to-list 'default-frame-alist '(vertical-scroll-bars))) (add-to-list 'default-frame-alist '(vertical-scroll-bars)))
(when IS-MAC (when! IS-MAC
;; Curse Lion and its sudden but inevitable fullscreen mode! ;; Curse Lion and its sudden but inevitable fullscreen mode!
;; NOTE Meaningless to railwaycat's emacs-mac build ;; NOTE Meaningless to railwaycat's emacs-mac build
(setq ns-use-native-fullscreen nil) (setq ns-use-native-fullscreen nil)
@ -413,16 +416,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(set-window-configuration doom--ediff-saved-wconf))))) (set-window-configuration doom--ediff-saved-wconf)))))
(use-package! goto-addr
:hook (text-mode . goto-address-mode)
:hook (prog-mode . goto-address-prog-mode)
:config
(define-key goto-address-highlight-keymap (kbd "RET") #'goto-address-at-point))
(use-package! hl-line (use-package! hl-line
;; Highlights the current line ;; Highlights the current line
:hook ((prog-mode text-mode conf-mode) . hl-line-mode) :hook ((prog-mode text-mode conf-mode special-mode) . hl-line-mode)
:config :config
;; Not having to render the hl-line overlay in multiple buffers offers a tiny ;; Not having to render the hl-line overlay in multiple buffers offers a tiny
;; performance boost. I also don't need to see it in other buffers. ;; performance boost. I also don't need to see it in other buffers.
@ -488,6 +484,14 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
all-the-icons-wicon all-the-icons-wicon
all-the-icons-material all-the-icons-material
all-the-icons-alltheicon) all-the-icons-alltheicon)
:preface
(setq doom-unicode-extra-fonts
(list "Weather Icons"
"github-octicons"
"FontAwesome"
"all-the-icons"
"file-icons"
"Material Icons"))
:config :config
(cond ((daemonp) (cond ((daemonp)
(defadvice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args) (defadvice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args)
@ -582,8 +586,9 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
(set-face-attribute 'fixed-pitch-serif nil :font doom-serif-font)) (set-face-attribute 'fixed-pitch-serif nil :font doom-serif-font))
(when doom-variable-pitch-font (when doom-variable-pitch-font
(set-face-attribute 'variable-pitch nil :font doom-variable-pitch-font)) (set-face-attribute 'variable-pitch nil :font doom-variable-pitch-font))
(when (and doom-unicode-font (fboundp 'set-fontset-font)) (when (fboundp 'set-fontset-font)
(set-fontset-font t 'unicode doom-unicode-font nil 'prepend))) (dolist (font (append doom-unicode-extra-fonts (doom-enlist doom-unicode-font)))
(set-fontset-font t 'unicode font nil 'prepend))))
((debug error) ((debug error)
(if (string-prefix-p "Font not available: " (error-message-string e)) (if (string-prefix-p "Font not available: " (error-message-string e))
(lwarn 'doom-ui :warning (lwarn 'doom-ui :warning
@ -598,22 +603,30 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
(let ((doom--prefer-theme-elc t)) ; DEPRECATED in Emacs 27 (let ((doom--prefer-theme-elc t)) ; DEPRECATED in Emacs 27
(load-theme doom-theme t))))) (load-theme doom-theme t)))))
(defadvice! doom--run-load-theme-hooks-a (theme &optional _no-confirm no-enable) (defadvice! doom--load-theme-a (orig-fn theme &optional no-confirm no-enable)
"Set up `doom-load-theme-hook' to run after `load-theme' is called." "Run `doom-load-theme-hook' on `load-theme' and fix its issues.
:after-while #'load-theme
1. Disable previously enabled themes.
2. Don't let face-remapping screw up loading the new theme
(*cough*`mixed-pitch-mode').
3. Record the current theme in `doom-theme'."
:around #'load-theme
;; HACK Run `load-theme' from an estranged buffer, where we can be assured
;; that buffer-local face remaps (by `mixed-pitch-mode', for instance)
;; won't interfere with changing themes.
(with-temp-buffer
(when-let (result (funcall orig-fn theme no-confirm no-enable))
(unless no-enable (unless no-enable
(setq doom-theme theme (setq doom-theme theme
doom-init-theme-p t) doom-init-theme-p t)
(run-hooks 'doom-load-theme-hook))) ;; `load-theme' doesn't disable previously enabled themes, which seems
;; like what you'd want. You could always use `enable-theme' to activate
;; multiple themes instead.
(mapc #'disable-theme (remq theme custom-enabled-themes))
(run-hooks 'doom-load-theme-hook))
result)))
(defadvice! doom--disable-enabled-themes-a (theme &optional _no-confirm no-enable) (when! (not EMACS27+)
"Disable previously enabled themes before loading a new one.
Otherwise, themes can conflict with each other."
:after-while #'load-theme
(unless no-enable
(mapc #'disable-theme (remq theme custom-enabled-themes))))
(unless EMACS27+
;; DEPRECATED Not needed in Emacs 27 ;; DEPRECATED Not needed in Emacs 27
(defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args) (defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args)
"Have `load-theme' prioritize the byte-compiled theme. "Have `load-theme' prioritize the byte-compiled theme.
@ -622,10 +635,8 @@ This offers a moderate boost in startup (or theme switch) time, so long as
:around #'load-theme :around #'load-theme
(if (or (null after-init-time) (if (or (null after-init-time)
doom--prefer-theme-elc) doom--prefer-theme-elc)
(cl-letf* ((old-locate-file (symbol-function 'locate-file)) (letf! (defun locate-file (filename path &optional _suffixes predicate)
((symbol-function 'locate-file) (funcall locate-file filename path '("c" "") predicate))
(lambda (filename path &optional _suffixes predicate)
(funcall old-locate-file filename path '("c" "") predicate))))
(apply orig-fn args)) (apply orig-fn args))
(apply orig-fn args)))) (apply orig-fn args))))

View file

@ -8,11 +8,16 @@
"Current version of Doom Emacs.") "Current version of Doom Emacs.")
(defconst EMACS27+ (> emacs-major-version 26)) (defconst EMACS27+ (> emacs-major-version 26))
(defconst EMACS28+ (> emacs-major-version 27))
(defconst IS-MAC (eq system-type 'darwin)) (defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux)) (defconst IS-LINUX (eq system-type 'gnu/linux))
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos))) (defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
(defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix))) (defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix)))
;; Unix tools looks for HOME, but this is normally not defined on Windows.
(when (and IS-WINDOWS (null (getenv "HOME")))
(setenv "HOME" (getenv "USERPROFILE")))
;; Ensure `doom-core-dir' is in `load-path' ;; Ensure `doom-core-dir' is in `load-path'
(add-to-list 'load-path (file-name-directory load-file-name)) (add-to-list 'load-path (file-name-directory load-file-name))
@ -39,6 +44,8 @@
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h)) (add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
;; Just the bare necessities ;; Just the bare necessities
(require 'subr-x)
(require 'cl-lib)
(require 'core-lib) (require 'core-lib)
@ -196,29 +203,30 @@ users).")
(setq gnutls-verify-error (not (getenv "INSECURE")) (setq gnutls-verify-error (not (getenv "INSECURE"))
gnutls-algorithm-priority gnutls-algorithm-priority
(when (boundp 'libgnutls-version) (when (boundp 'libgnutls-version)
(concat "SECURE128:+SECURE192:-VERS-ALL:+VERS-TLS1.2" (concat "SECURE128:+SECURE192:-VERS-ALL"
(if (and (not IS-WINDOWS) (if (and (not IS-WINDOWS)
(not (version< emacs-version "26.3")) (not (version< emacs-version "26.3"))
(>= libgnutls-version 30605)) (>= libgnutls-version 30605))
":+VERS-TLS1.3"))) ":+VERS-TLS1.3")
":+VERS-TLS1.2"))
;; `gnutls-min-prime-bits' is set based on recommendations from ;; `gnutls-min-prime-bits' is set based on recommendations from
;; https://www.keylength.com/en/4/ ;; https://www.keylength.com/en/4/
gnutls-min-prime-bits 3072 gnutls-min-prime-bits 3072
tls-checktrust gnutls-verify-error tls-checktrust gnutls-verify-error
;; Emacs is built with `gnutls' by default, so `tls-program' would not ;; Emacs is built with `gnutls' by default, so `tls-program' would not be
;; be used in that case. Otherwiese, people have reasons to not go with ;; used in that case. Otherwise, people have reasons to not go with
;; `gnutls', we use `openssl' instead. ;; `gnutls', we use `openssl' instead. For more details, see
;; For more details, see https://redd.it/8sykl1 ;; https://redd.it/8sykl1
tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof" tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof"
"gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \ "gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \
--strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h" --strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h"
;; compatibility fallbacks ;; compatibility fallbacks
"gnutls-cli -p %p %h")) "gnutls-cli -p %p %h"))
;; Emacs stores authinfo in $HOME and in plaintext. Let's not do that, mkay? ;; Emacs stores `authinfo' in $HOME and in plain-text. Let's not do that, mkay?
;; This file stores usernames, passwords, and other such treasures for the ;; This file stores usernames, passwords, and other such treasures for the
;; aspiring malicious third party. ;; aspiring malicious third party.
(setq auth-sources (list (expand-file-name "authinfo.gpg" doom-etc-dir) (setq auth-sources (list (concat doom-etc-dir "authinfo.gpg")
"~/.authinfo.gpg")) "~/.authinfo.gpg"))
;; Emacs on Windows frequently confuses HOME (C:\Users\<NAME>) and %APPDATA%, ;; Emacs on Windows frequently confuses HOME (C:\Users\<NAME>) and %APPDATA%,
@ -281,7 +289,7 @@ users).")
(setq ffap-machine-p-known 'reject) (setq ffap-machine-p-known 'reject)
;; Font compacting can be terribly expensive, especially for rendering icon ;; Font compacting can be terribly expensive, especially for rendering icon
;; fonts on Windows. Whether it has a noteable affect on Linux and Mac hasn't ;; fonts on Windows. Whether it has a notable affect on Linux and Mac hasn't
;; been determined, but we inhibit it there anyway. ;; been determined, but we inhibit it there anyway.
(setq inhibit-compacting-font-caches t) (setq inhibit-compacting-font-caches t)
@ -425,17 +433,6 @@ If this is a daemon session, load them all immediately instead."
;; ;;
;;; Bootstrap helpers ;;; Bootstrap helpers
(defun doom-try-run-hook (hook)
"Run HOOK (a hook function) with better error handling.
Meant to be used with `run-hook-wrapped'."
(doom-log "Running doom hook: %s" hook)
(condition-case e
(funcall hook)
((debug error)
(signal 'doom-hook-error (list hook e))))
;; return nil so `run-hook-wrapped' won't short circuit
nil)
(defun doom-display-benchmark-h (&optional return-p) (defun doom-display-benchmark-h (&optional return-p)
"Display a benchmark including number of packages and modules loaded. "Display a benchmark including number of packages and modules loaded.
@ -448,50 +445,6 @@ If RETURN-P, return the message as a string instead of displaying it."
(setq doom-init-time (setq doom-init-time
(float-time (time-subtract (current-time) before-init-time)))))) (float-time (time-subtract (current-time) before-init-time))))))
(defun doom-load-autoloads-file (file &optional noerror)
"Tries to load FILE (an autoloads file).
Return t on success, nil otherwise (but logs a warning)."
(condition-case e
(load (substring file 0 -3) noerror 'nomessage)
((debug error)
(message "Autoload file error: %s -> %s" (file-name-nondirectory file) e)
nil)))
(defun doom-load-envvars-file (file &optional noerror)
"Read and set envvars from FILE.
If NOERROR is non-nil, don't throw an error if the file doesn't exist or is
unreadable. Returns the names of envvars that were changed."
(if (not (file-readable-p file))
(unless noerror
(signal 'file-error (list "Couldn't read envvar file" file)))
(let (envvars environment)
(with-temp-buffer
(save-excursion
(insert "\n")
(insert-file-contents file))
(while (re-search-forward "\n *\\([^#= \n]*\\)=" nil t)
(push (match-string 1) envvars)
(push (buffer-substring
(match-beginning 1)
(1- (or (save-excursion
(when (re-search-forward "^\\([^= ]+\\)=" nil t)
(line-beginning-position)))
(point-max))))
environment)))
(when environment
(setq process-environment
(append (nreverse environment) process-environment)
exec-path
(if (member "PATH" envvars)
(append (split-string (getenv "PATH") path-separator t)
(list exec-directory))
exec-path)
shell-file-name
(if (member "SHELL" envvars)
(or (getenv "SHELL") shell-file-name)
shell-file-name))
envvars))))
(defun doom-initialize (&optional force-p noerror) (defun doom-initialize (&optional force-p noerror)
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil). "Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
@ -510,7 +463,7 @@ The overall load order of Doom is as follows:
Module config.el files Module config.el files
~/.doom.d/config.el ~/.doom.d/config.el
`doom-init-modules-hook' `doom-init-modules-hook'
`doom-after-init-hook' (`after-init-hook') `doom-after-init-modules-hook' (`after-init-hook')
`emacs-startup-hook' `emacs-startup-hook'
`doom-init-ui-hook' `doom-init-ui-hook'
`window-setup-hook' `window-setup-hook'

View file

@ -2,47 +2,44 @@
;;; core/packages.el ;;; core/packages.el
;; core.el ;; core.el
(package! auto-minor-mode :pin "17cfa1b548") (package! auto-minor-mode :pin "17cfa1b54800fdef2975c0c0531dad34846a5065")
(package! gcmh :pin "b1bde50891") (package! gcmh :pin "b1bde5089169a74f62033d027e06e98cbeedd43f")
;; core-ui.el ;; core-ui.el
(package! all-the-icons :pin "0b74fc3618") (package! all-the-icons :pin "0b74fc361817e885580c3f3408079f949f5830e1")
(package! hide-mode-line :pin "88888825b5") (package! hide-mode-line :pin "88888825b5b27b300683e662fa3be88d954b1cea")
(package! highlight-numbers :pin "8b4744c7f4") (package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307")
(package! rainbow-delimiters :pin "5125f4e476") (package! rainbow-delimiters :pin "5125f4e47604ad36c3eb4706310fcafac729ca8c")
(package! restart-emacs :pin "9aa90d3df9") (package! restart-emacs :pin "9aa90d3df9e08bc420e1c9845ee3ff568e911bd9")
;; core-editor.el ;; core-editor.el
(package! better-jumper :pin "6d240032ca") (package! better-jumper :pin "6d240032ca213ccb3347e25f26c29b6822bf03a7")
(package! dtrt-indent :pin "9163cd990f") (package! dtrt-indent :pin "9163cd990fb1f43dafed3948c6e406c13a45a6be")
(package! helpful :pin "c54e9ddbd6") (package! helpful :pin "c54e9ddbd6a77858048c1a4c4b549de98af8f88e")
(when IS-MAC (when IS-MAC
(package! ns-auto-titlebar :pin "1efc30d385")) (package! ns-auto-titlebar :pin "1efc30d38509647b417f05587fd7003457719256"))
(package! pcre2el :pin "0b5b2a2c17") (package! pcre2el :pin "0b5b2a2c173aab3fd14aac6cf5e90ad3bf58fa7d")
(package! smartparens :pin "555626a43f") (package! smartparens :pin "555626a43f9bb1985aa9a0eb675f2b88b29702c8")
(package! so-long (package! so-long
:built-in 'prefer ; included in Emacs 27+ :built-in 'prefer ; included in Emacs 27+
;; REVIEW so-long is slated to be published to ELPA eventually, but until then ;; REVIEW so-long is slated to be published to ELPA eventually, but until then
;; I've created my own mirror for it because git.savannah.gnu.org runs ;; I've created my own mirror for it because git.savannah.gnu.org runs
;; on a potato. ;; on a potato.
:recipe (:host github :repo "hlissner/emacs-so-long") :recipe (:host github :repo "hlissner/emacs-so-long")
:pin "ed666b0716") :pin "ed666b0716f60e8988c455804de24b55919e71ca")
(package! ws-butler (package! ws-butler
;; Use my fork of ws-butler, which has a few choice improvements and ;; Use my fork of ws-butler, which has a few choice improvements and
;; optimizations (the original has been abandoned). ;; optimizations (the original has been abandoned).
:recipe (:host github :repo "hlissner/ws-butler") :recipe (:host github :repo "hlissner/ws-butler")
:pin "2bb49d3ee7") :pin "2bb49d3ee7d2cba133bc7e9cdac416cd1c5e4fe0")
(unless IS-WINDOWS (unless IS-WINDOWS
(package! clipetty (package! clipetty
:recipe (:host github :repo "spudlyo/clipetty") :recipe (:host github :repo "spudlyo/clipetty")
:pin "7ee3f9c52f")) :pin "01b39044b9b65fa4ea7d3166f8b1ffab6f740362"))
;; core-projects.el ;; core-projects.el
(package! projectile :pin "eec569dc32") (package! projectile :pin "5cd261dd75f4d711c0016617621349e2a98b43aa")
;; core-keybinds.el ;; core-keybinds.el
(package! general :pin "14ad4c888b") (package! general :pin "42e38034cd2305fa7432866323c923979d8f9b06")
(package! which-key :pin "8b49ae978c") (package! which-key :pin "8b49ae978cceca65967f3544c236f32964ddbed0")
;; autoload/cache.el
(package! persistent-soft :pin "a1e0ddf2a1")

View file

@ -535,7 +535,7 @@ These are side-by-side comparisons, showing how to bind keys with and without
** Persist Emacs' initial frame position, dimensions and/or full-screen state across sessions ** Persist Emacs' initial frame position, dimensions and/or full-screen state across sessions
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
;; add to ~/.doom.d/config.el ;; add to ~/.doom.d/config.el
(when-let (dims (doom-cache-get 'last-frame-size)) (when-let (dims (doom-store-get 'last-frame-size))
(cl-destructuring-bind ((left . top) width height fullscreen) dims (cl-destructuring-bind ((left . top) width height fullscreen) dims
(setq initial-frame-alist (setq initial-frame-alist
(append initial-frame-alist (append initial-frame-alist
@ -546,7 +546,7 @@ These are side-by-side comparisons, showing how to bind keys with and without
(fullscreen . ,fullscreen)))))) (fullscreen . ,fullscreen))))))
(defun save-frame-dimensions () (defun save-frame-dimensions ()
(doom-cache-set 'last-frame-size (doom-store-set 'last-frame-size
(list (frame-position) (list (frame-position)
(frame-width) (frame-width)
(frame-height) (frame-height)

View file

@ -343,9 +343,7 @@ provides, and ~bin/doom help COMMAND~ to display documentation for a particular
#+begin_quote #+begin_quote
I recommend you add =~/.emacs.d/bin= to your ~PATH~ so you can call =doom= I recommend you add =~/.emacs.d/bin= to your ~PATH~ so you can call =doom=
directly and from anywhere. Accomplish this by adding this to your .bashrc or directly and from anywhere. Accomplish this by adding this to your .bashrc or
.zshrc file: .zshrc file: ~export PATH=~/.emacs.d/bin:$PATH~
~export PATH="$HOME/.emacs.d/bin:$PATH"~
#+end_quote #+end_quote
*** Install Doom Manually *** Install Doom Manually
@ -910,7 +908,7 @@ also be helpful for debugging.
+ define-key + define-key
+ global-set-key + global-set-key
+ map! + map!
+ unmap! + undefine-key!
+ define-key! + define-key!
** Writing your own modules ** Writing your own modules

View file

@ -92,7 +92,6 @@ Modules that reconfigure or augment packages or features built into Emacs.
Modules that bring support for a language or group of languages to Emacs. Modules that bring support for a language or group of languages to Emacs.
+ [[file:../modules/lang/agda/README.org][agda]] - TODO + [[file:../modules/lang/agda/README.org][agda]] - TODO
+ assembly - TODO
+ [[file:../modules/lang/cc/README.org][cc]] =+lsp= - TODO + [[file:../modules/lang/cc/README.org][cc]] =+lsp= - TODO
+ [[file:../modules/lang/clojure/README.org][clojure]] =+lsp= - TODO + [[file:../modules/lang/clojure/README.org][clojure]] =+lsp= - TODO
+ common-lisp - TODO + common-lisp - TODO
@ -112,11 +111,12 @@ Modules that bring support for a language or group of languages to Emacs.
+ [[file:../modules/lang/haskell/README.org][haskell]] =+dante +ghcide +lsp= - TODO + [[file:../modules/lang/haskell/README.org][haskell]] =+dante +ghcide +lsp= - TODO
+ hy - TODO + hy - TODO
+ [[file:../modules/lang/idris/README.org][idris]] - TODO + [[file:../modules/lang/idris/README.org][idris]] - TODO
+ [[file:../modules/lang/json/README.org][json]] =+lsp= - TODO
+ java =+meghanada +lsp= - TODO + java =+meghanada +lsp= - TODO
+ [[file:../modules/lang/javascript/README.org][javascript]] =+lsp= - JavaScript, TypeScript, and CoffeeScript support + [[file:../modules/lang/javascript/README.org][javascript]] =+lsp= - JavaScript, TypeScript, and CoffeeScript support
+ julia =+lsp= - TODO + julia =+lsp= - TODO
+ kotlin =+lsp+= - TODO + kotlin =+lsp+= - TODO
+ [[file:../modules/lang/latex/README.org][latex]] =+latexmk +cdlatex +fold= - TODO + [[file:../modules/lang/latex/README.org][latex]] =+latexmk +cdlatex +fold +lsp= - TODO
+ lean - TODO + lean - TODO
+ [[file:../modules/lang/ledger/README.org][ledger]] - TODO + [[file:../modules/lang/ledger/README.org][ledger]] - TODO
+ lua =+moonscript= - TODO + lua =+moonscript= - TODO
@ -129,7 +129,7 @@ Modules that bring support for a language or group of languages to Emacs.
+ [[file:../modules/lang/php/README.org][php]] =+lsp= - TODO + [[file:../modules/lang/php/README.org][php]] =+lsp= - TODO
+ plantuml - TODO + plantuml - TODO
+ purescript - TODO + purescript - TODO
+ [[file:../modules/lang/python/README.org][python]] =+lsp +pyenv +conda= - TODO + [[file:../modules/lang/python/README.org][python]] =+lsp +pyenv +conda +poetry= - TODO
+ qt - TODO + qt - TODO
+ racket - TODO + racket - TODO
+ [[file:../modules/lang/rest/README.org][rest]] - TODO + [[file:../modules/lang/rest/README.org][rest]] - TODO
@ -143,6 +143,7 @@ Modules that bring support for a language or group of languages to Emacs.
+ swift =+lsp= - TODO + swift =+lsp= - TODO
+ terra - TODO + terra - TODO
+ web =+lsp= - HTML and CSS (SCSS/SASS/LESS/Stylus) support. + web =+lsp= - HTML and CSS (SCSS/SASS/LESS/Stylus) support.
+ [[file:../modules/lang/yaml/README.org][yaml]] =+lsp= - TODO
* :term * :term
Modules that offer terminal emulation. Modules that offer terminal emulation.
@ -167,7 +168,7 @@ Small modules that give Emacs access to external tools & services.
backend backend
+ [[file:../modules/tools/lsp/README.org][lsp]] =+peek= - TODO + [[file:../modules/tools/lsp/README.org][lsp]] =+peek= - TODO
+ macos - TODO + macos - TODO
+ magit - TODO + [[file:../modules/tools/magit/README.org][magit]] =+forge= - TODO
+ make - TODO + make - TODO
+ pass - TODO + pass - TODO
+ pdf - TODO + pdf - TODO

View file

@ -1,11 +1,11 @@
;;; init.el -*- lexical-binding: t; -*- ;;; init.el -*- lexical-binding: t; -*-
;; This file controls what Doom modules are enabled and what order they load in. ;; This file controls what Doom modules are enabled and what order they load
;; Remember to run 'doom sync' after modifying it! ;; in. Remember to run 'doom sync' after modifying it!
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's ;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find information about all of Doom's modules ;; documentation. There you'll find information about all of Doom's
;; and what flags they support. ;; modules and what flags they support.
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or ;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c g k' for non-vim users) to view its documentation. This works on ;; 'C-c g k' for non-vim users) to view its documentation. This works on
@ -34,7 +34,7 @@
;;hydra ;;hydra
;;indent-guides ; highlighted indent columns ;;indent-guides ; highlighted indent columns
modeline ; snazzy, Atom-inspired modeline, plus API modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping ;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim ;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows (popup +defaults) ; tame sudden yet inevitable temporary windows
@ -44,7 +44,7 @@
;;unicode ; extended unicode support for various languages ;;unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB vi-tilde-fringe ; fringe tildes to mark beyond EOB
window-select ; visually switch windows ;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing ;;zen ; distraction-free coding or writing
@ -104,14 +104,13 @@
:lang :lang
;;agda ; types of types of types of types... ;;agda ; types of types of types of types...
;;assembly ; assembly for fun or debugging
;;cc ; C/C++/Obj-C madness ;;cc ; C/C++/Obj-C madness
;;clojure ; java with a lisp ;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all ;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs ;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c ;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans ;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats ;;data ; config/data formats
;;(dart +flutter) ; paint ui and not much else ;;(dart +flutter) ; paint ui and not much else
;;elixir ; erlang done right ;;elixir ; erlang done right
;;elm ; care for a cup of TEA? ;;elm ; care for a cup of TEA?
@ -125,6 +124,7 @@
;;(haskell +dante) ; a language that's lazier than I am ;;(haskell +dante) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python ;;hy ; readability of scheme w/ speed of python
;;idris ; ;;idris ;
;;json ; At least it ain't XML
;;(java +meghanada) ; the poster child for carpal tunnel syndrome ;;(java +meghanada) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB
@ -158,6 +158,7 @@
;;swift ; who asked for emoji variables? ;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance. ;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes ;;web ; the tubes
;;yaml ; JSON, but readable
:email :email
;;(mu4e +gmail) ;;(mu4e +gmail)

View file

@ -42,10 +42,10 @@
org-gcal-fetch org-gcal-fetch
org-gcal-post-at-point org-gcal-post-at-point
org-gcal-delete-at-point) org-gcal-delete-at-point)
:init
(defvar org-gcal-dir (concat doom-cache-dir "org-gcal/"))
(defvar org-gcal-token-file (concat org-gcal-dir "token.gpg"))
:config :config
;; hack to avoid the deferred.el error ;; hack to avoid the deferred.el error
(defun org-gcal--notify (title mes) (defun org-gcal--notify (title mes)
(message "org-gcal::%s - %s" title mes))) (message "org-gcal::%s - %s" title mes)))
;; (use-package! alert)

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; app/calendar/packages.el ;;; app/calendar/packages.el
(package! calfw :pin "03abce9762") (package! calfw :pin "03abce97620a4a7f7ec5f911e669da9031ab9088")
(package! calfw-org :pin "03abce9762") (package! calfw-org :pin "03abce97620a4a7f7ec5f911e669da9031ab9088")
(package! org-gcal :pin "6821e34967") (package! org-gcal :pin "2ee2b31547e6f4e33db70fb812d552e55d612fd6")

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; app/irc/packages.el ;;; app/irc/packages.el
(package! circe :pin "e5bf5f8974") (package! circe :pin "e5bf5f89741a9c43aa406491e94dd8d58c302fb4")
(package! circe-notifications :pin "291149ac12") (package! circe-notifications :pin "291149ac12877bbd062da993479d3533a26862b0")

View file

@ -101,10 +101,9 @@
;;;###autoload ;;;###autoload
(defun +rss-put-sliced-image-fn (spec alt &optional flags) (defun +rss-put-sliced-image-fn (spec alt &optional flags)
"TODO" "TODO"
(cl-letf (((symbol-function #'insert-image) (letf! (defun insert-image (image &optional alt _area _slice)
(lambda (image &optional alt _area _slice)
(let ((height (cdr (image-size image t)))) (let ((height (cdr (image-size image t))))
(insert-sliced-image image alt nil (max 1 (/ height 20.0)) 1))))) (insert-sliced-image image alt nil (max 1 (/ height 20.0)) 1)))
(shr-put-image spec alt flags))) (shr-put-image spec alt flags)))
;;;###autoload ;;;###autoload

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; app/rss/packages.el ;;; app/rss/packages.el
(package! elfeed :pin "d0405e6386") (package! elfeed :pin "d0405e63863e54a01200740a6717ac875eceabc1")
(package! elfeed-org :pin "77b6bbf222") (package! elfeed-org :pin "77b6bbf222487809813de260447d31c4c59902c9")

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; app/twitter/packages.el ;;; app/twitter/packages.el
(package! twittering-mode :pin "114891e8fd") (package! twittering-mode :pin "114891e8fdb4f06b1326a6cf795e49c205cf9e29")
(package! avy :pin "3bf83140fa") (package! avy :pin "509471bad0e8094b8639729ec39ca141fae7d4bd")

View file

@ -8,15 +8,16 @@
:init (setq langtool-default-language "en-US") :init (setq langtool-default-language "en-US")
:config :config
(unless (or langtool-bin (unless (or langtool-bin
langtool-language-tool-jar) langtool-language-tool-jar
(setq langtool-language-tool-jar langtool-java-classpath)
(cond (IS-MAC (cond (IS-MAC
(setq langtool-language-tool-jar
(locate-file "libexec/languagetool-commandline.jar" (locate-file "libexec/languagetool-commandline.jar"
(doom-files-in "/usr/local/Cellar/languagetool" (doom-files-in "/usr/local/Cellar/languagetool"
:type 'dirs :type 'dirs
:depth 2))) :depth 2))))
(IS-LINUX (IS-LINUX
"/usr/share/java/languagetool/languagetool-commandline.jar"))))) (setq langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")))))
;; Detects weasel words, passive voice and duplicates. Proselint would be a ;; Detects weasel words, passive voice and duplicates. Proselint would be a

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; checkers/grammar/packages.el ;;; checkers/grammar/packages.el
(package! langtool :pin "a71ed02ce0") (package! langtool :pin "a71ed02ce06920ae3cafd6708de1c21811ce14c3")
(package! writegood-mode :pin "b71757ec33") (package! writegood-mode :pin "b71757ec337e226909fb0422f0224e31acc71733")

View file

@ -1,11 +1,11 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; checkers/spell/packages.el ;;; checkers/spell/packages.el
(package! flyspell-correct :pin "e765d1a3d9") (package! flyspell-correct :pin "fd8ac7a4f922ce5ea1cc5d4583a7d584847cb6b5")
(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)
(package! flyspell-correct-ivy :pin "e765d1a3d9")) (package! flyspell-correct-ivy))
((featurep! :completion helm) ((featurep! :completion helm)
(package! flyspell-correct-helm :pin "e765d1a3d9")) (package! flyspell-correct-helm))
((package! flyspell-correct-popup :pin "e765d1a3d9"))) ((package! flyspell-correct-popup)))
(package! flyspell-lazy :pin "3ebf68cc9e") (package! flyspell-lazy :pin "3ebf68cc9eb10c972a2de8d7861cbabbbce69570")

View file

@ -1,9 +1,9 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; checkers/syntax/packages.el ;;; checkers/syntax/packages.el
(package! flycheck :pin "f19a51c0f1") (package! flycheck :pin "246e1d4380721ca03962464f11d02dd1372860ce")
(package! flycheck-popup-tip :pin "ef86aad907") (package! flycheck-popup-tip :pin "ef86aad907f27ca076859d8d9416f4f7727619c6")
(when (featurep! +childframe) (when (featurep! +childframe)
(package! flycheck-posframe :pin "2b3e94c2e4")) (package! flycheck-posframe :pin "2b3e94c2e427ec9831c513007460c5ea9e2225a3"))
;; TODO flymake? ;; TODO flymake?

View file

@ -11,9 +11,26 @@
company-require-match 'never company-require-match 'never
company-global-modes company-global-modes
'(not erc-mode message-mode help-mode gud-mode eshell-mode) '(not erc-mode message-mode help-mode gud-mode eshell-mode)
company-backends '(company-capf)
company-frontends '(company-pseudo-tooltip-frontend company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)) company-echo-metadata-frontend)
;; Buffer-local backends will be computed when loading a major mode, so
;; only specify a global default here.
company-backends '(company-capf)
;; Company overrides `company-active-map' based on
;; `company-auto-complete-chars'; no magic please!
company-auto-complete-chars nil
;; Only search the current buffer for `company-dabbrev' (a backend that
;; suggests text your open buffers). This prevents Company from causing
;; lag once you have a lot of buffers open.
company-dabbrev-other-buffers nil
;; Make `company-dabbrev' fully case-sensitive, to improve UX with
;; domain-specific words with particular casing.
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil)
:config :config
(when (featurep! :editor evil) (when (featurep! :editor evil)
(add-hook 'company-mode-hook #'evil-normalize-keymaps) (add-hook 'company-mode-hook #'evil-normalize-keymaps)
@ -106,6 +123,8 @@
(ElispFeature . ,(all-the-icons-material "stars" :face 'all-the-icons-orange)) (ElispFeature . ,(all-the-icons-material "stars" :face 'all-the-icons-orange))
(ElispFace . ,(all-the-icons-material "format_paint" :face 'all-the-icons-pink))))) (ElispFace . ,(all-the-icons-material "format_paint" :face 'all-the-icons-pink)))))
(delq! 'company-echo-metadata-frontend company-frontends)
(defun +company-box-icons--elisp-fn (candidate) (defun +company-box-icons--elisp-fn (candidate)
(when (derived-mode-p 'emacs-lisp-mode) (when (derived-mode-p 'emacs-lisp-mode)
(let ((sym (intern candidate))) (let ((sym (intern candidate)))

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; completion/company/packages.el ;;; completion/company/packages.el
(package! company :pin "61ddd9afb5") (package! company :pin "6333fc4ebbbf4d28e834de8715561e984f149ecb")
(package! company-dict :pin "cd7b8394f6") (package! company-dict :pin "cd7b8394f6014c57897f65d335d6b2bd65dab1f4")
(package! company-prescient :pin "53307731f3") (package! company-prescient :pin "0f4a89bdec61395138d968a38d375e63ccfbed63")
(when (featurep! +childframe) (when (featurep! +childframe)
(package! company-box :pin "8fc6168f2d")) (package! company-box :pin "3814fcb14e92f4b85b19e664e216a7c8d5c7144d"))

View file

@ -101,14 +101,7 @@ be negative.")
:config :config
(set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil) (set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil)
;; HACK Doom doesn't support these commands, which invite the user to install ;; Hide the modeline in helm windows as it serves little purpose.
;; the package via ELPA. Force them to use +helm/* instead, because they work
;; out of the box.
(advice-add #'helm-projectile-rg :override #'+helm/project-search)
(advice-add #'helm-projectile-ag :override #'+helm/project-search)
(advice-add #'helm-projectile-grep :override #'+helm/project-search)
;; Hide the modeline
(defun +helm--hide-mode-line (&rest _) (defun +helm--hide-mode-line (&rest _)
(with-current-buffer (helm-buffer-get) (with-current-buffer (helm-buffer-get)
(unless helm-mode-line-string (unless helm-mode-line-string

View file

@ -1,19 +1,19 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; completion/helm/packages.el ;;; completion/helm/packages.el
(package! helm :pin "d978f20f4c") (package! helm :pin "b6db9fb47a8900704394e63b795f4a54cb4701a8")
(package! helm-rg :pin "785a80fe5c") (package! helm-rg :pin "785a80fe5cc87e27c5ea3d00a70049028d9e2847")
(package! helm-c-yasnippet :pin "65ca732b51") (package! helm-c-yasnippet :pin "65ca732b510bfc31636708aebcfe4d2d845b59b0")
(package! helm-company :pin "6eb5c2d730") (package! helm-company :pin "6eb5c2d730a60e394e005b47c1db018697094dde")
(package! helm-describe-modes (package! helm-describe-modes
:recipe (:host github :repo "emacs-helm/helm-describe-modes") :recipe (:host github :repo "emacs-helm/helm-describe-modes")
:pin "11fb36af11") :pin "11fb36af119b784539d31c6160002de1957408aa")
(package! helm-projectile :pin "5328b74ddd") (package! helm-projectile :pin "5328b74dddcee8d1913803ca8167868831a07463")
(package! swiper-helm :pin "93fb6db87b") (package! swiper-helm :pin "93fb6db87bc6a5967898b5fd3286954cc72a0008")
(when (featurep! +fuzzy) (when (featurep! +fuzzy)
(package! helm-flx :pin "6640fac5cb")) (package! helm-flx :pin "6640fac5cb16bee73c95b8ed1248a4e5e113690e"))
(when (featurep! +childframe) (when (featurep! +childframe)
(package! posframe :pin "e62e584268")) (package! posframe :pin "093b29a53cbeda6d637ccc9ef4dfc47123e79b9e"))
(when (featurep! :lang org) (when (featurep! :lang org)
(package! helm-org :pin "b7a18dfc17")) (package! helm-org :pin "b7a18dfc17e8b933956d61d68c435eee03a96c24"))
(package! helm-descbinds :pin "b725159823") (package! helm-descbinds :pin "b72515982396b6e336ad7beb6767e95a80fca192")

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; completion/ido/packages.el ;;; completion/ido/packages.el
(package! flx-ido :pin "17f5c9cb2a") (package! flx-ido :pin "17f5c9cb2af18aa6f52910ff4a5a63591261ced5")
(package! ido-completing-read+ :pin "98d3a6e56b") (package! ido-completing-read+ :pin "98d3a6e56b1d3652da7b47f49f76d77f82ea80ba")
(package! ido-sort-mtime :pin "f638ff0c92") (package! ido-sort-mtime :pin "f638ff0c922af862f5211779f2311a27fde428eb")
(package! ido-vertical-mode :pin "16c4c1a112") (package! ido-vertical-mode :pin "16c4c1a112796ee0bcf401ea39d3e2643a89feaf")
(package! crm-custom :pin "f1aaccf643") (package! crm-custom :pin "f1aaccf64306a5f99d9bf7ba815d7ea41c15518d")

View file

@ -129,7 +129,11 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(ivy-rich-counsel-function-docstring (:face font-lock-doc-face)))) (ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well ;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
'counsel-projectile-switch-to-buffer 'counsel-projectile-switch-to-buffer
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer)) (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer)
'counsel-bookmark
'(:columns
((ivy-rich-candidate (:width 0.5))
(ivy-rich-bookmark-filename (:width 60)))))
;; Remove built-in coloring of buffer list; we do our own ;; Remove built-in coloring of buffer list; we do our own
(setq ivy-switch-buffer-faces-alist nil) (setq ivy-switch-buffer-faces-alist nil)
@ -260,9 +264,15 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
:override #'counsel--find-return-list :override #'counsel--find-return-list
(cl-destructuring-bind (find-program . args) (cl-destructuring-bind (find-program . args)
(cond ((executable-find doom-projectile-fd-binary) (cond ((executable-find doom-projectile-fd-binary)
(cons doom-projectile-fd-binary (list "-t" "f" "-E" ".git"))) (cons doom-projectile-fd-binary
(list "--color=never" "-E" ".git"
"--type" "file" "--type" "symlink" "--follow")))
((executable-find "rg") ((executable-find "rg")
(split-string (format counsel-rg-base-command "--files --no-messages") " " t)) (append (list "rg" "--files" "--follow" "--color=never" "--hidden" "--no-messages")
(cl-loop for dir in projectile-globally-ignored-directories
collect "--glob"
collect (concat "!" dir))
(if IS-WINDOWS (list "--path-separator" "/"))))
((cons find-program args))) ((cons find-program args)))
(unless (listp args) (unless (listp args)
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly.")) (user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))
@ -328,7 +338,9 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; posframe. ;; posframe.
(dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep)) (dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep))
(setf (alist-get fn ivy-posframe-display-functions-alist) (setf (alist-get fn ivy-posframe-display-functions-alist)
#'ivy-display-function-fallback))) #'ivy-display-function-fallback))
(add-hook 'doom-reload-hook #'posframe-delete-all))
(use-package! flx (use-package! flx

View file

@ -1,23 +1,23 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; completion/ivy/packages.el ;;; completion/ivy/packages.el
(package! swiper :pin "64f05f4735") (package! swiper :pin "9e0803cdb5b47e4e1844e8281516b46589ef26c7")
(package! ivy) (package! ivy)
(package! ivy-hydra) (package! ivy-hydra)
(package! counsel) (package! counsel)
(package! amx :pin "e512e74e83") (package! amx :pin "7fb7b874291e0cdeb1f0acb18564a686ec86788d")
(package! counsel-projectile :pin "b556ed8995") (package! counsel-projectile :pin "b556ed8995f375e57496f3482aef4b0def565de8")
(package! ivy-rich :pin "596874d146") (package! ivy-rich :pin "3f818b201769bc13cc75aa73645217e374136aca")
(package! wgrep :pin "5977b8e000") (package! wgrep :pin "5977b8e00051c9003ca96e9d35133e0dea68db2c")
(if (featurep! +prescient) (if (featurep! +prescient)
(package! ivy-prescient :pin "53307731f3") (package! ivy-prescient :pin "0f4a89bdec61395138d968a38d375e63ccfbed63")
(when (featurep! +fuzzy) (when (featurep! +fuzzy)
(package! flx :pin "17f5c9cb2a"))) (package! flx :pin "17f5c9cb2af18aa6f52910ff4a5a63591261ced5")))
(when (featurep! +childframe) (when (featurep! +childframe)
(package! ivy-posframe :pin "ae9bafe94f")) (package! ivy-posframe :pin "ae9bafe94fe6b77b6fe45766ae6172646f6a5d50"))
(when (featurep! +icons) (when (featurep! +icons)
(package! all-the-icons-ivy :pin "a70cbfa1ef")) (package! all-the-icons-ivy :pin "a70cbfa1effe36efc946a823a580cec686d5e88d"))

View file

@ -39,7 +39,7 @@
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace :desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines :desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
:desc "List errors" "x" #'flymake-show-diagnostics-buffer :desc "List errors" "x" #'flymake-show-diagnostics-buffer
(:when (featurep! :tools flycheck) (:when (featurep! :checkers syntax)
:desc "List errors" "x" #'flycheck-list-errors) :desc "List errors" "x" #'flycheck-list-errors)
(:when (featurep! :tools lsp) (:when (featurep! :tools lsp)
:desc "LSP Code actions" "a" #'lsp-execute-code-action :desc "LSP Code actions" "a" #'lsp-execute-code-action
@ -159,7 +159,7 @@
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer :desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture :desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file :desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph-show :desc "Show graph" "g" #'org-roam-graph
:desc "Insert" "i" #'org-roam-insert :desc "Insert" "i" #'org-roam-insert
:desc "Org Roam" "r" #'org-roam :desc "Org Roam" "r" #'org-roam
(:prefix ("d" . "by date") (:prefix ("d" . "by date")
@ -182,7 +182,7 @@
:desc "Find file in project sidebar" "P" #'+neotree/find-this-file) :desc "Find file in project sidebar" "P" #'+neotree/find-this-file)
(:when (featurep! :ui treemacs) (:when (featurep! :ui treemacs)
:desc "Project sidebar" "p" #'+treemacs/toggle :desc "Project sidebar" "p" #'+treemacs/toggle
:desc "Find file in project rsidebar" "P" #'+treemacs/find-file) :desc "Find file in project rsidebar" "P" #'treemacs-find-file)
(:when (featurep! :term shell) (:when (featurep! :term shell)
:desc "Toggle shell popup" "t" #'+shell/toggle :desc "Toggle shell popup" "t" #'+shell/toggle
:desc "Open shell here" "T" #'+shell/here) :desc "Open shell here" "T" #'+shell/here)
@ -249,14 +249,14 @@
:desc "Indent style" "I" #'doom/toggle-indent-style :desc "Indent style" "I" #'doom/toggle-indent-style
:desc "Line numbers" "l" #'doom/toggle-line-numbers :desc "Line numbers" "l" #'doom/toggle-line-numbers
:desc "Word-wrap mode" "w" #'+word-wrap-mode :desc "Word-wrap mode" "w" #'+word-wrap-mode
(:when (featurep! :tools flycheck) (:when (featurep! :checkers syntax)
:desc "Flycheck" "f" #'flycheck-mode) :desc "Flycheck" "f" #'flycheck-mode)
(:when (featurep! :ui indent-guides) (:when (featurep! :ui indent-guides)
:desc "Indent guides" "i" #'highlight-indent-guides-mode) :desc "Indent guides" "i" #'highlight-indent-guides-mode)
(:when (featurep! :lang org +present) (:when (featurep! :lang org +present)
:desc "org-tree-slide mode" "p" #'+org-present/start) :desc "org-tree-slide mode" "p" #'+org-present/start)
:desc "Read-only mode" "r" #'read-only-mode :desc "Read-only mode" "r" #'read-only-mode
(:when (featurep! :tools flyspell) (:when (featurep! :checkers spell)
:desc "Flyspell" "s" #'flyspell-mode) :desc "Flyspell" "s" #'flyspell-mode)
(:when (featurep! :lang org +pomodoro) (:when (featurep! :lang org +pomodoro)
:desc "Pomodoro timer" "t" #'org-pomodoro) :desc "Pomodoro timer" "t" #'org-pomodoro)
@ -543,14 +543,4 @@
;;; treemacs ;;; treemacs
(:when (featurep! :ui treemacs) (:when (featurep! :ui treemacs)
"<f9>" #'+treemacs/toggle "<f9>" #'+treemacs/toggle
"<C-f9>" #'+treemacs/find-file) "<C-f9>" #'treemacs-find-file))
;;; yasnippet
(:after yasnippet
:map yas-keymap ; keymap while editing an inserted snippet
"C-e" #'+snippets/goto-end-of-field
"C-a" #'+snippets/goto-start-of-field
"<S-tab>" #'yas-prev-field
"<M-backspace>" #'+snippets/delete-to-start-of-field
[backspace] #'+snippets/delete-backward-char
[delete] #'+snippets/delete-forward-char-or-field))

View file

@ -4,9 +4,12 @@
;; NOTE SPC u replaces C-u as the universal argument. ;; NOTE SPC u replaces C-u as the universal argument.
;; Minibuffer ;; Minibuffer
(define-key! evil-ex-completion-map (define-key! :keymaps '(evil-ex-completion-map evil-ex-search-keymap)
"C-a" #'evil-beginning-of-line "C-a" #'evil-beginning-of-line
"C-b" #'evil-backward-char) "C-b" #'evil-backward-char
"C-f" #'evil-forward-char
"C-j" #'next-complete-history-element
"C-k" #'previous-complete-history-element)
(define-key! :keymaps +default-minibuffer-maps (define-key! :keymaps +default-minibuffer-maps
[escape] #'abort-recursive-edit [escape] #'abort-recursive-edit
@ -15,16 +18,20 @@
"C-u" #'evil-delete-back-to-indentation "C-u" #'evil-delete-back-to-indentation
"C-v" #'yank "C-v" #'yank
"C-w" #'doom/delete-backward-word "C-w" #'doom/delete-backward-word
"C-z" (λ! (ignore-errors (call-interactively #'undo))) "C-z" (λ! (ignore-errors (call-interactively #'undo))))
;; Scrolling lines
(when (featurep! :editor evil +everywhere)
(define-key! :keymaps +default-minibuffer-maps
"C-j" #'next-line "C-j" #'next-line
"C-k" #'previous-line "C-k" #'previous-line
"C-S-j" #'scroll-up-command "C-S-j" #'scroll-up-command
"C-S-k" #'scroll-down-command) "C-S-k" #'scroll-down-command)
(define-key! :states 'insert :keymaps +default-minibuffer-maps
"C-j" #'next-line
"C-k" #'previous-line)
(define-key! read-expression-map (define-key! read-expression-map
"C-j" #'next-line-or-history-element "C-j" #'next-line-or-history-element
"C-k" #'previous-line-or-history-element)) "C-k" #'previous-line-or-history-element)))
;; ;;
@ -186,9 +193,9 @@
;;; :ui ;;; :ui
(map! (:when (featurep! :ui popup) (map! (:when (featurep! :ui popup)
:n "C-`" #'+popup/toggle "C-`" #'+popup/toggle
:n "C-~" #'+popup/raise "C-~" #'+popup/raise
:g "C-x p" #'+popup/other) "C-x p" #'+popup/other)
(:when (featurep! :ui workspaces) (:when (featurep! :ui workspaces)
:n "C-t" #'+workspace/new :n "C-t" #'+workspace/new
@ -489,7 +496,7 @@
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer :desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture :desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file :desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph-show :desc "Show graph" "g" #'org-roam-graph
:desc "Insert" "i" #'org-roam-insert :desc "Insert" "i" #'org-roam-insert
:desc "Org Roam" "r" #'org-roam :desc "Org Roam" "r" #'org-roam
(:prefix ("d" . "by date") (:prefix ("d" . "by date")
@ -522,7 +529,7 @@
:desc "Find file in project sidebar" "P" #'+neotree/find-this-file) :desc "Find file in project sidebar" "P" #'+neotree/find-this-file)
(:when (featurep! :ui treemacs) (:when (featurep! :ui treemacs)
:desc "Project sidebar" "p" #'+treemacs/toggle :desc "Project sidebar" "p" #'+treemacs/toggle
:desc "Find file in project sidebar" "P" #'+treemacs/find-file) :desc "Find file in project sidebar" "P" #'treemacs-find-file)
(:when (featurep! :term shell) (:when (featurep! :term shell)
:desc "Toggle shell popup" "t" #'+shell/toggle :desc "Toggle shell popup" "t" #'+shell/toggle
:desc "Open shell here" "T" #'+shell/here) :desc "Open shell here" "T" #'+shell/here)

View file

@ -27,11 +27,15 @@
;;;###autoload ;;;###autoload
(defun +default/browse-notes () (defun +default/browse-notes ()
"Browse files from `org-directory'." "Browse files from `org-directory'."
(interactive) (doom-project-browse org-directory)) (interactive)
(require 'org)
(doom-project-browse org-directory))
;;;###autoload ;;;###autoload
(defun +default/find-in-notes () (defun +default/find-in-notes ()
"Find a file under `org-directory', recursively." "Find a file under `org-directory', recursively."
(interactive) (doom-project-find-file org-directory)) (interactive)
(require 'org)
(doom-project-find-file org-directory))
;;;###autoload ;;;###autoload
(defun +default/find-file-under-here () (defun +default/find-file-under-here ()

View file

@ -25,7 +25,8 @@ If prefix ARG is set, prompt for a directory to search from."
"Conduct a text search in the current project root. "Conduct a text search in the current project root.
If prefix ARG is set, prompt for a known project to search from." If prefix ARG is set, prompt for a known project to search from."
(interactive "P") (interactive "P")
(let* ((disabled-command-function nil) (let* ((projectile-project-root nil)
(disabled-command-function nil)
(default-directory (default-directory
(if arg (if arg
(if-let (projects (projectile-relevant-known-projects)) (if-let (projects (projectile-relevant-known-projects))
@ -51,7 +52,8 @@ If prefix ARG is set, prompt for a known project to search from."
(interactive (interactive
(list (rxt-quote-pcre (or (doom-thing-at-point-or-region) "")) (list (rxt-quote-pcre (or (doom-thing-at-point-or-region) ""))
current-prefix-arg)) current-prefix-arg))
(let ((default-directory (let* ((projectile-project-root nil)
(default-directory
(if arg (if arg
(if-let (projects (projectile-relevant-known-projects)) (if-let (projects (projectile-relevant-known-projects))
(completing-read "Switch to project: " projects (completing-read "Switch to project: " projects

View file

@ -50,21 +50,6 @@ If `buffer-file-name' isn't set, uses `default-directory'."
(abbreviate-file-name path) (abbreviate-file-name path)
(file-name-nondirectory path))))) (file-name-nondirectory path)))))
;;;###autoload
(defun +default--newline-indent-and-continue-comments-a ()
"A replacement for `newline-and-indent'.
Continues comments if executed from a commented line, with special support for
languages with weak native comment continuation support (like C-family
languages)."
(interactive)
(if (and (sp-point-in-comment)
comment-line-break-function)
(funcall comment-line-break-function nil)
(delete-horizontal-space t)
(newline nil t)
(indent-according-to-mode)))
(defun doom--backward-delete-whitespace-to-column () (defun doom--backward-delete-whitespace-to-column ()
"Delete back to the previous column of whitespace, or as much whitespace as "Delete back to the previous column of whitespace, or as much whitespace as

View file

@ -1,5 +1,8 @@
;;; config/default/config.el -*- lexical-binding: t; -*- ;;; config/default/config.el -*- lexical-binding: t; -*-
(defvar +default-want-RET-continue-comments t
"If non-nil, RET will continue commented lines.")
(defvar +default-minibuffer-maps (defvar +default-minibuffer-maps
(append '(minibuffer-local-map (append '(minibuffer-local-map
minibuffer-local-ns-map minibuffer-local-ns-map
@ -31,7 +34,10 @@
(after! epa (after! epa
;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt ;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt
;; for the key passphrase. ;; for the key passphrase.
(setq epa-pinentry-mode 'loopback) (set (if EMACS27+
'epg-pinentry-mode
'epa-pinentry-mode) ; DEPRECATED `epa-pinentry-mode'
'loopback)
;; Default to the first secret key available in your keyring. ;; Default to the first secret key available in your keyring.
(setq-default (setq-default
epa-file-encrypt-to epa-file-encrypt-to
@ -217,8 +223,28 @@
;; f) do none of this when inside a string ;; f) do none of this when inside a string
(advice-add #'delete-backward-char :override #'+default--delete-backward-char-a)) (advice-add #'delete-backward-char :override #'+default--delete-backward-char-a))
;; Makes `newline-and-indent' continue comments (and more reliably) ;; HACK Makes `newline-and-indent' continue comments (and more reliably).
(advice-add #'newline-and-indent :override #'+default--newline-indent-and-continue-comments-a)) ;; Consults `doom-point-in-comment-functions' to detect a commented
;; region and uses that mode's `comment-line-break-function' to continue
;; comments. If neither exists, it will fall back to the normal behavior
;; of `newline-and-indent'.
;;
;; We use an advice here instead of a remapping because many modes define
;; and remap to their own newline-and-indent commands, and tackling all
;; those cases was judged to be more work than dealing with the edge
;; cases on a case by case basis.
(defadvice! +default--newline-indent-and-continue-comments-a (&rest _)
"A replacement for `newline-and-indent'.
Continues comments if executed from a commented line. Consults
`doom-point-in-comment-functions' to determine if in a comment."
:before-until #'newline-and-indent
(interactive "*")
(when (and +default-want-RET-continue-comments
(doom-point-in-comment-p)
(fboundp comment-line-break-function))
(funcall comment-line-break-function nil)
t)))
;; ;;

View file

@ -1,9 +1,9 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; config/default/packages.el ;;; config/default/packages.el
(package! avy :pin "3bf83140fa") (package! avy :pin "509471bad0e8094b8639729ec39ca141fae7d4bd")
(package! drag-stuff :pin "6d06d846cd") (package! drag-stuff :pin "6d06d846cd37c052d79acd0f372c13006aa7e7c8")
(package! link-hint :pin "0d9cabcdb7") (package! link-hint :pin "7440704cacb5c0fab35fff8ec59d30fbea17f44a")
(unless (featurep! :editor evil) (unless (featurep! :editor evil)
(package! expand-region :pin "ea6b4cbb99")) (package! expand-region :pin "ea6b4cbb9985ddae532bd2faf9bb00570c9f2781"))

View file

@ -98,7 +98,7 @@
(evil-ex-define-cmd "tabsave" #'+workspace:save) (evil-ex-define-cmd "tabsave" #'+workspace:save)
;;; Org-mode ;;; Org-mode
(evil-ex-define-cmd "cap" #'org-capture) (evil-ex-define-cmd "cap[ture]" #'org-capture)
;;; ibuffer ;;; ibuffer
(when (featurep! :emacs ibuffer) (when (featurep! :emacs ibuffer)

View file

@ -71,6 +71,7 @@ The following vim plugins have been ported to evil:
| vim-lion | evil-lion | omap =gl= / =gL= | | vim-lion | evil-lion | omap =gl= / =gL= |
| vim-seek or vim-sneak | evil-snipe | mmap =s= / =S=, omap =z= / =Z= & =x= / =X= | | vim-seek or vim-sneak | evil-snipe | mmap =s= / =S=, omap =z= / =Z= & =x= / =X= |
| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | | vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= |
| vim-unimpaired | (provided by Doom) | [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/evil/config.el#L413-L460][see the list]] |
This module has also ported vim-unimpaired keybinds to Emacs. This module has also ported vim-unimpaired keybinds to Emacs.

View file

@ -7,7 +7,7 @@
(call-interactively #'doom/escape))) (call-interactively #'doom/escape)))
;;;###autoload ;;;###autoload
(defun +evil-resolve-vim-path-a (file-name) (defun +evil-replace-filename-modifiers-a (file-name)
"Take a path and resolve any vim-like filename modifiers in it. This adds "Take a path and resolve any vim-like filename modifiers in it. This adds
support for most vim file modifiers, as well as: support for most vim file modifiers, as well as:
@ -15,20 +15,20 @@ support for most vim file modifiers, as well as:
See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for
more information on modifiers." more information on modifiers."
(let (case-fold-search) (let ((origin-buffer (current-buffer))
case-fold-search)
(with-temp-buffer (with-temp-buffer
(let ((buffer-file-name (buffer-file-name origin-buffer)))
(save-excursion (insert file-name)) (save-excursion (insert file-name))
(while (re-search-forward "\\(^\\|[^\\\\]\\)\\(\\([%#]\\)\\(:\\([PphtreS~.]\\|g?s\\)\\)*\\)" nil t) (while (re-search-forward "\\(^\\|[^\\\\]\\)\\(\\([%#]\\)\\(:\\([PphtreS~.]\\|g?s\\)\\)*\\)" nil t)
(catch 'continue (if (null buffer-file-name)
(unless buffer-file-name
(replace-match (match-string 1) t t nil 2) (replace-match (match-string 1) t t nil 2)
(throw 'continue t))
(let ((beg (match-beginning 2)) (let ((beg (match-beginning 2))
(end (match-end 3)) (end (match-end 3))
(path (pcase (match-string 3) (path (pcase (match-string 3)
("%" (file-relative-name buffer-file-name)) ("%" (file-relative-name buffer-file-name default-directory))
("#" (and (other-buffer) ("#" (and (other-buffer origin-buffer)
(buffer-file-name (other-buffer))))))) (buffer-file-name (other-buffer origin-buffer)))))))
(save-match-data (save-match-data
(goto-char beg) (goto-char beg)
(while (re-search-forward ":\\([PphtreS~.]\\|g?s\\)" (+ (point) 3) t) (while (re-search-forward ":\\([PphtreS~.]\\|g?s\\)" (+ (point) 3) t)
@ -38,11 +38,11 @@ more information on modifiers."
(setq modifier (substring modifier 1))) (setq modifier (substring modifier 1)))
(setq end (match-end 1) (setq end (match-end 1)
path path
(or (when path (pcase (and path (substring modifier 0 1))
(pcase (substring modifier 0 1) (`nil "")
("p" (expand-file-name path)) ("p" (expand-file-name path))
("~" (concat "~/" (file-relative-name path "~"))) ("~" (concat "~/" (file-relative-name path "~")))
("." (file-relative-name path default-directory)) ("." (file-relative-name path))
("t" (file-name-nondirectory (directory-file-name path))) ("t" (file-name-nondirectory (directory-file-name path)))
("r" (file-name-sans-extension path)) ("r" (file-name-sans-extension path))
("e" (file-name-extension path)) ("e" (file-name-extension path))
@ -68,13 +68,12 @@ more information on modifiers."
(unless project-root (unless project-root
(user-error "Not in a project")) (user-error "Not in a project"))
(abbreviate-file-name project-root))))) (abbreviate-file-name project-root)))))
""))
;; strip trailing slash, if applicable ;; strip trailing slash, if applicable
(or (string-empty-p path) (or (string-empty-p path)
(not (equal (substring path -1) "/")) (not (equal (substring path -1) "/"))
(setq path (substring path 0 -1)))))) (setq path (substring path 0 -1))))))
(replace-match path t t nil 2)))) (replace-match path t t nil 2))))
(replace-regexp-in-string "\\\\\\([#%]\\)" "\\1" (buffer-string) t)))) (replace-regexp-in-string "\\\\\\([#%]\\)" "\\1" (buffer-string) t)))))
(defun +evil--insert-newline (&optional above _noextranewline) (defun +evil--insert-newline (&optional above _noextranewline)
(let ((pos (save-excursion (beginning-of-line-text) (point))) (let ((pos (save-excursion (beginning-of-line-text) (point)))
@ -124,8 +123,7 @@ more information on modifiers."
(not (eq this-command 'evil-open-below)) (not (eq this-command 'evil-open-below))
(evil-insert-state-p)) (evil-insert-state-p))
(funcall orig-fn count) (funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-below) (letf! (defun evil-insert-newline-below () (+evil--insert-newline))
(lambda () (+evil--insert-newline))))
(let ((evil-auto-indent evil-auto-indent)) (let ((evil-auto-indent evil-auto-indent))
(funcall orig-fn count))))) (funcall orig-fn count)))))
@ -135,8 +133,7 @@ more information on modifiers."
(not (eq this-command 'evil-open-above)) (not (eq this-command 'evil-open-above))
(evil-insert-state-p)) (evil-insert-state-p))
(funcall orig-fn count) (funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-above) (letf! (defun evil-insert-newline-above () (+evil--insert-newline 'above))
(lambda () (+evil--insert-newline 'above))))
(let ((evil-auto-indent evil-auto-indent)) (let ((evil-auto-indent evil-auto-indent))
(funcall orig-fn count))))) (funcall orig-fn count)))))

View file

@ -108,7 +108,7 @@ g Repeat alignment on all matches in each line"
If BANG is non-nil, open compilation output in a comint buffer. If BANG is non-nil, open compilation output in a comint buffer.
If BANG, then run ARGUMENTS as a full command. This command understands vim file If BANG, then run ARGUMENTS as a full command. This command understands vim file
modifiers (like %:p:h). See `+evil-resolve-vim-path-a' for details." modifiers (like %:p:h). See `+evil-replace-filename-modifiers-a' for details."
(interactive "<sh><!>") (interactive "<sh><!>")
(let ((compile-command "make")) (let ((compile-command "make"))
(+evil:compile (if (stringp arguments) (+evil:compile (if (stringp arguments)
@ -122,7 +122,7 @@ modifiers (like %:p:h). See `+evil-resolve-vim-path-a' for details."
If BANG is non-nil, open compilation output in a comint buffer. If BANG is non-nil, open compilation output in a comint buffer.
This command understands vim file modifiers (like %:p:h). See This command understands vim file modifiers (like %:p:h). See
`+evil-resolve-vim-path-a' for details." `+evil-replace-filename-modifiers-a' for details."
(interactive "<sh><!>") (interactive "<sh><!>")
(compile (evil-ex-replace-special-filenames (compile (evil-ex-replace-special-filenames
(format "%s %s" (format "%s %s"

View file

@ -6,8 +6,7 @@
kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)." kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
:repeat nil :repeat nil
(interactive "<f><!>") (interactive "<f><!>")
(doom/delete-this-file (or filename (file-truename buffer-file-name)) (doom/delete-this-file filename force-p))
force-p))
;;;###autoload (autoload '+evil:move-this-file "editor/evil/autoload/files" nil t) ;;;###autoload (autoload '+evil:move-this-file "editor/evil/autoload/files" nil t)
(evil-define-command +evil:move-this-file (new-path &optional force-p) (evil-define-command +evil:move-this-file (new-path &optional force-p)
@ -30,4 +29,3 @@ overwrite the destination file if it exists, without confirmation."
(when (or (not new-path) (string-empty-p new-path)) (when (or (not new-path) (string-empty-p new-path))
(user-error "No new path was specified")) (user-error "No new path was specified"))
(doom/copy-this-file new-path force-p)) (doom/copy-this-file new-path force-p))

View file

@ -159,7 +159,7 @@ directives. By default, this only recognizes C directives.")
;; monkey patch `evil-ex-replace-special-filenames' to improve support for ;; monkey patch `evil-ex-replace-special-filenames' to improve support for
;; file modifiers like %:p:h. This adds support for most of vim's modifiers, ;; file modifiers like %:p:h. This adds support for most of vim's modifiers,
;; and one custom one: %:P (expand to the project root). ;; and one custom one: %:P (expand to the project root).
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-resolve-vim-path-a) (advice-add #'evil-ex-replace-special-filenames :override #'+evil-replace-filename-modifiers-a)
;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer ;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h) (add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h)
@ -280,8 +280,13 @@ directives. By default, this only recognizes C directives.")
evil-escape-delay 0.15) evil-escape-delay 0.15)
(evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape) (evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape)
:config :config
;; no `evil-escape' in minibuffer ;; no `evil-escape' in minibuffer, unless `evil-collection-setup-minibuffer'
(add-hook 'evil-escape-inhibit-functions #'minibufferp) ;; is enabled, where we could be in insert mode in the minibuffer.
(add-hook! 'evil-escape-inhibit-functions
(defun +evil-inhibit-escape-in-minibuffer-fn ()
(and (minibufferp)
(or (not (bound-and-true-p evil-collection-setup-minibuffer))
(evil-normal-state-p)))))
;; so that evil-escape-mode-hook runs, and can be toggled by evil-mc ;; so that evil-escape-mode-hook runs, and can be toggled by evil-mc
(evil-escape-mode +1)) (evil-escape-mode +1))

View file

@ -258,6 +258,10 @@ and complains if a module is loaded too early (during startup)."
(+evil-collection-init 'elisp-mode)) (+evil-collection-init 'elisp-mode))
(add-transient-hook! 'occur-mode (add-transient-hook! 'occur-mode
(+evil-collection-init '(occur replace))) (+evil-collection-init '(occur replace)))
(add-transient-hook! 'minibuffer-setup-hook
(when evil-collection-setup-minibuffer
(+evil-collection-init 'minibuffer)
(evil-collection-minibuffer-insert)))
;; HACK Do this ourselves because evil-collection break's `eval-after-load' ;; HACK Do this ourselves because evil-collection break's `eval-after-load'
;; load order by loading their target plugin before applying keys. This ;; load order by loading their target plugin before applying keys. This

View file

@ -1,27 +1,29 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/evil/packages.el ;;; editor/evil/packages.el
(package! evil :pin "8aa6337fa8") (package! evil :pin "d243eae8649272799ec3864fde14c1164f036940")
(package! evil-args :pin "758ad5ae54") (package! evil-args :pin "758ad5ae54ad34202064fec192c88151c08cb387")
(package! evil-easymotion :pin "79c13ed3bc") (package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9")
(package! evil-embrace :pin "4379adea03") (package! evil-embrace :pin "4379adea032b25e359d01a36301b4a5afdd0d1b7")
(package! evil-escape :pin "f4e9116bfb") (package! evil-escape
(package! evil-exchange :pin "3030e21ee1") :recipe (:host github :repo "hlissner/evil-escape")
(package! evil-indent-plus :pin "0c7501e6ef") :pin "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077")
(package! evil-lion :pin "6b03593f5d") (package! evil-exchange :pin "3030e21ee16a42dfce7f7cf86147b778b3f5d8c1")
(package! evil-nerd-commenter :pin "747e346f11") (package! evil-indent-plus :pin "0c7501e6efed661242c3a20e0a6c79a6455c2c40")
(package! evil-lion :pin "6b03593f5dd6e7c9ca02207f9a73615cf94c93ab")
(package! evil-nerd-commenter :pin "1bd2de52011c39777a3e8779b14cee2790dc873b")
(package! evil-numbers (package! evil-numbers
:recipe (:host github :repo "janpath/evil-numbers") :recipe (:host github :repo "janpath/evil-numbers")
:pin "c2cfdd1eb1") :pin "c2cfdd1eb1f193bea28ee79b191b78309677058a")
(package! evil-snipe :pin "3ec8adfd49") (package! evil-snipe :pin "2ba6353bb9253dbbc4193f1d35403e7dcc1317b1")
(package! evil-surround :pin "9b0b17f06c") (package! evil-surround :pin "9b0b17f06cef9bac81ee4800d121265e54718a17")
(package! evil-textobj-anyblock :pin "ff00980f06") (package! evil-textobj-anyblock :pin "ff00980f0634f95bf2ad9956b615a155ea8743be")
(package! evil-traces :pin "bc25cae9fa") (package! evil-traces :pin "bc25cae9fa5ab0ba1507827f0944f52ce0ca7462")
(package! evil-visualstar :pin "06c053d8f7") (package! evil-visualstar :pin "06c053d8f7381f91c53311b1234872ca96ced752")
(package! exato :pin "d5daea3017") (package! exato :pin "d5daea30176d48e74c9d063ac9bfc240ebeb97d0")
(package! evil-quick-diff (package! evil-quick-diff
:recipe (:host github :repo "rgrinberg/evil-quick-diff") :recipe (:host github :repo "rgrinberg/evil-quick-diff")
:pin "69c883720b") :pin "69c883720b30a892c63bc89f49d4f0e8b8028908")
;; ;;
(when (featurep! +everywhere) (when (featurep! +everywhere)
@ -31,4 +33,4 @@
(package! neotree) (package! neotree)
(autoload 'neotree-make-executor "neotree" nil nil 'macro)) (autoload 'neotree-make-executor "neotree" nil nil 'macro))
(package! evil-collection :pin "493d523c9b")) (package! evil-collection :pin "ba3630476b3927d9d2e3ec75308a28e3a5bd54a8"))

View file

@ -9,10 +9,10 @@
(load! "../autoload/evil") (load! "../autoload/evil")
(before-each (before-each
(fset 'resv #'+evil-resolve-vim-path-a) (fset 'resv #'+evil-replace-filename-modifiers-a)
(spy-on 'doom-project-root :and-call-fake (lambda () project-root))) (spy-on 'doom-project-root :and-call-fake (lambda () project-root)))
;; `evil-ex-replace-special-filenames' / `+evil-resolve-vim-path-a' ;; `evil-ex-replace-special-filenames' / `+evil-replace-filename-modifiers-a'
(describe "file modifiers" (describe "file modifiers"
(it "supports basic vim file modifiers" (it "supports basic vim file modifiers"
(let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el") (let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el")

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/file-templates/packages.el ;;; editor/file-templates/packages.el
(package! yasnippet :pin "ac03c2f192") (package! yasnippet :pin "5b1217ab085fab4abeb1118dccb260691b446703")

View file

@ -7,7 +7,7 @@
(match-string 2 buffer-file-name)) (match-string 2 buffer-file-name))
"")`} "")`}
#+DATE: `(format (format-time-string "%B %%s, %Y") (string-to-number (format-time-string "%d")))` #+DATE: `(format (format-time-string "%B %%s, %Y") (string-to-number (format-time-string "%d")))`
#+SINCE: ${2:{replace with next tagged release version}} #+SINCE: ${2:<replace with next tagged release version>}
#+STARTUP: inlineimages nofold #+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport: * Table of Contents :TOC_3:noexport:

View file

@ -3,6 +3,6 @@
(package! hideshow :built-in t) (package! hideshow :built-in t)
(package! vimish-fold :pin "d3248a41a7") (package! vimish-fold :pin "63685239655a151181b9152e45478dad587f86f2")
(when (featurep! :editor evil) (when (featurep! :editor evil)
(package! evil-vimish-fold :pin "b6e0e6b91b")) (package! evil-vimish-fold :pin "b6e0e6b91b8cd047e80debef1a536d9d49eef31a"))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/god/packages.el ;;; editor/god/packages.el
(package! god-mode :pin "1eb6ef3a4f") (package! god-mode :pin "1eb6ef3a4f67a805c5d6deb1e3895b6c853707d7")

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/lispyville/packages.el ;;; editor/lispyville/packages.el
(package! lispy :pin "c7e282ae06") (package! lispy :pin "cdaa9c70ca39a880163cbbce924bb46cc56b9fa4")
(when (featurep! :editor evil) (when (featurep! :editor evil)
(package! lispyville :pin "25a70126ea")) (package! lispyville :pin "25a70126ea807653e0a8c512d4128c90ed673d7a"))

View file

@ -3,7 +3,7 @@
(cond (cond
((featurep! :editor evil) ((featurep! :editor evil)
(package! evil-multiedit :pin "9f271e0e60") (package! evil-multiedit :pin "9f271e0e6048297692f80ed6c5ae8994ac523abc")
(package! evil-mc :pin "4d4c0172e4")) (package! evil-mc :pin "4d4c0172e4c7f80acc1d0e73d5fb3e536929b262"))
((package! multiple-cursors :pin "b880554d04"))) ((package! multiple-cursors :pin "b880554d04b8f61165afba7d4de19ac9e39bb7ab")))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/objed/packages.el ;;; editor/objed/packages.el
(package! objed :pin "8dc17701d1") (package! objed :pin "e89d8dae3b2d4331a4455d2a7b203500537d184d")

View file

@ -11,4 +11,4 @@
;; separate session: ;; separate session:
(autoload 'evil-define-key "evil-core" nil nil 'macro)) (autoload 'evil-define-key "evil-core" nil nil 'macro))
(package! parinfer :pin "eaad857ae4") (package! parinfer :pin "eaad857ae4351f72a561ee3dec8943713510003f")

View file

@ -3,4 +3,4 @@
(package! rotate-text (package! rotate-text
:recipe (:host github :repo "debug-ito/rotate-text.el") :recipe (:host github :repo "debug-ito/rotate-text.el")
:pin "48f193697d") :pin "48f193697db996855aee1ad2bc99b38c6646fe76")

View file

@ -20,8 +20,7 @@
;; Remove default ~/.emacs.d/snippets ;; Remove default ~/.emacs.d/snippets
(defvar yas-snippet-dirs nil) (defvar yas-snippet-dirs nil)
(if (daemonp) (unless (daemonp)
(after! yasnippet (yas-reload-all))
;; Ensure `yas-reload-all' is called as late as possible. Other modules ;; Ensure `yas-reload-all' is called as late as possible. Other modules
;; could have additional configuration for yasnippet. For example, ;; could have additional configuration for yasnippet. For example,
;; file-templates. ;; file-templates.
@ -88,7 +87,10 @@
;; Replace commands with superior alternatives ;; Replace commands with superior alternatives
:map yas-minor-mode-map :map yas-minor-mode-map
[remap yas-new-snippet] #'+snippets/new [remap yas-new-snippet] #'+snippets/new
[remap yas-visit-snippet-file] #'+snippets/edit)) [remap yas-visit-snippet-file] #'+snippets/edit)
;; If in a daemon session, front-load this expensive work:
(if (daemonp) (yas-reload-all)))
(use-package! auto-yasnippet (use-package! auto-yasnippet
@ -100,6 +102,6 @@
us who use yas-minor-mode and enable yasnippet more selectively. This advice us who use yas-minor-mode and enable yasnippet more selectively. This advice
swaps `yas-global-mode' with `yas-minor-mode'." swaps `yas-global-mode' with `yas-minor-mode'."
:around '(aya-expand aya-open-line) :around '(aya-expand aya-open-line)
(cl-letf (((symbol-function #'yas-global-mode) #'yas-minor-mode) (letf! ((#'yas-global-mode #'yas-minor-mode)
(yas-global-mode yas-minor-mode)) (yas-global-mode yas-minor-mode))
(apply orig-fn args)))) (apply orig-fn args))))

View file

@ -1,10 +1,10 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/snippets/packages.el ;;; editor/snippets/packages.el
(package! yasnippet :pin "5b1217ab08") (package! yasnippet :pin "5b1217ab085fab4abeb1118dccb260691b446703")
(package! auto-yasnippet :pin "db9e0dd433") (package! auto-yasnippet :pin "db9e0dd4335b2202cd5dac95bbbc87a1032d9bbe")
(package! doom-snippets (package! doom-snippets
:recipe (:host github :recipe (:host github
:repo "hlissner/doom-snippets" :repo "hlissner/doom-snippets"
:files ("*.el" "*")) :files ("*.el" "*"))
:pin "feaedeb550") :pin "422f683adfbec1b01fe00524690b64dc9e702ae0")

View file

@ -24,3 +24,7 @@ Otherwise no extra indentation will be used.")
'(text-mode markdown-mode markdown-view-mode gfm-mode gfm-view-mode rst-mode '(text-mode markdown-mode markdown-view-mode gfm-mode gfm-view-mode rst-mode
latex-mode LaTeX-mode) latex-mode LaTeX-mode)
"Major-modes where `+word-wrap-mode' should not provide extra indentation.") "Major-modes where `+word-wrap-mode' should not provide extra indentation.")
(when (memq 'visual-line-mode text-mode-hook)
(remove-hook 'text-mode-hook #'visual-line-mode)
(add-hook 'text-mode-hook #'+word-wrap-mode))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/word-wrap/packages.el ;;; editor/word-wrap/packages.el
(package! adaptive-wrap :pin "1810c0ee8d") (package! adaptive-wrap :pin "1810c0ee8d827dd502ddeaae5bd759d4811fcbce")

8
modules/emacs/dired/config.el Executable file → Normal file
View file

@ -31,7 +31,7 @@
(setq insert-directory-program gls) (setq insert-directory-program gls)
;; BSD ls doesn't support --group-directories-first ;; BSD ls doesn't support --group-directories-first
(setq args (delete "--group-directories-first" args)))) (setq args (delete "--group-directories-first" args))))
(setq dired-listing-switches (string-join args " "))) (setq dired-listing-switches (string-join args " "))
(add-hook! 'dired-mode-hook (add-hook! 'dired-mode-hook
(defun +dired-disable-gnu-ls-flags-in-tramp-buffers-h () (defun +dired-disable-gnu-ls-flags-in-tramp-buffers-h ()
@ -40,11 +40,7 @@
This is because there's no guarantee the remote system has GNU ls, which is the This is because there's no guarantee the remote system has GNU ls, which is the
only variant that supports --group-directories-first." only variant that supports --group-directories-first."
(when (file-remote-p default-directory) (when (file-remote-p default-directory)
(setq-local dired-listing-switches (setq-local dired-listing-switches (car args))))))
(string-join
(split-string dired-listing-switches
"--group-directories-first")
" ")))))
;; Don't complain about this command being disabled when we use it ;; Don't complain about this command being disabled when we use it
(put 'dired-find-alternate-file 'disabled nil) (put 'dired-find-alternate-file 'disabled nil)

View file

@ -1,12 +1,12 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; emacs/dired/packages.el ;;; emacs/dired/packages.el
(package! diredfl :pin "83567d00af") (package! diredfl :pin "83567d00affce66a4e501563eddd0bd436ac48d0")
(package! dired-git-info :pin "b47f2b0c3a") (package! dired-git-info :pin "b47f2b0c3a6cb9b7a62a4ee2605a492e512d40a9")
(package! diff-hl :pin "2cf8b489f3") (package! diff-hl :pin "a625033fb1dde83f6e4c2fc21f632b22ec34b609")
(package! dired-rsync :pin "bfd5c155be") (package! dired-rsync :pin "bfd5c155be1cb6b71c83e5f41116c81b6532b6d5")
(when (featurep! +ranger) (when (featurep! +ranger)
(package! ranger :pin "af6f781a60")) (package! ranger :pin "ae9b3816a6da927cca5beb62c45400103797a2da"))
(when (featurep! +icons) (when (featurep! +icons)
(package! all-the-icons-dired :pin "816987d339")) (package! all-the-icons-dired :pin "fc2dfa1e9eb8bf1c402a675e7089638d702a27a5"))
(package! fd-dired :pin "fd4c3f490b") (package! fd-dired :pin "001cc95effdd5c4d9974b3f2c40b2ddf1f0e3de2")

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; emacs/ibuffer/packages.el ;;; emacs/ibuffer/packages.el
(package! ibuffer-projectile :pin "504b0edaa0") (package! ibuffer-projectile :pin "504b0edaa0d937ce60ccc8fdf09f2dae0a90fbaf")
(package! ibuffer-vc :pin "1249c1e30c") (package! ibuffer-vc :pin "1249c1e30cf11badfe032ac3b1058f24ba510ace")

View file

@ -2,6 +2,6 @@
;;; emacs/undo/packages.el ;;; emacs/undo/packages.el
(if (featurep! +tree) (if (featurep! +tree)
(package! undo-tree :pin "5b6df03781") (package! undo-tree :pin "5b6df03781495d8a25695d846b0cce496d3d3058")
(package! undo-fu :pin "0c34b6747e") (package! undo-fu :pin "0ce9ac36144e80316fff50bfe1bc5dd7e5e7ded6")
(package! undo-fu-session :pin "b808ef0cdc")) (package! undo-fu-session :pin "b808ef0cdcdd2eef221c67eda567eed7fcb3d4af"))

View file

@ -5,7 +5,7 @@
(package! vc-annotate :built-in t) (package! vc-annotate :built-in t)
(package! smerge-mode :built-in t) (package! smerge-mode :built-in t)
(package! browse-at-remote :pin "6aecae4b5d") (package! browse-at-remote :pin "6aecae4b5d202e582425fc8aa2c9c2b6a4779f25")
(package! git-timemachine :pin "391eb61050") (package! git-timemachine :pin "391eb61050de321101e631fcf373fc70ec6e7700")
(package! gitconfig-mode :pin "55468314a5") (package! gitconfig-mode :pin "55468314a5f6b77d2c96be62c7005ac94545e217")
(package! gitignore-mode :pin "55468314a5") (package! gitignore-mode :pin "55468314a5f6b77d2c96be62c7005ac94545e217")

View file

@ -12,11 +12,12 @@
- [[#arch-linux][Arch Linux]] - [[#arch-linux][Arch Linux]]
- [[#nixos][NixOS]] - [[#nixos][NixOS]]
- [[#opensuse][openSUSE]] - [[#opensuse][openSUSE]]
- [[Debian/Ubuntu]] - [[#debianubuntu][Debian/Ubuntu]]
- [[#features][Features]] - [[#features][Features]]
- [[#configuration][Configuration]] - [[#configuration][Configuration]]
- [[#offlineimap][offlineimap]] - [[#offlineimap][offlineimap]]
- [[#mbsync][mbsync]] - [[#mbsync][mbsync]]
- [[#mu-and-mu4e][mu and mu4e]]
- [[#troubleshooting][Troubleshooting]] - [[#troubleshooting][Troubleshooting]]
- [[#no-such-file-or-directory-mu4e][=No such file or directory, mu4e=]] - [[#no-such-file-or-directory-mu4e][=No such file or directory, mu4e=]]
- [[#void-function-org-time-add-error-on-gentoo][~(void-function org-time-add)~ error on Gentoo]] - [[#void-function-org-time-add-error-on-gentoo][~(void-function org-time-add)~ error on Gentoo]]
@ -37,13 +38,13 @@ via IMAP) and ~mu~ (to index my mail into a format ~mu4e~ can understand).
+ ~+gmail~ Enables gmail-specific configuration. + ~+gmail~ Enables gmail-specific configuration.
** Plugins ** Plugins
+ [[https://github.com/agpchil/mu4e-maildirs-extension][mu4e-maildirs-extension]] This module install no plugins.
* Prerequisites * Prerequisites
This module requires: This module requires:
+ Either ~mbsync~ (default) or ~offlineimap~ (to sync mail with) + Either ~mbsync~ (default) or ~offlineimap~ (to sync mail with)
+ ~mu~ (to index your downloaded messages) + ~mu~, to index your downloaded messages and to provide the ~mu4e~ package.
** MacOS ** MacOS
#+BEGIN_SRC sh #+BEGIN_SRC sh
@ -105,20 +106,53 @@ sudo apt-get install maildir-utils # mu
* Configuration * Configuration
** offlineimap ** offlineimap
This module uses =mbsync= by default. To change this, change ~+mu4e-backend~: This module uses =mbsync= by default. To use =offlineimap=, change ~+mu4e-backend~:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq +mu4e-backend 'offlineimap) (setq +mu4e-backend 'offlineimap)
#+END_SRC #+END_SRC
Then you must set up offlineimap and index your mail: Next, you need to write a configuration file for =offlineimap=. Mine can be found
[[https://github.com/hlissner/dotfiles/tree/master/shell/mu][in my dotfiles repository]]. It is configured to download mail to ~\~/.mail~. I
use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. You can find a *very*
detailed configuration [[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
1. Write a ~\~/.offlineimaprc~. Mine can be found [[https://github.com/hlissner/dotfiles/tree/master/shell/mu][in my dotfiles repository]]. It Next you can download your email with ~offlineimap -o~. This may take a while,
is configured to download mail to ~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely especially if you have thousands of mails.
store my login credentials. You can find a *very* detailed configuration
[[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]]. You can now proceed with the [[*mu and mu4e][mu and mu4e]] section.
2. Download your email: ~offlineimap -o~ (may take a while)
3. Index it with mu: ~mu index --maildir ~/.mail~ ** mbsync
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for
[[*offlineimap][offlineimap]].
Start with writing a ~\~/.mbsyncrc~. An example for GMAIL can be found on
[[http://pragmaticemacs.com/emacs/migrating-from-offlineimap-to-mbsync-for-mu4e/][pragmaticemacs.com]]. A non-GMAIL example is available as a gist [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][here]]. The [[http://isync.sourceforge.net/mbsync.html][manual
page]] contains all needed information to set up your own.
Next you can download your email with ~mbsync --all~. This may take a while, but
should be quicker than =offlineimap= ;).
You can now proceed with the [[*mu and mu4e][mu and mu4e]] section.
** mu and mu4e
You should have your email downloaded already. If you have not, you need to set
=offlineimap= or =mbsync= up before you proceed.
Before you can use =mu4e= or the cli program =mu=, you need to index your email
initially. How to do that differs a little depending on the version of =mu= you
use. You can check your version with ~mu --version~.
For =mu= *>=1.4* you need to run two commands:
#+BEGIN_SRC sh
mu init --maildir ~/.mail --my-address email@example.com
mu index
#+END_SRC
=mu= *<1.4* only requires one command:
#+BEGIN_SRC sh
mu index --maildir ~/.mail
#+END_SRC
Then configure Emacs to use your email address: Then configure Emacs to use your email address:
@ -130,12 +164,11 @@ Then configure Emacs to use your email address:
(mu4e-trash-folder . "/Lissner.net/Trash") (mu4e-trash-folder . "/Lissner.net/Trash")
(mu4e-refile-folder . "/Lissner.net/All Mail") (mu4e-refile-folder . "/Lissner.net/All Mail")
(smtpmail-smtp-user . "henrik@lissner.net") (smtpmail-smtp-user . "henrik@lissner.net")
(user-mail-address . "henrik@lissner.net") (user-mail-address . "henrik@lissner.net") ;; only needed for mu < 1.4
(mu4e-compose-signature . "---\nHenrik Lissner")) (mu4e-compose-signature . "---\nHenrik Lissner"))
t) t)
#+END_SRC #+END_SRC
** TODO mbsync
* Troubleshooting * Troubleshooting
** =No such file or directory, mu4e= ** =No such file or directory, mu4e=
You will get =No such file or directory, mu4e= errors if you don't run ~doom You will get =No such file or directory, mu4e= errors if you don't run ~doom

View file

@ -6,7 +6,7 @@
list of cons cells (VARIABLE . VALUE) -- you may want to modify: list of cons cells (VARIABLE . VALUE) -- you may want to modify:
+ `user-full-name' (this or the global `user-full-name' is required) + `user-full-name' (this or the global `user-full-name' is required)
+ `user-mail-address' (required) + `user-mail-address' (required in mu4e < 1.4)
+ `smtpmail-smtp-user' (required for sending mail from Emacs) + `smtpmail-smtp-user' (required for sending mail from Emacs)
OPTIONAL: OPTIONAL:
@ -19,8 +19,9 @@ OPTIONAL:
DEFAULT-P is a boolean. If non-nil, it marks that email account as the DEFAULT-P is a boolean. If non-nil, it marks that email account as the
default/fallback account." default/fallback account."
(after! mu4e (after! mu4e
(when (version< mu4e-mu-version "1.4")
(when-let (address (cdr (assq 'user-mail-address letvars))) (when-let (address (cdr (assq 'user-mail-address letvars)))
(add-to-list 'mu4e-user-mail-address-list address)) (add-to-list 'mu4e-user-mail-address-list address)))
(setq mu4e-contexts (setq mu4e-contexts
(cl-loop for context in mu4e-contexts (cl-loop for context in mu4e-contexts
unless (string= (mu4e-context-name context) label) unless (string= (mu4e-context-name context) label)

View file

@ -14,9 +14,11 @@
:commands mu4e mu4e-compose-new :commands mu4e mu4e-compose-new
:init :init
(provide 'html2text) ; disable obsolete package (provide 'html2text) ; disable obsolete package
(when (or (not (require 'mu4e-meta nil t))
(version< mu4e-mu-version "1.4"))
(setq mu4e-maildir "~/.mail" (setq mu4e-maildir "~/.mail"
mu4e-attachment-dir "~/.mail/.attachments" mu4e-user-mail-address-list nil))
mu4e-user-mail-address-list nil) (setq mu4e-attachment-dir "~/.mail/.attachments")
:config :config
(pcase +mu4e-backend (pcase +mu4e-backend
(`mbsync (`mbsync
@ -90,6 +92,9 @@
;; Wrap text in messages ;; Wrap text in messages
(setq-hook! 'mu4e-view-mode-hook truncate-lines nil) (setq-hook! 'mu4e-view-mode-hook truncate-lines nil)
;; Html mails might be better rendered in a browser
(add-to-list 'mu4e-view-actions '("View in browser" . mu4e-action-view-in-browser))
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)) (imagemagick-register-types))
@ -104,13 +109,13 @@
(use-package! org-mu4e (use-package! org-mu4e
:hook (mu4e-compose-mode . org-mu4e-compose-org-mode) :hook (mu4e-compose-mode . org-mu4e-compose-org-mode)
:config :config
(setq org-mu4e-link-query-in-headers-mode nil (setq org-mu4e-convert-to-html t)
org-mu4e-convert-to-html t) (when (version< mu4e-mu-version "1.4")
(setq org-mu4e-link-query-in-headers-mode nil))
;; Only render to html once. If the first send fails for whatever reason, ;; Only render to html once. If the first send fails for whatever reason,
;; org-mu4e would do so each time you try again. ;; org-mu4e would do so each time you try again.
(add-hook! 'message-send-hook (setq-hook! 'message-send-hook org-mu4e-convert-to-html nil))
(setq-local org-mu4e-convert-to-html nil)))
;; ;;

View file

@ -1,9 +1,9 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; email/notmuch/packages.el ;;; email/notmuch/packages.el
(package! notmuch :pin "aba7fb375b") (package! notmuch :pin "ad9c2e91a012920bebfe70bc472d44678abc3259")
(package! org-mime :pin "b189976217") (package! org-mime :pin "9f8444603806e6baa94b2b67a23aab0ea52fef97")
(when (featurep! :completion ivy) (when (featurep! :completion ivy)
(package! counsel-notmuch :pin "a4a1562935")) (package! counsel-notmuch :pin "a4a1562935e4180c42524c51609d1283e9be0688"))
(when (featurep! :completion helm) (when (featurep! :completion helm)
(package! helm-notmuch :pin "97a01497e0")) (package! helm-notmuch :pin "97a01497e079a7b6505987e9feba6b603bbec288"))

View file

@ -4,8 +4,8 @@
;; HACK These are wanderlust's dependencies (wanderlust depends on semi, semi ;; HACK These are wanderlust's dependencies (wanderlust depends on semi, semi
;; depends on flim, flim on apel), but they all have non-standard default ;; depends on flim, flim on apel), but they all have non-standard default
;; branches which straight cannot detect without our help. ;; branches which straight cannot detect without our help.
(package! apel :recipe (:branch "apel-wl") :pin "d146ddbf88") (package! apel :recipe (:branch "apel-wl") :pin "d146ddbf8818e81d3577d5eee7825d377bec0c73")
(package! flim :recipe (:branch "flim-1_14-wl") :pin "e4bd54fd7d") (package! flim :recipe (:branch "flim-1_14-wl") :pin "f303f2f6c124bc8635add96d3326a2209749437b")
(package! semi :recipe (:branch "semi-1_14-wl") :pin "16228dc2d1") (package! semi :recipe (:branch "semi-1_14-wl") :pin "57a948c5f07e57e78ab3c0e6fd76ffcd591bb4ac")
(package! wanderlust :pin "7a919e422a") (package! wanderlust :pin "7af0d582cd48a37469e0606ea35887740d78c8b5")

View file

@ -2,9 +2,10 @@
(use-package! pyim (use-package! pyim
:after-call after-find-file pre-command-hook :after-call after-find-file pre-command-hook
:init
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/"))
:config :config
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/") (setq pyim-page-tooltip t
pyim-page-tooltip t
default-input-method "pyim")) default-input-method "pyim"))

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; input/chinese/packages.el ;;; input/chinese/packages.el
(package! pyim :pin "77170724fa") (package! pyim :pin "b934273bb33d6be6aea6e20e68930bc5aaf4a48a")
(package! fcitx :pin "12dc2638dd") (package! fcitx :pin "12dc2638ddd15c8f6cfaecb20e1f428ab2bb5624")
(package! ace-pinyin :pin "8b2e9335b0") (package! ace-pinyin :pin "8b2e9335b02486730ea4ceee790130cc5328f9ea")
(package! pangu-spacing :pin "f92898949b") (package! pangu-spacing :pin "f92898949ba3bf991fd229416f3bbb54e9c6c223")

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; input/japanese/packages.el ;;; input/japanese/packages.el
(package! migemo :pin "f42832c8ac") (package! migemo :pin "f42832c8ac462ecbec9a16eb781194f876fba64a")
(package! avy-migemo :pin "922a6dd82c") (package! avy-migemo :pin "922a6dd82c0bfa316b0fbb56a9d4dd4ffa5707e7")
(package! ddskk :pin "f9a2333ec3") (package! ddskk :pin "11d91b4cce988e15d7c5fc4345535c9d7a92d53b")
(package! pangu-spacing :pin "f92898949b") (package! pangu-spacing :pin "f92898949ba3bf991fd229416f3bbb54e9c6c223")

View file

@ -1,4 +0,0 @@
;;; lang/assembly/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.hax\\'" . haxor-mode))

View file

@ -1,6 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; lang/assembly/packages.el
(package! mips-mode :pin "75152fc78b")
(package! haxor-mode :pin "6fa25a8e6b")
(package! nasm-mode :pin "65ca6546fc")

View file

@ -11,8 +11,9 @@
;; ;;
;;; Packages ;;; Packages
;;;###package clojure-mode (use-package! clojure-mode
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode) :hook (clojure-mode . rainbow-delimiters-mode)
:config
(when (featurep! +lsp) (when (featurep! +lsp)
(add-hook! '(clojure-mode-local-vars-hook (add-hook! '(clojure-mode-local-vars-hook
clojurec-mode-local-vars-hook clojurec-mode-local-vars-hook
@ -25,7 +26,7 @@
clojurec-mode clojurec-mode
clojurescript-mode clojurescript-mode
clojurex-mode)) clojurex-mode))
(add-to-list 'lsp-language-id-configuration (cons m "clojure"))))) (add-to-list 'lsp-language-id-configuration (cons m "clojure"))))))
(use-package! cider (use-package! cider
@ -58,13 +59,18 @@
cider-repl-history-quit-action 'delete-and-restore cider-repl-history-quit-action 'delete-and-restore
cider-repl-history-highlight-inserted-item t cider-repl-history-highlight-inserted-item t
cider-repl-history-size 1000 cider-repl-history-size 1000
cider-repl-pop-to-buffer-on-connect 'display-only
cider-repl-result-prefix ";; => " cider-repl-result-prefix ";; => "
cider-repl-print-length 100 cider-repl-print-length 100
cider-repl-use-clojure-font-lock t cider-repl-use-clojure-font-lock t
cider-repl-use-pretty-printing t cider-repl-use-pretty-printing t
cider-repl-wrap-history nil cider-repl-wrap-history nil
cider-stacktrace-default-filters '(tooling dup)) cider-stacktrace-default-filters '(tooling dup)
;; Don't focus the CIDER REPL when it starts. Since it can take so long
;; to start up, you either wait for a minute doing nothing or be
;; prepared for your cursor to suddenly change buffers without warning.
;; See https://github.com/clojure-emacs/cider/issues/1872
cider-repl-pop-to-buffer-on-connect 'display-only)
;; Error messages emitted from CIDER is silently funneled into *nrepl-server* ;; Error messages emitted from CIDER is silently funneled into *nrepl-server*
;; rather than the *cider-repl* buffer. How silly. We might want to see that ;; rather than the *cider-repl* buffer. How silly. We might want to see that

View file

@ -73,7 +73,17 @@
((message "WARNING: Couldn't find `inferior-lisp-program' (%s)" ((message "WARNING: Couldn't find `inferior-lisp-program' (%s)"
inferior-lisp-program))))) inferior-lisp-program)))))
(map! :localleader (map! (:map sly-db-mode-map
:n "gr" #'sly-db-restart-frame)
(:map sly-inspector-mode-map
:n "gr" #'sly-inspector-reinspect
:n "gR" #'sly-inspector-fetch-all
:n "K" #'sly-inspector-describe-inspectee)
(:map sly-xref-mode-map
:n "gr" #'sly-recompile-xref
:n "gR" #'sly-recompile-all-xrefs)
(:localleader
:map lisp-mode-map :map lisp-mode-map
:desc "Sly" "'" #'sly :desc "Sly" "'" #'sly
:desc "Sly (ask)" ";" (λ!! #'sly '-) :desc "Sly (ask)" ";" (λ!! #'sly '-)
@ -130,7 +140,7 @@
(:prefix ("t" . "trace") (:prefix ("t" . "trace")
:desc "Toggle" "t" #'sly-toggle-trace-fdefinition :desc "Toggle" "t" #'sly-toggle-trace-fdefinition
:desc "Toggle (fancy)" "T" #'sly-toggle-fancy-trace :desc "Toggle (fancy)" "T" #'sly-toggle-fancy-trace
:desc "Untrace all" "u" #'sly-untrace-all)) :desc "Untrace all" "u" #'sly-untrace-all)))
(when (featurep! :editor evil +everywhere) (when (featurep! :editor evil +everywhere)
(add-hook 'sly-mode-hook #'evil-normalize-keymaps))) (add-hook 'sly-mode-hook #'evil-normalize-keymaps)))

View file

@ -4,8 +4,8 @@
(package! dart-mode :pin "04fcd649f1") (package! dart-mode :pin "04fcd649f1")
(when (featurep! +lsp) (when (featurep! +lsp)
(package! lsp-dart :pin "064d47bad3")) (package! lsp-dart :pin "80f8ecaf62"))
(when (featurep! +flutter) (when (featurep! +flutter)
(package! flutter :pin "ec92a4df84") (package! flutter :pin "293b7225b9")
(package! hover :pin "6f9ed1a651")) (package! hover :pin "6f9ed1a651"))

View file

@ -1,9 +1,5 @@
;;; lang/data/config.el -*- lexical-binding: t; -*- ;;; lang/data/config.el -*- lexical-binding: t; -*-
;; Built in plugins
(add-to-list 'auto-mode-alist '("/sxhkdrc\\'" . conf-mode))
(add-to-list 'auto-mode-alist '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode))
(use-package! nxml-mode (use-package! nxml-mode
:mode "\\.p\\(?:list\\|om\\)\\'" ; plist, pom :mode "\\.p\\(?:list\\|om\\)\\'" ; plist, pom
:mode "\\.xs\\(?:d\\|lt\\)\\'" ; xslt, xsd :mode "\\.xs\\(?:d\\|lt\\)\\'" ; xslt, xsd
@ -16,9 +12,6 @@
(setq-hook! 'nxml-mode-hook tab-width nxml-child-indent)) (setq-hook! 'nxml-mode-hook tab-width nxml-child-indent))
;;
;;; Third-party plugins
;;;###package csv-mode ;;;###package csv-mode
(map! :after csv-mode (map! :after csv-mode
:localleader :localleader
@ -29,25 +22,3 @@
"S" #'csv-sort-numeric-fields "S" #'csv-sort-numeric-fields
"k" #'csv-kill-fields "k" #'csv-kill-fields
"t" #'csv-transpose) "t" #'csv-transpose)
(use-package! graphql-mode
:mode "\\.gql\\'"
:config (setq-hook! 'graphql-mode-hook tab-width graphql-indent-level))
(use-package! json-mode
:mode "\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'"
:config
(set-electric! 'json-mode :chars '(?\n ?: ?{ ?})))
(after! jsonnet-mode
(set-electric! 'jsonnet-mode :chars '(?\n ?: ?{ ?})))
(after! yaml-mode
(setq-hook! 'yaml-mode-hook tab-width yaml-indent-offset))
;;
;;; Frameworks
(def-project-mode! +data-vagrant-mode
:files ("Vagrantfile"))

View file

@ -1,12 +1,4 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/data/packages.el ;;; lang/data/packages.el
(package! graphql-mode :pin "7c37aee28b")
(package! json-mode :pin "0e819e519a")
(package! jsonnet-mode :pin "d8b486c837")
(package! yaml-mode :pin "cecf4b106b")
(package! csv-mode :pin "635337407c") (package! csv-mode :pin "635337407c")
(package! dhall-mode :pin "ef4d33debe")
(package! protobuf-mode
:recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*"))
:pin "94b7bd7e8b")

View file

@ -1,12 +1,10 @@
;;; lang/elm/config.el -*- lexical-binding: t; -*- ;;; lang/elm/config.el -*- lexical-binding: t; -*-
(after! elm-mode (after! elm-mode
(add-hook 'elm-mode-hook #'rainbow-delimiters-mode) (if (featurep! +lsp)
(add-hook 'elm-mode-local-vars-hook #'lsp!)
(set-company-backend! 'elm-mode 'company-elm))
(when (featurep! +lsp)
(add-hook 'elm-mode-local-vars-hook #'lsp!))
(set-company-backend! 'elm-mode 'company-elm)
(set-repl-handler! 'elm-mode #'run-elm-interactive) (set-repl-handler! 'elm-mode #'run-elm-interactive)
(set-pretty-symbols! 'elm-mode (set-pretty-symbols! 'elm-mode
:null "null" :null "null"
@ -22,4 +20,4 @@
(use-package! flycheck-elm (use-package! flycheck-elm
:when (featurep! :checkers syntax) :when (featurep! :checkers syntax)
:after elm-mode :after elm-mode
:config (add-to-list 'flycheck-checkers 'elm nil #'eq)) :config (add-to-list 'flycheck-checkers 'elm))

View file

@ -221,6 +221,66 @@ verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'."
(default-value 'flycheck-emacs-lisp-check-form) (default-value 'flycheck-emacs-lisp-check-form)
")")))) ")"))))
;;;###autoload
(defun +emacs-lisp-truncate-pin ()
"Truncates long SHA1 hashes in `package!' :pin's."
(save-excursion
(goto-char (match-beginning 0))
(and (stringp (plist-get (sexp-at-point) :pin))
(search-forward ":pin" nil t)
(let ((start (re-search-forward "\"[^\"]\\{10\\}" nil t))
(finish (and (re-search-forward "\"" (line-end-position) t)
(match-beginning 0))))
(when (and start finish)
(put-text-property start finish 'display "...")))))
nil)
;;;###autoload
(defun +emacs-lisp-indent-function (indent-point state)
"A replacement for `lisp-indent-function'.
Indents plists more sensibly. Adapted from
https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
(let ((normal-indent (current-column))
(orig-point (point))
;; TODO Refactor `target' usage (ew!)
target)
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(cond ((and (elt state 2)
(or (not (looking-at-p "\\sw\\|\\s_"))
(eq (char-after) ?:)))
(unless (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp)
(goto-char calculate-lisp-indent-last-sexp)
(beginning-of-line)
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t))
(backward-prefix-chars)
(current-column))
((and (save-excursion
(goto-char indent-point)
(skip-syntax-forward " ")
(not (eq (char-after) ?:)))
(save-excursion
(goto-char orig-point)
(and (eq (char-after) ?:)
(setq target (current-column)))))
(save-excursion
(move-to-column target t)
target))
((let* ((function (buffer-substring (point) (progn (forward-sexp 1) (point))))
(method (or (function-get (intern-soft function) 'lisp-indent-function)
(get (intern-soft function) 'lisp-indent-hook))))
(cond ((or (eq method 'defun)
(and (null method)
(> (length function) 3)
(string-match-p "\\`def" function)))
(lisp-indent-defform state indent-point))
((integerp method)
(lisp-indent-specform method state indent-point normal-indent))
(method
(funcall method indent-point state))))))))
;;;###autoload ;;;###autoload
(defun +emacs-lisp/edebug-instrument-defun-on () (defun +emacs-lisp/edebug-instrument-defun-on ()
"Toggle on instrumentalisation for the function under `defun'." "Toggle on instrumentalisation for the function under `defun'."

View file

@ -43,7 +43,9 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
mode-name "Elisp" mode-name "Elisp"
;; Don't treat autoloads or sexp openers as outline headers, we have ;; Don't treat autoloads or sexp openers as outline headers, we have
;; hideshow for that. ;; hideshow for that.
outline-regexp +emacs-lisp-outline-regexp) outline-regexp +emacs-lisp-outline-regexp
;; Fixed indenter that intends plists sensibly.
lisp-indent-function #'+emacs-lisp-indent-function)
;; variable-width indentation is superior in elisp ;; variable-width indentation is superior in elisp
(add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq) (add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq)
@ -75,7 +77,9 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
("^;;;###\\(autodef\\|if\\|package\\)[ \n]" (1 font-lock-warning-face t))) ("^;;;###\\(autodef\\|if\\|package\\)[ \n]" (1 font-lock-warning-face t)))
;; highlight defined, special variables & functions ;; highlight defined, special variables & functions
(when +emacs-lisp-enable-extra-fontification (when +emacs-lisp-enable-extra-fontification
`((+emacs-lisp-highlight-vars-and-faces . +emacs-lisp--face))))) `((+emacs-lisp-highlight-vars-and-faces . +emacs-lisp--face)))
`(("(package!\\_>" (0 (+emacs-lisp-truncate-pin))))))
;; Recenter window after following definition ;; Recenter window after following definition
(advice-add #'elisp-def :after #'doom-recenter-a) (advice-add #'elisp-def :after #'doom-recenter-a)

View file

@ -4,6 +4,8 @@
(package! elisp-mode :built-in t) (package! elisp-mode :built-in t)
(package! highlight-quoted :pin "2410347815") (package! highlight-quoted :pin "2410347815")
;; Tools
(package! macrostep :pin "424e3734a1") (package! macrostep :pin "424e3734a1")
(package! overseer :pin "02d49f582e") (package! overseer :pin "02d49f582e")
(package! elisp-def :pin "368b04da68") (package! elisp-def :pin "368b04da68")
@ -11,4 +13,5 @@
(when (featurep! :checkers syntax) (when (featurep! :checkers syntax)
(package! flycheck-cask :pin "3457ae553c")) (package! flycheck-cask :pin "3457ae553c"))
;; Libraries
(package! buttercup :pin "a91f282025") (package! buttercup :pin "a91f282025")

View file

@ -0,0 +1,114 @@
#+TITLE: lang/java
#+DATE: January 16, 2017
#+SINCE: v1.3
#+STARTUP: inlineimages
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#prerequisites][Prerequisites]]
- [[#openjdk-11][OpenJDK 11]]
- [[#ubuntu][Ubuntu]]
- [[#fedora][Fedora]]
- [[#oracle-jdk-11][Oracle JDK 11]]
- [[#ubuntu-1][Ubuntu]]
- [[#fedora-1][Fedora]]
- [[#features][Features]]
- [[#lsp-features][=+lsp= features]]
- [[#meghanada-features][=+meghanada= features]]
- [[#configuration][Configuration]]
* Description
This module adds [[https://www.java.com][java]] support to Doom Emacs, including =android-mode= and
=groovy-mode=.
** Module Flags
+ =+lsp= Enables integration for the eclipse.jdt.ls LSP server.
+ =+meghanada= Enables the [[https://github.com/mopemope/meghanada-emacs/tree/master][meghanada-mode]]
The =+lsp= and =+meghanada= packages are mutually exclusive and do not work
together. At the time of writing the =+meghanada= is already configured whereas
=+lsp= needs to manual configuring.
* Prerequisites
This module requires the Java SDK.
** OpenJDK 11
*** Ubuntu
#+BEGIN_SRC sh
sudo apt-get install openjdk-11-jdk-headless
#+END_SRC
*** Fedora
#+BEGIN_SRC sh
sudo dnf install java-11-openjdk
#+END_SRC
** Oracle JDK 11
*** Ubuntu
#+BEGIN_SRC sh
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
sudo apt install oracle-java11-set-default
#+END_SRC
*** Fedora
#+BEGIN_SRC sh
curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz
sudo mv jdk-11.0.2/ /usr/local/
#+END_SRC
Open =/etc/profile.d/jdk11.sh= as root and add
#+BEGIN_SRC sh
export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin
#+END_SRC
Save the file and source the file
#+BEGIN_SRC sh
source /etc/profile.d/jdk11.sh
java -version
#+END_SRC
* Features
** =+lsp= features
According to [[https://github.com/emacs-lsp/lsp-java]] it adds
+ As you type reporting of parsing and compilation errors (via flycheck/[[https://github.com/emacs-lsp/lsp-ui][lsp-ui]])
+ Code completion - using [[https://github.com/tigersoldier/company-lsp][company-lsp]] or builtin complete-at-point
+ Javadoc hovers - using [[https://github.com/emacs-lsp/lsp-ui][lsp-ui]]
+ Code actions - using [[https://github.com/emacs-lsp/lsp-ui][lsp-ui]]
+ Code outline - using builtin [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html][imenu]]
+ Code navigation - using builtin [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html][xref]]
+ Code lens (references/implementations) - using builtin [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html][xref]]
+ Highlights
+ Code formatting
+ Maven pom.xml project support
+ Limited Gradle support
+ Visual debugger - [[https://github.com/yyoncho/dap-mode/][dap-mode]]
+ Test runner - [[https://github.com/yyoncho/dap-mode/][dap-mode]]
+ Project explorer integration - [[https://github.com/Alexander-Miller/treemacs][treemacs]]
+ Integration with [[https://start.spring.io/][Spring Initializr]]
** =+meghanada= features
According to [[https://github.com/mopemope/meghanada-emacs/]] it adds
+ Auto-update server module
+ [[https://gradle.org/][Gradle]] and [[http://maven.apache.org/][Maven]] and Eclipse project support
+ No need build tool's plugin
+ Run build tool task
+ Compile your project
+ Syntax check and analyze java source (=flycheck-meghanada=)
+ Support =Generic Types=
+ Code completion with [[http://company-mode.github.io/][company-mode]] (=company-meghanada=)
+ Optimize import and sort
+ Jump declaration
+ Run [[http://www.junit.org/][JUnit]] test (include test runner)
+ Diagnostic reporting with [[http://flycheck.org/][flycheck]] (=flycheck-meghanada=)
+ Show symbol's type info with =el-doc=
+ Search references
+ Full-featured text search
* TODO Configuration

View file

@ -22,7 +22,7 @@ If the depth is 2, the first two directories are removed: net.lissner.game.")
;; ;;
;; java-mode ;;; java-mode
(add-hook 'java-mode-hook #'rainbow-delimiters-mode) (add-hook 'java-mode-hook #'rainbow-delimiters-mode)
@ -31,7 +31,7 @@ If the depth is 2, the first two directories are removed: net.lissner.game.")
;; ;;
;; Common packages ;;; Common packages
(use-package! android-mode (use-package! android-mode
:commands android-mode :commands android-mode

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