2529 |
(set (car settings) (eval (cadr settings))))) |
(set (car settings) (eval (cadr settings))))) |
2530 |
(setq settings (cddr settings))))) |
(setq settings (cddr settings))))) |
2531 |
|
|
|
(defun antlr-c-common-init () |
|
|
"Like `c-basic-common-init' when using cc-mode before v5.30." |
|
|
;; X/Emacs 20 only |
|
|
(make-local-variable 'paragraph-start) |
|
|
(make-local-variable 'paragraph-separate) |
|
|
(make-local-variable 'paragraph-ignore-fill-prefix) |
|
|
(make-local-variable 'require-final-newline) |
|
|
(make-local-variable 'parse-sexp-ignore-comments) |
|
|
(make-local-variable 'comment-start) |
|
|
(make-local-variable 'comment-multi-line) |
|
|
(make-local-variable 'outline-regexp) |
|
|
(make-local-variable 'outline-level) |
|
|
(make-local-variable 'adaptive-fill-regexp) |
|
|
(make-local-variable 'adaptive-fill-mode) |
|
|
(make-local-variable 'imenu-generic-expression) ;set in the mode functions |
|
|
(and (boundp 'comment-line-break-function) |
|
|
(make-local-variable 'comment-line-break-function)) |
|
|
;; Emacs 19.30 and beyond only, AFAIK |
|
|
(if (boundp 'fill-paragraph-function) |
|
|
(progn |
|
|
(make-local-variable 'fill-paragraph-function) |
|
|
(setq fill-paragraph-function 'c-fill-paragraph))) |
|
|
;; now set their values |
|
|
(setq paragraph-start (concat page-delimiter "\\|$") |
|
|
paragraph-separate paragraph-start |
|
|
paragraph-ignore-fill-prefix t |
|
|
parse-sexp-ignore-comments t |
|
|
comment-column 32 |
|
|
comment-multi-line nil |
|
|
comment-line-break-function 'c-comment-line-break-function |
|
|
adaptive-fill-regexp nil |
|
|
adaptive-fill-mode nil) |
|
|
(c-set-style (or antlr-indent-style "gnu")) |
|
|
(and (boundp 'c-current-comment-prefix) (boundp 'c-comment-prefix-regexp) |
|
|
(setq c-current-comment-prefix |
|
|
(if (listp c-comment-prefix-regexp) |
|
|
(cdr-safe (or (assoc major-mode c-comment-prefix-regexp) |
|
|
(assoc 'other c-comment-prefix-regexp))) |
|
|
c-comment-prefix-regexp))) |
|
|
;; we have to do something special for c-offsets-alist so that the |
|
|
;; buffer local value has its own alist structure. |
|
|
(setq c-offsets-alist (copy-alist c-offsets-alist)) |
|
|
;; setup the comment indent variable in a Emacs version portable way |
|
|
;; ignore any byte compiler warnings you might get here |
|
|
(make-local-variable 'comment-indent-function) |
|
|
(setq comment-indent-function 'c-comment-indent)) |
|
|
|
|
2532 |
(defun antlr-language-option (search) |
(defun antlr-language-option (search) |
2533 |
"Find language in `antlr-language-alist' for language option. |
"Find language in `antlr-language-alist' for language option. |
2534 |
If SEARCH is non-nil, find element for language option. Otherwise, find |
If SEARCH is non-nil, find element for language option. Otherwise, find |
2596 |
(funcall init-fn))) ; is a function in v5.29 |
(funcall init-fn))) ; is a function in v5.29 |
2597 |
(t ; cc-mode upto 5.28 |
(t ; cc-mode upto 5.28 |
2598 |
(antlr-c-init-language-vars))) ; do it myself |
(antlr-c-init-language-vars))) ; do it myself |
2599 |
(cond ((fboundp 'c-basic-common-init) ; cc-mode 5.30+ |
(c-basic-common-init antlr-language (or antlr-indent-style "gnu")) |
|
(c-basic-common-init antlr-language (or antlr-indent-style "gnu"))) |
|
|
(t |
|
|
(antlr-c-common-init))) |
|
2600 |
(make-local-variable 'outline-regexp) |
(make-local-variable 'outline-regexp) |
2601 |
(make-local-variable 'outline-level) |
(make-local-variable 'outline-level) |
2602 |
(make-local-variable 'require-final-newline) |
(make-local-variable 'require-final-newline) |
2604 |
(make-local-variable 'indent-region-function) |
(make-local-variable 'indent-region-function) |
2605 |
(setq outline-regexp "[^#\n\^M]" |
(setq outline-regexp "[^#\n\^M]" |
2606 |
outline-level 'c-outline-level) ; TODO: define own |
outline-level 'c-outline-level) ; TODO: define own |
2607 |
(setq require-final-newline t) |
(setq require-final-newline mode-require-final-newline) |
2608 |
(setq indent-line-function 'antlr-indent-line |
(setq indent-line-function 'antlr-indent-line |
2609 |
indent-region-function nil) ; too lazy |
indent-region-function nil) ; too lazy |
2610 |
(setq comment-start "// " |
(setq comment-start "// " |