(Fprimitive_undo): Use base buffer's modtime field.
[bpt/emacs.git] / lisp / hilit19.el
index 2bf5f92..5fca0ba 100644 (file)
@@ -1,5 +1,5 @@
 ;; hilit19.el (Release 2.19) -- customizable highlighting for Emacs19.
-;; Copyright (c) 1993 Free Software Foundation, Inc.
+;; Copyright (c) 1993, 1994 Free Software Foundation, Inc.
 ;;
 ;; Author:   Jonathan Stigelman <Stig@netcom.com>
 ;; Keywords: faces
 ;;
 ;; KNOWN BUGS/TO DO LIST/HELP WANTED/APPLY WITHIN
 ;;
-;; * When more than one size of font is used in different frames, only one
-;;   font size can have bold & italic properties.
-;;
 ;; * unbalanced, unescaped double quote characters can confuse hilit19.
 ;;   This will be fixed someday, so don't bug me about it.
 ;;
@@ -637,17 +634,11 @@ See the documentation for hilit-translate and hilit-face-translation-table."
            (set-face-font face nil frame)
            (set-face-underline-p face (string-match "underline" fn))
            (if (string-match ".*bold" fn)
-               (progn
-                 ;; first, fix up this frame's face
-                 (make-face-bold face frame  'noerr)
-                 ;; now, fix up the face from the global list
-                 (set-face-font face (face-font face frame) t)))
+               ;; make face bold in all frames
+               (make-face-bold face nil 'noerr))
            (if (string-match ".*italic" fn)
-               (progn
-                 ;; first, fix up this frame's face
-                 (make-face-italic face frame 'noerr)
-                 ;; now, fix up the face from the global list
-                 (set-face-font face (face-font face frame) t)))
+               ;; make face italic in all frames
+               (make-face-italic face nil 'noerr))
            ))
       )))
   face)
@@ -824,9 +815,11 @@ non-nil."
         (if (> buffer-saved-size (car hilit-auto-rehighlight-fallback))
             (setq hilit-auto-rehighlight
                   (cdr hilit-auto-rehighlight-fallback)))
-        (if (> buffer-saved-size hilit-auto-highlight-maxout) nil
-          (hilit-rehighlight-buffer)
-          (set-buffer-modified-p nil)))))
+        (if (> buffer-saved-size hilit-auto-highlight-maxout)
+            nil
+          (let ((bm (buffer-modified-p)))
+            (hilit-rehighlight-buffer)
+            (set-buffer-modified-p bm))))))
 
 (defun hilit-repaint-command (arg)
   "Rehighlights according to the value of hilit-auto-rehighlight, or the
@@ -1140,7 +1133,24 @@ number of backslashes."
       ("[ \n\t({]\\(\\(const\\|register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\|class\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type)
       ;; key words
       ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>[^_]"
-       1 keyword)))))
+       1 keyword))))
+
+  (hilit-set-mode-patterns
+   '(objc-mode objective-C-mode)
+   (append
+    comments c++-comments strings preprocessor
+    '(
+      ;; function decls are expected to have types on the previous line
+      ("^\\(\\(\\w\\|[$_]\\)+::\\)?\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun)
+      ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun)
+
+      ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl)
+      ;; datatype -- black magic regular expression
+      ("[ \n\t({]\\(\\(const\\|register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\|class\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type)
+      ;; key words
+      ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|interface\\|implementation\\|end\\|super\\|self\\)\\>[^_]"
+       1 keyword))))
+  )
 
 (hilit-set-mode-patterns
  'perl-mode
@@ -1255,9 +1265,9 @@ number of backslashes."
    ("\\\\caption\\(\\[[^]]*\\]\\)?{" "}" label)
 
    ;; formulas
-   ("\\\\("  "\\\\)" formula)                   ; \( \)
-   ("\\\\\\[" "\\\\\\]" formula)                ; \[ \]
-   ("[^$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$'
+   ("[^\\]\\\\("  "\\\\)" formula)                   ; \( \)
+   ("[^\\]\\\\\\[" "\\\\\\]" formula)                ; \[ \]
+   ("[^\\$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$'
    
    ;; things that bring in external files
    ("\\\\\\(include\\|input\\|bibliography\\){" "}" include)
@@ -1380,10 +1390,10 @@ number of backslashes."
    ("^\\s *(def\\(un\\|macro\\|advice\\|subst\\|method\\)\\s " "\\()\\|nil\\)" defun)
 
    ("^\\s *(\\(def\\(var\\|type\\|parameter\\)\\|declare\\)\\s +\\S +" nil decl)
-   ("^\\s *(def\\(const\\(ant\\)?\\|class\\|struct\\)\\s \\S +[ \t\n]+\\((\\(([^()]*)\\|[^()]+\\)*)\\)?" nil define)
+   ("^\\s *(def\\(const\\(ant\\)?\\|class\\|struct\\)\\s \\S +[ \t\n]+" nil define)
    ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include)
    ("[ \t]\\&\\(key\\|rest\\|optional\\|aux\\)\\s *" nil keyword)
-   ("(\\(let\\*?\\|locally\\|cond\\|if\\*?\\|or\\|and\\|map\\(car\\|c[ao]n\\)?\\|prog[nv1*]?\\|while\\|when\\|unless\\|do\\(\\*\\|list\\|times\\)\\|lambda\\|function\\|values\\|set\\([qf]\\|car\\|cdr\\)?\\|rplac[ad]\\|nconc\\|block\\|go\\|return\\(-from\\)?\\|[ec]?\\(type\\)?case\\|multiple-value-\\(bind\\|setq\\|list\\|call\\|prog1\\)\\|unwind-protect\\|handler-case\\|catch\\|throw\\|eval-when\\(-compile\\)?\\)[ \t\n]" 1 keyword)
+   ("(\\(let\\*?\\|locally\\|cond\\|if\\*?\\|or\\|and\\|map\\(car\\|c[ao]n\\)?\\|prog[nv1*]?\\|while\\|when\\|unless\\|do\\(\\*\\|list\\|times\\)\\|list\\|lambda\\|function\\|values\\|set\\([qf]\\|car\\|cdr\\)?\\|rplac[ad]\\|nconc\\|block\\|go\\|return\\(-from\\)?\\|[ec]?\\(type\\)?case\\|multiple-value-\\(bind\\|setq\\|list\\|call\\|prog1\\)\\|unwind-protect\\|handler-case\\|catch\\|throw\\|eval-when\\(-compile\\)?\\)[ \t\n]" 1 keyword)
    ))
 
 
@@ -1459,10 +1469,21 @@ number of backslashes."
 (hilit-set-mode-patterns
  'calendar-mode
  '(("[A-Z][a-z]+ [0-9]+" nil define)   ; month and year
-   ("S  M Tu  W Th  F  S" nil label)   ; week days
-   ("[0-9]+\\*" nil defun)             ; holidays
-   ("[0-9]+\\+" nil comment)           ; diary days
-   ))
+   ("S  M Tu  W Th  F  S" nil label))) ; week days
+
+(hilit-set-mode-patterns
+ 'asm-mode
+ '(("/\\*" "\\*/" comment)
+   ("^#[ \t]*\\(undef\\|define\\).*$" "[^\\]$" define)
+   ("^#.*$" nil include)
+   ;; labels
+   ("^.+:" nil defun)
+   ;; assembler directives
+   ("^[ \t]*\\..*$" nil decl)
+   ;; register names
+   ("\\$[a-z0-9]+" nil string)
+   ;; mnemonics
+   ("^[ \t]*[a-z]+" nil struct)))
 
 (hilit-set-mode-patterns
  'pascal-mode