Skip to content

Commit

Permalink
Add item to docs/TODO.md and simplify regexp_compile_internal()
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarnes committed Dec 23, 2024
1 parent 1ccff01 commit 96facb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ Features

* Allow custom colors/attributes in the statusline (see also: [#70])

* Allow [`include`] to run *any* command when used from command mode
or key bindings (the restrictions noted for [configuration commands]
should only apply to `rc` files and built-in configs)

Documentation
-------------

Expand Down Expand Up @@ -319,15 +323,17 @@ Testing/Debugging
[`dte-syntax(5)`]: https://craigbarnes.gitlab.io/dte/dte-syntax.html
[`default`]: https://craigbarnes.gitlab.io/dte/dte-syntax.html#default

[configuration commands]: https://craigbarnes.gitlab.io/dte/dterc.html#configuration-commands
[`alias`]: https://craigbarnes.gitlab.io/dte/dterc.html#alias
[`clear`]: https://craigbarnes.gitlab.io/dte/dterc.html#clear
[`command`]: https://craigbarnes.gitlab.io/dte/dterc.html#command
[`copy`]: https://craigbarnes.gitlab.io/dte/dterc.html#copy
[`delete-line`]: https://craigbarnes.gitlab.io/dte/dterc.html#delete-line
[`errorfmt`]: https://craigbarnes.gitlab.io/dte/dterc.html#errorfmt
[`exec`]: https://craigbarnes.gitlab.io/dte/dterc.html#exec
[`hi`]: https://craigbarnes.gitlab.io/dte/dterc.html#hi
[`ft`]: https://craigbarnes.gitlab.io/dte/dterc.html#ft
[`hi`]: https://craigbarnes.gitlab.io/dte/dterc.html#hi
[`include`]: https://craigbarnes.gitlab.io/dte/dterc.html#include
[`macro`]: https://craigbarnes.gitlab.io/dte/dterc.html#macro
[`paste`]: https://craigbarnes.gitlab.io/dte/dterc.html#paste
[`quit`]: https://craigbarnes.gitlab.io/dte/dterc.html#quit
Expand Down
2 changes: 2 additions & 0 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ static bool cmd_hi(EditorState *e, const CommandArgs *a)
update_all_syntax_styles(&e->syntaxes, &e->styles);
e->screen_update |= UPDATE_ALL_WINDOWS;
}

return true;
}

Expand All @@ -874,6 +875,7 @@ static bool cmd_include(EditorState *e, const CommandArgs *a)
if (has_flag(a, 'b')) {
flags |= CFG_BUILTIN;
}

int err = read_normal_config(e, a->args[0], flags);
// TODO: Clean up read_normal_config() so this can be simplified to `err == 0`
return err == 0 || (err == ENOENT && !(flags & CFG_MUST_EXIST));
Expand Down
5 changes: 1 addition & 4 deletions src/regexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ bool regexp_error_msg(const regex_t *re, const char *pattern, int err)
bool regexp_compile_internal(regex_t *re, const char *pattern, int flags)
{
int err = regcomp(re, pattern, flags);
if (err) {
return regexp_error_msg(re, pattern, err);
}
return true;
return !err || regexp_error_msg(re, pattern, err);
}

void regexp_compile_or_fatal_error(regex_t *re, const char *pattern, int flags)
Expand Down

0 comments on commit 96facb9

Please sign in to comment.