summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-styles.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-02-17 07:26:46 +0000
committerRichard M. Stallman <rms@gnu.org>1998-02-17 07:26:46 +0000
commitf014d22e0763191c5d694fa045d30b49e638b3e8 (patch)
tree4322aa31835e1b5225541ae4670c07f85eb5b5b1 /lisp/progmodes/cc-styles.el
parent87f235fb1b432fc7fc8669bf067354cbd05f3982 (diff)
downloademacs-f014d22e0763191c5d694fa045d30b49e638b3e8.tar.gz
(c-copy-tree): New function.
(c-initialize-builtin-style): Use c-copy-tree.
Diffstat (limited to 'lisp/progmodes/cc-styles.el')
-rw-r--r--lisp/progmodes/cc-styles.el26
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
(c-initialize-cc-mode t)
(or (assoc "cc-mode" c-style-alist)
(assoc "user" c-style-alist)
- (let (copyfunc)
- ;; use built-in copy-tree if its there.
- (if (and (fboundp 'copy-tree)
- (functionp (symbol-function 'copy-tree)))
- (setq copyfunc (symbol-function 'copy-tree))
- (setq copyfunc (lambda (tree)
- (if (consp tree)
- (cons (funcall copyfunc (car tree))
- (funcall copyfunc (cdr tree)))
- tree))))
+ (progn
(c-add-style "user"
(mapcar
(function
(lambda (var)
(let ((val (symbol-value var)))
- (cons var (if (atom val)
- val
- (funcall copyfunc val)
- ))
- )))
+ (cons var (c-copy-tree val)))))
'(c-backslash-column
c-basic-offset
c-cleanup-list
@@ -622,6 +609,15 @@ offset for that syntactic element. Optional ADD says to add SYMBOL to
(if c-style-variables-are-local-p
(c-make-styles-buffer-local)))
+(defun c-copy-tree (tree)
+ (if (consp tree)
+ (if (consp (cdr tree))
+ (cons (c-copy-tree (car tree))
+ (cons (c-copy-tree (cadr tree))
+ (c-copy-tree (cddr tree))))
+ (cons (c-copy-tree (car tree))
+ (c-copy-tree (cdr tree))))
+ tree))
(defun c-make-styles-buffer-local (&optional this-buf-only-p)
"Make all CC Mode style variables buffer local.