aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2005-04-27 21:59:43 +0000
committerNick Roberts2005-04-27 21:59:43 +0000
commita5bad486ccfcb53322c2f37daeb94059d21cb3fc (patch)
treede29c3662dcdf92d8863f054ff40c707b226a2c2
parent8c75afbf680339206eeb7da1191b25f007a970ef (diff)
downloademacs-a5bad486ccfcb53322c2f37daeb94059d21cb3fc.tar.gz
emacs-a5bad486ccfcb53322c2f37daeb94059d21cb3fc.zip
(cc-create-define-alist): New function.
(cc-define-alist): New variable. (c-mode): Make it local and set it.
-rw-r--r--lisp/progmodes/cc-mode.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index eaa798217cf..b464c1483b1 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -639,6 +639,21 @@ Note that the style variables are always made local to the buffer."
639;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode)) 639;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode))
640;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode)) 640;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode))
641 641
642(defvar cc-define-alist nil "Alist of #define directives for GUD tooltips.")
643
644(defun cc-create-define-alist ()
645 (let* ((file (buffer-file-name))
646 (output
647 (with-output-to-string
648 (with-current-buffer standard-output
649 (call-process "/lib/cpp"
650 file t nil "-dM"))))
651 (define-list (split-string output "\n" t))
652 (name))
653 (dolist (define define-list)
654 (setq name (nth 1 (split-string define "[( ]")))
655 (push (cons name define) cc-define-alist))))
656
642;;;###autoload 657;;;###autoload
643(defun c-mode () 658(defun c-mode ()
644 "Major mode for editing K&R and ANSI C code. 659 "Major mode for editing K&R and ANSI C code.
@@ -662,11 +677,13 @@ Key bindings:
662 mode-name "C" 677 mode-name "C"
663 local-abbrev-table c-mode-abbrev-table 678 local-abbrev-table c-mode-abbrev-table
664 abbrev-mode t) 679 abbrev-mode t)
680 (make-local-variable 'cc-define-alist)
665 (use-local-map c-mode-map) 681 (use-local-map c-mode-map)
666 (c-init-language-vars-for 'c-mode) 682 (c-init-language-vars-for 'c-mode)
667 (c-common-init 'c-mode) 683 (c-common-init 'c-mode)
668 (easy-menu-add c-c-menu) 684 (easy-menu-add c-c-menu)
669 (cc-imenu-init cc-imenu-c-generic-expression) 685 (cc-imenu-init cc-imenu-c-generic-expression)
686 (cc-create-define-alist)
670 (run-mode-hooks 'c-mode-common-hook 'c-mode-hook) 687 (run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
671 (c-update-modeline)) 688 (c-update-modeline))
672 689