version 1.61, 2002/03/23 13:38:04
|
version 1.64, 2002/12/21 17:27:13
|
Line 136
|
Line 136
|
; |
; |
; Folding neuschreiben (neue Parser-Informationen benutzen) |
; Folding neuschreiben (neue Parser-Informationen benutzen) |
|
|
;;; Hilighting and indentation engine (dk) |
;;; Motion-hooking (dk) |
|
;;; |
|
(defun forth-idle-function () |
|
"Function that is called when Emacs is idle to detect cursor motion |
|
in forth-block-mode buffers (which is mainly used for screen number |
|
display in). Currently ignores forth-mode buffers but that may change |
|
in the future." |
|
(if (eq major-mode 'forth-block-mode) |
|
(forth-check-motion))) |
|
|
|
(defvar forth-idle-function-timer nil |
|
"Timer that runs `forth-idle-function' or nil if no timer installed.") |
|
|
|
(defun forth-install-motion-hook () |
|
"Install the motion-hooking mechanism. Currently uses idle timers |
|
but might be transparently changed in the future." |
|
(unless forth-idle-function-timer |
|
;; install idle function only once (first time forth-mode is used) |
|
(setq forth-idle-function-timer |
|
(run-with-idle-timer .05 t 'forth-idle-function)))) |
|
|
|
(defvar forth-was-point nil) |
|
|
|
(defun forth-check-motion () |
|
"Run `forth-motion-hooks', if `point' changed since last call. This |
|
used to be called via `post-command-hook' but uses idle timers now as |
|
users complaint about lagging performance." |
|
(when (or (eq forth-was-point nil) (/= forth-was-point (point))) |
|
(setq forth-was-point (point)) |
|
(run-hooks 'forth-motion-hooks))) |
|
|
|
|
|
;;; Hilighting and indentation engine (dk) |
;;; |
;;; |
(defvar forth-disable-parser nil |
(defvar forth-disable-parser nil |
"*Non-nil means to disable on-the-fly parsing of Forth-code. |
"*Non-nil means to disable on-the-fly parsing of Forth-code. |
Line 234 PARSED-TYPE specifies what kind of text
|
Line 266 PARSED-TYPE specifies what kind of text
|
"[ \t\n]" t name (font-lock-function-name-face . 3)) |
"[ \t\n]" t name (font-lock-function-name-face . 3)) |
(("if" "begin" "ahead" "do" "?do" "+do" "u+do" "-do" "u-do" "for" |
(("if" "begin" "ahead" "do" "?do" "+do" "u+do" "-do" "u-do" "for" |
"case" "of" "?dup-if" "?dup-0=-if" "then" "endif" "until" |
"case" "of" "?dup-if" "?dup-0=-if" "then" "endif" "until" |
"repeat" "again" |
"repeat" "again" "leave" "?leave" |
"loop" "+loop" "-loop" "next" "endcase" "endof" "else" "while" "try" |
"loop" "+loop" "-loop" "next" "endcase" "endof" "else" "while" "try" |
"recover" "endtry" "assert(" "assert0(" "assert1(" "assert2(" |
"recover" "endtry" "assert(" "assert0(" "assert1(" "assert2(" |
"assert3(" ")" "<interpretation" "<compilation" "interpretation>" |
"assert3(" ")" "<interpretation" "<compilation" "interpretation>" |
Line 358 TYPE might be omitted. If it's specified
|
Line 390 TYPE might be omitted. If it's specified
|
have any effect on indentation inside definitions. (:NONAME is a good |
have any effect on indentation inside definitions. (:NONAME is a good |
example for this kind of word). |
example for this kind of word). |
|
|
INDENT1 specifies how to indent a word that's located at a line's begin, |
INDENT1 specifies how to indent a word that's located at the beginning |
following any number of whitespaces. |
of a line, following any number of whitespaces. |
|
|
INDENT2 specifies how to indent words that are not located at a line's begin. |
INDENT2 specifies how to indent words that are not located at the |
|
beginning of a line. |
|
|
INDENT1 and INDENT2 are indentation specifications of the form |
INDENT1 and INDENT2 are indentation specifications of the form |
(SELF-INDENT . NEXT-INDENT), where SELF-INDENT is a numerical value, |
(SELF-INDENT . NEXT-INDENT), where SELF-INDENT is a numerical value, |
Line 384 INDENT1 and INDENT2 are indentation spec
|
Line 417 INDENT1 and INDENT2 are indentation spec
|
(0 . 2) (0 . 2) non-immediate) |
(0 . 2) (0 . 2) non-immediate) |
("\\S-+%$" (0 . 2) (0 . 0) non-immediate) |
("\\S-+%$" (0 . 2) (0 . 0) non-immediate) |
((";" ";m") (-2 . 0) (0 . -2)) |
((";" ";m") (-2 . 0) (0 . -2)) |
(("again" "repeat" "then" "endif" "endtry" "endcase" "endof" |
(("again" "then" "endif" "endtry" "endcase" "endof" |
"[then]" "[endif]" "[loop]" "[+loop]" "[next]" |
"[then]" "[endif]" "[loop]" "[+loop]" "[next]" |
"[until]" "[repeat]" "[again]" "loop") |
"[until]" "[again]" "loop") |
(-2 . 0) (0 . -2)) |
(-2 . 0) (0 . -2)) |
(("end-code" "end-class" "end-interface" "end-class-noname" |
(("end-code" "end-class" "end-interface" "end-class-noname" |
"end-interface-noname" "end-struct" "class;") |
"end-interface-noname" "end-struct" "class;") |
Line 394 INDENT1 and INDENT2 are indentation spec
|
Line 427 INDENT1 and INDENT2 are indentation spec
|
(("protected" "public" "how:") (-1 . 1) (0 . 0) non-immediate) |
(("protected" "public" "how:") (-1 . 1) (0 . 0) non-immediate) |
(("+loop" "-loop" "until") (-2 . 0) (-2 . 0)) |
(("+loop" "-loop" "until") (-2 . 0) (-2 . 0)) |
(("else" "recover" "[else]") (-2 . 2) (0 . 0)) |
(("else" "recover" "[else]") (-2 . 2) (0 . 0)) |
(("while" "does>" "[while]") (-1 . 1) (0 . 0)) |
(("does>") (-1 . 1) (0 . 0)) |
|
(("while" "[while]") (-2 . 4) (0 . 2)) |
|
(("repeat" "[repeat]") (-4 . 0) (0 . -4)) |
(("\\g") (-2 . 2) (0 . 0)))) |
(("\\g") (-2 . 2) (0 . 0)))) |
|
|
(defvar forth-local-indent-words nil |
(defvar forth-local-indent-words nil |
Line 876 Used for imenu index generation.")
|
Line 911 Used for imenu index generation.")
|
(forth-newline-remove-trailing) |
(forth-newline-remove-trailing) |
(indent-according-to-mode)) |
(indent-according-to-mode)) |
|
|
;;; end hilighting/indentation |
|
|
|
;;; Block file encoding/decoding (dk) |
;;; Block file encoding/decoding (dk) |
;;; |
;;; |
Line 1035 exceeds 64 characters."
|
Line 1069 exceeds 64 characters."
|
|
|
(add-hook 'forth-motion-hooks 'forth-update-warn-long-lines) |
(add-hook 'forth-motion-hooks 'forth-update-warn-long-lines) |
|
|
(defvar forth-was-point nil) |
|
(defun forth-check-motion () |
|
"Run `forth-motion-hooks', if `point' changed since last call." |
|
(when (or (eq forth-was-point nil) (/= forth-was-point (point))) |
|
(setq forth-was-point (point)) |
|
(run-hooks 'forth-motion-hooks))) |
|
|
|
;;; End block file editing |
;;; End block file editing |
|
|
|
|
Line 1117 exceeds 64 characters."
|
Line 1144 exceeds 64 characters."
|
(setq char (1+ char)))) |
(setq char (1+ char)))) |
)) |
)) |
|
|
|
|
(defun forth-mode-variables () |
(defun forth-mode-variables () |
(set-syntax-table forth-mode-syntax-table) |
(set-syntax-table forth-mode-syntax-table) |
(setq local-abbrev-table forth-mode-abbrev-table) |
(setq local-abbrev-table forth-mode-abbrev-table) |
Line 1149 exceeds 64 characters."
|
Line 1175 exceeds 64 characters."
|
(make-local-variable 'forth-compiled-indent-words) |
(make-local-variable 'forth-compiled-indent-words) |
(make-local-variable 'forth-hilight-level) |
(make-local-variable 'forth-hilight-level) |
(make-local-variable 'after-change-functions) |
(make-local-variable 'after-change-functions) |
(make-local-variable 'post-command-hook) |
|
(make-local-variable 'forth-show-screen) |
(make-local-variable 'forth-show-screen) |
(make-local-variable 'forth-screen-marker) |
(make-local-variable 'forth-screen-marker) |
(make-local-variable 'forth-warn-long-lines) |
(make-local-variable 'forth-warn-long-lines) |
Line 1158 exceeds 64 characters."
|
Line 1183 exceeds 64 characters."
|
(make-local-variable 'forth-use-objects) |
(make-local-variable 'forth-use-objects) |
(setq forth-screen-marker (copy-marker 0)) |
(setq forth-screen-marker (copy-marker 0)) |
(add-hook 'after-change-functions 'forth-change-function) |
(add-hook 'after-change-functions 'forth-change-function) |
(add-hook 'post-command-hook 'forth-check-motion) |
(if (and forth-jit-parser (>= emacs-major-version 21)) |
(if (>= emacs-major-version 21) |
|
(add-hook 'fontification-functions 'forth-fontification-function)) |
(add-hook 'fontification-functions 'forth-fontification-function)) |
(setq imenu-create-index-function 'forth-create-index)) |
(setq imenu-create-index-function 'forth-create-index)) |
|
|
Line 1274 Variables controling documentation searc
|
Line 1298 Variables controling documentation searc
|
(use-local-map forth-mode-map) |
(use-local-map forth-mode-map) |
(setq mode-name "Forth") |
(setq mode-name "Forth") |
(setq major-mode 'forth-mode) |
(setq major-mode 'forth-mode) |
|
(forth-install-motion-hook) |
;; convert buffer contents from block file format, if necessary |
;; convert buffer contents from block file format, if necessary |
(when (forth-detect-block-file-p) |
(when (forth-detect-block-file-p) |
(widen) |
(widen) |