; * lisp/emacs-lisp/subr-x.el (string-pad): Optimise.
This commit is contained in:
parent
f6356dc88d
commit
d8d582dc3c
1 changed files with 3 additions and 7 deletions
|
@ -254,13 +254,9 @@ the string."
|
|||
(unless (natnump length)
|
||||
(signal 'wrong-type-argument (list 'natnump length)))
|
||||
(let ((pad-length (- length (length string))))
|
||||
(if (< pad-length 0)
|
||||
string
|
||||
(concat (and start
|
||||
(make-string pad-length (or padding ?\s)))
|
||||
string
|
||||
(and (not start)
|
||||
(make-string pad-length (or padding ?\s)))))))
|
||||
(cond ((<= pad-length 0) string)
|
||||
(start (concat (make-string pad-length (or padding ?\s)) string))
|
||||
(t (concat string (make-string pad-length (or padding ?\s)))))))
|
||||
|
||||
(defun string-chop-newline (string)
|
||||
"Remove the final newline (if any) from STRING."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue