[gnus git] branch master updated: m0-5-172-g1dd17bf =1= gmm-utils.el (gmm-labels): Use cl-labels if available
Katsumi Yamaoka <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 1dd17bf9b604184bffb73cceb9e3892b323efd52 (commit)
from 4701091fb20fe41f824040bd0ce4513a58b00468 (commit)
- Log -----------------------------------------------------------------
commit 1dd17bf9b604184bffb73cceb9e3892b323efd52
Author: Katsumi Yamaoka <[email protected]>
Date: Tue Dec 4 23:23:55 2012 +0000
gmm-utils.el (gmm-labels): Use cl-labels if available
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b88504a..d9d29e6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2012-12-04 Katsumi Yamaoka <[email protected]>
+ * gmm-utils.el (gmm-labels): Use cl-labels if available.
+
+2012-12-04 Katsumi Yamaoka <[email protected]>
+
* gmm-utils.el (gmm-flet, gmm-labels): New macros.
* gnus-sync.el (gnus-sync-lesync-call)
diff --git a/lisp/gmm-utils.el b/lisp/gmm-utils.el
index 3d504d7..9be6c66 100644
--- a/lisp/gmm-utils.el
+++ b/lisp/gmm-utils.el
@@ -435,46 +435,14 @@ coding-system."
(fmakunbound (car orig)))))))
(put 'gmm-flet 'lisp-indent-function 1)
-;; An alist of original function names and those unique names.
-(defvar gmm-labels-environment)
-
-(defun gmm-labels-expand (form)
- "Expand funcalls in FORM according to `gmm-labels-environment'.
-This function is a subroutine that `gmm-labels' uses to convert any
-`(FN ...)' and #'FN elements in FORM into `(funcall UN ...)' and `UN'
-respectively if `(FN . UN)' is listed in `gmm-labels-environment'."
- (cond ((or (not (consp form)) (memq (car form) '(\` backquote quote)))
- form)
- ((assq (car form) gmm-labels-environment)
- `(funcall ,(cdr (assq (car form) gmm-labels-environment))
- ,@(mapcar #'gmm-labels-expand (cdr form))))
- ((eq (car form) 'function)
- (if (and (assq (cadr form) gmm-labels-environment)
- (not (cddr form)))
- (cdr (assq (cadr form) gmm-labels-environment))
- (cons 'function (mapcar #'gmm-labels-expand (cdr form)))))
- (t
- (mapcar #'gmm-labels-expand form))))
-
(defmacro gmm-labels (bindings &rest body)
"Make temporary function bindings.
The lexical scoping is handled via `lexical-let' rather than relying
on `lexical-binding'.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
- (let (gmm-labels-environment def defs)
- (dolist (binding bindings)
- (push (cons (car binding)
- (make-symbol (format "--gmm-%s--" (car binding))))
- gmm-labels-environment))
- `(lexical-let ,(mapcar #'cdr gmm-labels-environment)
- (setq ,@(dolist (env gmm-labels-environment (nreverse defs))
- (setq def (cdr (assq (car env) bindings)))
- (push (cdr env) defs)
- (push `(lambda ,(car def)
- ,@(mapcar #'gmm-labels-expand (cdr def)))
- defs)))
- ,@(mapcar #'gmm-labels-expand body))))
+ `(,(progn (require 'cl) (if (fboundp 'cl-labels) 'cl-labels 'labels))
+ ,bindings ,@body))
(put 'gmm-labels 'lisp-indent-function 1)
(provide 'gmm-utils)
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 4 ++++
lisp/gmm-utils.el | 36 ++----------------------------------
2 files changed, 6 insertions(+), 34 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project