[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification
From: |
Drew Adams |
Subject: |
RE: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification |
Date: |
Sat, 6 May 2017 09:30:46 -0700 (PDT) |
> > +(defsubst string-trim-left (string &optional regexp)
> > + "Trim STRING of leading whitespace matching REGEXP.
> > +
> > +REGEXP defaults to \"[ \t\n\r]+\"."
> > + (if (string-match (concat "\\`" (or regexp "[ \t\n\r]+")) string)
> > (replace-match "" t t string)
> > string))
>
> Isn't there a way to do [...] that would work with defsubst?
IMHO, *none* of the defsubsts in subr-x.el should be there.
They should all be defuns. (Currently, even their names are
inconsistent, some with `--' to indicate internal, most not.)
The code will be byte-compiled. I see zero reason why these
functions should be defsubsts. Instead of using a boatload
of defsubsts willy nilly, any defsubsts we put in the code
should be _strongly_ justified. I don't see any justification
for these defsubsts.
It's not just because `defsubst' still exists that we should
use it casually (or even use it at all). It is a precambrian
vestige, with little or no real use case.
Just one opinion.
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, (continued)
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Jean-Christophe Helary, 2017/05/07
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Eli Zaretskii, 2017/05/07
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Stefan Monnier, 2017/05/07
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Jean-Christophe Helary, 2017/05/10
- Message not available
- Re: bug#26908: Fwd: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Jean-Christophe Helary, 2017/05/16
- Re: bug#26908: Fwd: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Eli Zaretskii, 2017/05/16
- Re: bug#26908: Fwd: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Jean-Christophe Helary, 2017/05/16
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Jean-Christophe Helary, 2017/05/06
- RE: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification,
Drew Adams <=
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Stefan Monnier, 2017/05/06
- subr-x.el code and defsubst [was: Trimming strings, /.../subr-x.el modification], Drew Adams, 2017/05/06
- Re: subr-x.el code and defsubst [was: Trimming strings, /.../subr-x.el modification], Tianxiang Xiong, 2017/05/14
- RE: subr-x.el code and defsubst [was: Trimming strings, /.../subr-x.el modification], Drew Adams, 2017/05/14
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Andreas Schwab, 2017/05/06
- Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification, Tino Calancha, 2017/05/06