From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati <arash@gnu.org> Newsgroups: gmane.emacs.help Subject: Question about cl-flet and cl-letf Date: Thu, 26 Oct 2023 22:10:23 +0200 Message-ID: <m2edhh6t74.fsf@macmutant.fritz.box> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36224"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: "emacs-help" <help-gnu-emacs@gnu.org> Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 26 22:11:13 2023 Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org> Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>) id 1qw6hE-0009BH-Ae for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 26 Oct 2023 22:11:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <help-gnu-emacs-bounces@gnu.org>) id 1qw6gZ-00010T-2L; Thu, 26 Oct 2023 16:10:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <arash@gnu.org>) id 1qw6gX-0000zw-HV for help-gnu-emacs@gnu.org; Thu, 26 Oct 2023 16:10:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <arash@gnu.org>) id 1qw6gX-00012m-8M for help-gnu-emacs@gnu.org; Thu, 26 Oct 2023 16:10:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=MGu+74o0QftwkhLQ05N3e36DgMWom2gGRwYD4ll3gMg=; b=AdSjca44NpjqZI es9F47OhDhg6TiUF+cgn2ZEytBQT5qKEXds3fI+dKUWQCDmY8c1x5Iyg0jY2FiSgrePT8CRbHGErp Xt87MJjo9MS6CwG3q6J4ANKQR+OF+y2iOidO8JuD9eIdHKNNhJHBjxeZsiQvBoWdKTD4NX9tvkH1w xU3xgwoUdYFXuSrt60+TvYbBU3CD2uldFAVdE++RbdLh4HHZYoL5mVH16Hr5DLM/7aNs1Cxhq7ky6 jsmi4VTAuVG2cisjtrb1M7s/0NvrJPnWxFsZ4ts6VdKxaxEKc86em1DkCIJAAmdAb+7V0C89FlA3G qoamL71FAy1BW+zOMsuw==; X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>, <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs> List-Post: <mailto:help-gnu-emacs@gnu.org> List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>, <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe> Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145391 Archived-At: <http://permalink.gmane.org/gmane.emacs.help/145391> Hi all, my understanding of the manual and docstring of the macros mentioned above is that these two pieces of code should be equivalent: (cl-flet ((y-or-n-p #'always)) (while (...) BODY)) (cl-letf (((symbol-function 'y-or-n-p) #'always)) (while (...) BODY)) I have an use-case where they are not. Before getting into details about the function (which is long) and trying to come up with a reduced version: Am I correct with the assumption above? Currently, my function works with `cl-left' as expected and with `cl-flet' not, i.e., `y-or-no-p' returns t inside BODY with `cl-letf' and not with `cl-flet'. I'd appreciate if somebody would enlighten me. Best, Arash