branch: master commit e4cae0a0ddca9c6928a7ff5607949adb5c743bb5 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
hydra.el (defhydra): Simplify :cmd-name part * hydra.el (defhydra): When a plist isn't nil, `plist-put' can be used, which is useful to overwrite :cmd-name if it's present. When plist is nil, use the old code. --- hydra.el | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hydra.el b/hydra.el index f228e97..22f522c 100644 --- a/hydra.el +++ b/hydra.el @@ -914,10 +914,14 @@ result of `defhydra'." (setcdr (cdr h) (cons (hydra-plist-get-default body-plist :hint "") (cddr h)))) - (setcdr (cddr h) - `(:cmd-name - ,(hydra--head-name h name body) - ,@(cl-cdddr h)))))))) + (let ((hint-and-plist (cddr h))) + (if (null (cdr hint-and-plist)) + (setcdr hint-and-plist + (list :cmd-name + (hydra--head-name h name body))) + (plist-put (cdr hint-and-plist) + :cmd-name + (hydra--head-name h name body))))))))) (let ((doc (hydra--doc body-key body-name heads)) (heads-nodup (hydra--delete-duplicates heads))) (mapc