GNU bug report logs - #49194
kill-whole-line 'plus-newline-even-if-none-in-reality

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Wed, 23 Jun 2021 17:49:02 UTC

Severity: wishlist

Tags: moreinfo, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49194 in the body.
You can then email your comments to 49194 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Wed, 23 Jun 2021 17:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 23 Jun 2021 17:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Wed, 23 Jun 2021 23:34:29 +0800
The kill-whole-line variable is great, but not great enough.

(info "(emacs) Killing by Lines") says:
     If the variable ‘kill-whole-line’ is non-‘nil’, ‘C-k’ at the very
  beginning of a line kills the entire line including the following
  newline.  This variable is normally ‘nil’.

So setting it to non-nil allows us to get newlines, 99% of the time.

I hereby propose an additional value, call it one of:

   'always
   'no-matter-what
   'plus-newline-even-at-eof
   'plus-newline-even-if-none-in-reality

> See (info "(emacs) Customize Save") for require-final-newline. Bye.

Wait! Who says I even want the file to end in a newline? I just want
kill-whole-line to have a setting to consistently get a newline at the
end, and not 99% of the time.

> Then add a newline there yourself and remove it when you are finished. Bye.

Wait! The file might even be a readonly file owned by someone else. I
can't just "add one there myself."

> Well then copy the file first. Bye.

Seems like overkill, just to kill (copy) one line.

Anyway 'plus-newline-even-if-none-in-reality etc., being non-nil, would
also be 99% backwards compatible too!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 16:13:01 GMT) Full text and rfc822 format available.

Message #8 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Thu, 24 Jun 2021 18:11:53 +0200
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> I hereby propose an additional value, call it one of:
>
>    'always
>    'no-matter-what
>    'plus-newline-even-at-eof
>    'plus-newline-even-if-none-in-reality
>
>> See (info "(emacs) Customize Save") for require-final-newline. Bye.
>
> Wait! Who says I even want the file to end in a newline? I just want
> kill-whole-line to have a setting to consistently get a newline at the
> end, and not 99% of the time.
>
>> Then add a newline there yourself and remove it when you are finished. Bye.
>
> Wait! The file might even be a readonly file owned by someone else. I
> can't just "add one there myself."
>
>> Well then copy the file first. Bye.
>
> Seems like overkill, just to kill (copy) one line.
>
> Anyway 'plus-newline-even-if-none-in-reality etc., being non-nil, would
> also be 99% backwards compatible too!

I'm not quite sure what this essay is trying to express -- are you
asking for a new setting for `kill-whole-line' that deletes the preceding
newline if you call `C-k' at the start of the final line in a buffer,
and that final line doesn't have a newline at the end?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 24 Jun 2021 16:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:00:02 GMT) Full text and rfc822 format available.

Message #13 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 01:59:02 +0800
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:

LI> I'm not quite sure what this essay is trying to express -- are you
LI> asking for a new setting for `kill-whole-line' that deletes the preceding
LI> newline if you call `C-k' at the start of the final line in a buffer,
LI> and that final line doesn't have a newline at the end?

No. I'm just saying that a bonus newline should be added to what gets
copied (so later, upon C-y, it is present.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:27:02 GMT) Full text and rfc822 format available.

Message #16 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Thu, 24 Jun 2021 20:26:23 +0200
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> No. I'm just saying that a bonus newline should be added to what gets
> copied (so later, upon C-y, it is present.)

I think that sounds like really surprising behaviour, but I guess if
it's hidden behind a new `kill-whole-line' value, I guess I don't have
any objections to adding it.  Any other opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:43:01 GMT) Full text and rfc822 format available.

Message #19 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 02:42:20 +0800
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> gnus.org> writes:

LI> I think that sounds like really surprising behaviour, but I guess if
                                                        ^(more surprising
                                                        is the lack of
                                                        newlines on
                                                        certain C-y's
                                                        later.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:44:01 GMT) Full text and rfc822 format available.

Message #22 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49194 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Thu, 24 Jun 2021 21:42:56 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Thu, 24 Jun 2021 20:26:23 +0200
> Cc: 49194 <at> debbugs.gnu.org
> 
> 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:
> 
> > No. I'm just saying that a bonus newline should be added to what gets
> > copied (so later, upon C-y, it is present.)
> 
> I think that sounds like really surprising behaviour, but I guess if
> it's hidden behind a new `kill-whole-line' value, I guess I don't have
> any objections to adding it.  Any other opinions?

AFAIU, what the OP wants already happens: the newline is saved in
kill-ring together with the line, and is yanked back with C-y.  So I
don't think I understand the request.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:47:02 GMT) Full text and rfc822 format available.

Message #25 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49194 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Thu, 24 Jun 2021 20:46:37 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> AFAIU, what the OP wants already happens: the newline is saved in
> kill-ring together with the line, and is yanked back with C-y.  So I
> don't think I understand the request.

He wants to kill the final line in a buffer (that might not have a
newline character at the end), but end up with a string in the kill ring
that does have a newline at the end.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 18:53:01 GMT) Full text and rfc822 format available.

