| |
|
| ;;; imenu support |
;;; imenu support |
| ;;; |
;;; |
| |
(defvar forth-defining-words |
| |
'("VARIABLE" "CONSTANT" "2VARIABLE" "2CONSTANT" "FVARIABLE" "FCONSTANT" |
| |
"USER" "VALUE" "field" "end-struct" "VOCABULARY" "CREATE" ":" "CODE" |
| |
"DEFER" "ALIAS") |
| |
"List of words, that define the following word.\ |
| |
Used for imenu index generation") |
| |
|
| |
|
| (defun forth-next-definition-starter () |
(defun forth-next-definition-starter () |
| (progn |
(progn |
| (let* ((regexp (car forth-compiled-defining-words)) |
(let* ((pos (re-search-forward forth-defining-words-regexp (point-max) t))) |
| (pos (re-search-forward regexp (point-max) t))) |
|
| (message "regexp: %s pos:%s" regexp pos) |
|
| (if pos |
(if pos |
| (if (or (text-property-not-all (match-beginning 0) (match-end 0) |
(if (or (text-property-not-all (match-beginning 0) (match-end 0) |
| 'forth-parsed nil) |
'forth-parsed nil) |
| nil)))) |
nil)))) |
| |
|
| (defun forth-create-index () |
(defun forth-create-index () |
| (let* ((defwords |
(let* ((forth-defining-words-regexp |
| (forth-filter (lambda (word) |
(concat "\\<\\(" (regexp-opt forth-defining-words) "\\)\\>")) |
| (and (eq (nth 1 word) 'definition-starter) |
|
| (> (length word) 3))) |
|
| forth-words)) |
|
| (forth-compiled-defining-words (forth-compile-wordlist defwords)) |
|
| (index nil)) |
(index nil)) |
| (goto-char (point-min)) |
(goto-char (point-min)) |
| (while (forth-next-definition-starter) |
(while (forth-next-definition-starter) |
| (if (looking-at "[ \t]*\\([^ \t\n]+\\)") |
(if (looking-at "[ \t]*\\([^ \t\n]+\\)") |
| (setq index (cons (cons (match-string 1) (point)) index)))) |
(setq index (cons (cons (match-string 1) (point)) index)))) |
| (message "index: %s" index) |
|
| index)) |
index)) |
| |
|
| |
(require 'speedbar) |
| (speedbar-add-supported-extension ".fs") |
(speedbar-add-supported-extension ".fs") |
| (speedbar-add-supported-extension ".fb") |
(speedbar-add-supported-extension ".fb") |
| |
|
| |
|
| (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: ")) |
| |
; (when (not regexp-p) |
| |
; (setq tagname (concat "^\\(" (regexp-opt (list tagname)) |
| |
; "\\)$")) |
| |
; (setq regexp-p t)) |
| (switch-to-buffer |
(switch-to-buffer |
| (find-tag-noselect (concat " " tagname " ") next-p regexp-p))) |
(find-tag-noselect (concat " " tagname " ") next-p regexp-p))) |
| |
|