diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-08-10 13:06:12 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-08-10 13:06:12 +0200 |
commit | d8d582dc3c30e184e6f849eb302d0c89be019c83 (patch) | |
tree | f811c002d9c92949dec0746adba640d05725acc9 /lisp | |
parent | f6356dc88d23eb405aa6d8bd9dd5f669f1bc45ee (diff) | |
download | emacs-d8d582dc3c30e184e6f849eb302d0c89be019c83.tar.gz emacs-d8d582dc3c30e184e6f849eb302d0c89be019c83.tar.bz2 emacs-d8d582dc3c30e184e6f849eb302d0c89be019c83.zip |
; * lisp/emacs-lisp/subr-x.el (string-pad): Optimise.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index b7083bfe7cc..1cce97cdb10 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -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." |