From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.mail.mh-e.devel Subject: Re: Where to put fix for #22317, mh-e: wrong usage of cl-flet Date: Mon, 02 May 2016 00:49:17 -0400 Message-ID: References: <83602.1462155588@olgas.newt.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1462164686 13666 80.91.229.3 (2 May 2016 04:51:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 May 2016 04:51:26 +0000 (UTC) Cc: mh-e-devel@lists.sourceforge.net To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 02 06:51:17 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ax5pF-0005lt-6w for ged-emacs-devel@m.gmane.org; Mon, 02 May 2016 06:51:17 +0200 Original-Received: from localhost ([::1]:35261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax5p8-0000I1-3l for ged-emacs-devel@m.gmane.org; Mon, 02 May 2016 00:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax5oq-0008VS-TL for emacs-devel@gnu.org; Mon, 02 May 2016 00:50:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ax5of-0000Po-DA for emacs-devel@gnu.org; Mon, 02 May 2016 00:50:47 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:51482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax5of-0000OZ-6B for emacs-devel@gnu.org; Mon, 02 May 2016 00:50:41 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ax5oU-0005S2-Vs for emacs-devel@gnu.org; Mon, 02 May 2016 06:50:31 +0200 Original-Received: from 69-196-139-75.dsl.teksavvy.com ([69.196.139.75]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 May 2016 06:50:30 +0200 Original-Received: from monnier by 69-196-139-75.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 May 2016 06:50:30 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69-196-139-75.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:Catxyndhbw19i5UMq20hIJ9nE/Y= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:203514 gmane.mail.mh-e.devel:13888 Archived-At: > +(defmacro mh-flet (bindings &rest body) > + "Make temporary overriding function definitions. > +This is an analogue of a dynamically scoped `let' that operates on > +the function cell of FUNCs rather than their value cell. > + > +\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" > + (if (fboundp 'cl-letf) > + `(cl-letf ,(mapcar (lambda (binding) > + `((symbol-function ',(car binding)) > + (lambda ,@(cdr binding)))) > + bindings) > + ,@body) > + `(flet ,bindings ,@body))) As long as you use (require 'cl), then I see no reason to stop using `flet'. If you're annoyed by the warning, then add a `with-no-warnings'. Or use `letf' unconditionally. The other option is to stop using (require 'cl) and start using (require 'cl-lib) instead, in which case you'll want to always use cl-letf. `cl-lib' is distributed in GNU ELPA and should work on XEmacs and Emacsā‰„22. In neither of those 3 solutions do you need to switch between 2 different expansions. > +(put 'mh-flet 'lisp-indent-function 1) > +(put 'mh-flet 'edebug-form-spec > + '((&rest (sexp sexp &rest form)) &rest form)) I think even the oldest emacsen you support can handle (declare (indent 1) (debug ((&rest (sexp sexp &rest form)) &rest form))) so I recommend you use that instead. Stefan