unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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).