emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any reasons against having `fboundp-and-funcall' (equivalent to `bound-a


From: Jens Schmidt
Subject: Any reasons against having `fboundp-and-funcall' (equivalent to `bound-and-true-p')?
Date: Wed, 21 Jun 2023 16:29:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

I was delighted when I recently came across `bound-and-true-p' in standard Emacs. But what about `fboundp-and-funcall'? Like this:

(defmacro fboundp-and-funcall (function &rest arguments)
  `(let ((function ,function))
     (and (fboundp function)
          (funcall function ,@arguments))))

;; arguments not eval'ed in case of failure
(fboundp-and-funcall #'foo (setq baz 'bar))
nil
(boundp 'baz)
nil

(fboundp-and-funcall #'identity 'foo)
foo

WDYT?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]