diff options
| author | Stefan Monnier | 2014-10-15 17:46:47 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-10-15 17:46:47 -0400 |
| commit | bcb7ccde45f9388f8b36b88fdfcb5e786762c373 (patch) | |
| tree | 7f773c20728e6482c6ee2b66f4f87d4237d4ba9c | |
| parent | efd91b5847a269ccfa2cd7383f73369428296734 (diff) | |
| download | emacs-bcb7ccde45f9388f8b36b88fdfcb5e786762c373.tar.gz emacs-bcb7ccde45f9388f8b36b88fdfcb5e786762c373.zip | |
* 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.
| -rw-r--r-- | lisp/cedet/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/comp.el | 26 |
2 files changed, 24 insertions, 10 deletions
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 9aabc9c9e0d..2fdd1cefdcb 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-10-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * semantic/wisent/comp.el (wisent-defcontext): Move declarations | ||
| 4 | outside of eval-when-compile. Use `declare'. | ||
| 5 | (wisent-with-context): Add `defvar' declarations in case this macro is | ||
| 6 | used in a file compiled with lexical-binding. | ||
| 7 | (wisent-semantic-action-expand-body): Avoid add-to-list on local var. | ||
| 8 | |||
| 1 | 2014-09-22 David Engster <deng@randomsample.de> | 9 | 2014-09-22 David Engster <deng@randomsample.de> |
| 2 | 10 | ||
| 3 | * ede/emacs.el (ede-emacs-version): Do not call 'egrep' to | 11 | * ede/emacs.el (ede-emacs-version): Do not call 'egrep' to |
diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index 9e25b52e8ce..2e5d2a43395 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | 41 | ||
| 42 | ;;; Code: | 42 | ;;; Code: |
| 43 | (require 'semantic/wisent) | 43 | (require 'semantic/wisent) |
| 44 | (eval-when-compile (require 'cl)) | ||
| 44 | 45 | ||
| 45 | ;;;; ------------------- | 46 | ;;;; ------------------- |
| 46 | ;;;; Misc. useful things | 47 | ;;;; Misc. useful things |
| @@ -66,18 +67,23 @@ | |||
| 66 | 67 | ||
| 67 | (defmacro wisent-defcontext (name &rest vars) | 68 | (defmacro wisent-defcontext (name &rest vars) |
| 68 | "Define a context NAME that will bind variables VARS." | 69 | "Define a context NAME that will bind variables VARS." |
| 70 | (declare (indent 1)) | ||
| 69 | (let* ((context (wisent-context-name name)) | 71 | (let* ((context (wisent-context-name name)) |
| 70 | (bindings (mapcar #'(lambda (v) (list 'defvar v)) vars))) | 72 | (declarations (mapcar #'(lambda (v) (list 'defvar v)) vars))) |
| 71 | `(eval-when-compile | 73 | `(progn |
| 72 | ,@bindings | 74 | ,@declarations |
| 73 | (defvar ,context ',vars)))) | 75 | (eval-when-compile |
| 74 | (put 'wisent-defcontext 'lisp-indent-function 1) | 76 | (defvar ,context ',vars))))) |
| 75 | 77 | ||
| 76 | (defmacro wisent-with-context (name &rest body) | 78 | (defmacro wisent-with-context (name &rest body) |
| 77 | "Bind variables in context NAME then eval BODY." | 79 | "Bind variables in context NAME then eval BODY." |
| 78 | `(let* ,(wisent-context-bindings name) | 80 | (declare (indent 1)) |
| 79 | ,@body)) | 81 | (let ((bindings (wisent-context-bindings name))) |
| 80 | (put 'wisent-with-context 'lisp-indent-function 1) | 82 | `(progn |
| 83 | ,@(mapcar (lambda (binding) `(defvar ,(or (car-safe binding) binding))) | ||
| 84 | bindings) | ||
| 85 | (let* ,bindings | ||
| 86 | ,@body)))) | ||
| 81 | 87 | ||
| 82 | ;; A naive implementation of data structures! But it suffice here ;-) | 88 | ;; A naive implementation of data structures! But it suffice here ;-) |
| 83 | 89 | ||
| @@ -2896,7 +2902,7 @@ references found in BODY, and XBODY is BODY expression with | |||
| 2896 | (progn | 2902 | (progn |
| 2897 | (if (wisent-check-$N body n) | 2903 | (if (wisent-check-$N body n) |
| 2898 | ;; Accumulate $i symbol | 2904 | ;; Accumulate $i symbol |
| 2899 | (add-to-list 'found body)) | 2905 | (pushnew body found :test #'equal)) |
| 2900 | (cons found body)) | 2906 | (cons found body)) |
| 2901 | ;; BODY is a list, expand inside it | 2907 | ;; BODY is a list, expand inside it |
| 2902 | (let (xbody sexpr) | 2908 | (let (xbody sexpr) |
| @@ -2916,7 +2922,7 @@ references found in BODY, and XBODY is BODY expression with | |||
| 2916 | ;; $i symbol | 2922 | ;; $i symbol |
| 2917 | ((wisent-check-$N sexpr n) | 2923 | ((wisent-check-$N sexpr n) |
| 2918 | ;; Accumulate $i symbol | 2924 | ;; Accumulate $i symbol |
| 2919 | (add-to-list 'found sexpr)) | 2925 | (pushnew sexpr found :test #'equal)) |
| 2920 | ) | 2926 | ) |
| 2921 | ;; Accumulate expanded forms | 2927 | ;; Accumulate expanded forms |
| 2922 | (setq xbody (nconc xbody (list sexpr)))) | 2928 | (setq xbody (nconc xbody (list sexpr)))) |