comparison lisp/progmodes/make-mode.el @ 68239:e08826f8b714

Added makefile-imake-mode.
author Masatake YAMATO <jet@gyve.org>
date Tue, 17 Jan 2006 18:11:53 +0000
parents ca3575ba6361
children dc49655f57ae d88caeac70d7
comparison
equal deleted inserted replaced
68238:f88d3a26b09b 68239:e08826f8b714
487 makefile-bsdmake-statements 487 makefile-bsdmake-statements
488 t 488 t
489 "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)" 489 "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)"
490 '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face))) 490 '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face)))
491 491
492 (defconst makefile-imake-font-lock-keywords
493 (append
494 (makefile-make-font-lock-keywords
495 makefile-var-use-regex
496 makefile-statements
497 t
498 nil
499 '("^XCOMM.*$" . font-lock-comment-face)
500 '("XVAR\\(?:use\\|def\\)[0-9]" 0 font-lock-keyword-face prepend)
501 '("@@" . font-lock-preprocessor-face)
502 )
503 cpp-font-lock-keywords))
504
492 505
493 (defconst makefile-font-lock-syntactic-keywords 506 (defconst makefile-font-lock-syntactic-keywords
494 ;; From sh-script.el. 507 ;; From sh-script.el.
495 ;; A `#' begins a comment in sh when it is unquoted and at the beginning 508 ;; A `#' begins a comment in sh when it is unquoted and at the beginning
496 ;; of a word. In the shell, words are separated by metacharacters. 509 ;; of a word. In the shell, words are separated by metacharacters.
579 (define-key map "\C-c\C-i" 'makefile-insert-gmake-function) 592 (define-key map "\C-c\C-i" 'makefile-insert-gmake-function)
580 (define-key map "\C-c\C-\\" 'makefile-backslash-region) 593 (define-key map "\C-c\C-\\" 'makefile-backslash-region)
581 (define-key map "\C-c\C-m\C-a" 'makefile-automake-mode) 594 (define-key map "\C-c\C-m\C-a" 'makefile-automake-mode)
582 (define-key map "\C-c\C-m\C-b" 'makefile-bsdmake-mode) 595 (define-key map "\C-c\C-m\C-b" 'makefile-bsdmake-mode)
583 (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode) 596 (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode)
597 (define-key map "\C-c\C-m\C-i" 'makefile-imake-mode)
584 (define-key map "\C-c\C-m\C-m" 'makefile-mode) 598 (define-key map "\C-c\C-m\C-m" 'makefile-mode)
585 (define-key map "\C-c\C-m\C-p" 'makefile-makepp-mode) 599 (define-key map "\C-c\C-m\C-p" 'makefile-makepp-mode)
586 (define-key map "\M-p" 'makefile-previous-dependency) 600 (define-key map "\M-p" 'makefile-previous-dependency)
587 (define-key map "\M-n" 'makefile-next-dependency) 601 (define-key map "\M-n" 'makefile-next-dependency)
588 (define-key map "\e\t" 'makefile-complete) 602 (define-key map "\e\t" 'makefile-complete)
636 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table) 650 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
637 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table) 651 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
638 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table) 652 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
639 (modify-syntax-entry ?# "< " makefile-mode-syntax-table) 653 (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
640 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table)) 654 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
655
656 (defvar makefile-imake-mode-syntax-table (copy-syntax-table
657 makefile-mode-syntax-table))
658 (if makefile-imake-mode-syntax-table
659 ()
660 (modify-syntax-entry ?/ ". 14" makefile-imake-mode-syntax-table)
661 (modify-syntax-entry ?* ". 23" makefile-imake-mode-syntax-table)
662 (modify-syntax-entry ?# "'" makefile-imake-mode-syntax-table)
663 (modify-syntax-entry ?\n ". b" makefile-imake-mode-syntax-table))
641 664
642 665
643 ;;; ------------------------------------------------------------ 666 ;;; ------------------------------------------------------------
644 ;;; Internal variables. 667 ;;; Internal variables.
645 ;;; You don't need to configure below this line. 668 ;;; You don't need to configure below this line.
699 (defun makefile-mode () 722 (defun makefile-mode ()
700 "Major mode for editing standard Makefiles. 723 "Major mode for editing standard Makefiles.
701 724
702 If you are editing a file for a different make, try one of the 725 If you are editing a file for a different make, try one of the
703 variants `makefile-automake-mode', `makefile-gmake-mode', 726 variants `makefile-automake-mode', `makefile-gmake-mode',
704 `makefile-makepp-mode' or `makefile-bsdmake-mode'. All but the 727 `makefile-makepp-mode', `makefile-bsdmake-mode' or,
728 `makefile-imake-mode'All but the
705 last should be correctly chosen based on the file name, except if 729 last should be correctly chosen based on the file name, except if
706 it is *.mk. This function ends by invoking the function(s) 730 it is *.mk. This function ends by invoking the function(s)
707 `makefile-mode-hook'. 731 `makefile-mode-hook'.
708 732
709 It is strongly recommended to use `font-lock-mode', because that 733 It is strongly recommended to use `font-lock-mode', because that
882 (set (make-local-variable 'makefile-dependency-skip) "^:!") 906 (set (make-local-variable 'makefile-dependency-skip) "^:!")
883 (set (make-local-variable 'makefile-rule-action-regex) 907 (set (make-local-variable 'makefile-rule-action-regex)
884 makefile-bsdmake-rule-action-regex) 908 makefile-bsdmake-rule-action-regex)
885 (setq font-lock-defaults 909 (setq font-lock-defaults
886 `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults)))) 910 `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults))))
911
912 ;;;###autoload
913 (define-derived-mode makefile-imake-mode makefile-mode "Imakefile"
914 "An adapted `makefile-mode' that knows about imake."
915 :syntax-table makefile-imake-mode-syntax-table
916 (let ((base `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))
917 new)
918 ;; Remove `font-lock-syntactic-keywords' entry from font-lock-defaults.
919 (mapc (lambda (elt)
920 (unless (and (consp elt)
921 (eq (car elt) 'font-lock-syntactic-keywords))
922 (setq new (cons elt new))))
923 base)
924 (setq font-lock-defaults (nreverse new))))
887 925
888 926
889 927
890 ;;; Motion code. 928 ;;; Motion code.
891 929