]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/icon.el
(bdf-generate-font): New argument CHARSET. Give WIDTH
[gnu-emacs] / lisp / progmodes / icon.el
index fa13aa2595d8098b9c20f9f2d823e76c846cc793..dc72fbe07ffa88ef0107e29c5132817985e97c17 100644 (file)
@@ -122,11 +122,11 @@ This applies when braces are inserted."
   "*Non-nil means TAB in Icon mode should always reindent the current line.
 It will then reindent, regardless of where in the line point is
 when the TAB command is used."
-  :type 'integer
+  :type 'boolean
   :group 'icon)
 
 (defvar icon-imenu-generic-expression
-      '((nil "^[ \t]*procedure[ \t]*\\(\\sw+\\)[ \t]*("  1))
+      '((nil "^[ \t]*procedure[ \t]+\\(\\sw+\\)[ \t]*("  1))
   "Imenu expression for Icon mode.  See `imenu-generic-expression'.")
 
 
@@ -193,20 +193,21 @@ with no args, if that value is non-nil."
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults  
        '((icon-font-lock-keywords
-          icon-font-lock-keywords-1 
-          icon-font-lock-keywords-2
-          )
+          icon-font-lock-keywords-1 icon-font-lock-keywords-2)
          nil nil ((?_ . "w")) beginning-of-defun
-         (font-lock-comment-start-regexp . "#")
+         ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP.
+         ;(font-lock-comment-start-regexp . "#")
          (font-lock-mark-block-function . mark-defun)))
   ;; imenu support
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression icon-imenu-generic-expression)
   ;; hideshow support
   ;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
