emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/cl-generic a69b621 3/5: * cl-generic/cl-generic.el (cl-


From: Stefan Monnier
Subject: [elpa] externals/cl-generic a69b621 3/5: * cl-generic/cl-generic.el (cl-defmethod): Use cl-flet if available.
Date: Tue, 1 Dec 2020 15:25:37 -0500 (EST)

branch: externals/cl-generic
commit a69b621504a8d965f5469b770a97ab0b4a514cdb
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * cl-generic/cl-generic.el (cl-defmethod): Use cl-flet if available.
---
 cl-generic.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/cl-generic.el b/cl-generic.el
index df09449..4b1a377 100644
--- a/cl-generic.el
+++ b/cl-generic.el
@@ -4,7 +4,7 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; vcomment: Emacs-25's version is 1.0 so this has to stay below.
-;; Version: 0.1
+;; Version: 0.2
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -101,15 +101,17 @@
            ;; We could just alias `cl-call-next-method' to `call-next-method',
            ;; and that would work, but then files compiled with this cl-generic
            ;; wouldn't work in Emacs-25 any more.
-           ;; Also we use `labels' rather than one of cl-lib's macros, so as to
-           ;; be compatible with older emacsen (and ELPA's cl-lib emulation
-           ;; doesn't provide cl-flet and provides an incomplete cl-labels).
+           ;; Also we fallback on `labels' if `cl-flet' is not available
+           ;; (ELPA's cl-lib emulation doesn't provide cl-flet).
+           ;; We don't always use `labels' because that generates warnings
+           ;; in newer Emacsen where `cl-flet' is available.
            ,@(if qualifiers
                  ;; Must be :before or :after, so can't call next-method.
                  body
-               `((labels ((cl-call-next-method (&rest args)
-                                               (apply #'call-next-method args))
-                          (cl-next-method-p () (next-method-p)))
+               `((,(if (fboundp 'cl-flet) 'cl-flet 'labels)
+                      ((cl-call-next-method (&rest args)
+                                            (apply #'call-next-method args))
+                       (cl-next-method-p () (next-method-p)))
                    ,@body))))))))
 
 (provide 'cl-generic)



reply via email to

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