branch: elpa/helm commit 213ee16d53613f55d1c601c263ad6512832e697a Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Use pcase for helm-stringify and use it in helm-elisp --- helm-elisp.el | 5 +---- helm-lib.el | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/helm-elisp.el b/helm-elisp.el index 69064b6825..4b9b7d9311 100644 --- a/helm-elisp.el +++ b/helm-elisp.el @@ -791,10 +791,7 @@ is only used to test DEFAULT." (unless (memq 'helm-apropos helm-commands-using-frame) (setq helm-M-x-show-short-doc (not helm-M-x-show-short-doc) helm-apropos-show-short-doc (not helm-apropos-show-short-doc)) - (helm-update (concat "^" (pcase (helm-get-selection) - ((and (pred stringp) str) str) - ((and (pred symbolp) sym) - (symbol-name sym)))) + (helm-update (concat "^" (helm-stringify (helm-get-selection))) (helm-get-current-source))))) ;;;###autoload diff --git a/helm-lib.el b/helm-lib.el index 565db187af..d337a46730 100644 --- a/helm-lib.el +++ b/helm-lib.el @@ -1045,10 +1045,10 @@ Examples: (defun helm-stringify (elm) "Return the representation of ELM as a string. ELM can be a string, a number or a symbol." - (cl-typecase elm - (string elm) - (number (number-to-string elm)) - (symbol (symbol-name elm)))) + (pcase elm + ((pred stringp) elm) + ((pred numberp) (number-to-string elm)) + ((pred symbolp) (symbol-name elm)))) (defun helm-substring (str width) "Return the substring of string STR from 0 to WIDTH.