! Evaluation status:
-TUPLE: fuel-status in use ds? restarts ;
+TUPLE: fuel-status in use restarts ;
SYMBOL: fuel-status-stack
V{ } clone fuel-status-stack set-global
f fuel-eval-res-flag set-global ; inline
: push-fuel-status ( -- )
- in get use get clone display-stacks? get restarts get-global clone
+ in get use get clone restarts get-global clone
fuel-status boa
fuel-status-stack get push ;
fuel-status-stack get pop {
[ in>> in set ]
[ use>> clone use set ]
- [ ds?>> display-stacks? swap [ on ] [ off ] if ]
[
restarts>> fuel-eval-restartable? [ drop ] [
clone restarts set-global
error get
fuel-eval-result get-global
fuel-eval-output get-global
- 3array fuel-pprint flush nl "EOT:" write ;
+ 3array fuel-pprint flush nl "<~FUEL~>" write nl flush ;
: fuel-forget-error ( -- ) f error set-global ; inline
: fuel-forget-result ( -- ) f fuel-eval-result set-global ; inline
: (fuel-begin-eval) ( -- )
push-fuel-status
- display-stacks? off
fuel-forget-error
fuel-forget-result
fuel-forget-output ;
: (fuel-end-eval) ( quot -- )
- with-string-writer fuel-eval-output set-global
- fuel-retort pop-fuel-status ; inline
+ with-string-writer fuel-eval-output set-global fuel-retort
+ pop-fuel-status ; inline
: (fuel-eval) ( lines -- )
[ [ parse-lines ] with-compilation-unit call ] curry
: fuel-end-eval ( -- ) [ ] (fuel-end-eval) ; inline
+: fuel-run-file ( path -- ) run-file ; inline
+
+! Edit locations
+
: fuel-get-edit-location ( defspec -- )
where [
first2 [ (normalize-path) ] dip 2array fuel-eval-set-result
: fuel-get-vocab-location ( vocab -- )
>vocab-link fuel-get-edit-location ; inline
+! Completion support
+
+: fuel-filter-prefix ( seq prefix -- seq )
+ [ drop-prefix nip length 0 = ] curry filter prune ; inline
+
: (fuel-get-vocabs) ( -- seq )
all-vocabs-seq [ vocab-name ] map ; inline
: fuel-get-vocabs ( -- )
(fuel-get-vocabs) fuel-eval-set-result ; inline
+: fuel-get-vocabs/prefix ( prefix -- )
+ (fuel-get-vocabs) swap fuel-filter-prefix fuel-eval-set-result ; inline
+
+: fuel-vocab-summary ( name -- )
+ >vocab-link summary fuel-eval-set-result ; inline
+
MEMO: (fuel-vocab-words) ( name -- seq )
>vocab-link words [ name>> ] map ;
: (fuel-get-words) ( prefix names/f -- seq )
[ fuel-vocabs-words ] [ fuel-current-words ] if* natural-sort
- swap [ drop-prefix nip length 0 = ] curry filter ;
+ swap fuel-filter-prefix ;
: fuel-get-words ( prefix names -- )
(fuel-get-words) fuel-eval-set-result ; inline
-: fuel-run-file ( path -- ) run-file ; inline
+
+! -run=fuel support
: fuel-startup ( -- ) "listener" run-file ; inline
- RET : help for word at point
- f/b : next/previous page
- SPC/S-SPC : scroll up/down
+ - TAB/S-TAB : next/previous headline
+ - C-cz : switch to listener
- q: bury buffer
:type 'hook
:group 'factor-mode)
-\f
-;;; Faces:
-
-(fuel-font-lock--define-faces
- factor-font-lock font-lock factor-mode
- ((comment comment "comments")
- (constructor type "constructors (<foo>)")
- (declaration keyword "declaration words")
- (parsing-word keyword "parsing words")
- (setter-word function-name "setter words (>>foo)")
- (stack-effect comment "stack effect specifications")
- (string string "strings")
- (symbol variable-name "name of symbol being defined")
- (type-name type "type names")
- (vocabulary-name constant "vocabulary names")
- (word function-name "word, generic or method being defined")))
-
\f
;;; Syntax table:
(autoload 'run-factor "fuel-listener.el"
"Start a Factor listener, or switch to a running one." t)
+(autoload 'switch-to-factor "fuel-listener.el"
+ "Start a Factor listener, or switch to a running one." t)
+
(autoload 'fuel-autodoc-mode "fuel-help.el"
"Minor mode showing in the minibuffer a synopsis of Factor word at point."
t)
(when (equal item (ring-ref ring ind))
(throw 'found ind)))))))
+(when (not (fboundp 'completion-table-dynamic))
+ (defun completion-table-dynamic (fun)
+ (lexical-let ((fun fun))
+ (lambda (string pred action)
+ (with-current-buffer (let ((win (minibuffer-selected-window)))
+ (if (window-live-p win) (window-buffer win)
+ (current-buffer)))
+ (complete-with-action action (funcall fun string) string pred))))))
+
\f
;;; Utilities
(defsubst empty-string-p (str) (equal str ""))
+(defun fuel--string-prefix-p (prefix str)
+ (and (>= (length str) (length prefix))
+ (string= (substring-no-properties 0 (length prefix) str)
+ (substring-no-properties prefix))))
+
(defun fuel--respecting-message (format &rest format-args)
"Display TEXT as a message, without hiding any minibuffer contents."
(let ((text (format " [%s]" (apply #'format format format-args))))
(fuel-eval--send/wait '(:fuel* (fuel-get-vocabs) "fuel" (:array)))))))
fuel-completion--vocabs)
+(defsubst fuel-completion--vocab-list (prefix)
+ (fuel-eval--retort-result
+ (fuel-eval--send/wait `(:fuel* (,prefix fuel-get-vocabs/prefix) t t))))
+
(defun fuel-completion--words (prefix vocabs)
(let ((vs (if vocabs (cons :array vocabs) 'f))
(us (or vocabs 't)))
If this window is no longer active or displaying the completions
buffer then we can ignore `fuel-completion--window-cfg'."))
-(defun fuel-completion--maybe-save-window-configuration ()
+(defun fuel-completion--save-window-cfg ()
"Maybe save the current window configuration.
Return true if the configuration was saved."
(unless (or fuel-completion--window-cfg
(defun fuel-completion--delay-restoration ()
(add-hook 'pre-command-hook
- 'fuel-completion--maybe-restore-window-configuration
+ 'fuel-completion--maybe-restore-window-cfg
nil t))
-(defun fuel-completion--forget-window-configuration ()
+(defun fuel-completion--forget-window-cfg ()
(setq fuel-completion--window-cfg nil)
(setq fuel-completion--completions-window nil))
-(defun fuel-completion--restore-window-configuration ()
+(defun fuel-completion--restore-window-cfg ()
"Restore the window config if available."
(remove-hook 'pre-command-hook
- 'fuel-completion--maybe-restore-window-configuration)
+ 'fuel-completion--maybe-restore-window-cfg)
(when (and fuel-completion--window-cfg
(fuel-completion--window-active-p))
(save-excursion
(when (buffer-live-p fuel-completion--comp-buffer)
(kill-buffer fuel-completion--comp-buffer))))
-(defun fuel-completion--maybe-restore-window-configuration ()
+(defun fuel-completion--maybe-restore-window-cfg ()
"Restore the window configuration, if the following command
terminates a current completion."
(remove-hook 'pre-command-hook
- 'fuel-completion--maybe-restore-window-configuration)
+ 'fuel-completion--maybe-restore-window-cfg)
(condition-case err
(cond ((find last-command-char "()\"'`,# \r\n:")
- (fuel-completion--restore-window-configuration))
+ (fuel-completion--restore-window-cfg))
((not (fuel-completion--window-active-p))
- (fuel-completion--forget-window-configuration))
+ (fuel-completion--forget-window-cfg))
(t (fuel-completion--delay-restoration)))
(error
;; Because this is called on the pre-command-hook, we mustn't let
;; errors propagate.
- (message "Error in fuel-completion--restore-window-configuration: %S" err))))
+ (message "Error in fuel-completion--restore-window-cfg: %S" err))))
(defun fuel-completion--window-active-p ()
"Is the completion window currently active?"
fuel-completion--comp-buffer)))
(defun fuel-completion--display-comp-list (completions base)
- (let ((savedp (fuel-completion--maybe-save-window-configuration)))
+ (let ((savedp (fuel-completion--save-window-cfg)))
(with-output-to-temp-buffer fuel-completion--comp-buffer
(display-completion-list completions base)
(let ((offset (- (point) 1 (length base))))
(defvar fuel-completion--all-words-list-func
(completion-table-dynamic 'fuel-completion--all-words-list))
-(defun fuel-completion--complete (prefix)
- (let* ((words (fuel-completion--word-list prefix))
+(defun fuel-completion--complete (prefix vocabs)
+ (let* ((words (if vocabs
+ (fuel-completion--vocabs)
+ (fuel-completion--word-list prefix)))
(completions (all-completions prefix words))
(partial (try-completion prefix words))
(partial (if (eq partial t) prefix partial)))
(cons completions partial)))
-(defsubst fuel-completion--read-word (prompt &optional default history all)
+(defun fuel-completion--read-word (prompt &optional default history all)
(completing-read prompt
(if all fuel-completion--all-words-list-func
fuel-completion--word-list-func)
(let* ((end (point))
(beg (fuel-syntax--symbol-start))
(prefix (buffer-substring-no-properties beg end))
- (result (fuel-completion--complete prefix))
+ (result (fuel-completion--complete prefix (fuel-syntax--in-using)))
(completions (car result))
(partial (cdr result)))
(cond ((null completions)
(fuel--respecting-message "Can't find completion for %S" prefix)
- (fuel-completion--restore-window-configuration))
+ (fuel-completion--restore-window-cfg))
(t (insert-and-inherit (substring partial (length prefix)))
(cond ((= (length completions) 1)
(fuel--respecting-message "Sole completion")
- (fuel-completion--restore-window-configuration))
+ (fuel-completion--restore-window-cfg))
(t (fuel--respecting-message "Complete but not unique")
(fuel-completion--display-or-scroll completions
partial)))))))
(cons :id (random))
(cons :string str)
(cons :continuation cont)
- (cons :buffer (or sender-buffer (current-buffer)))
- (cons :output "")))
+ (cons :buffer (or sender-buffer (current-buffer)))))
(defsubst fuel-con--request-p (req)
(and (listp req) (eq (car req) :fuel-connection-request)))
(defsubst fuel-con--request-buffer (req)
(cdr (assoc :buffer req)))
-(defun fuel-con--request-output (req &optional suffix)
- (let ((cell (assoc :output req)))
- (when suffix (setcdr cell (concat (cdr cell) suffix)))
- (cdr cell)))
-
(defsubst fuel-con--request-deactivate (req)
(setcdr (assoc :continuation req) nil))
(fuel-con--connection-start-timer conn))))
(defconst fuel-con--prompt-regex "( .+ ) ")
-(defconst fuel-con--eot-marker "EOT:")
-(defconst fuel-con--init-stanza (format "USE: fuel %S write" fuel-con--eot-marker))
+(defconst fuel-con--eot-marker "<~FUEL~>")
+(defconst fuel-con--init-stanza "USE: fuel f fuel-eval")
(defconst fuel-con--comint-finished-regex
- (format "%s%s" fuel-con--eot-marker fuel-con--prompt-regex))
+ (format "^%s$" fuel-con--eot-marker))
(defun fuel-con--setup-comint ()
- (comint-redirect-cleanup)
+ (set (make-local-variable 'comint-redirect-insert-matching-regexp) t)
(add-hook 'comint-redirect-filter-functions
- 'fuel-con--comint-redirect-filter t t)
+ 'fuel-con--comint-preoutput-filter nil t)
(add-hook 'comint-redirect-hook
'fuel-con--comint-redirect-hook nil t))
(defadvice comint-redirect-setup (after fuel-con--advice activate)
(setq comint-redirect-finished-regexp fuel-con--comint-finished-regex))
+(defun fuel-con--comint-preoutput-filter (str)
+ (when (string-match fuel-con--comint-finished-regex str)
+ (setq comint-redirect-finished-regexp fuel-con--prompt-regex))
+ str)
+
\f
;;; Requests handling:
+(defsubst fuel-con--comint-buffer ()
+ (get-buffer-create " *fuel connection retort*"))
+
+(defsubst fuel-con--comint-buffer-form ()
+ (with-current-buffer (fuel-con--comint-buffer)
+ (goto-char (point-min))
+ (condition-case nil
+ (read (current-buffer))
+ (error (list 'fuel-con-error (buffer-string))))))
+
(defun fuel-con--process-next (con)
(when (not (fuel-con--connection-current-request con))
(let* ((buffer (fuel-con--connection-buffer con))
(req (fuel-con--connection-pop-request con))
- (str (and req (fuel-con--request-string req))))
+ (str (and req (fuel-con--request-string req)))
+ (cbuf (with-current-buffer (fuel-con--comint-buffer)
+ (erase-buffer)
+ (current-buffer))))
(if (not (buffer-live-p buffer))
(fuel-con--connection-cancel-timer con)
(when (and buffer req str)
(set-buffer buffer)
(fuel-log--info "<%s>: %s" (fuel-con--request-id req) str)
- (comint-redirect-send-command (format "%s" str)
- (fuel-log--buffer) nil t))))))
+ (comint-redirect-send-command (format "%s" str) cbuf nil t))))))
(defun fuel-con--process-completed-request (req)
- (let ((str (fuel-con--request-output req))
- (cont (fuel-con--request-continuation req))
+ (let ((cont (fuel-con--request-continuation req))
(id (fuel-con--request-id req))
(rstr (fuel-con--request-string req))
(buffer (fuel-con--request-buffer req)))
(if (not cont)
(fuel-log--warn "<%s> Droping result for request %S (%s)"
- id rstr str)
+ id rstr req)
(condition-case cerr
(with-current-buffer (or buffer (current-buffer))
- (funcall cont str)
- (fuel-log--info "<%s>: processed\n\t%s" id str))
- (error (fuel-log--error "<%s>: continuation failed %S \n\t%s"
- id rstr cerr))))))
-
-(defvar fuel-con--debug-comint-p nil)
-
-(defun fuel-con--comint-redirect-filter (str)
- (if (not fuel-con--connection)
- (fuel-log--error "No connection in buffer (%s)" str)
- (let ((req (fuel-con--connection-current-request fuel-con--connection)))
- (if (not req) (fuel-log--error "No current request (%s)" str)
- (fuel-con--request-output req str)
- (fuel-log--info "<%s>: in progress" (fuel-con--request-id req)))))
- (if fuel-con--debug-comint-p (fuel--shorten-str str 256) ""))
+ (funcall cont (fuel-con--comint-buffer-form))
+ (fuel-log--info "<%s>: processed\n\t%s" id req))
+ (error (fuel-log--error
+ "<%s>: continuation failed %S \n\t%s" id rstr cerr))))))
(defun fuel-con--comint-redirect-hook ()
(if (not fuel-con--connection)
(defsubst factor--fuel-in (in)
(cond ((null in) :in)
- ((eq in t) "fuel-scratchpad")
+ ((eq in 'f) 'f)
+ ((eq in 't) "fuel-scratchpad")
((stringp in) in)
(t (error "Invalid 'in' (%s)" in))))
(defsubst fuel-eval--retort-result (ret) (nth 1 ret))
(defsubst fuel-eval--retort-output (ret) (nth 2 ret))
-(defsubst fuel-eval--retort-p (ret) (listp ret))
+(defsubst fuel-eval--retort-p (ret)
+ (and (listp ret) (= 3 (length ret))))
(defsubst fuel-eval--make-parse-error-retort (str)
(fuel-eval--retort-make (cons 'fuel-parse-retort-error str) nil))
-(defun fuel-eval--parse-retort (str)
- (save-current-buffer
- (condition-case nil
- (let ((ret (car (read-from-string str))))
- (if (fuel-eval--retort-p ret) ret (error)))
- (error (fuel-eval--make-parse-error-retort str)))))
+(defun fuel-eval--parse-retort (ret)
+ (if (fuel-eval--retort-p ret) ret
+ (fuel-eval--make-parse-error-retort ret)))
(defsubst fuel-eval--error-name (err) (car err))
;;; Code:
-(require 'fuel-base)
(require 'fuel-syntax)
+(require 'fuel-base)
(require 'font-lock)
',faces)))
(,setup))))
+(fuel-font-lock--define-faces
+ factor-font-lock font-lock factor-mode
+ ((comment comment "comments")
+ (constructor type "constructors (<foo>)")
+ (declaration keyword "declaration words")
+ (parsing-word keyword "parsing words")
+ (setter-word function-name "setter words (>>foo)")
+ (getter-word function-name "getter words (foo>>)")
+ (stack-effect comment "stack effect specifications")
+ (string string "strings")
+ (symbol variable-name "name of symbol being defined")
+ (type-name type "type names")
+ (vocabulary-name constant "vocabulary names")
+ (word function-name "word, generic or method being defined")))
+
\f
;;; Font lock:
(2 'factor-font-lock-word))
(,fuel-syntax--parent-type-regex 1 'factor-font-lock-type-name)
(,fuel-syntax--constructor-regex . 'factor-font-lock-constructor)
- (,fuel-syntax--setter-regex . 'factor-font-lock-setter-word)
+ (,fuel-syntax--setter-regex 2 'factor-font-lock-setter-word)
+ (,fuel-syntax--getter-regex 2 'factor-font-lock-getter-word)
(,fuel-syntax--symbol-definition-regex 2 'factor-font-lock-symbol)
(,fuel-syntax--use-line-regex 1 'factor-font-lock-vocabulary-name))
"Font lock keywords definition for Factor mode.")
(let ((word (or word (fuel-syntax-symbol-at-point)))
(fuel-log--inhibit-p t))
(when word
- (let* ((cmd `(:fuel* (((:quote ,word) synopsis :get)) t))
- (ret (fuel-eval--send/wait cmd 20)))
- (when (and ret (not (fuel-eval--retort-error ret)))
+ (let* ((cmd (if (fuel-syntax--in-using)
+ `(:fuel* (,word fuel-vocab-summary) t t)
+ `(:fuel* (((:quote ,word) synopsis :get)) t)))
+ (ret (fuel-eval--send/wait cmd 20))
+ (res (fuel-eval--retort-result ret)))
+ (when (and ret (not (fuel-eval--retort-error ret)) (stringp res))
(if fuel-help-minibuffer-font-lock
- (fuel-help--font-lock-str (fuel-eval--retort-result ret))
- (fuel-eval--retort-result ret)))))))
+ (fuel-help--font-lock-str res)
+ res))))))
(make-variable-buffer-local
(defvar fuel-autodoc-mode-string " A"
fuel-help-always-ask))
(def (if ask (fuel-completion--read-word prompt
def
- 'fuel-help--prompt-history)
+ 'fuel-help--prompt-history
+ t)
def))
(cmd `(:fuel* ((:quote ,def) ,(if see 'see 'help)) t)))
(message "Looking up '%s' ..." def)
(when (re-search-forward (format "^%s" def) nil t)
(beginning-of-line)
(kill-region (point-min) (point))
- (next-line)
- (open-line 1)
(fuel-help--history-push (cons def (buffer-string)))))
(set-buffer-modified-p nil)
(pop-to-buffer hb)
(goto-char (point-min))
(message "%s" def)))
+\f
+;;; Help mode font lock:
+
+(defconst fuel-help--headlines
+ (regexp-opt '("Class description"
+ "Definition"
+ "Errors"
+ "Examples"
+ "Generic word contract"
+ "Inputs and outputs"
+ "Methods"
+ "Notes"
+ "Parent topics:"
+ "See also"
+ "Syntax"
+ "Variable description"
+ "Variable value"
+ "Vocabulary"
+ "Warning"
+ "Word description")
+ t))
+
+(defconst fuel-help--headlines-regexp (format "^%s" fuel-help--headlines))
+
+(defconst fuel-help--font-lock-keywords
+ `(,@fuel-font-lock--font-lock-keywords
+ (,fuel-help--headlines-regexp . 'fuel-help-font-lock-headlines)))
+
+
\f
;;; Interactive help commands:
(error "No previous page"))
(fuel-help--insert-contents (car item) (cdr item) t)))
+(defun fuel-help-next-headline (&optional count)
+ (interactive "P")
+ (end-of-line)
+ (when (re-search-forward fuel-help--headlines-regexp nil t (or count 1))
+ (beginning-of-line)))
+
+(defun fuel-help-previous-headline (&optional count)
+ (interactive "P")
+ (re-search-backward fuel-help--headlines-regexp nil t count))
+
\f
-;;;; Factor help mode:
+;;;; Help mode map:
(defvar fuel-help-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "b" 'fuel-help-previous)
(define-key map "f" 'fuel-help-next)
(define-key map "l" 'fuel-help-previous)
+ (define-key map "p" 'fuel-help-previous)
(define-key map "n" 'fuel-help-next)
+ (define-key map (kbd "TAB") 'fuel-help-next-headline)
+ (define-key map (kbd "S-TAB") 'fuel-help-previous-headline)
+ (define-key map [(backtab)] 'fuel-help-previous-headline)
(define-key map (kbd "SPC") 'scroll-up)
(define-key map (kbd "S-SPC") 'scroll-down)
+ (define-key map "\C-cz" 'run-factor)
+ (define-key map "\C-c\C-z" 'run-factor)
map))
-(defconst fuel-help--headlines
- (regexp-opt '("Class description"
- "Definition"
- "Errors"
- "Examples"
- "Generic word contract"
- "Inputs and outputs"
- "Methods"
- "Notes"
- "Parent topics:"
- "See also"
- "Syntax"
- "Variable description"
- "Variable value"
- "Vocabulary"
- "Warning"
- "Word description")
- t))
-
-(defconst fuel-help--headlines-regexp (format "^%s" fuel-help--headlines))
-
-(defconst fuel-help--font-lock-keywords
- `(,@fuel-font-lock--font-lock-keywords
- (,fuel-help--headlines-regexp . 'fuel-help-font-lock-headlines)))
+\f
+;;; Help mode definition:
(defun fuel-help-mode ()
"Major mode for browsing Factor documentation.
(make-comint-in-buffer "fuel listener" (current-buffer) factor nil
"-run=listener" (format "-i=%s" image))
(fuel-listener--wait-for-prompt 10000)
+ (fuel-con--setup-connection (current-buffer))
(fuel-con--send-string/wait (current-buffer)
fuel-con--init-stanza
'(lambda (s) (message "FUEL listener up and running!"))
\f
;;; Fuel listener mode:
+;;;###autoload
(define-derived-mode fuel-listener-mode comint-mode "Fuel Listener"
"Major mode for interacting with an inferior Factor listener process.
\\{fuel-listener-mode-map}"
(set (make-local-variable 'comint-prompt-regexp) fuel-con--prompt-regex)
+ (set (make-local-variable 'comint-use-prompt-regexp) t)
(set (make-local-variable 'comint-prompt-read-only) t)
(fuel-listener--setup-completion))
;;; Code:
-(require 'factor-mode)
-(require 'fuel-base)
-(require 'fuel-syntax)
-(require 'fuel-font-lock)
-(require 'fuel-debug)
-(require 'fuel-help)
-(require 'fuel-eval)
-(require 'fuel-completion)
(require 'fuel-listener)
+(require 'fuel-completion)
+(require 'fuel-eval)
+(require 'fuel-help)
+(require 'fuel-debug)
+(require 'fuel-font-lock)
+(require 'fuel-syntax)
+(require 'fuel-base)
\f
;;; Customization:
\f
;;; User commands
-(defun fuel-run-file (&optional arg)
- "Sends the current file to Factor for compilation.
-With prefix argument, ask for the file to run."
- (interactive "P")
+(defun fuel-mode--read-file (arg)
(let* ((file (or (and arg (read-file-name "File: " nil (buffer-file-name) t))
(buffer-file-name)))
(file (expand-file-name file))
(buffer (find-file-noselect file)))
+ (when (and buffer
+ (buffer-modified-p buffer)
+ (y-or-n-p "Save file? "))
+ (save-buffer buffer))
+ (cons file buffer)))
+
+(defun fuel-run-file (&optional arg)
+ "Sends the current file to Factor for compilation.
+With prefix argument, ask for the file to run."
+ (interactive "P")
+ (let* ((f/b (fuel-mode--read-file arg))
+ (file (car f/b))
+ (buffer (cdr f/b)))
(when buffer
(with-current-buffer buffer
(message "Compiling %s ..." file)
(message "Compiling %s ... OK!" file)
(message "")))
+
(defun fuel-eval-region (begin end &optional arg)
"Sends region to Fuel's listener for evaluation.
Unless called with a prefix, switchs to the compilation results
(define-key fuel-mode-map (vector '(control ?c) `(control ,p) k) c)
(define-key fuel-mode-map (vector '(control ?c) `(control ,p) `(control ,k)) c))
-(fuel-mode--key-1 ?z 'run-factor)
(fuel-mode--key-1 ?k 'fuel-run-file)
+(fuel-mode--key-1 ?l 'fuel-run-file)
(fuel-mode--key-1 ?r 'fuel-eval-region)
+(fuel-mode--key-1 ?z 'run-factor)
(define-key fuel-mode-map "\C-\M-x" 'fuel-eval-definition)
(define-key fuel-mode-map "\C-\M-r" 'fuel-eval-extended-region)
(define-key fuel-mode-map (kbd "M-TAB") 'fuel-completion--complete-symbol)
(fuel-mode--key ?e ?e 'fuel-eval-extended-region)
+(fuel-mode--key ?e ?l 'fuel-run-file)
(fuel-mode--key ?e ?r 'fuel-eval-region)
(fuel-mode--key ?e ?v 'fuel-edit-vocabulary)
(fuel-mode--key ?e ?w 'fuel-edit-word)
'("flushable" "foldable" "inline" "parsing" "recursive"))
(defconst fuel-syntax--declaration-words-regex
- (regexp-opt fuel-syntax--declaration-words 'words))
+ (format "%s\\($\\| \\)"
+ (regexp-opt fuel-syntax--declaration-words 'words)))
(defsubst fuel-syntax--second-word-regex (prefixes)
(format "^%s +\\([^ \r\n]+\\)" (regexp-opt prefixes t)))
(defconst fuel-syntax--constructor-regex "<[^ >]+>")
-(defconst fuel-syntax--setter-regex "\\W>>[^ ]+\\b")
+(defconst fuel-syntax--getter-regex "\\( \\|^\\)\\([^ ]+>>\\)\\( \\|$\\)")
+(defconst fuel-syntax--setter-regex "\\( \\|^\\)\\(>>[^ ]+\\)\\( \\|$\\)")
(defconst fuel-syntax--symbol-definition-regex
(fuel-syntax--second-word-regex '("SYMBOL:" "VAR:")))
(defsubst fuel-syntax--at-using ()
(looking-at fuel-syntax--using-lines-regex))
+(defun fuel-syntax--in-using ()
+ (let ((p (point)))
+ (save-excursion
+ (and (re-search-backward "^USING: " nil t)
+ (re-search-forward " ;" nil t)
+ (< p (match-end 0))))))
+
(defsubst fuel-syntax--beginning-of-defun (&optional times)
(re-search-backward fuel-syntax--begin-of-def-regex nil t times))