From: Stefan Monnier Date: Thu, 30 Oct 2014 03:50:15 +0000 (-0400) Subject: * lisp/progmodes/cc-defs.el (c--macroexpand-all): New function. X-Git-Tag: emacs-24.4.90~303 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=237bf45a48999d5a8a3617822dddf3ea305bc269;p=emacs.git * lisp/progmodes/cc-defs.el (c--macroexpand-all): New function. (c-lang-defconst): * lisp/progmodes/cc-langs.el (c-make-init-lang-vars-fun): Use it. Fixes: debbugs:18845 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b95591b6ddb..33e0b1c757a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,14 @@ +2014-10-30 Stefan Monnier + + + * progmodes/cc-defs.el (c--macroexpand-all): New function (bug#18845). + (c-lang-defconst): + * progmodes/cc-langs.el (c-make-init-lang-vars-fun): Use it. + 2014-10-29 Eli Zaretskii - * progmodes/compile.el (compilation-start): If - compilation-scroll-output is non-nil, don't force window-start of + * progmodes/compile.el (compilation-start): + If compilation-scroll-output is non-nil, don't force window-start of the compilation buffer to be at beginning of buffer. (Bug#18874) 2014-10-23 Tassilo Horn diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 1606cfb3357..18e23d4e861 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -169,6 +169,10 @@ This variant works around bugs in `eval-when-compile' in various (put 'cc-eval-when-compile 'lisp-indent-hook 0)) +(eval-and-compile + (defalias 'c--macroexpand-all + (if (fboundp 'macroexpand-all) + 'macroexpand-all 'cl-macroexpand-all))) ;;; Macros. @@ -1834,12 +1838,9 @@ system." immediately, i.e. at the same time as the `c-lang-defconst' form itself is evaluated." ;; Evaluate at macro expansion time, i.e. in the - ;; `cl-macroexpand-all' inside `c-lang-defconst'. + ;; `c--macroexpand-all' inside `c-lang-defconst'. (eval form)) -;; Only used at compile time - suppress "might not be defined at runtime". -(declare-function cl-macroexpand-all "cl" (form &optional env)) - (defmacro c-lang-defconst (name &rest args) "Set the language specific values of the language constant NAME. The second argument can optionally be a docstring. The rest of the @@ -1881,7 +1882,7 @@ constant. A file is identified by its base name." (let* ((sym (intern (symbol-name name) c-lang-constants)) ;; Make `c-lang-const' expand to a straightforward call to - ;; `c-get-lang-constant' in `cl-macroexpand-all' below. + ;; `c-get-lang-constant' in `c--macroexpand-all' below. ;; ;; (The default behavior, i.e. to expand to a call inside ;; `eval-when-compile' should be equivalent, since that macro @@ -1944,7 +1945,7 @@ constant. A file is identified by its base name." ;; reason, but we also use this expansion handle ;; `c-lang-defconst-eval-immediately' and to register ;; dependencies on the `c-lang-const's in VAL.) - (setq val (cl-macroexpand-all val)) + (setq val (c--macroexpand-all val)) (setq bindings (cons (cons assigned-mode val) bindings) args (cdr args)))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index d2d2de8801a..c5cdc731361 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -213,7 +213,6 @@ the evaluated constant value at compile time." ;; These are defined in cl as aliases to the cl- versions. ;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) ;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) -;(declare-function cl-macroexpand-all "cl" (form &optional env)) (eval-and-compile ;; Some helper functions used when building the language constants. @@ -3183,7 +3182,7 @@ accomplish that conveniently." `(lambda () ;; This let sets up the context for `c-mode-var' and similar - ;; that could be in the result from `cl-macroexpand-all'. + ;; that could be in the result from `c--macroexpand-all'. (let ((c-buffer-is-cc-mode ',mode) current-var source-eval) (c-make-emacs-variables-local) @@ -3193,12 +3192,12 @@ accomplish that conveniently." (setq ,@(let ((c-buffer-is-cc-mode mode) (c-lang-const-expansion 'immediate)) ;; `c-lang-const' will expand to the evaluated - ;; constant immediately in `cl-macroexpand-all' + ;; constant immediately in `c--macroexpand-all' ;; below. (cl-mapcan (lambda (init) `(current-var ',(car init) - ,(car init) ,(macroexpand-all + ,(car init) ,(c--macroexpand-all (elt init 1)))) ;; Note: The following `append' copies the ;; first argument. That list is small, so