diff options
| author | Stefan Monnier | 2014-10-29 23:50:15 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-10-29 23:50:15 -0400 |
| commit | 237bf45a48999d5a8a3617822dddf3ea305bc269 (patch) | |
| tree | ceed824397bd7547c250c9fc19167a680038fd9f | |
| parent | 6b3093be63ab02626d8315b9fac16e4d551585ed (diff) | |
| download | emacs-237bf45a48999d5a8a3617822dddf3ea305bc269.tar.gz emacs-237bf45a48999d5a8a3617822dddf3ea305bc269.zip | |
* 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
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 13 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 7 |
3 files changed, 19 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b95591b6ddb..33e0b1c757a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,7 +1,14 @@ | |||
| 1 | 2014-10-30 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | |||
| 4 | * progmodes/cc-defs.el (c--macroexpand-all): New function (bug#18845). | ||
| 5 | (c-lang-defconst): | ||
| 6 | * progmodes/cc-langs.el (c-make-init-lang-vars-fun): Use it. | ||
| 7 | |||
| 1 | 2014-10-29 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-10-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * progmodes/compile.el (compilation-start): If | 10 | * progmodes/compile.el (compilation-start): |
| 4 | compilation-scroll-output is non-nil, don't force window-start of | 11 | If compilation-scroll-output is non-nil, don't force window-start of |
| 5 | the compilation buffer to be at beginning of buffer. (Bug#18874) | 12 | the compilation buffer to be at beginning of buffer. (Bug#18874) |
| 6 | 13 | ||
| 7 | 2014-10-23 Tassilo Horn <tsdh@gnu.org> | 14 | 2014-10-23 Tassilo Horn <tsdh@gnu.org> |
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 | |||
| 169 | 169 | ||
| 170 | (put 'cc-eval-when-compile 'lisp-indent-hook 0)) | 170 | (put 'cc-eval-when-compile 'lisp-indent-hook 0)) |
| 171 | 171 | ||
| 172 | (eval-and-compile | ||
| 173 | (defalias 'c--macroexpand-all | ||
| 174 | (if (fboundp 'macroexpand-all) | ||
| 175 | 'macroexpand-all 'cl-macroexpand-all))) | ||
| 172 | 176 | ||
| 173 | ;;; Macros. | 177 | ;;; Macros. |
| 174 | 178 | ||
| @@ -1834,12 +1838,9 @@ system." | |||
| 1834 | immediately, i.e. at the same time as the `c-lang-defconst' form | 1838 | immediately, i.e. at the same time as the `c-lang-defconst' form |
| 1835 | itself is evaluated." | 1839 | itself is evaluated." |
| 1836 | ;; Evaluate at macro expansion time, i.e. in the | 1840 | ;; Evaluate at macro expansion time, i.e. in the |
| 1837 | ;; `cl-macroexpand-all' inside `c-lang-defconst'. | 1841 | ;; `c--macroexpand-all' inside `c-lang-defconst'. |
| 1838 | (eval form)) | 1842 | (eval form)) |
| 1839 | 1843 | ||
| 1840 | ;; Only used at compile time - suppress "might not be defined at runtime". | ||
| 1841 | (declare-function cl-macroexpand-all "cl" (form &optional env)) | ||
| 1842 | |||
| 1843 | (defmacro c-lang-defconst (name &rest args) | 1844 | (defmacro c-lang-defconst (name &rest args) |
| 1844 | "Set the language specific values of the language constant NAME. | 1845 | "Set the language specific values of the language constant NAME. |
| 1845 | The second argument can optionally be a docstring. The rest of the | 1846 | 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." | |||
| 1881 | 1882 | ||
| 1882 | (let* ((sym (intern (symbol-name name) c-lang-constants)) | 1883 | (let* ((sym (intern (symbol-name name) c-lang-constants)) |
| 1883 | ;; Make `c-lang-const' expand to a straightforward call to | 1884 | ;; Make `c-lang-const' expand to a straightforward call to |
| 1884 | ;; `c-get-lang-constant' in `cl-macroexpand-all' below. | 1885 | ;; `c-get-lang-constant' in `c--macroexpand-all' below. |
| 1885 | ;; | 1886 | ;; |
| 1886 | ;; (The default behavior, i.e. to expand to a call inside | 1887 | ;; (The default behavior, i.e. to expand to a call inside |
| 1887 | ;; `eval-when-compile' should be equivalent, since that macro | 1888 | ;; `eval-when-compile' should be equivalent, since that macro |
| @@ -1944,7 +1945,7 @@ constant. A file is identified by its base name." | |||
| 1944 | ;; reason, but we also use this expansion handle | 1945 | ;; reason, but we also use this expansion handle |
| 1945 | ;; `c-lang-defconst-eval-immediately' and to register | 1946 | ;; `c-lang-defconst-eval-immediately' and to register |
| 1946 | ;; dependencies on the `c-lang-const's in VAL.) | 1947 | ;; dependencies on the `c-lang-const's in VAL.) |
| 1947 | (setq val (cl-macroexpand-all val)) | 1948 | (setq val (c--macroexpand-all val)) |
| 1948 | 1949 | ||
| 1949 | (setq bindings (cons (cons assigned-mode val) bindings) | 1950 | (setq bindings (cons (cons assigned-mode val) bindings) |
| 1950 | args (cdr args)))) | 1951 | 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." | |||
| 213 | ;; These are defined in cl as aliases to the cl- versions. | 213 | ;; These are defined in cl as aliases to the cl- versions. |
| 214 | ;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) | 214 | ;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) |
| 215 | ;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) | 215 | ;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) |
| 216 | ;(declare-function cl-macroexpand-all "cl" (form &optional env)) | ||
| 217 | 216 | ||
| 218 | (eval-and-compile | 217 | (eval-and-compile |
| 219 | ;; Some helper functions used when building the language constants. | 218 | ;; Some helper functions used when building the language constants. |
| @@ -3183,7 +3182,7 @@ accomplish that conveniently." | |||
| 3183 | `(lambda () | 3182 | `(lambda () |
| 3184 | 3183 | ||
| 3185 | ;; This let sets up the context for `c-mode-var' and similar | 3184 | ;; This let sets up the context for `c-mode-var' and similar |
| 3186 | ;; that could be in the result from `cl-macroexpand-all'. | 3185 | ;; that could be in the result from `c--macroexpand-all'. |
| 3187 | (let ((c-buffer-is-cc-mode ',mode) | 3186 | (let ((c-buffer-is-cc-mode ',mode) |
| 3188 | current-var source-eval) | 3187 | current-var source-eval) |
| 3189 | (c-make-emacs-variables-local) | 3188 | (c-make-emacs-variables-local) |
| @@ -3193,12 +3192,12 @@ accomplish that conveniently." | |||
| 3193 | (setq ,@(let ((c-buffer-is-cc-mode mode) | 3192 | (setq ,@(let ((c-buffer-is-cc-mode mode) |
| 3194 | (c-lang-const-expansion 'immediate)) | 3193 | (c-lang-const-expansion 'immediate)) |
| 3195 | ;; `c-lang-const' will expand to the evaluated | 3194 | ;; `c-lang-const' will expand to the evaluated |
| 3196 | ;; constant immediately in `cl-macroexpand-all' | 3195 | ;; constant immediately in `c--macroexpand-all' |
| 3197 | ;; below. | 3196 | ;; below. |
| 3198 | (cl-mapcan | 3197 | (cl-mapcan |
| 3199 | (lambda (init) | 3198 | (lambda (init) |
| 3200 | `(current-var ',(car init) | 3199 | `(current-var ',(car init) |
| 3201 | ,(car init) ,(macroexpand-all | 3200 | ,(car init) ,(c--macroexpand-all |
| 3202 | (elt init 1)))) | 3201 | (elt init 1)))) |
| 3203 | ;; Note: The following `append' copies the | 3202 | ;; Note: The following `append' copies the |
| 3204 | ;; first argument. That list is small, so | 3203 | ;; first argument. That list is small, so |