(defvar icon-mode-abbrev-table nil "\
Abbrev table in use in Icon-mode buffers.")

(define-abbrev-table (quote icon-mode-abbrev-table) nil)

(defvar icon-mode-map nil "\
Keymap used in Icon mode.")

(if icon-mode-map nil (setq icon-mode-map (make-sparse-keymap)) (define-key icon-mode-map "{" (quote electric-icon-brace)) (define-key icon-mode-map "}" (quote electric-icon-brace)) (define-key icon-mode-map "" (quote mark-icon-function)) (define-key icon-mode-map "" (quote beginning-of-icon-defun)) (define-key icon-mode-map "" (quote end-of-icon-defun)) (define-key icon-mode-map "" (quote indent-icon-exp)) (define-key icon-mode-map "" (quote backward-delete-char-untabify)) (define-key icon-mode-map "	" (quote icon-indent-command)))

(defvar icon-mode-syntax-table nil "\
Syntax table in use in Icon-mode buffers.")

(if icon-mode-syntax-table nil (setq icon-mode-syntax-table (make-syntax-table)) (modify-syntax-entry 92 "\\" icon-mode-syntax-table) (modify-syntax-entry 35 "<" icon-mode-syntax-table) (modify-syntax-entry 10 ">" icon-mode-syntax-table) (modify-syntax-entry 36 "." icon-mode-syntax-table) (modify-syntax-entry 47 "." icon-mode-syntax-table) (modify-syntax-entry 42 "." icon-mode-syntax-table) (modify-syntax-entry 43 "." icon-mode-syntax-table) (modify-syntax-entry 45 "." icon-mode-syntax-table) (modify-syntax-entry 61 "." icon-mode-syntax-table) (modify-syntax-entry 37 "." icon-mode-syntax-table) (modify-syntax-entry 60 "." icon-mode-syntax-table) (modify-syntax-entry 62 "." icon-mode-syntax-table) (modify-syntax-entry 38 "." icon-mode-syntax-table) (modify-syntax-entry 124 "." icon-mode-syntax-table) (modify-syntax-entry 39 "\"" icon-mode-syntax-table))

(defconst icon-indent-level 4 "\
*Indentation of Icon statements with respect to containing block.")

(defconst icon-brace-imaginary-offset 0 "\
*Imagined indentation of a Icon open brace that actually follows a statement.")

(defconst icon-brace-offset 0 "\
*Extra indentation for braces, compared with other text in same context.")

(defconst icon-continued-statement-offset 4 "\
*Extra indent for lines not starting new statements.")

