comparison lisp/progmodes/antlr-mode.el @ 59238:a7774e900abe

(antlr-mode): Use mode-require-final-newline. Delete old-Emacs compatibility code. (antlr-c-common-init): Function deleted.
author Richard M. Stallman <rms@gnu.org>
date Fri, 31 Dec 2004 14:50:27 +0000
parents af00346728dd
children c905fcf5e3d9 95879cc1ed20
comparison
equal deleted inserted replaced
59237:276072a4cd9d 59238:a7774e900abe
2527 (when (boundp (car settings)) 2527 (when (boundp (car settings))
2528 (ignore-errors 2528 (ignore-errors
2529 (set (car settings) (eval (cadr settings))))) 2529 (set (car settings) (eval (cadr settings)))))
2530 (setq settings (cddr settings))))) 2530 (setq settings (cddr settings)))))
2531 2531
2532 (defun antlr-c-common-init ()
2533 "Like `c-basic-common-init' when using cc-mode before v5.30."
2534 ;; X/Emacs 20 only
2535 (make-local-variable 'paragraph-start)
2536 (make-local-variable 'paragraph-separate)
2537 (make-local-variable 'paragraph-ignore-fill-prefix)
2538 (make-local-variable 'require-final-newline)
2539 (make-local-variable 'parse-sexp-ignore-comments)
2540 (make-local-variable 'comment-start)
2541 (make-local-variable 'comment-multi-line)
2542 (make-local-variable 'outline-regexp)
2543 (make-local-variable 'outline-level)
2544 (make-local-variable 'adaptive-fill-regexp)
2545 (make-local-variable 'adaptive-fill-mode)
2546 (make-local-variable 'imenu-generic-expression) ;set in the mode functions
2547 (and (boundp 'comment-line-break-function)
2548 (make-local-variable 'comment-line-break-function))
2549 ;; Emacs 19.30 and beyond only, AFAIK
2550 (if (boundp 'fill-paragraph-function)
2551 (progn
2552 (make-local-variable 'fill-paragraph-function)
2553 (setq fill-paragraph-function 'c-fill-paragraph)))
2554 ;; now set their values
2555 (setq paragraph-start (concat page-delimiter "\\|$")
2556 paragraph-separate paragraph-start
2557 paragraph-ignore-fill-prefix t
2558 parse-sexp-ignore-comments t
2559 comment-column 32
2560 comment-multi-line nil
2561 comment-line-break-function 'c-comment-line-break-function
2562 adaptive-fill-regexp nil
2563 adaptive-fill-mode nil)
2564 (c-set-style (or antlr-indent-style "gnu"))
2565 (and (boundp 'c-current-comment-prefix) (boundp 'c-comment-prefix-regexp)
2566 (setq c-current-comment-prefix
2567 (if (listp c-comment-prefix-regexp)
2568 (cdr-safe (or (assoc major-mode c-comment-prefix-regexp)
2569 (assoc 'other c-comment-prefix-regexp)))
2570 c-comment-prefix-regexp)))
2571 ;; we have to do something special for c-offsets-alist so that the
2572 ;; buffer local value has its own alist structure.
2573 (setq c-offsets-alist (copy-alist c-offsets-alist))
2574 ;; setup the comment indent variable in a Emacs version portable way
2575 ;; ignore any byte compiler warnings you might get here
2576 (make-local-variable 'comment-indent-function)
2577 (setq comment-indent-function 'c-comment-indent))
2578
2579 (defun antlr-language-option (search) 2532 (defun antlr-language-option (search)
2580 "Find language in `antlr-language-alist' for language option. 2533 "Find language in `antlr-language-alist' for language option.
2581 If SEARCH is non-nil, find element for language option. Otherwise, find 2534 If SEARCH is non-nil, find element for language option. Otherwise, find
2582 the default language." 2535 the default language."
2583 (let ((value (and search 2536 (let ((value (and search
2641 ((fboundp 'c-init-language-vars) ; cc-mode 5.29 2594 ((fboundp 'c-init-language-vars) ; cc-mode 5.29
2642 (let ((init-fn 'c-init-language-vars)) 2595 (let ((init-fn 'c-init-language-vars))
2643 (funcall init-fn))) ; is a function in v5.29 2596 (funcall init-fn))) ; is a function in v5.29
2644 (t ; cc-mode upto 5.28 2597 (t ; cc-mode upto 5.28
2645 (antlr-c-init-language-vars))) ; do it myself 2598 (antlr-c-init-language-vars))) ; do it myself
2646 (cond ((fboundp 'c-basic-common-init) ; cc-mode 5.30+ 2599 (c-basic-common-init antlr-language (or antlr-indent-style "gnu"))
2647 (c-basic-common-init antlr-language (or antlr-indent-style "gnu")))
2648 (t
2649 (antlr-c-common-init)))
2650 (make-local-variable 'outline-regexp) 2600 (make-local-variable 'outline-regexp)
2651 (make-local-variable 'outline-level) 2601 (make-local-variable 'outline-level)
2652 (make-local-variable 'require-final-newline) 2602 (make-local-variable 'require-final-newline)
2653 (make-local-variable 'indent-line-function) 2603 (make-local-variable 'indent-line-function)
2654 (make-local-variable 'indent-region-function) 2604 (make-local-variable 'indent-region-function)
2655 (setq outline-regexp "[^#\n\^M]" 2605 (setq outline-regexp "[^#\n\^M]"
2656 outline-level 'c-outline-level) ; TODO: define own 2606 outline-level 'c-outline-level) ; TODO: define own
2657 (setq require-final-newline t) 2607 (setq require-final-newline mode-require-final-newline)
2658 (setq indent-line-function 'antlr-indent-line 2608 (setq indent-line-function 'antlr-indent-line
2659 indent-region-function nil) ; too lazy 2609 indent-region-function nil) ; too lazy
2660 (setq comment-start "// " 2610 (setq comment-start "// "
2661 comment-end "" 2611 comment-end ""
2662 comment-start-skip "/\\*+ *\\|// *") 2612 comment-start-skip "/\\*+ *\\|// *")