From: Bozhidar Batsov Date: Fri, 29 Nov 2013 16:51:44 +0000 (+0200) Subject: * lisp/emacs-lisp/helpers.el (string-empty-p): New function. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~644 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=015b3b3e8ec1330a0bbe3981e7070df8e17c9399;p=emacs.git * lisp/emacs-lisp/helpers.el (string-empty-p): New function. (string-blank-p): New function --- diff --git a/etc/NEWS b/etc/NEWS index 6b0d18459b1..2f9f84d8113 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -787,6 +787,8 @@ frame. ** New library helpers.el for misc helper functions *** `hash-table-keys' *** `hash-table-values' +*** `string-blank-p` +*** `string-empty-p` *** `string-join` *** `string-reverse` *** `string-trim-left' diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ac425d76154..4e838dd4181 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-11-29 Bozhidar Batsov + + * emacs-lisp/helpers.el (string-empty-p): New function. + (string-blank-p): New function. + 2013-11-29 Andreas Politz * imenu.el (imenu--index-alist): Add missing dot to the docstring diff --git a/lisp/emacs-lisp/helpers.el b/lisp/emacs-lisp/helpers.el index 8be0c628486..8049f4e1d1d 100644 --- a/lisp/emacs-lisp/helpers.el +++ b/lisp/emacs-lisp/helpers.el @@ -37,6 +37,10 @@ (maphash (lambda (_k v) (push v values)) hash-table) values)) +(defsubst string-empty-p (string) + "Check whether STRING is empty." + (string= string "")) + (defsubst string-join (strings &optional separator) "Join all STRINGS using SEPARATOR." (mapconcat 'identity strings separator)) @@ -61,6 +65,10 @@ "Remove leading and trailing whitespace from STRING." (string-trim-left (string-trim-right string))) +(defsubst string-blank-p (string) + "Check whether STRING is either empty or only whitespace." + (string-empty-p (string-trim string))) + (provide 'helpers) ;;; helpers.el ends here