[gforth] / gforth / gforth.el  

gforth: gforth/gforth.el

Diff for /gforth/gforth.el between version 1.56 and 1.57

version 1.56, Sat Jan 5 17:42:29 2002 UTC version 1.57, Thu Jan 17 19:26:34 2002 UTC
Line 57 
Line 57 
            (string-to-int (match-string 0 emacs-version)))))             (string-to-int (match-string 0 emacs-version)))))
   
   
   ; todo:
   ;
   
   ; Wörter ordentlich hilighten, die nicht auf Whitespace beginnen ( ..)IF
   ; -- mit aktueller Konzeption nicht möglich??
   ;
   ; Konfiguration über customization groups
   ;
   ; Bereich nur auf Wortanfang/ende ausweiten, wenn Anfang bzw Ende in einem
   ; Wort liegen (?) -- speed!
   ;
   ; 'forth-word' property muss eindeutig sein!
   ;
   ; Forth-Menu
   ;
   ; Interface zu GForth Prozessen (Patches von Michael Scholz)
   ;
   ; Byte-compile-Code rausschmeißen, Compilieren im Makefile über Emacs
   ; batch-Modus
   ;
   ; forth-help Kram rausschmeißen
   ;
   ; XEmacs Kompatibilität? imenu/speedbar -> fume?
   ;
   ; Folding neuschreiben (neue Parser-Informationen benutzen)
   
 ;;; Hilighting and indentation engine                           (dk)  ;;; Hilighting and indentation engine                           (dk)
 ;;;  ;;;
   (require 'font-lock)
   
 (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 199 
Line 226 
   
 (defvar forth-use-objects nil  (defvar forth-use-objects nil
   "*Non-nil makes forth-mode also hilight words from the \"Objects\" package.")    "*Non-nil makes forth-mode also hilight words from the \"Objects\" package.")
 (defvar forth-objects-words nil  (defvar forth-objects-words
   "Hilighting description for words of the \"Objects\" package")  
 (setq forth-objects-words  
       '(((":m") definition-starter (font-lock-keyword-face . 1)        '(((":m") definition-starter (font-lock-keyword-face . 1)
          "[ \t\n]" t name (font-lock-function-name-face . 3))           "[ \t\n]" t name (font-lock-function-name-face . 3))
         (("m:") definition-starter (font-lock-keyword-face . 1))          (("m:") definition-starter (font-lock-keyword-face . 1))
Line 229 
Line 254 
         (("public" "protected" "class" "exitm" "implementation" "interface"          (("public" "protected" "class" "exitm" "implementation" "interface"
           "methods" "end-methods" "this")            "methods" "end-methods" "this")
          non-immediate (font-lock-keyword-face . 2))           non-immediate (font-lock-keyword-face . 2))
         (("object") non-immediate (font-lock-type-face . 2))))      (("object") non-immediate (font-lock-type-face . 2)))
     "Hilighting description for words of the \"Objects\" package")
   
   
 (defvar forth-use-oof nil  (defvar forth-use-oof nil
   "*Non-nil makes forth-mode also hilight words from the \"OOF\" package.")    "*Non-nil makes forth-mode also hilight words from the \"OOF\" package.")
 (defvar forth-oof-words nil  (defvar forth-oof-words
   "Hilighting description for words of the \"OOF\" package")  
 (setq forth-oof-words  
       '((("class") non-immediate (font-lock-keyword-face . 2)        '((("class") non-immediate (font-lock-keyword-face . 2)
          "[ \t\n]" t name (font-lock-type-face . 3))           "[ \t\n]" t name (font-lock-type-face . 3))
         (("var") non-immediate (font-lock-type-face . 2)          (("var") non-immediate (font-lock-type-face . 2)
Line 251 
Line 276 
         (("class;" "how:" "self" "new" "new[]" "definitions" "class?" "with"          (("class;" "how:" "self" "new" "new[]" "definitions" "class?" "with"
           "endwith")            "endwith")
          non-immediate (font-lock-keyword-face . 2))           non-immediate (font-lock-keyword-face . 2))
         (("object") non-immediate (font-lock-type-face . 2))))      (("object") non-immediate (font-lock-type-face . 2)))
     "Hilighting description for words of the \"OOF\" package")
   
 (defvar forth-local-words nil  (defvar forth-local-words nil
   "List of Forth words to prepend to `forth-words'. Should be set by a    "List of Forth words to prepend to `forth-words'. Should be set by a
Line 266 
Line 292 
   
 (defvar forth-compiled-words nil "Compiled representation of `forth-words'.")  (defvar forth-compiled-words nil "Compiled representation of `forth-words'.")
   
   (defvar forth-indent-words nil
     "List of words that have indentation behaviour.
   Each element of `forth-indent-words' should have the form
      (MATCHER INDENT1 INDENT2 &optional TYPE)
   
 ; todo:  MATCHER is either a list of strings to match, or a REGEXP.
 ;     If it's a REGEXP, it should not be surrounded by `\\<` or `\\>`, since
      that'll be done automatically by the search routines.
   
 ; Wörter ordentlich hilighten, die nicht auf Whitespace beginnen ( ..)IF  TYPE might be omitted. If it's specified, the only allowed value is
 ; -- mit aktueller Konzeption nicht möglich??     currently the symbol `non-immediate', meaning that the word will not
 ;     have any effect on indentation inside definitions. (:NONAME is a good
 ; Konfiguration über customization groups     example for this kind of word).
 ;  
 ; Bereich nur auf Wortanfang/ende ausweiten, wenn Anfang bzw Ende in einem  INDENT1 specifies how to indent a word that's located at a line's begin,
 ; Wort liegen (?) -- speed!     following any number of whitespaces.
 ;  
 ; 'forth-word' property muss eindeutig sein!  INDENT2 specifies how to indent words that are not located at a line's begin.
 ;  
 ; Forth-Menu  INDENT1 and INDENT2 are indentation specifications of the form
 ;     (SELF-INDENT . NEXT-INDENT), where SELF-INDENT is a numerical value,
 ; Interface zu GForth Prozessen (Patches von Michael Scholz)     specifying how the matching line and all following lines are to be
 ;     indented, relative to previous lines. NEXT-INDENT specifies how to indent
 ; Byte-compile-Code rausschmeißen, Compilieren im Makefile über Emacs     following lines, relative to the matching line.
 ; batch-Modus  
 ;     Even values of SELF-INDENT and NEXT-INDENT correspond to multiples of
 ; forth-help Kram rausschmeißen     `forth-indent-level'. Odd values get an additional
 ;     `forth-minor-indent-level' added/substracted. Eg a value of -2 indents
 ; XEmacs Kompatibilität? imenu/speedbar -> fume?     1 * forth-indent-level  to the left, wheras 3 indents
 ;     1 * forth-indent-level + forth-minor-indent-level  columns to the right.")
 ; Folding neuschreiben (neue Parser-Informationen benutzen)  
   (setq forth-indent-words
         '((("if" "begin" "do" "?do" "+do" "-do" "u+do"
             "u-do" "?dup-if" "?dup-0=-if" "case" "of" "try"
             "[if]" "[ifdef]" "[ifundef]" "[begin]" "[for]" "[do]" "[?do]")
            (0 . 2) (0 . 2))
           ((":" ":noname" "code" "struct" "m:" ":m" "class" "interface")
            (0 . 2) (0 . 2) non-immediate)
           ("\\S-+%$" (0 . 2) (0 . 0) non-immediate)
           ((";" ";m") (-2 . 0) (0 . -2))
           (("again" "repeat" "then" "endtry" "endcase" "endof"
             "[then]" "[endif]" "[loop]" "[+loop]" "[next]"
             "[until]" "[repeat]" "[again]" "loop")
            (-2 . 0) (0 . -2))
           (("end-code" "end-class" "end-interface" "end-class-noname"
             "end-interface-noname" "end-struct" "class;")
            (-2 . 0) (0 . -2) non-immediate)
           (("protected" "public" "how:") (-1 . 1) (0 . 0) non-immediate)
           (("+loop" "-loop" "until") (-2 . 0) (-2 . 0))
           (("else" "recover" "[else]") (-2 . 2) (0 . 0))
           (("while" "does>" "[while]") (-1 . 1) (0 . 0))
           (("\\g") (-2 . 2) (0 . 0))))
   
   (defvar forth-local-indent-words nil
     "List of Forth words to prepend to `forth-indent-words', when a forth-mode
   buffer is created. Should be set by a Forth source, using a local variables
   list at the end of the file (\"Local Variables: ... forth-local-words: ...
   End:\" construct).")
   
   (defvar forth-custom-indent-words nil
     "List of Forth words to prepend to `forth-indent-words'. Should be set in
    your .emacs.")
   
   (defvar forth-indent-level 4
     "*Indentation of Forth statements.")
   (defvar forth-minor-indent-level 2
     "*Minor indentation of Forth statements.")
   (defvar forth-compiled-indent-words nil)
   
 ;(setq debug-on-error t)  ;(setq debug-on-error t)
   
Line 577 
Line 645 
   "List of words, that define the following word.    "List of words, that define the following word.
 Used for imenu index generation.")  Used for imenu index generation.")
   
   (defvar forth-defining-words-regexp nil
     "Regexp that's generated for matching `forth-defining-words'")
   
 (defun forth-next-definition-starter ()  (defun forth-next-definition-starter ()
   (progn    (progn
Line 600 
Line 670 
           (setq index (cons (cons (match-string 1) (point)) index))))            (setq index (cons (cons (match-string 1) (point)) index))))
     index))      index))
   
 (unwind-protect  ;; top-level require is executed at byte-compile and load time
     (progn  (require 'speedbar nil t)
       (require 'speedbar)  
   ;; this code is executed at load-time only
   (when (require 'speedbar nil t)
       (speedbar-add-supported-extension ".fs")        (speedbar-add-supported-extension ".fs")
       (speedbar-add-supported-extension ".fb")))    (speedbar-add-supported-extension ".fb"))
   
 ;; (require 'profile)  ;; (require 'profile)
 ;; (setq profile-functions-list '(forth-set-word-properties forth-next-known-forth-word forth-update-properties forth-delete-properties forth-get-regexp-branch))  ;; (setq profile-functions-list '(forth-set-word-properties forth-next-known-forth-word forth-update-properties forth-delete-properties forth-get-regexp-branch))
Line 612 
Line 684 
 ;;; Indentation  ;;; Indentation
 ;;;  ;;;
   
 (defvar forth-indent-words nil  
   "List of words that have indentation behaviour.  
 Each element of `forth-indent-words' should have the form  
    (MATCHER INDENT1 INDENT2 &optional TYPE)  
   
 MATCHER is either a list of strings to match, or a REGEXP.  
    If it's a REGEXP, it should not be surrounded by `\\<` or `\\>`, since  
    that'll be done automatically by the search routines.  
   
 TYPE might be omitted. If it's specified, the only allowed value is  
    currently the symbol `non-immediate', meaning that the word will not  
    have any effect on indentation inside definitions. (:NONAME is a good  
    example for this kind of word).  
   
 INDENT1 specifies how to indent a word that's located at a line's begin,  
    following any number of whitespaces.  
   
 INDENT2 specifies how to indent words that are not located at a line's begin.  
   
 INDENT1 and INDENT2 are indentation specifications of the form  
    (SELF-INDENT . NEXT-INDENT), where SELF-INDENT is a numerical value,  
    specifying how the matching line and all following lines are to be  
    indented, relative to previous lines. NEXT-INDENT specifies how to indent  
    following lines, relative to the matching line.  
   
    Even values of SELF-INDENT and NEXT-INDENT correspond to multiples of  
    `forth-indent-level'. Odd values get an additional  
    `forth-minor-indent-level' added/substracted. Eg a value of -2 indents  
    1 * forth-indent-level  to the left, wheras 3 indents  
    1 * forth-indent-level + forth-minor-indent-level  columns to the right.")  
   
 (setq forth-indent-words  
       '((("if" "begin" "do" "?do" "+do" "-do" "u+do"  
           "u-do" "?dup-if" "?dup-0=-if" "case" "of" "try"  
           "[if]" "[ifdef]" "[ifundef]" "[begin]" "[for]" "[do]" "[?do]")  
          (0 . 2) (0 . 2))  
         ((":" ":noname" "code" "struct" "m:" ":m" "class" "interface")  
          (0 . 2) (0 . 2) non-immediate)  
         ("\\S-+%$" (0 . 2) (0 . 0) non-immediate)  
         ((";" ";m") (-2 . 0) (0 . -2))  
         (("again" "repeat" "then" "endtry" "endcase" "endof"  
           "[then]" "[endif]" "[loop]" "[+loop]" "[next]"  
           "[until]" "[repeat]" "[again]" "loop")  
          (-2 . 0) (0 . -2))  
         (("end-code" "end-class" "end-interface" "end-class-noname"  
           "end-interface-noname" "end-struct" "class;")  
          (-2 . 0) (0 . -2) non-immediate)  
         (("protected" "public" "how:") (-1 . 1) (0 . 0) non-immediate)  
         (("+loop" "-loop" "until") (-2 . 0) (-2 . 0))  
         (("else" "recover" "[else]") (-2 . 2) (0 . 0))  
         (("while" "does>" "[while]") (-1 . 1) (0 . 0))  
         (("\\g") (-2 . 2) (0 . 0))))  
   
 (defvar forth-local-indent-words nil  
   "List of Forth words to prepend to `forth-indent-words', when a forth-mode  
 buffer is created. Should be set by a Forth source, using a local variables  
 list at the end of the file (\"Local Variables: ... forth-local-words: ...  
 End:\" construct).")  
   
 (defvar forth-custom-indent-words nil  
   "List of Forth words to prepend to `forth-indent-words'. Should be set in  
  your .emacs.")  
   
 (defvar forth-indent-level 4  
   "*Indentation of Forth statements.")  
 (defvar forth-minor-indent-level 2  
   "*Minor indentation of Forth statements.")  
 (defvar forth-compiled-indent-words nil)  
   
 ;; Return, whether `pos' is the first forth word on its line  ;; Return, whether `pos' is the first forth word on its line
 (defun forth-first-word-on-line-p (pos)  (defun forth-first-word-on-line-p (pos)
   (save-excursion    (save-excursion
Line 945 
Line 948 
   "Non-nil means to warn about lines that are longer than 64 characters")    "Non-nil means to warn about lines that are longer than 64 characters")
   
 (defvar forth-screen-marker nil)  (defvar forth-screen-marker nil)
   (defvar forth-screen-number-string nil)
   
 (defun forth-update-show-screen ()  (defun forth-update-show-screen ()
   "If `forth-show-screen' is non-nil, put overlay arrow to start of screen,    "If `forth-show-screen' is non-nil, put overlay arrow to start of screen,
Line 1009 
Line 1013 
 (define-key forth-mode-map "\e." 'forth-find-tag)  (define-key forth-mode-map "\e." 'forth-find-tag)
   
 ;setup for C-h C-i to work  ;setup for C-h C-i to work
 (if (fboundp 'info-lookup-add-help)  (require 'info-look nil t)
   (when (require 'info-look nil t)
     (info-lookup-add-help      (info-lookup-add-help
      :topic 'symbol       :topic 'symbol
      :mode 'forth-mode       :mode 'forth-mode
Line 1018 
Line 1023 
      :ignore-case t       :ignore-case t
      :doc-spec '(("(gforth)Name Index" nil "`" "'  "))))       :doc-spec '(("(gforth)Name Index" nil "`" "'  "))))
   
 (load "etags")  (require 'etags)
   
 (defun forth-find-tag (tagname &optional next-p regexp-p)  (defun forth-find-tag (tagname &optional next-p regexp-p)
   (interactive (find-tag-interactive "Find tag: "))    (interactive (find-tag-interactive "Find tag: "))
Line 1067 
Line 1072 
   (setq comment-column 40)    (setq comment-column 40)
   (make-local-variable 'comment-start-skip)    (make-local-variable 'comment-start-skip)
   (setq comment-start-skip "\\ ")    (setq comment-start-skip "\\ ")
   (make-local-variable 'comment-indent-hook)    (make-local-variable 'comment-indent-function)
   (setq comment-indent-hook 'forth-comment-indent)    (setq comment-indent-function 'forth-comment-indent)
   (make-local-variable 'parse-sexp-ignore-comments)    (make-local-variable 'parse-sexp-ignore-comments)
   (setq parse-sexp-ignore-comments t)    (setq parse-sexp-ignore-comments t)
   (setq case-fold-search t)    (setq case-fold-search t)
Line 1779 
Line 1784 
   
 (define-key forth-mode-map "\C-x\C-e" 'compile)  (define-key forth-mode-map "\C-x\C-e" 'compile)
 (define-key forth-mode-map "\C-x\C-n" 'next-error)  (define-key forth-mode-map "\C-x\C-n" 'next-error)
 (require 'compile "compile")  (require 'compile)
   
 (defvar forth-compile-command "gforth ")  (defvar forth-compile-command "gforth ")
 ;(defvar forth-compilation-window-percent-height 30)  ;(defvar forth-compilation-window-percent-height 30)
Line 1846 
Line 1851 
                 ((looking-at "\\\\G")                  ((looking-at "\\\\G")
                         2)                          2)
                 ((looking-at "[ \t]+\\\\")                  ((looking-at "[ \t]+\\\\")
                         3))           3)))
 )  
   
 (defun fold-f  ()  (defun fold-f  ()
    (interactive)     (interactive)
Line 1862 
Line 1866 
    (define-key outline-minor-mode-map '(shift up) 'hide-sublevels)     (define-key outline-minor-mode-map '(shift up) 'hide-sublevels)
    (define-key outline-minor-mode-map '(shift right) 'show-children)     (define-key outline-minor-mode-map '(shift right) 'show-children)
    (define-key outline-minor-mode-map '(shift left) 'hide-subtree)     (define-key outline-minor-mode-map '(shift left) 'hide-subtree)
    (define-key outline-minor-mode-map '(shift down) 'show-subtree)     (define-key outline-minor-mode-map '(shift down) 'show-subtree))
   
 )  
   
 ;;(define-key global-map '(shift up) 'fold-f)  ;;(define-key global-map '(shift up) 'fold-f)
   
Line 1884 
Line 1886 
 ;       (define-key global-map '(shift button3) 'mouse-function-menu)  ;       (define-key global-map '(shift button3) 'mouse-function-menu)
 ))  ))
   
   (provide 'forth-mode)
   
 ;;; gforth.el ends here  ;;; gforth.el ends here


Generate output suitable for use with a patch program
Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help