* Why having string-chop-newline
@ 2020-12-30 9:06 Evgeny Zajcev
2020-12-30 9:22 ` tomas
0 siblings, 1 reply; 4+ messages in thread
From: Evgeny Zajcev @ 2020-12-30 9:06 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
Why is `string-chop-newline' needed?
(string-trim-right string "\n") or (string-remove-suffix "\n" string) looks
much more descriptive and maintainable.
`string-chop-newline` name does not say us from where newline is chopped
If one need a function to map across a list of strings returning remove
newline from the tail, then `partial-apply' could be used, such as:
(mapcar (apply-partially 'string-remove-suffix "\n")
list-of-strings-with-trailing-newline)
I propose not to add one-liners just to have them in because other string
manipulating packages provides similar one liners
What do you think?
Thanks
--
lg
[-- Attachment #2: Type: text/html, Size: 979 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why having string-chop-newline
2020-12-30 9:06 Why having string-chop-newline Evgeny Zajcev
@ 2020-12-30 9:22 ` tomas
2020-12-30 11:56 ` Stefan Kangas
0 siblings, 1 reply; 4+ messages in thread
From: tomas @ 2020-12-30 9:22 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 255 bytes --]
On Wed, Dec 30, 2020 at 12:06:39PM +0300, Evgeny Zajcev wrote:
> Why is `string-chop-newline' needed?
FWIW, "my" Emacs has no function named like that. Perhaps you
should give us a hint towards where you found it, to help set
the context...
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why having string-chop-newline
2020-12-30 9:22 ` tomas
@ 2020-12-30 11:56 ` Stefan Kangas
2020-12-30 12:08 ` tomas
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2020-12-30 11:56 UTC (permalink / raw)
To: tomas, emacs-devel
<tomas@tuxteam.de> writes:
> On Wed, Dec 30, 2020 at 12:06:39PM +0300, Evgeny Zajcev wrote:
>> Why is `string-chop-newline' needed?
>
> FWIW, "my" Emacs has no function named like that. Perhaps you
> should give us a hint towards where you found it, to help set
> the context...
See this commit on master:
commit f329a3180ead740bb85e1edfc48ae360a56f7ffd
Author: Lars Ingebrigtsen <larsi@gnus.org>
Date: Mon Dec 21 22:05:37 2020 +0100
Add string-chop-newline
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why having string-chop-newline
2020-12-30 11:56 ` Stefan Kangas
@ 2020-12-30 12:08 ` tomas
0 siblings, 0 replies; 4+ messages in thread
From: tomas @ 2020-12-30 12:08 UTC (permalink / raw)
To: Stefan Kangas; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
On Wed, Dec 30, 2020 at 03:56:48AM -0800, Stefan Kangas wrote:
> <tomas@tuxteam.de> writes:
>
> > On Wed, Dec 30, 2020 at 12:06:39PM +0300, Evgeny Zajcev wrote:
> >> Why is `string-chop-newline' needed?
> >
> > FWIW, "my" Emacs has no function named like that. Perhaps you
> > should give us a hint towards where you found it, to help set
> > the context...
>
> See this commit on master:
>
> commit f329a3180ead740bb85e1edfc48ae360a56f7ffd
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Mon Dec 21 22:05:37 2020 +0100
>
> Add string-chop-newline
>
> * doc/lispref/strings.texi (Creating Strings): Document it.
> * lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
Oh, thanks. Seems my bleeding edge lags a bit :)
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-30 12:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-30 9:06 Why having string-chop-newline Evgeny Zajcev
2020-12-30 9:22 ` tomas
2020-12-30 11:56 ` Stefan Kangas
2020-12-30 12:08 ` tomas
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).