diff options
| author | Richard M. Stallman | 1998-02-17 07:26:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-02-17 07:26:46 +0000 |
| commit | f014d22e0763191c5d694fa045d30b49e638b3e8 (patch) | |
| tree | 4322aa31835e1b5225541ae4670c07f85eb5b5b1 | |
| parent | 87f235fb1b432fc7fc8669bf067354cbd05f3982 (diff) | |
| download | emacs-f014d22e0763191c5d694fa045d30b49e638b3e8.tar.gz emacs-f014d22e0763191c5d694fa045d30b49e638b3e8.zip | |
(c-copy-tree): New function.
(c-initialize-builtin-style): Use c-copy-tree.
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 0e8b1247520..6001207544c 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -584,26 +584,13 @@ offset for that syntactic element. Optional ADD says to add SYMBOL to | |||
| 584 | (c-initialize-cc-mode t) | 584 | (c-initialize-cc-mode t) |
| 585 | (or (assoc "cc-mode" c-style-alist) | 585 | (or (assoc "cc-mode" c-style-alist) |
| 586 | (assoc "user" c-style-alist) | 586 | (assoc "user" c-style-alist) |
| 587 | (let (copyfunc) | 587 | (progn |
| 588 | ;; use built-in copy-tree if its there. | ||
| 589 | (if (and (fboundp 'copy-tree) | ||
| 590 | (functionp (symbol-function 'copy-tree))) | ||
| 591 | (setq copyfunc (symbol-function 'copy-tree)) | ||
| 592 | (setq copyfunc (lambda (tree) | ||
| 593 | (if (consp tree) | ||
| 594 | (cons (funcall copyfunc (car tree)) | ||
| 595 | (funcall copyfunc (cdr tree))) | ||
| 596 | tree)))) | ||
| 597 | (c-add-style "user" | 588 | (c-add-style "user" |
| 598 | (mapcar | 589 | (mapcar |
| 599 | (function | 590 | (function |
| 600 | (lambda (var) | 591 | (lambda (var) |
| 601 | (let ((val (symbol-value var))) | 592 | (let ((val (symbol-value var))) |
| 602 | (cons var (if (atom val) | 593 | (cons var (c-copy-tree val))))) |
| 603 | val | ||
| 604 | (funcall copyfunc val) | ||
| 605 | )) | ||
| 606 | ))) | ||
| 607 | '(c-backslash-column | 594 | '(c-backslash-column |
| 608 | c-basic-offset | 595 | c-basic-offset |
| 609 | c-cleanup-list | 596 | c-cleanup-list |
| @@ -622,6 +609,15 @@ offset for that syntactic element. Optional ADD says to add SYMBOL to | |||
| 622 | (if c-style-variables-are-local-p | 609 | (if c-style-variables-are-local-p |
| 623 | (c-make-styles-buffer-local))) | 610 | (c-make-styles-buffer-local))) |
| 624 | 611 | ||
| 612 | (defun c-copy-tree (tree) | ||
| 613 | (if (consp tree) | ||
| 614 | (if (consp (cdr tree)) | ||
| 615 | (cons (c-copy-tree (car tree)) | ||
| 616 | (cons (c-copy-tree (cadr tree)) | ||
| 617 | (c-copy-tree (cddr tree)))) | ||
| 618 | (cons (c-copy-tree (car tree)) | ||
| 619 | (c-copy-tree (cdr tree)))) | ||
| 620 | tree)) | ||
| 625 | 621 | ||
| 626 | (defun c-make-styles-buffer-local (&optional this-buf-only-p) | 622 | (defun c-make-styles-buffer-local (&optional this-buf-only-p) |
| 627 | "Make all CC Mode style variables buffer local. | 623 | "Make all CC Mode style variables buffer local. |