emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 87e422f: Beef up the Emacs string utility set a bit


From: Lars Ingebrigtsen
Subject: Re: master 87e422f: Beef up the Emacs string utility set a bit
Date: Mon, 21 Dec 2020 21:03:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Kangas <stefankangas@gmail.com> writes:

> I had a look at GitHub to get some data, in case that helps.

Yes, thanks.

> It seems to have some real world usage, at least:
>
>     https://github.com/search?l=Emacs+Lisp&q=s-chomp&type=Code

Hm...  is there a way to filter out the code people are including from
s.el?  Many of those are just the example code from there:

(defexamples s-chomp
  (s-chomp "no newlines\n") => "no newlines"
  (s-chomp "no newlines\r\n") => "no newlines"
  (s-chomp "some newlines\n\n") => "some newlines\n")

Let's see...

https://github.com/search?q=s-chomp+-defexample+-newlines&type=Code

This probably filters a bit too much?  But it got rid of most of the
example code.

What would we call it in Emacs Lisp?  I guess most people would
understand `string-chomp', but it's a bit un-Elispy.

>> s-repeat (num s)
>>
>> This neither.
>
> Seems to see some use, but not a lot:
>
>     https://github.com/search?l=Emacs+Lisp&q=s-repeat&type=Code

4K of those were from

         (s-repeat (org-habit-scheduled-repeat habit))

With

https://github.com/search?q=s-repeat+-org&type=Code

we're down to more reasonable numbers.  Of the first few pagefuls of
hits, more than nine tenths of them use s-repeat at a synonym for
make-string.  (s-repeat count "-") instead of (make-string count ?-).

So I'm leaning towards "not".

>> There's also a bunch of "titleize" functions that just seem to quirky.
>> And the camelCase and SnakeCase functions?  Dunno, I think they're best
>> left in the s.el for people that want that.
>
> Unsure about titleize, but here we have:
>
>     https://github.com/search?l=Emacs+Lisp&q=s-titleize&type=Code

Oh, I forgot again that "titleize" here was the same as `capitalize' in
Emacs Lisp.  OK, then the possibly useful function is

s-capitalize (s)

which upcases the first character and downcases the rest.  And that
seems to have a fair number of usages:

https://github.com/search?q=s-capitalize&type=Code

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]