-  (pushnew '(icon-mode  "\\<procedure\\>" "\\<end\\>" nil 
-                       icon-forward-sexp-function)
-          hs-special-modes-alist :test 'equal)
+  (unless (assq 'icon-mode hs-special-modes-alist)
+    (setq hs-special-modes-alist
+         (cons '(icon-mode  "\\<procedure\\>" "\\<end\\>" nil 
+                            icon-forward-sexp-function)
+               hs-special-modes-alist)))
   (run-hooks 'icon-mode-hook))
 \f
 ;; This is used by indent-for-comment to decide how much to
@@ -294,8 +295,6 @@ Return the amount the indentation changed by."
     (setq beg (point))
     (cond ((eq indent nil)
           (setq indent (current-indentation)))
-         ((eq indent t)
-          (setq indent (calculate-icon-indent-within-comment)))
          ((looking-at "[ \t]*#")
           (setq indent 0))
          (t
@@ -511,7 +510,7 @@ Returns nil if line starts inside a string, t if in a comment."
        (contain-stack (list (point)))
        (case-fold-search nil)
        restart outer-loop-done inner-loop-done state ostate
-       this-indent last-sexp
+       this-indent last-sexp last-depth
        at-else at-brace at-do
        (opoint (point))
        (next-depth 0))
@@ -525,8 +524,8 @@ Returns nil if line starts inside a string, t if in a comment."
        ;; plus enough other lines to get to one that
        ;; does not end inside a comment or string.
        ;; Meanwhile, do appropriate indentation on comment lines.
-       (setq innerloop-done nil)
-       (while (and (not innerloop-done)
+       (setq inner-loop-done nil)
+       (while (and (not inner-loop-done)
                    (not (and (eobp) (setq outer-loop-done t))))
          (setq ostate state)
          (setq state (parse-partial-sexp (point) (progn (end-of-line) (point))
@@ -539,7 +538,7 @@ Returns nil if line starts inside a string, t if in a comment."
              (icon-indent-line))
          (if (or (nth 3 state))
              (forward-line 1)
-           (setq innerloop-done t)))
+           (setq inner-loop-done t)))
        (if (<= next-depth 0)
            (setq outer-loop-done t))
        (if outer-loop-done
@@ -617,9 +616,9 @@ Returns nil if line starts inside a string, t if in a comment."
   (eval-when-compile
     (list
      ;; Fontify procedure name definitions.
-     '("^[ \t]*\\(procedure\\)[ \t]*\\(\\sw+\\)[ \t]*("
+       '("^[ \t]*\\(procedure\\)\\>[ \t]*\\(\\sw+\\)?"
        (1 font-lock-builtin-face) (2 font-lock-function-name-face nil t))))
-  "Subdued level highlighting for `icon-mode'.")
+  "Subdued level highlighting for Icon mode.")
 
 (defconst icon-font-lock-keywords-2
   (append 
@@ -627,34 +626,67 @@ Returns nil if line starts inside a string, t if in a comment."
    (eval-when-compile
      (list
       ;; Fontify all type specifiers.
-      ;;"null" "string" "co-expression" "table" "integer" "cset"  "set" "real" "file" "list"
-      (cons "\\<\\(c\\(o-expression\\|set\\)\\|file\\|integer\\|list\\|null\\|real\\|s\\(et\\|tring\\)\\|table\\)\\>"'font-lock-type-face)
+      (cons 
+       (concat 
+       "\\<" (regexp-opt  '("null" "string" "co-expression" "table" "integer" 
+                            "cset"  "set" "real" "file" "list") t) 
+       "\\>") 
+       'font-lock-type-face)
       ;; Fontify all keywords.
-      ;;"break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" "until" "case" "of" "while" "create" "every" "suspend" "default" "fail" "record" "then"
-      (cons "\\<\\(b\\(reak\\|y\\)\\|c\\(ase\\|reate\\)\\|d\\(efault\\|o\\)\\|e\\(lse\\|very\\)\\|fail\\|if\\|n\\(ext\\|ot\\)\\|of\\|re\\(cord\\|peat\\|turn\\)\\|suspend\\|t\\(hen\\|o\\)\\|until\\|while\\)\\>" 'font-lock-keyword-face)
+      ;;
+      (cons 
+       (concat 
+       "\\<" 
+       (regexp-opt 
+        '("break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" 
+          "until" "case" "of" "while" "create" "every" "suspend" "default" 
+          "fail" "record" "then") t)
+       "\\>")
+       'font-lock-keyword-face)
       ;; "end" "initial" 
-      (cons (concat "\\<\\(end\\|initial\\)\\>") 'font-lock-builtin-face)
+      (cons (concat "\\<" (regexp-opt '("end" "initial") t) "\\>")
+           'font-lock-builtin-face)
       ;; Fontify all system variables.
-      ;;"&allocated" "&ascii" "&clock" "&col" "&collections" "&column" "&control" "&cset" "&current" "&date" "&dateline" "&digits" "&dump" "&error" "&errornumber" "&errortext" "&errorvalue" "&errout" "&eventcode" "&eventsource" "&eventvalue" "&fail" "&features" "&file" "&host" "&input" "&interval" "&lcase" "&ldrag" "&letters" "&level" "&line" "&lpress" "&lrelease" "&main" "&mdrag" "&meta" "&mpress" "&mrelease" "&null" "&output" "&phi" "&pi" "&pos" "&progname" "&random" "&rdrag" "&regions" "&resize" "&row" "&rpress" "&rrelease" "&shift" "&source" "&storage" "&subject" "&time" "&trace" "&ucase" "&version" "&window" "&x" "&y"
-      (cons (concat "\\(&\\(a\\(llocated\\|scii\\)\\|c\\(lock\\|o\\(l\\(\\|lections\\|umn\\)\\|ntrol\\)\\|set\\|urrent\\)\\|d\\(ate\\(\\|line\\)\\|igits\\|ump\\)\\|e\\(rro\\(r\\(\\|number\\|text\\|value\\)\\|ut\\)\\|vent\\(code\\|source\\|value\\)\\)\\|f\\(ail\\|eatures\\|ile\\)\\|host\\|in\\(put\\|terval\\)\\|l\\(case\\|drag\\|e\\(tters\\|vel\\)\\|ine\\|press\\|release\\)\\|m\\(ain\\|drag\\|eta\\|press\\|release\\)\\|null\\|output\\|p\\(hi\\|i\\|os\\|rogname\\)\\|r\\(andom\\|drag\\|e\\(gions\\|size\\)\\|ow\\|press\\|release\\)\\|s\\(hift\\|ource\\|torage\\|ubject\\)\\|t\\(ime\\|race\\)\\|ucase\\|version\\|window\\|[exy]\\)\\)") 'font-lock-reference-face)
-      ;; global local static declarations and link files
-      (cons  "^[ \t]*\\(global\\|link\\|local\\|static\\)\\(\\sw+\\>\\)*"
-            '((1 font-lock-builtin-face)
-              (font-lock-match-c-style-declaration-item-and-skip-to-next
-               (goto-char (or (match-beginning 2) (match-end 1))) nil
-               (1 (if (match-beginning 2)
-                      font-lock-function-name-face
-                    font-lock-variable-name-face)))))
-      ;; $define $elif $ifdef $ifdef $ifndef
-      (cons "^\\(\\$\\(define\\|elif\\|if\\(\\|def\\|ndef\\)\\|undef\\)\\)[ \t]+\\([^ \t\n]+\\)" 
-           '((1 font-lock-builtin-face) (4 font-lock-variable-name-face nil t)))
-      ;; $dump $endif $else $include 
-      (cons "^\\(\\$\\(dump\\|e\\(lse\\|ndif\\)\\|include\\)\\)\\>" 'font-lock-builtin-face)
-      ;; $warning $error
-      (cons "^\\(\\$\\(warning\\|error\\)\\)[ \t]+\\([^\n]+\\)" 
-           '((1 font-lock-builtin-face) (3 font-lock-warning-face nil t)))
-      )))
-    "Gaudy level highlighting for `icon-mode'.")
+      (cons 
+       (regexp-opt 
+       '("&allocated" "&ascii" "&clock" "&col" "&collections" "&column" 
+         "&control" "&cset" "&current" "&date" "&dateline" "&digits" "&dump"
+         "&e" "&error" "&errornumber" "&errortext" "&errorvalue" "&errout" 
+         "&eventcode" "&eventsource" "&eventvalue" "&fail" "&features" 
+         "&file" "&host" "&input" "&interval" "&lcase" "&ldrag" "&letters" 
+         "&level" "&line" "&lpress" "&lrelease" "&main" "&mdrag" "&meta" 
+         "&mpress" "&mrelease" "&null" "&output" "&phi" "&pi" "&pos" 
+         "&progname" "&random" "&rdrag" "&regions" "&resize" "&row" 
+         "&rpress" "&rrelease" "&shift" "&source" "&storage" "&subject" 
+         "&time" "&trace" "&ucase" "&version" "&window" "&x" "&y") t)
+       'font-lock-constant-face)
+      (cons      ;; global local static declarations and link files
+       (concat 
+       "^[ \t]*"
+       (regexp-opt '("global" "link" "local" "static") t)
+       "\\(\\sw+\\>\\)*")
+       '((1 font-lock-builtin-face)
+        (font-lock-match-c-style-declaration-item-and-skip-to-next
+         (goto-char (or (match-beginning 2) (match-end 1))) nil
+         (1 (if (match-beginning 2)
+                font-lock-function-name-face
+              font-lock-variable-name-face)))))
+
+      (cons      ;; $define $elif $ifdef $ifndef $undef
+       (concat "^" 
+              (regexp-opt'("$define" "$elif" "$ifdef" "$ifndef" "$undef") t)
+              "\\>[ \t]*\\([^ \t\n]+\\)?")
+           '((1 font-lock-builtin-face) 
+             (4 font-lock-variable-name-face nil t)))
+      (cons      ;; $dump $endif $else $include 
+       (concat 
+       "^" (regexp-opt'("$dump" "$endif" "$else" "$include") t) "\\>" )
+       'font-lock-builtin-face)
+      (cons      ;; $warning $error
+       (concat "^" (regexp-opt '("$warning" "$error") t)
+              "\\>[ \t]*\\(.+\\)?")
+       '((1 font-lock-builtin-face) (3 font-lock-warning-face nil t))))))
+  "Gaudy level highlighting for Icon mode.")
 
 (defvar icon-font-lock-keywords icon-font-lock-keywords-1
   "Default expressions to highlight in `icon-mode'.")
@@ -666,5 +698,6 @@ Returns nil if line starts inside a string, t if in a comment."
     (end-of-icon-defun)
     (forward-char -1)))
 
-(provide 'icon-mode)
+(provide 'icon)
+
 ;;; icon.el ends here