unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
@ 2021-06-23 15:34 積丹尼 Dan Jacobson
  2021-06-24 16:11 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-06-23 15:34 UTC (permalink / raw)
  To: 49194

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!





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-23 15:34 bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality 積丹尼 Dan Jacobson
@ 2021-06-24 16:11 ` Lars Ingebrigtsen
  2021-06-24 17:59   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-24 16:11 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 49194

積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 16:11 ` Lars Ingebrigtsen
@ 2021-06-24 17:59   ` 積丹尼 Dan Jacobson
  2021-06-24 18:26     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-06-24 17:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194

>>>>> "LI" == Lars Ingebrigtsen <larsi@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.)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 17:59   ` 積丹尼 Dan Jacobson
@ 2021-06-24 18:26     ` Lars Ingebrigtsen
  2021-06-24 18:42       ` 積丹尼 Dan Jacobson
  2021-06-24 18:42       ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-24 18:26 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 49194

積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 18:26     ` Lars Ingebrigtsen
@ 2021-06-24 18:42       ` 積丹尼 Dan Jacobson
  2021-06-24 18:42       ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-06-24 18:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194

>>>>> "LI" == Lars Ingebrigtsen <larsi@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.)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 18:26     ` Lars Ingebrigtsen
  2021-06-24 18:42       ` 積丹尼 Dan Jacobson
@ 2021-06-24 18:42       ` Eli Zaretskii
  2021-06-24 18:46         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-06-24 18:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194, jidanni

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Thu, 24 Jun 2021 20:26:23 +0200
> Cc: 49194@debbugs.gnu.org
> 
> 積丹尼 Dan Jacobson <jidanni@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 18:42       ` Eli Zaretskii
@ 2021-06-24 18:46         ` Lars Ingebrigtsen
  2021-06-24 18:51           ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-24 18:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 49194, jidanni

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 18:46         ` Lars Ingebrigtsen
@ 2021-06-24 18:51           ` Eli Zaretskii
  2021-06-24 20:20             ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-06-24 18:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194, jidanni

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: jidanni@jidanni.org,  49194@debbugs.gnu.org
> Date: Thu, 24 Jun 2021 20:46:37 +0200
> 
> Eli Zaretskii <eliz@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?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 18:51           ` Eli Zaretskii
@ 2021-06-24 20:20             ` 積丹尼 Dan Jacobson
  2021-06-25  6:01               ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-06-24 20:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 49194

>>>>> "EZ" == Eli Zaretskii <eliz@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!





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-24 20:20             ` 積丹尼 Dan Jacobson
@ 2021-06-25  6:01               ` Eli Zaretskii
  2021-06-25 14:02                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2021-06-25  6:01 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: larsi, 49194

> From: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,  49194@debbugs.gnu.org
> Date: Fri, 25 Jun 2021 04:20:50 +0800
> 
> >>>>> "EZ" == Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-25  6:01               ` Eli Zaretskii
@ 2021-06-25 14:02                 ` Lars Ingebrigtsen
  2021-06-25 14:03                   ` Eli Zaretskii
  2021-06-26 17:12                   ` 積丹尼 Dan Jacobson
  0 siblings, 2 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-25 14:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 49194, 積丹尼 Dan Jacobson

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-25 14:02                 ` Lars Ingebrigtsen
@ 2021-06-25 14:03                   ` Eli Zaretskii
  2021-06-26 17:12                   ` 積丹尼 Dan Jacobson
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2021-06-25 14:03 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194, jidanni

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 積丹尼 Dan Jacobson <jidanni@jidanni.org>,
>   49194@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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality
  2021-06-25 14:02                 ` Lars Ingebrigtsen
  2021-06-25 14:03                   ` Eli Zaretskii
@ 2021-06-26 17:12                   ` 積丹尼 Dan Jacobson
  1 sibling, 0 replies; 13+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-06-26 17:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49194

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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-06-26 17:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 15:34 bug#49194: kill-whole-line 'plus-newline-even-if-none-in-reality 積丹尼 Dan Jacobson
2021-06-24 16:11 ` Lars Ingebrigtsen
2021-06-24 17:59   ` 積丹尼 Dan Jacobson
2021-06-24 18:26     ` Lars Ingebrigtsen
2021-06-24 18:42       ` 積丹尼 Dan Jacobson
2021-06-24 18:42       ` Eli Zaretskii
2021-06-24 18:46         ` Lars Ingebrigtsen
2021-06-24 18:51           ` Eli Zaretskii
2021-06-24 20:20             ` 積丹尼 Dan Jacobson
2021-06-25  6:01               ` Eli Zaretskii
2021-06-25 14:02                 ` Lars Ingebrigtsen
2021-06-25 14:03                   ` Eli Zaretskii
2021-06-26 17:12                   ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).