]> git.eshelyaron.com Git - emacs.git/commitdiff
Added makefile-imake-mode.
authorMasatake YAMATO <jet@gyve.org>
Tue, 17 Jan 2006 18:11:53 +0000 (18:11 +0000)
committerMasatake YAMATO <jet@gyve.org>
Tue, 17 Jan 2006 18:11:53 +0000 (18:11 +0000)
etc/NEWS
lisp/ChangeLog
lisp/files.el
lisp/progmodes/make-mode.el

index 50bc6b1089ddd5a4f28dd99f5389cfd40d9b6411..f50601971665ebd9d5a54acc5f60c9d36e3ace77 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1876,9 +1876,9 @@ subprocess are controlled by the user options `scheme-trace-command',
 `scheme-untrace-command' and `scheme-expand-current-form'.
 
 ---
-** Makefile mode has submodes for automake, gmake, makepp and BSD make.
+** Makefile mode has submodes for automake, gmake, makepp, BSD make and imake.
 
-The former two couldn't be differentiated before, and the latter two
+The former two couldn't be differentiated before, and the latter three
 are new.  Font-locking is robust now and offers new customizable
 faces.
 
index d81b2ed6a8bc4427deb42cc17bdfc95da124705c..3c747c3d34667dc80b5e20ffc91f4e7cdf585a45 100644 (file)
@@ -1,3 +1,16 @@
+2006-01-18  Masatake YAMATO  <jet@gyve.org>
+
+       * progmodes/make-mode.el (makefile-imake-mode): New mode
+       derived from maiefile-mode.
+       (makefile-imake-mode-syntax-table): New syntax table
+       derived from makefile-mode-syntax-table.
+       (makefile-mode): Write about makefile-imake-mode in 
+       doc string.
+       (makefile-mode-map): Bind "\C-c\C-m\C-i" to makefile-imake-mode.
+       (makefile-imake-font-lock-keywords): New font lock keywords.
+
+       * files.el (auto-mode-alist): Added Imakefile.
+
 2006-01-17  Agustin Martin  <agustin.martin@hispalinux.es>
 
        * textmodes/flyspell.el (ispell-kill-ispell-hook): Add to the hook when
index 2b439e20d3ff938c0f85af7a5ccacf99b9e0f2e1..d1202f99d3a0c922963fbc1b4abc90c7a237eee5 100644 (file)
@@ -1812,6 +1812,7 @@ in that case, this function acts as if `enable-local-variables' were t."
      ("\\.ad[abs]\\'" . ada-mode)
      ("\\.ad[bs].dg\\'" . ada-mode)
      ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
+     ("Imakefile\\'" . makefile-imake-mode)
      ,@(if (memq system-type '(berkeley-unix next-mach darwin))
           '(("\\.mk\\'" . makefile-bsdmake-mode)
             ("GNUmakefile\\'" . makefile-gmake-mode)
index 4665e2cb7c00102b124a9ca640d56963d7bc489c..42a021ec692901d250bfa3809a55d7ea88977e60 100644 (file)
@@ -489,6 +489,19 @@ not be enclosed in { } or ( )."
    "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)"
    '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face)))
 
+(defconst makefile-imake-font-lock-keywords
+  (append 
+   (makefile-make-font-lock-keywords
+    makefile-var-use-regex
+    makefile-statements
+    t
+    nil
+    '("^XCOMM.*$" . font-lock-comment-face)
+    '("XVAR\\(?:use\\|def\\)[0-9]" 0 font-lock-keyword-face prepend)
+    '("@@" . font-lock-preprocessor-face)
+    )
+   cpp-font-lock-keywords))
+
 
 (defconst makefile-font-lock-syntactic-keywords
   ;; From sh-script.el.
@@ -581,6 +594,7 @@ The function must satisfy this calling convention:
     (define-key map "\C-c\C-m\C-a" 'makefile-automake-mode)
     (define-key map "\C-c\C-m\C-b" 'makefile-bsdmake-mode)
     (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode)
+    (define-key map "\C-c\C-m\C-i" 'makefile-imake-mode)
     (define-key map "\C-c\C-m\C-m" 'makefile-mode)
     (define-key map "\C-c\C-m\C-p" 'makefile-makepp-mode)
     (define-key map "\M-p"     'makefile-previous-dependency)
@@ -639,6 +653,15 @@ The function must satisfy this calling convention:
   (modify-syntax-entry ?#  "<     " makefile-mode-syntax-table)
   (modify-syntax-entry ?\n ">     " makefile-mode-syntax-table))
 
+(defvar makefile-imake-mode-syntax-table (copy-syntax-table
+                                         makefile-mode-syntax-table))
+(if makefile-imake-mode-syntax-table
+    ()
+  (modify-syntax-entry ?/  ". 14" makefile-imake-mode-syntax-table)
+  (modify-syntax-entry ?*  ". 23" makefile-imake-mode-syntax-table)
+  (modify-syntax-entry ?#  "'" makefile-imake-mode-syntax-table)
+  (modify-syntax-entry ?\n ". b" makefile-imake-mode-syntax-table))
+
 
 ;;; ------------------------------------------------------------
 ;;; Internal variables.
@@ -701,7 +724,8 @@ The function must satisfy this calling convention:
 
 If you are editing a file for a different make, try one of the
 variants `makefile-automake-mode', `makefile-gmake-mode',
-`makefile-makepp-mode' or `makefile-bsdmake-mode'.  All but the
+`makefile-makepp-mode', `makefile-bsdmake-mode' or, 
+`makefile-imake-mode'All but the
 last should be correctly chosen based on the file name, except if
 it is *.mk.  This function ends by invoking the function(s)
 `makefile-mode-hook'.
@@ -885,6 +909,20 @@ Makefile mode can be configured by modifying the following variables:
   (setq font-lock-defaults
        `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults))))
 
+;;;###autoload
+(define-derived-mode makefile-imake-mode makefile-mode "Imakefile"
+  "An adapted `makefile-mode' that knows about imake."
+  :syntax-table makefile-imake-mode-syntax-table
+  (let ((base `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))
+       new)
+    ;; Remove `font-lock-syntactic-keywords' entry from font-lock-defaults.
+    (mapc (lambda (elt)
+           (unless (and (consp elt)
+                        (eq (car elt) 'font-lock-syntactic-keywords))
+             (setq new (cons elt new))))
+         base)
+    (setq font-lock-defaults (nreverse new))))
+
 \f
 
 ;;; Motion code.