Message #28 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49194 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Thu, 24 Jun 2021 21:51:42 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: jidanni <at> jidanni.org,  49194 <at> debbugs.gnu.org
> Date: Thu, 24 Jun 2021 20:46:37 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > AFAIU, what the OP wants already happens: the newline is saved in
> > kill-ring together with the line, and is yanked back with C-y.  So I
> > don't think I understand the request.
> 
> He wants to kill the final line in a buffer (that might not have a
> newline character at the end), but end up with a string in the kill ring
> that does have a newline at the end.

That makes no sense to me: the command kills a line of buffer text, it
doesn't (and shouldn't) invent characters out of thin air.  When there
_is_ a newline at EOL, setting kill-whole-line will cause C-k to kill
that newline as well; but if there's no newline there, why should this
particular command with that option invent such a newline and save it
in kill-ring?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Thu, 24 Jun 2021 20:22:02 GMT) Full text and rfc822 format available.

Message #31 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 04:20:50 +0800
>>>>> "EZ" == Eli Zaretskii <eliz <at> gnu.org> writes:

EZ> That makes no sense to me: the command kills a line of buffer text, it
EZ> doesn't (and shouldn't) invent characters out of thin air.  When there
EZ> _is_ a newline at EOL, setting kill-whole-line will cause C-k to kill
EZ> that newline as well; but if there's no newline there, why should this
EZ> particular command with that option invent such a newline and save it
EZ> in kill-ring?

1. There may not be a newline yet, but there will be upon sending the
message, or saving the file, depending on other settings.

2. That allows consistent yanking later. C-k ... C-y now will always
have a newline. Else even though C-k appears to behave the same at the
end of file, C-y depends different later.

Anyway, just try making a bunch of lines like this:
                                   ^^^^^^^^^^^^^^^
                                   ^^^^^^^^^^^^^^^
                                   ^^^^^^^^^^^^^^^
at the end of your reply, without extra fuss when copying the first!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Fri, 25 Jun 2021 06:03:01 GMT) Full text and rfc822 format available.

Message #34 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: larsi <at> gnus.org, 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 09:01:53 +0300
> From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,  49194 <at> debbugs.gnu.org
> Date: Fri, 25 Jun 2021 04:20:50 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> EZ> That makes no sense to me: the command kills a line of buffer text, it
> EZ> doesn't (and shouldn't) invent characters out of thin air.  When there
> EZ> _is_ a newline at EOL, setting kill-whole-line will cause C-k to kill
> EZ> that newline as well; but if there's no newline there, why should this
> EZ> particular command with that option invent such a newline and save it
> EZ> in kill-ring?
> 
> 1. There may not be a newline yet, but there will be upon sending the
> message, or saving the file, depending on other settings.
> 
> 2. That allows consistent yanking later. C-k ... C-y now will always
> have a newline. Else even though C-k appears to behave the same at the
> end of file, C-y depends different later.
> 
> Anyway, just try making a bunch of lines like this:
>                                    ^^^^^^^^^^^^^^^
>                                    ^^^^^^^^^^^^^^^
>                                    ^^^^^^^^^^^^^^^
> at the end of your reply, without extra fuss when copying the first!

If this is about your personal needs, why not make a keyboard macro to
achieve what you want, and use it thereafter?  IMO, we shouldn't add
to Emacs stuff that is needed by a single user (or a small number of
users) because of their peculiar workflows, and which makes little
sense with other workflows.  Inventing characters at kill time sounds
very strange an unintuitive behavior, so adding it to Emacs, even as
an option, would be a mistake, IMO.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Fri, 25 Jun 2021 14:03:01 GMT) Full text and rfc822 format available.

Message #37 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49194 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 16:02:36 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> If this is about your personal needs, why not make a keyboard macro to
> achieve what you want, and use it thereafter?  IMO, we shouldn't add
> to Emacs stuff that is needed by a single user (or a small number of
> users) because of their peculiar workflows, and which makes little
> sense with other workflows.  Inventing characters at kill time sounds
> very strange an unintuitive behavior, so adding it to Emacs, even as
> an option, would be a mistake, IMO.

It's not something I'd use myself, but it makes some kind of vague sense
that I could see being generally useful.  That is -- "it'd be nice if
`C-k' always put an entire, full line into the kill ring".

But I agree that it's somewhat obscure functionality, so unless there's
a greater clamouring for this, we probably shouldn't add it, and I'm
closing this bug report.

(If several other people pipe up saying "that's what I've wanted all my
life!" then we could reconsider.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Jun 2021 14:03:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 49194 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Jun 2021 14:03:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Fri, 25 Jun 2021 14:05:01 GMT) Full text and rfc822 format available.

Message #44 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49194 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Fri, 25 Jun 2021 17:03:51 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
>   49194 <at> debbugs.gnu.org
> Date: Fri, 25 Jun 2021 16:02:36 +0200
> 
> (If several other people pipe up saying "that's what I've wanted all my
> life!" then we could reconsider.)

Right.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49194; Package emacs. (Sat, 26 Jun 2021 17:14:02 GMT) Full text and rfc822 format available.

Message #47 received at 49194 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 49194 <at> debbugs.gnu.org
Subject: Re: bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
Date: Sun, 27 Jun 2021 01:12:55 +0800
Just like some people see the need to always append a "\n" to the end of
a file, some people also see the need to always append a "\n" to the
end of what C-k kills.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Jul 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.