puni icon indicating copy to clipboard operation
puni copied to clipboard

Improve support for `kill-whole-line`

Open hpfr opened this issue 1 year ago • 2 comments

Hi, thanks for making Puni, I appreciate the philosophy behind it.

One thing that’s been bothering me is that with kill-whole-line set, puni-kill-line correctly kills through \n but then puts point at the start of the next expression instead of remaining at column 0. This means the next invocation of puni-kill-line will not kill through \n, so you have to press C-k twice per line or alternate C-a and C-k as you would if kill-whole-line were unset.

I’m used to kill-whole-line enabling me to repeatedly C-k to quickly kill multiple lines, where n presses of C-k results in n killed lines.

Of course, soft deletion should take precedence. So when there is a closing delimiter on the current line, puni-kill-line should still stop there. But outside of that case, I would like puni-kill-line to keep point at column 0, so that while inside a balanced expression, each C-k kills a full line while at column 0.

Does this make any sense? Thanks!

hpfr avatar Nov 17 '24 04:11 hpfr

I think I'm running into this too. Does #64 describe the behavior you're seeing?

Edit: I opened #77, since #64 is closed. Also FWIW my issue occurs regardless of the value of kill-whole-line.

astratagem avatar Aug 02 '25 20:08 astratagem

This is different from the issue originally described in #64, where new indentation is created. In my case I only get point jumping to the start of the next expression, which is a result of the fix for #16. #64 was resolved by @AmaiKinono’s follow-up fix. As for your issue, I can reproduce it but I am not convinced it’s for Puni to fix. I replied about that there.


For clarification, here is an example case of the issue I’m describing, where point is |:

Start with point at column 0 and run puni-kill-line with kill-whole-line set.

  hardware = {
|   brillo.enable = true;
    bluetooth.enable = true;
  };

Expected result, so you can keep killing whole lines with repeated C-k:

  hardware = {
|   bluetooth.enable = true;
  };

Actual result:

  hardware = {
   |bluetooth.enable = true;
  };

I think it’s mostly reasonable to reindent as implemented in #16, but I think it’s also reasonable to not reindent if you are in column 0 with kill-whole-line set for the case where you want to rapidly kill by line.

hpfr avatar Aug 03 '25 22:08 hpfr