aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2005-04-29 23:47:30 +0000
committerNick Roberts2005-04-29 23:47:30 +0000
commit6661c5bb79fcf336512e719f330d96d0eecac9df (patch)
tree3e807a6e5eb9d114929cde6235304e9e9609e01c
parent80b61a0f0b4ed45c9d8f0beffad8548b910a9503 (diff)
downloademacs-6661c5bb79fcf336512e719f330d96d0eecac9df.tar.gz
emacs-6661c5bb79fcf336512e719f330d96d0eecac9df.zip
(cc-create-define-alist): Check that file
exists. Initialise cc-define-alist. (c-mode): Add cc-create-define-alist locally to after-save-hook.
-rw-r--r--lisp/progmodes/cc-mode.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 920b253d4b7..fd31ac54183 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -649,9 +649,10 @@ Note that the style variables are always made local to the buffer."
649 (with-output-to-string 649 (with-output-to-string
650 (with-current-buffer standard-output 650 (with-current-buffer standard-output
651 (call-process cc-mode-cpp-program 651 (call-process cc-mode-cpp-program
652 file t nil "-dM")))) 652 (if (file-exists-p file) file nil) t nil "-dM"))))
653 (define-list (split-string output "\n" t)) 653 (define-list (split-string output "\n" t))
654 (name)) 654 (name))
655 (setq cc-define-alist nil)
655 (dolist (define define-list) 656 (dolist (define define-list)
656 (setq name (nth 1 (split-string define "[( ]"))) 657 (setq name (nth 1 (split-string define "[( ]")))
657 (push (cons name define) cc-define-alist)))) 658 (push (cons name define) cc-define-alist))))
@@ -686,6 +687,7 @@ Key bindings:
686 (easy-menu-add c-c-menu) 687 (easy-menu-add c-c-menu)
687 (cc-imenu-init cc-imenu-c-generic-expression) 688 (cc-imenu-init cc-imenu-c-generic-expression)
688 (cc-create-define-alist) 689 (cc-create-define-alist)
690 (add-hook 'after-save-hook 'cc-create-define-alist nil t)
689 (run-mode-hooks 'c-mode-common-hook 'c-mode-hook) 691 (run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
690 (c-update-modeline)) 692 (c-update-modeline))
691 693