(defconst icon-continued-brace-offset 0 "\
*Extra indent for substatements that start with open-braces.
This is in addition to icon-continued-statement-offset.")

(defconst icon-auto-newline nil "\
*Non-nil means automatically newline before and after braces,
and after colons and semicolons, inserted in C code.")

(defconst icon-tab-always-indent t "\
*Non-nil means TAB in Icon mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.")

(defun icon-mode nil "\
Major mode for editing Icon code.
Expression and list commands understand all Icon brackets.
Tab indents for Icon code.
Paragraphs are separated by blank lines only.
Delete converts tabs to spaces as it moves back.
Variables controlling indentation style:
    Non-nil means TAB in Icon mode should always reindent the current line,
    regardless of where in the line point is when the TAB command is used.
    Non-nil means automatically newline before and after braces
    inserted in Icon code.
    Indentation of Icon statements within surrounding block.
    The surrounding block's indentation is the indentation
    of the line on which the open-brace appears.
    Extra indentation given to a substatement, such as the
    then-clause of an if or body of a while.
    Extra indentation given to a brace that starts a substatement.
    This is in addition to icon-continued-statement-offset.
    Extra indentation for line if it starts with an open brace.
    An open brace following other text is treated as if it were
    this far to the right of the start of its line.

Turning on Icon mode calls the value of the variable icon-mode-hook with no args,
if that value is non-nil." (interactive) (byte-code "ш !ԉՉ
!!P!!ى	!ˉ
!ډ!ۉ
!܉!݉!މ!" [icon-mode-map major-mode mode-name local-abbrev-table icon-mode-abbrev-table icon-mode-syntax-table paragraph-start page-delimiter paragraph-separate indent-line-function require-final-newline t comment-start comment-end comment-column comment-start-skip comment-indent-hook nil kill-all-local-variables use-local-map icon-mode "Icon" set-syntax-table make-local-variable "^$\\|" icon-indent-line "# " "" 32 "# *" icon-comment-indent run-hooks icon-mode-hook] 14))

(defun icon-comment-indent nil (byte-code "!
Â!iT])" [comment-column looking-at "^#" 0 skip-chars-backward " 	"] 4))

(defun electric-icon-brace (arg) "\
Insert character and correct line's indentation." (interactive "P") (byte-code "Ĉ	?&l&!n)&
%  Â&ąL
> `Z GTb!)^b	!!)c	!!)" [insertpos arg icon-auto-newline t nil last-command-char skip-chars-backward " 	" icon-indent-line newline 2 delete-char -1 self-insert-command prefix-numeric-value] 12))

(defun icon-indent-command (&optional whole-exp) (interactive "P") (byte-code "ňƈ?  `!`
	$+V?L!n?)T V " [whole-exp shift-amt beg end icon-tab-always-indent nil "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
or in the line's indentation; otherwise insert a tab.

A numeric argument, regardless of its value,
means indent rigidly all the 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." icon-indent-line beginning-of-line forward-sexp 1 forward-line indent-code-rigidly "#" skip-chars-backward " 	" insert-tab] 9))

(defun icon-indent-line nil "\
Indent current line as Icon code.
Return the amount the indentation changed by." (byte-code "!d`Z `=\" =/ !;ω!<H@!S!?b  )gUk!wZgU\\!iZ!d
Zb-" [indent nil beg shift-amt case-fold-search pos t icon-indent-level icon-brace-offset calculate-icon-indent beginning-of-line current-indentation calculate-icon-indent-within-comment looking-at "[ 	]*#" 0 skip-chars-forward " 	" "else\\b" "else\\s_" icon-backward-to-start-of-if 125 "end\\b" 123 zerop delete-region] 16))

(defun calculate-icon-indent (&optional parse-start) "\
Return appropriate indentation for current line as Icon code.
In usual case returns an integer: the column to indent to.
Returns nil if line starts inside a string, t if in a comment." (byte-code " `b `W:``#A@8D8M8Vf\"aTbi
we! stЂ? `b! !ib!g=)	#b!!!!!!`Wi)n
!nЂ #-)" [indent-point case-fold-search nil state containing-sexp toplevel parse-start t icon-continued-statement-offset icon-continued-brace-offset icon-indent-level icon-brace-offset icon-brace-imaginary-offset beginning-of-line beginning-of-icon-defun parse-partial-sexp 0 3 4 /= 123 icon-backward-to-noncomment icon-is-continuation-line icon-backward-to-start-of-continued-exp + skip-chars-forward " 	" looking-at "procedure\\s " forward-sexp forward-char 1 " 	
" "#" forward-line zerop skip-chars-backward current-indentation] 25))

(defun icon-is-continuation-line nil (byte-code "h!	=!`!`\"\"\">?*" [ch ch-syntax char-syntax 119 assoc buffer-substring forward-word -1 1 (("do") ("dynamic") ("else") ("initial") ("link") ("local") ("of") ("static") ("then")) (0 59 125 123 41 93 34 39 10)] 7))

(defun icon-backward-to-noncomment (lim) (byte-code "	?0
\"` # 
`W)!,É*" [opoint stop lim t nil skip-chars-backward " 	
" beginning-of-line search-forward "#" move forward-char -1] 7))

(defun icon-backward-to-start-of-continued-exp (lim) (byte-code "h>	! !
 `X#Tb!" [lim (41 93) forward-sexp -1 icon-is-continued-line end-of-line 0 beginning-of-line skip-chars-forward " 	"] 6))

(defun icon-is-continued-line nil (byte-code "! )" [end-of-line 0 icon-is-continuation-line] 3))

(defun icon-backward-to-start-of-if (&optional limit) "\
Move to the start of the last ``unbalanced'' if." (byte-code " `)	!?F!!)	TB!6	SB`WBˉb*" [limit if-level case-fold-search nil beginning-of-icon-defun 1 zerop backward-sexp looking-at "else\\b" "if\\b" 0] 8))

(defun mark-icon-function nil "\
Put mark at end of Icon function, point at beginning." (interactive) (byte-code "`! `!! " [nil push-mark end-of-icon-defun beginning-of-line 0 beginning-of-icon-defun] 6))

(defun beginning-of-icon-defun nil "\
Go to the start of the enclosing procedure; return t if at top level." (interactive) (byte-code "e#!" [t nil re-search-backward "^procedure\\s \\|^end[ 	
]" move looking-at "e"] 4))

(defun end-of-icon-defun nil (interactive) (byte-code "o?
!d#!!" [nil forward-char -1 re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" move forward-word forward-line 1] 5))

(defun indent-icon-exp nil "\
Indent each line of the Icon grouping following point." (interactive) (byte-code "C`C`
??ZmY҉?` `%@AA@AA@YAA@
8 8!҉LX҉
@f\"N@	!gU! 
@!iz{#	! 	@	)@@[!	\")gU!	Z	gU	\\	i	U` `\"	j! `)#  7)." [indent-stack nil contain-stack case-fold-search restart outer-loop-done inner-loop-done state ostate this-indent last-sexp at-else at-brace at-do opoint next-depth last-depth innerloop-done t icon-continued-statement-offset icon-continued-brace-offset val icon-indent-level icon-brace-offset comment-start-skip 0 forward-sexp 1 parse-partial-sexp end-of-line 4 icon-indent-line 3 forward-line /= setcar -1 skip-chars-forward " 	" 123 looking-at "else\\W" icon-backward-to-noncomment icon-is-continuation-line icon-backward-to-start-of-continued-exp + icon-backward-to-start-of-if current-indentation calculate-icon-indent 125 "end\\b" delete-region beginning-of-line re-search-forward indent-for-comment] 30))