home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / emacs-18.59-src.tgz / emacs-18.59-src.tar / fsf / emacs18 / lisp / icon.elc < prev    next >
Text File  |  1996-09-28  |  11KB  |  145 lines

  1.  
  2. (defvar icon-mode-abbrev-table nil "\
  3. Abbrev table in use in Icon-mode buffers.")
  4.  
  5. (define-abbrev-table (quote icon-mode-abbrev-table) nil)
  6.  
  7. (defvar icon-mode-map nil "\
  8. Keymap used in Icon mode.")
  9.  
  10. (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)))
  11.  
  12. (defvar icon-mode-syntax-table nil "\
  13. Syntax table in use in Icon-mode buffers.")
  14.  
  15. (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))
  16.  
  17. (defconst icon-indent-level 4 "\
  18. *Indentation of Icon statements with respect to containing block.")
  19.  
  20. (defconst icon-brace-imaginary-offset 0 "\
  21. *Imagined indentation of a Icon open brace that actually follows a statement.")
  22.  
  23. (defconst icon-brace-offset 0 "\
  24. *Extra indentation for braces, compared with other text in same context.")
  25.  
  26. (defconst icon-continued-statement-offset 4 "\
  27. *Extra indent for lines not starting new statements.")
  28.  
  29. (defconst icon-continued-brace-offset 0 "\
  30. *Extra indent for substatements that start with open-braces.
  31. This is in addition to icon-continued-statement-offset.")
  32.  
  33. (defconst icon-auto-newline nil "\
  34. *Non-nil means automatically newline before and after braces,
  35. and after colons and semicolons, inserted in C code.")
  36.  
  37. (defconst icon-tab-always-indent t "\
  38. *Non-nil means TAB in Icon mode should always reindent the current line,
  39. regardless of where in the line point is when the TAB command is used.")
  40.  
  41. (defun icon-mode nil "\
  42. Major mode for editing Icon code.
  43. Expression and list commands understand all Icon brackets.
  44. Tab indents for Icon code.
  45. Paragraphs are separated by blank lines only.
  46. Delete converts tabs to spaces as it moves back.
  47. \\{icon-mode-map}
  48. Variables controlling indentation style:
  49.  icon-tab-always-indent
  50.     Non-nil means TAB in Icon mode should always reindent the current line,
  51.     regardless of where in the line point is when the TAB command is used.
  52.  icon-auto-newline
  53.     Non-nil means automatically newline before and after braces
  54.     inserted in Icon code.
  55.  icon-indent-level
  56.     Indentation of Icon statements within surrounding block.
  57.     The surrounding block's indentation is the indentation
  58.     of the line on which the open-brace appears.
  59.  icon-continued-statement-offset
  60.     Extra indentation given to a substatement, such as the
  61.     then-clause of an if or body of a while.
  62.  icon-continued-brace-offset
  63.     Extra indentation given to a brace that starts a substatement.
  64.     This is in addition to icon-continued-statement-offset.
  65.  icon-brace-offset
  66.     Extra indentation for line if it starts with an open brace.
  67.  icon-brace-imaginary-offset
  68.     An open brace following other text is treated as if it were
  69.     this far to the right of the start of its line.
  70.  
  71. Turning on Icon mode calls the value of the variable icon-mode-hook with no args,
  72. if that value is non-nil." (interactive) (byte-code "шҠˆÓ!ˆÔ‰ˆÕ‰ˆ ‰ˆÖ!ˆ×Æ!ˆØP‰ˆ×È!ˆ‰ˆ×É!ˆÙ‰    ˆ×Ê!ˆË‰
  73. ˆ×Ì!ˆÚ‰ ˆ×Í!ˆÛ‰ˆ×Î!ˆÜ‰ˆ×Ï!ˆÝ‰ˆ×Ð!ˆÞ‰ˆßà!‡" [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))
  74.  
  75. (defun icon-comment-indent nil (byte-code "ÁÂ!ƒ
  76. ŠÄÅ!ˆiT])‡" [comment-column looking-at "^#" 0 skip-chars-backward "     "] 4))
  77.  
  78. (defun electric-icon-brace (arg) "\
  79. Insert character and correct line's indentation." (interactive "P") (byte-code "ĈÄ    ?…&l…&ŠÆÇ!ˆn)†&
  80. ƒ%È ˆÉ ˆÃ‚&ąLcˆÈ ˆ
  81. …>É ˆ`Ê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))
  82.  
  83. (defun icon-indent-command (&optional whole-exp) (interactive "P") (byte-code "ňƈƒ?Ç ÅÅŠ …È ˆ`‰ˆÉÊ!ˆ`‰ˆ
  84. bˆËÊ!ˆ`‰)ˆ
  85. V…;Ì
  86.     Í$+‚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.
  87. If icon-tab-always-indent is non-nil (the default), always indent current line.
  88. Otherwise, indent the current line only if point is at the left margin
  89. or in the line's indentation; otherwise insert a tab.
  90.  
  91. A numeric argument, regardless of its value,
  92. means indent rigidly all the lines of the expression starting after point
  93. so that this line becomes properly indented.
  94. 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))
  95.  
  96. (defun icon-indent-line nil "\
  97. Indent current line as Icon code.
  98. Return the amount the indentation changed by." (byte-code "ÉÁ!ÁÁÁd`ZÊ ˆ`‰ˆÁ=ƒ\"Ë ‰‚ƒÆ=ƒ/Ì ‰‚ƒÍÎ!ƒ;ω‚ƒÐÑ!ˆ<…H@‰ˆÍÒ!…SÍÓ!?ƒbŠÔ ˆË )‰‚ƒgÕU†kÍÖ!ƒwZ‰‚ƒg×U…ƒ\\‰ˆÐÑ!ˆiZ‰ˆØ !ƒ£dZ`V… dZb‚·Ù
  99. `\"ˆjˆdZ`V…·dZbˆ -‡" [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))
  100.  
  101. (defun calculate-icon-indent (&optional parse-start) "\
  102. Return appropriate indentation for current line as Icon code.
  103. In usual case returns an integer: the column to indent to.
  104. Returns nil if line starts inside a string, t if in a comment." (byte-code "ŠÍ ˆ`ƒb‚Π‰ˆ`W…:`‰ˆÏ`Ð#‰ˆ A@‰ˆ‚ˆÑ 8†DÒ 8ƒMÒ 8‚ …VÓ fÔ\"ƒa Tbˆi‚ƒwÕe!ˆÖ ƒs‚tЂ ?…‚Πˆ`‰ˆbˆÕ !ˆÖ ƒ°× !ˆØiŠbˆÙÚ!ˆgÔ=)ƒ«    ‚¬Ð#‚ bˆŠÛÜ!ƒÀÝÑ!‚ÃÞß!ˆÙà!ˆÛá!…Õâß!ˆ‚Ĉ`W…Ýi)†Øn…êã
  105. !ƒõ \\‚÷
  106. äÚ!ˆ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 "     
  107. " "#" forward-line zerop skip-chars-backward current-indentation] 25))
  108.  
  109. (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))
  110.  
  111. (defun icon-backward-to-noncomment (lim) (byte-code "ÄÄ    ?…0ÅÆ
  112. \"ˆ`‰ˆÇ ˆÈÉÊ#… 
  113. `Wƒ)ËÌ!‚,Ɉ‚*‡" [opoint stop lim t nil skip-chars-backward "     
  114. " beginning-of-line search-forward "#" move forward-char -1] 7))
  115.  
  116. (defun icon-backward-to-start-of-continued-exp (lim) (byte-code "hÁ>…    ÂÃ!ˆÄ …ÅÆ!ˆ‚
  117. ˆÇ ˆ`X…#TbˆÈÉ!‡" [lim (41 93) forward-sexp -1 icon-is-continued-line end-of-line 0 beginning-of-line skip-chars-forward "     "] 6))
  118.  
  119. (defun icon-is-continued-line nil (byte-code "ŠÀÁ!ˆÂ )‡" [end-of-line 0 icon-is-continuation-line] 3))
  120.  
  121. (defun icon-backward-to-start-of-if (&optional limit) "\
  122. Move to the start of the last ``unbalanced'' if." (byte-code "† ŠÄ ˆ`)‰ˆÅÃÆ    !?…FÇÅ!ˆÈÉ!ƒ)    T‰‚BÈÊ!ƒ6    S‰‚B`W…Bˉˆbˆ‚*‡" [limit if-level case-fold-search nil beginning-of-icon-defun 1 zerop backward-sexp looking-at "else\\b" "if\\b" 0] 8))
  123.  
  124. (defun mark-icon-function nil "\
  125. 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))
  126.  
  127. (defun beginning-of-icon-defun nil "\
  128. 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[     
  129. ]" move looking-at "e"] 4))
  130.  
  131. (defun end-of-icon-defun nil (interactive) (byte-code "Àˆo?…
  132. ÁÂ!ˆÃÄdÅ#ˆÆÂ!ˆÇÈ!‡" [nil forward-char -1 re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" move forward-word forward-line 1] 5))
  133.  
  134. (defun indent-icon-exp nil "\
  135. Indent each line of the Icon grouping following point." (interactive) (byte-code "ÁˆÁC`CÁÁÁÁÁÁÁÁÁÁÁ`Ù  
  136.     ŠÚÛ!)ˆŠÁ‰ˆm?…>?…‰ˆÁ‰ˆ?…Zm…Y҉?…³‰ˆÜ`Ý ˆ`ÁÁ%‰ˆ@‰ˆAA@…ˆAA@ÙY…“AA@‰
  137. ˆÞ8…ß ˆà8ƒ«áÛ!‚¯Ò‰ˆ‚LˆÙX…¾Ò‰ˆƒÇÁ‚â\"…ÔÁ‰
  138. ˆV…íA
  139. AS‰ˆ‚ÕˆW…ÁBÁ
  140. BT‰ˆ‚îˆ
  141. @?… ã
  142. A@†ŠÚä!ˆ`)\"ˆáÛ!ˆåæ!ˆlƒ1Á‚@…:@ÙYƒâ
  143. @fç\"ƒN@‰    ‚šŠèé!‰ ˆgçU‰ ˆê!ˆë ƒ‚ì
  144. @!ˆíi ƒz‚{Ù#‰    ‚™ ƒ”î!ˆï ‰    ‚™@‰    )‚²ð@…¦@[!㉠   \")ˆgñU†¼èò!…Ç    Z‰    ˆgçU…Ö    \\‰    ˆ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))
  145.