From 581fa3d958c064e05a8f980472880f153aba30a6 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 9 Aug 2022 19:49:40 +0200 Subject: Autoload string-blank-p * lisp/eshell/em-hist.el (subr-x): * lisp/net/eudc.el (subr-x): Don't require. * lisp/emacs-lisp/subr-x.el (string-blank-p): Autoload. --- lisp/emacs-lisp/subr-x.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp/emacs-lisp/subr-x.el') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index d5d7bfeb6f5..b7083bfe7cc 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 -- cgit v1.2.3 From d8d582dc3c30e184e6f849eb302d0c89be019c83 Mon Sep 17 00:00:00 2001 From: Mattias EngdegÄrd Date: Wed, 10 Aug 2022 13:06:12 +0200 Subject: ; * lisp/emacs-lisp/subr-x.el (string-pad): Optimise. --- lisp/emacs-lisp/subr-x.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp/subr-x.el') 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." -- cgit v1.2.3