14 Commits

Author SHA1 Message Date
18bb2da849 fix(lib): doom-project-find-file: allow arbitrary roots
Allow doom-project-find-file to search file hierarchies from arbitrary
starting points (otherwise, project.el will resolve to the nearest
project root).
2025-06-10 21:29:00 +02:00
1fc41d719c fix: project-current-directory-override takes a directory
Not a `t`. [It overrides `default-directory`](6c1c3120b9/lisp/progmodes/project.el (L196-L198)).
2025-01-09 01:06:20 -05:00
0a715cc3f2 refactor: (if|when)-let -> (if|when)-let*
With the former macros' future in the air (and likely to be targeted in
future, potentially breaking changes), I'll deal with this now than have
it bite me later.

Ref: https://lists.gnu.org/archive/html/emacs-devel/2024-10/msg00637.html
2025-01-08 19:33:37 -05:00
15904349cf refactor!: module API
BREAKING CHANGE: This backports some architectural choices from v3.0.
This changes Doom's module API, renaming some functions and removing
others, in order to facilitate some new features, prepare to move Doom's
modules into separate repos, and make way for two, much larger breaking
commits coming in the next few days.

This commit won't break anything for users unless they're tinkering with
Doom's internals/using its `doom-module-*` API directly. I am avoiding
broader backwards incompatibilities until the 3.0 release.

What's new:

- Negated flags. (modulep! :editor evil -everywhere) will return non-nil
  if :editor evil is active without its +everywhere flag.
- `modulep!` now takes multiple flags to simplify AND checks. E.g.

    (and (modulep! +foo)
         (modulep! +bar)
         (not (modulep! +baz)))

  Can now be expressed with:

    (modulep! +foo +bar -baz)
- Adds pcase matchers for `doom-module-context` and `doom-module`
  structs, making the following destructuring binds possible:

    (pcase-dolist ((doom-module group name flags features)
                   (hash-table-values doom-modules))
      ...)

  This will be used more in v3.0.
- Adds file cookie support to module init.el and config.el files.

Here's a summary of breaking changes made in this commit:

- `doom-module-context` was changed from a vector to a struct (record).
- `doom-modules` is now a table of `doom-module` structs, rather than
  free-form plists.
- The following macros have been renamed:
  - `doom-context-with` -> `with-doom-context`
  - `doom-module-context-with` -> `with-doom-module`
- The followings functions have been replaced/removed:
  - `doom-module-context`+`doom-module-context-get` -> `doom-module`
  - `doom-module-set` -> `doom-module--put`
  - `doom-module-p` -> `doom-module-active-p`
  - `doom-module-context-key` (is now a getter with the same name)
  - `doom-module-put` (removed)
  - `doom-module--context-field` (removed)
- The signatures for these functions have changed:
  - `doom-module-get CATEGORY &optional MODULE PROP` ->
    `doom-module-get (GROUP . MODULE) &optional PROP`
  - `doom-module-locate-path CATEGORY &optional MODULE FILE` ->
    `doom-module-locate-path (GROUP . MODULE) &optional FILE`
  - `doom-module-expand-path CATEGORY MODULE &optional FILE` ->
    `doom-module-expand-path (GROUP . MODULE) &optional FILE`
- Adds the following functions
  - `doom-module-exists-p`
  - `doom-module-key`
  - `doom-module->context`
  - `doom-module<-context`
- Removes the following variables
  - `doom-module--empty-context`

This commit results in a little redundancy, which I will address in
parts 2/3 and/or v3.0.
2024-10-20 02:41:42 -04:00
ad29be39f6 refactor(lib): add provide lines 2024-10-02 05:15:58 -04:00
22fc36dba7 fix(lib): doom/add-directory-as-project
If the target directory wasn't in a project, this command would throw a
type error (see #8032).

This also adds more checks and informative error handling to the
command.

Fix: #8032
2024-08-31 00:59:45 -04:00
bd728fd2a8 fix(lib): doom-project-find-file: fall back to find-file if DIR is empty
Fix: #7949
2024-07-16 11:06:39 -04:00
d7075b2420 tweak(lib): doom-project-find-file: use transient project
If DIR is not a project and does not have root markers, create a
transient project instead. This ensures that `project-find-file-in`, and
by extension vertico, is still used in non-project directories instead
of falling back to `find-file`

Ref: 1b0af3bfc7
2024-07-06 20:16:59 -04:00
1b0af3bfc7 fix(lib): doom-project-find-file: remove +vertico/consult-fd-or-find
When +vertico/find-file-in was replaced in 60e22fd with
+vertico/consult-fd-or-find, it changed a key behavior for
doom-project-find-file for Vertico users: instead of displaying an
initial list of all files under the target directory, it would display
nothing until the user entered in N * `consult-async-min-input`
characters, causing confusion (see linked comment).

Since Vertico integration modifies project-find-file-in's interface
appropriately, I leave it to that command instead.

Ref: https://github.com/doomemacs/doomemacs/issues/7312#issuecomment-1933404444
Amend: 60e22fd2eb
2024-02-08 02:00:55 -05:00
15339e4671 fix(lib): doom-project-find-file: cl-no-applicable-method project-root
Fix: #7312
2024-02-08 00:58:20 -05:00
60e22fd2eb refactor(vertico): use consult-fd
Close: #7458
Co-authored-by: LemonBreezes <look@strawberrytea.xyz>
2024-01-27 23:34:56 +02:00
5155f4aa78 fix(lib): unquote base-directory in project-file-exists-p!
Fix: #7356
Amend: b1cc719063
2023-08-19 22:57:32 +02:00
b1cc719063 feat(lib): add base-directory arg to project-file-exists-p!
I also revise its docstring.

Ref: #7333
Co-authored-by: LemonBreezes <LemonBreezes@users.noreply.github.com>
2023-08-18 19:04:25 +02:00
b9933e6637 refactor!: restructure Doom core
BREAKING CHANGE: This restructures the project in preparation for Doom
to be split into two repos. Users that have reconfigured Doom's CLI
stand a good chance of seeing breakage, especially if they've referred
to any core-* feature, e.g.

  (after! core-cli-ci ...)

To fix it, simply s/core-/doom-/, i.e.

  (after! doom-cli-ci ...)

What this commit specifically changes is:
- Renames all core features from core-* to doom-*
- Moves core/core-* -> lisp/doom-*
- Moves core/autoloads/* -> lisp/lib/*
- Moves core/templates -> templates/

Ref: #4273
2022-07-30 22:41:13 +02:00