From 6661c5bb79fcf336512e719f330d96d0eecac9df Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Fri, 29 Apr 2005 23:47:30 +0000 Subject: [PATCH] (cc-create-define-alist): Check that file exists. Initialise cc-define-alist. (c-mode): Add cc-create-define-alist locally to after-save-hook. --- lisp/progmodes/cc-mode.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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." (with-output-to-string (with-current-buffer standard-output (call-process cc-mode-cpp-program - file t nil "-dM")))) + (if (file-exists-p file) file nil) t nil "-dM")))) (define-list (split-string output "\n" t)) (name)) + (setq cc-define-alist nil) (dolist (define define-list) (setq name (nth 1 (split-string define "[( ]"))) (push (cons name define) cc-define-alist)))) @@ -686,6 +687,7 @@ Key bindings: (easy-menu-add c-c-menu) (cc-imenu-init cc-imenu-c-generic-expression) (cc-create-define-alist) + (add-hook 'after-save-hook 'cc-create-define-alist nil t) (run-mode-hooks 'c-mode-common-hook 'c-mode-hook) (c-update-modeline)) -- 2.39.2