Commit Graph

21 Commits

Author SHA1 Message Date
Johannes Altmanninger
7b93567bb1 Reset SIGINT handler in background processes
In a noninteractive shell, asynchronous commands ignore SIGINT and
SIGQUIT. We typically use such shells to feed fifo buffers which we
do want to cancel them on Control-C.  Make it so.

Same for SIGQUIT; that one is not typically used but I expect that
along the Kakoune server it kills any child processes that (haven't
been daemonized).

Note that for unknown reasons, Bash already doesn't ignore SIGINT in
async processes that use "eval".

Note that Dash has a bug that prevents this from working;
proposed fix is at
https://lore.kernel.org/dash/20240329153905.154792-2-aclopte@gmail.com/

(While at it balance out some parens, to help the m command)
2024-03-31 20:13:35 +11:00
Maxime Coste
9cc2f47e31 Modularize grep.kak, make.kak and jump.kak 2024-03-11 20:51:27 +11:00
Johannes Altmanninger
c81266d4f6 jump{,-next,-previous} cmds to navigate any grep-like buffer
`grep-next-match` works only on the `*grep*` buffer so it can't be used
on buffers that were preserved by renaming or on other grep-flavored
buffers created by 3rd party plugins kakoune-find and kakoune-lsp,
like `*find*` and `*references*`.

Let's generalize `grep-next-match` with a `jump-next` command that
takes a buffer argument.

This renames some options but I think they're not commonly used.
kakoune-lsp is an exception that uses grep_current_line but it's no big
deal, things will fail loud and early if options are missing.

Since grep.kak and friends now depend on jump.kak, move the jumpclient
declaration there as well.
2024-03-06 08:04:35 +11:00
Johannes Altmanninger
88aff72bc8 rc grep/make: don't touch user selections
Since the default make error pattern spans until the end of the
line, make-jump select the whole line, moving the cursor to the end.
This is especially  bad when the error message is very long and hence
the cursor movement scrolls the viewport so the file:line:col is no
longer visible.

Stop moving the cursor in `*make*` and `*grep*` buffers.
We already have highlighting to indicate the current line.
2024-02-27 00:03:43 +11:00
Johannes Altmanninger
847bf98b47 rc make: fix make-jump if selection includes trailing newline
Given

    make[1]: Entering directory '/home/johannes/git/kakoune/src'
    main.cc:66:9: error: expected ‘}’ before ‘asdf’

If I select the whole second line, including the newline, make-jump
fails with an enigmatic "no such file or directory main.cc".  This is
because `gl` does not move the cursor away from the newline. Fix it.

This appears to have regressed in 80d661e6a (rc/: More consistent
uses of regex syntax, 2017-09-29).
2024-02-27 00:03:38 +11:00
Johannes Altmanninger
40ffd5ff3b rc grep/make: never match multiline filenames
If a user modifies a grep buffer, we can end up in weird situations
where we try match a filename over multiple lines.

Let's rule out newlines in filenames here. There is an argument
this is a case of GIGO but we already do this for the corresponding
highlighters.

We also do it in make.kak, see ca225ad4d (Cleanup make.kak and optimize
the make-next/make-prev regexes, 2016-12-09). There is one case left
where a filename would theoretically span multiple lines. Fix and
optimize this too.
2024-02-27 00:03:36 +11:00
Johannes Altmanninger
20d353936e rc grep/make: Revert "Support windows style path in grep output"
grep-jump and make-jump[*] support Windows-style paths like C:\path.
However grep-next-match and make-next-error don't, which suggests
that no one uses this feature.  IIRC Cygwin mounts Windows drives in
proper Unix paths like /mnt/drive_c.

Let's remove it for simplicity and consistency.

This reverts commit 6c47b204e (Support windows style path in grep
output, 2014-11-11).

[*]: Though make-jump recently regressed in 8e5ca3f21 (rc/make.kak
introduce a new option to be back compatible, 2023-10-27) by failing
to capture the "C:" prefix.
2024-02-27 00:03:33 +11:00
Bob Qi
8424fbe0f0 rc/make.kak reuse make_error_pattern 2023-11-02 09:11:18 +08:00
Bob Qi
760f63b827 rc/make.kak set option type to be regex 2023-10-29 09:05:33 +08:00
Bob Qi
cb540def46 rc/make.kak avoid another using pattern directly 2023-10-27 10:16:57 +08:00
Bob Qi
8e5ca3f214 rc/make.kak introduce a new option to be back compatible 2023-10-27 09:57:10 +08:00
Bob Qi
2d849cc147 rc/make.kak set search register to avoid injection 2023-10-27 08:25:38 +08:00
Bob Qi
d0571ce238 rc/make.kak support override the whole error line pattern 2023-10-26 10:13:07 +08:00
Johannes Altmanninger
daabb5da4e rc make: make-next-error to switch toolsclient to *make* buffer
This is equivalent to a change to grep.kak in 649e252f7 (bring *grep*
buffer to front in context of toolsclient, 2020-08-14).

If a toolsclient is set, make-next-error (and make-previous-error) will
jump to %opt{make_current_error_line}. This is wrong if the toolsclient
does not show the *make* buffer. In that case make_current_error_line
is undefined and we end up showing the goto menu. This has occasionally
been annoying me for a long time but I never bothered investigating.

Fix this by switching to the *make* buffer. The potential downside
is if make-next-error is run from the toolsclient, where we no longer
jump to the error but that's fine because we can use <ret>.

We can maybe improve this later by extending the logic, see
https://github.com/mawww/kakoune/pull/3656#pullrequestreview-472052285
2022-10-16 20:00:22 +02:00
throwawayaccount12345-1
3e580b185c
rc/tools/make.kak: quote "${kak_opt_makecmd}"
As per man page eval(1p):
> The eval utility shall construct a command by concatenating arguments together,
> separating each with a `<space>` character.  The constructed command shall be
> read and executed by the shell.

When not quoting `$kak_opt_makecmd` in the eval, the variable is split by
newlines and spaces and then joined by spaces to form the command. If there
were newlines in `$kak_opt_makecmd`, the command would be malformed.


To reproduce:
```kak
set-option global makecmd "
echo foo
echo bar"
make a b c
```

Expected output in the `*make*` buffer:
```
foo
bar a b c
```

Actual output:
```
foo echo bar a b c
```

This patch fixes this.
2021-11-05 13:43:18 -03:00
Frank LENORMAND
275abb227e rc: Make docstrings more readable
This cosmetics commit makes use of the auto-deindentation syntax,
available to docstrings.
2020-02-03 20:53:28 +01:00
Maxime Coste
2904d13420 Add a {\} marker to disable markup processing 2019-11-28 20:23:52 +11:00
codesoap
9ca9d40c03 Revert "Don't create subshells when unnecessary"
This reverts commit 6c05e6e0f8.
Apparently the Linux sh needs subshells here.
2019-06-10 18:00:11 +02:00
codesoap
6c05e6e0f8 Don't create subshells when unnecessary 2019-06-09 13:24:30 +02:00
codesoap
009eb80ca0 Fix tools using fifos for OpenBSD
Without these changes, kak would hang on the corresponding commands,
displaying a 'waiting for shell command to finish' message.
2019-06-09 11:50:35 +02:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00