emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r118129: * lisp/cedet/semantic/wisent/comp.el (wisen


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r118129: * lisp/cedet/semantic/wisent/comp.el (wisent-defcontext): Move declarations
Date: Wed, 15 Oct 2014 21:46:51 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118129
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2014-10-15 17:46:47 -0400
message:
  * lisp/cedet/semantic/wisent/comp.el (wisent-defcontext): Move declarations
  outside of eval-when-compile.  Use `declare'.
  (wisent-with-context): Add `defvar' declarations in case this macro is
  used in a file compiled with lexical-binding.
  (wisent-semantic-action-expand-body): Avoid add-to-list on local var.
modified:
  lisp/cedet/ChangeLog           changelog-20100919015713-3rbr456yray5m84f-1
  lisp/cedet/semantic/wisent/comp.el 
comp.el-20091113204419-o5vbwnq5f7feedwu-11311
=== modified file 'lisp/cedet/ChangeLog'
--- a/lisp/cedet/ChangeLog      2014-09-22 19:20:45 +0000
+++ b/lisp/cedet/ChangeLog      2014-10-15 21:46:47 +0000
@@ -1,3 +1,11 @@
+2014-10-15  Stefan Monnier  <address@hidden>
+
+       * semantic/wisent/comp.el (wisent-defcontext): Move declarations
+       outside of eval-when-compile.  Use `declare'.
+       (wisent-with-context): Add `defvar' declarations in case this macro is
+       used in a file compiled with lexical-binding.
+       (wisent-semantic-action-expand-body): Avoid add-to-list on local var.
+
 2014-09-22  David Engster  <address@hidden>
 
        * ede/emacs.el (ede-emacs-version): Do not call 'egrep' to

=== modified file 'lisp/cedet/semantic/wisent/comp.el'
--- a/lisp/cedet/semantic/wisent/comp.el        2014-01-01 07:43:34 +0000
+++ b/lisp/cedet/semantic/wisent/comp.el        2014-10-15 21:46:47 +0000
@@ -41,6 +41,7 @@
 
 ;;; Code:
 (require 'semantic/wisent)
+(eval-when-compile (require 'cl))
 
 ;;;; -------------------
 ;;;; Misc. useful things
@@ -66,18 +67,23 @@
 
 (defmacro wisent-defcontext (name &rest vars)
   "Define a context NAME that will bind variables VARS."
+  (declare (indent 1))
   (let* ((context (wisent-context-name name))
-         (bindings (mapcar #'(lambda (v) (list 'defvar v)) vars)))
-    `(eval-when-compile
-       ,@bindings
-       (defvar ,context ',vars))))
-(put 'wisent-defcontext 'lisp-indent-function 1)
+         (declarations (mapcar #'(lambda (v) (list 'defvar v)) vars)))
+    `(progn
+       ,@declarations
+       (eval-when-compile
+         (defvar ,context ',vars)))))
 
 (defmacro wisent-with-context (name &rest body)
   "Bind variables in context NAME then eval BODY."
-  `(let* ,(wisent-context-bindings name)
-     ,@body))
-(put 'wisent-with-context 'lisp-indent-function 1)
+  (declare (indent 1))
+  (let ((bindings (wisent-context-bindings name)))
+    `(progn
+       ,@(mapcar (lambda (binding) `(defvar ,(or (car-safe binding) binding)))
+                 bindings)
+       (let* ,bindings
+         ,@body))))
 
 ;; A naive implementation of data structures!  But it suffice here ;-)
 
@@ -2896,7 +2902,7 @@
       (progn
         (if (wisent-check-$N body n)
             ;; Accumulate $i symbol
-            (add-to-list 'found body))
+            (pushnew body found :test #'equal))
         (cons found body))
     ;; BODY is a list, expand inside it
     (let (xbody sexpr)
@@ -2916,7 +2922,7 @@
          ;; $i symbol
          ((wisent-check-$N sexpr n)
           ;; Accumulate $i symbol
-          (add-to-list 'found sexpr))
+          (pushnew sexpr found :test #'equal))
          )
         ;; Accumulate expanded forms
         (setq xbody (nconc xbody (list sexpr))))


reply via email to

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