24 |
;; GNU General Public License for more details. |
;; GNU General Public License for more details. |
25 |
|
|
26 |
;; You should have received a copy of the GNU General Public License |
;; You should have received a copy of the GNU General Public License |
27 |
;; along with GNU Emacs; see the file COPYING. If not, write to |
;; along with this program; see the file COPYING. If not, write to |
28 |
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
29 |
;; Boston, MA 02111-1307, USA. |
;; Boston, MA 02110-1301, USA. |
30 |
|
|
31 |
;;; Commentary: |
;;; Commentary: |
32 |
|
|
91 |
(cc-require 'cc-align) |
(cc-require 'cc-align) |
92 |
(cc-require 'cc-menus) |
(cc-require 'cc-menus) |
93 |
|
|
94 |
;; SILENCE the compiler. |
;; Silence the compiler. |
95 |
(cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+ |
(cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+ |
96 |
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+ |
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+ |
97 |
(cc-bytecomp-defun set-keymap-parents) ; XEmacs |
(cc-bytecomp-defun set-keymap-parents) ; XEmacs |
98 |
|
(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1+ |
99 |
|
(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1. |
100 |
|
|
101 |
;; We set these variables during mode init, yet we don't require |
;; We set these variables during mode init, yet we don't require |
102 |
;; font-lock. |
;; font-lock. |
203 |
|
|
204 |
(defun c-make-inherited-keymap () |
(defun c-make-inherited-keymap () |
205 |
(let ((map (make-sparse-keymap))) |
(let ((map (make-sparse-keymap))) |
206 |
|
;; Necessary to use `cc-bytecomp-fboundp' below since this |
207 |
|
;; function is called from top-level forms that are evaluated |
208 |
|
;; while cc-bytecomp is active when one does M-x eval-buffer. |
209 |
(cond |
(cond |
210 |
;; XEmacs |
;; XEmacs |
211 |
((fboundp 'set-keymap-parents) |
((cc-bytecomp-fboundp 'set-keymap-parents) |
212 |
(set-keymap-parents map c-mode-base-map)) |
(set-keymap-parents map c-mode-base-map)) |
213 |
;; Emacs |
;; Emacs |
214 |
((fboundp 'set-keymap-parent) |
((cc-bytecomp-fboundp 'set-keymap-parent) |
215 |
(set-keymap-parent map c-mode-base-map)) |
(set-keymap-parent map c-mode-base-map)) |
216 |
;; incompatible |
;; incompatible |
217 |
(t (error "CC Mode is incompatible with this version of Emacs"))) |
(t (error "CC Mode is incompatible with this version of Emacs"))) |
592 |
|
|
593 |
(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) |
(add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) |
594 |
|
|
595 |
|
(defmacro c-run-mode-hooks (&rest hooks) |
596 |
|
;; Emacs 21.1 has introduced a system with delayed mode hooks that |
597 |
|
;; require the use of the new function `run-mode-hooks'. |
598 |
|
(if (cc-bytecomp-fboundp 'run-mode-hooks) |
599 |
|
`(run-mode-hooks ,@hooks) |
600 |
|
`(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks)))) |
601 |
|
|
602 |
|
|
603 |
;; Support for C |
;; Support for C |
604 |
|
|
679 |
(c-common-init 'c-mode) |
(c-common-init 'c-mode) |
680 |
(easy-menu-add c-c-menu) |
(easy-menu-add c-c-menu) |
681 |
(cc-imenu-init cc-imenu-c-generic-expression) |
(cc-imenu-init cc-imenu-c-generic-expression) |
682 |
(run-mode-hooks 'c-mode-common-hook 'c-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook) |
683 |
(c-update-modeline)) |
(c-update-modeline)) |
684 |
|
|
685 |
|
|
742 |
(c-common-init 'c++-mode) |
(c-common-init 'c++-mode) |
743 |
(easy-menu-add c-c++-menu) |
(easy-menu-add c-c++-menu) |
744 |
(cc-imenu-init cc-imenu-c++-generic-expression) |
(cc-imenu-init cc-imenu-c++-generic-expression) |
745 |
(run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) |
746 |
(c-update-modeline)) |
(c-update-modeline)) |
747 |
|
|
748 |
|
|
806 |
(c-common-init 'objc-mode) |
(c-common-init 'objc-mode) |
807 |
(easy-menu-add c-objc-menu) |
(easy-menu-add c-objc-menu) |
808 |
(cc-imenu-init nil 'cc-imenu-objc-function) |
(cc-imenu-init nil 'cc-imenu-objc-function) |
809 |
(run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) |
810 |
(c-update-modeline)) |
(c-update-modeline)) |
811 |
|
|
812 |
|
|
876 |
(c-common-init 'java-mode) |
(c-common-init 'java-mode) |
877 |
(easy-menu-add c-java-menu) |
(easy-menu-add c-java-menu) |
878 |
(cc-imenu-init cc-imenu-java-generic-expression) |
(cc-imenu-init cc-imenu-java-generic-expression) |
879 |
(run-mode-hooks 'c-mode-common-hook 'java-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook) |
880 |
(c-update-modeline)) |
(c-update-modeline)) |
881 |
|
|
882 |
|
|
934 |
(c-common-init 'idl-mode) |
(c-common-init 'idl-mode) |
935 |
(easy-menu-add c-idl-menu) |
(easy-menu-add c-idl-menu) |
936 |
;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO |
;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO |
937 |
(run-mode-hooks 'c-mode-common-hook 'idl-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook) |
938 |
(c-update-modeline)) |
(c-update-modeline)) |
939 |
|
|
940 |
|
|
996 |
(c-common-init 'pike-mode) |
(c-common-init 'pike-mode) |
997 |
(easy-menu-add c-pike-menu) |
(easy-menu-add c-pike-menu) |
998 |
;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO |
;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO |
999 |
(run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) |
1000 |
(c-update-modeline)) |
(c-update-modeline)) |
1001 |
|
|
1002 |
|
|
1088 |
;; in cc-engine.el, just before (defun c-fast-in-literal ... |
;; in cc-engine.el, just before (defun c-fast-in-literal ... |
1089 |
(defalias 'c-in-literal 'c-slow-in-literal) |
(defalias 'c-in-literal 'c-slow-in-literal) |
1090 |
|
|
1091 |
(run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) |
(c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) |
1092 |
(c-update-modeline)) |
(c-update-modeline)) |
1093 |
) ;; closes the (if (not (memq 'syntax-properties c-emacs-features)) |
) ;; closes the (if (not (memq 'syntax-properties c-emacs-features)) |
1094 |
|
|