(define-key icon-mode-map "\e\C-e" 'end-of-icon-defun)
(define-key icon-mode-map "\e\C-q" 'indent-icon-exp)
(define-key icon-mode-map "\177" 'backward-delete-char-untabify)
- (define-key icon-mode-map "\t" 'icon-indent-command)
-
- (define-key icon-mode-map [menu-bar] (make-sparse-keymap))
+
+ (define-key icon-mode-map [menu-bar] (make-sparse-keymap "Icon"))
(define-key icon-mode-map [menu-bar icon]
(cons "Icon" map))
(define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun))
"*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
(setq comment-start "# ")
(make-local-variable 'comment-end)
(setq comment-end "")
- (make-local-variable 'comment-column)
- (setq comment-column 32)
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "# *")
(make-local-variable 'comment-indent-function)
(setq comment-indent-function 'icon-comment-indent)
+ (set (make-local-variable 'indent-line-function) 'icon-indent-line)
;; font-lock support
- (make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults
+ (setq font-lock-defaults
'((icon-font-lock-keywords
icon-font-lock-keywords-1 icon-font-lock-keywords-2)
nil nil ((?_ . "w")) beginning-of-defun
;; we start from the assertion that `hs-special-modes-alist' is autoloaded.
(unless (assq 'icon-mode hs-special-modes-alist)
(setq hs-special-modes-alist
- (cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil
+ (cons '(icon-mode "\\<procedure\\>" "\\<end\\>" nil
icon-forward-sexp-function)
hs-special-modes-alist)))
(run-hooks 'icon-mode-hook))
;; This is used by indent-for-comment to decide how much to
;; indent a comment in Icon code based on its context.
(defun icon-comment-indent ()
- (if (looking-at "^#")
- 0
- (save-excursion
- (skip-chars-backward " \t")
- (max (if (bolp) 0 (1+ (current-column)))
- comment-column))))
+ (if (looking-at "^#") 0 comment-column))
(defun electric-icon-brace (arg)
"Insert character and correct line's indentation."
(self-insert-command (prefix-numeric-value arg)))))
\f
(defun icon-indent-command (&optional whole-exp)
- (interactive "P")
"Indent current line as Icon code, or in some cases insert a tab character.
If `icon-tab-always-indent' is non-nil (the default), always indent current
line. Otherwise, indent the current line only if point is at the left margin
lines of the expression starting after point so that this line becomes
properly indented. The relative indentation among the lines of the
expression are preserved."
+ (interactive "P")
(if whole-exp
;; If arg, always indent this line as Icon
;; and shift remaining lines of expression the same amount.
(setq beg (point))
(cond ((eq indent nil)
(setq indent (current-indentation)))
- ((looking-at "[ \t]*#")
+ ((looking-at "^#")
(setq indent 0))
(t
(skip-chars-forward " \t")
(progn (forward-word -1) (point))
(progn (forward-word 1) (point)))
icon-resword-alist)
- (not (memq ch '(0 ?\; ?\} ?\{ ?\) ?\] ?\" ?\' ?\n))))))
+ (not (memq ch '(0 ?\; ?\} ?\{ ?\) ?\] ?\" ?\' ?\# ?\, ?\. ?\n))))))
(defun icon-backward-to-noncomment (lim)
(let (opoint stop)
"Subdued level highlighting for Icon mode.")
(defconst icon-font-lock-keywords-2
- (append
+ (append
icon-font-lock-keywords-1
(eval-when-compile
(list
;; Fontify all type specifiers.
- (cons
- (concat
- "\\<" (regexp-opt '("null" "string" "co-expression" "table" "integer"
- "cset" "set" "real" "file" "list") t)
- "\\>")
+ (cons
+ (regexp-opt '("null" "string" "co-expression" "table" "integer"
+ "cset" "set" "real" "file" "list") 'words)
'font-lock-type-face)
;; Fontify all keywords.
;;
- (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)
- "\\>")
+ (cons
+ (regexp-opt
+ '("break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return"
+ "until" "case" "of" "while" "create" "every" "suspend" "default"
+ "fail" "record" "then") 'words)
'font-lock-keyword-face)
- ;; "end" "initial"
- (cons (concat "\\<" (regexp-opt '("end" "initial") t) "\\>")
+ ;; "end" "initial"
+ (cons (regexp-opt '("end" "initial") 'words)
'font-lock-builtin-face)
;; Fontify all system variables.
- (cons
- (regexp-opt
- '("&allocated" "&ascii" "&clock" "&col" "&collections" "&column"
+ (cons
+ (regexp-opt
+ '("&allocated" "&ascii" "&clock" "&col" "&collections" "&column"
"&control" "&cset" "¤t" "&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" "®ions" "&resize" "&row"
- "&rpress" "&rrelease" "&shift" "&source" "&storage" "&subject"
+ "&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" "®ions" "&resize" "&row"
+ "&rpress" "&rrelease" "&shift" "&source" "&storage" "&subject"
"&time" "&trace" "&ucase" "&version" "&window" "&x" "&y") t)
- 'font-lock-reference-face)
+ 'font-lock-constant-face)
(cons ;; global local static declarations and link files
- (concat
+ (concat
"^[ \t]*"
(regexp-opt '("global" "link" "local" "static") t)
"\\(\\sw+\\>\\)*")
font-lock-variable-name-face)))))
(cons ;; $define $elif $ifdef $ifndef $undef
- (concat "^"
+ (concat "^"
(regexp-opt'("$define" "$elif" "$ifdef" "$ifndef" "$undef") t)
"\\>[ \t]*\\([^ \t\n]+\\)?")
- '((1 font-lock-builtin-face)
+ '((1 font-lock-builtin-face)
(4 font-lock-variable-name-face nil t)))
- (cons ;; $dump $endif $else $include
- (concat
+ (cons ;; $dump $endif $else $include
+ (concat
"^" (regexp-opt'("$dump" "$endif" "$else" "$include") t) "\\>" )
'font-lock-builtin-face)
(cons ;; $warning $error
(end-of-icon-defun)
(forward-char -1)))
-(provide 'icon-mode)
+(provide 'icon)
+
+;;; arch-tag: 8abf8c99-e7df-44af-a58f-ef5ed2ee52cb
;;; icon.el ends here