diff options
author | Philip Kaludercic <philipk@posteo.net> | 2022-08-12 16:05:05 +0200 |
---|---|---|
committer | Philip Kaludercic <philipk@posteo.net> | 2022-08-12 16:05:05 +0200 |
commit | 1823349e6a61b2997b27cdb1ff42c69739693455 (patch) | |
tree | ed09268f8e57ab9196ff59df000c5f1268e09853 /lisp/emacs-lisp/subr-x.el | |
parent | faa7f03b0c5b6d2c51bb185cf5a0f422ba0fb956 (diff) | |
parent | 829b131e5b3ad3b077be9d31215770b251341c68 (diff) | |
download | emacs-1823349e6a61b2997b27cdb1ff42c69739693455.tar.gz emacs-1823349e6a61b2997b27cdb1ff42c69739693455.tar.bz2 emacs-1823349e6a61b2997b27cdb1ff42c69739693455.zip |
Merge remote-tracking branch 'origin/master' into feature/package+vc
Diffstat (limited to 'lisp/emacs-lisp/subr-x.el')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index d5d7bfeb6f5..1cce97cdb10 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -118,6 +118,7 @@ the resulting string may be longer than the original if LENGTH is (concat "..." (substring string (min (1- strlen) (max 0 (- strlen length)))))))) +;;;###autoload (defsubst string-blank-p (string) "Check whether STRING is either empty or only whitespace. The following characters count as whitespace here: space, tab, newline and @@ -253,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." |