el/dot-emacs.el: Fix phase-separation bug.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 May 2020 03:24:07 +0000 (04:24 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 24 May 2020 03:25:35 +0000 (04:25 +0100)
Previously, the macro would expect the parent style to exist at
expansion time, which works at the REPL, but not in the byte compiler.
Instead, expand to code to handle inheritance at runtime.

el/dot-emacs.el

index 8ca49a5..75e39a5 100644 (file)
@@ -2001,12 +2001,11 @@ set."
         (func (intern (concat "mdw-define-c-style/" name-string))))
     `(progn
        (setq ,var
-            ',(if (null parent)
-                  assocs
-                (let ((parent-list (symbol-value
-                                    (intern (concat "mdw-c-style/"
-                                                    (symbol-name parent))))))
-                  (mdw-merge-style-alists assocs parent-list))))
+            ,(if (null parent)
+                 `',assocs
+               (let ((parent-list (intern (concat "mdw-c-style/"
+                                                  (symbol-name parent)))))
+                 `(mdw-merge-style-alists ',assocs ,parent-list))))
        (defun ,func () (c-add-style ,name-string ,var))
        (and (featurep 'cc-mode) (,func))
        (add-hook 'mdw-define-c-styles-hook ',func)