Merge branch 'master' of git://factorcode.org/git/factor

db4
Daniel Ehrenberg 2009-02-09 15:22:20 -06:00
commit 8aa729abb1
9 changed files with 44 additions and 26 deletions

View File

@ -551,12 +551,12 @@ HELP: BIN:
{ $examples { $example "USE: prettyprint" "BIN: 100 ." "4" } } ;
HELP: GENERIC:
{ $syntax "GENERIC: word" }
{ $syntax "GENERIC: word" "GENERIC: word ( stack -- effect )" }
{ $values { "word" "a new word to define" } }
{ $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." } ;
HELP: GENERIC#
{ $syntax "GENERIC# word n" }
{ $syntax "GENERIC# word n" "GENERIC# word n ( stack -- effect )" }
{ $values { "word" "a new word to define" } { "n" "the stack position to dispatch on" } }
{ $description "Defines a new generic word which dispatches on the " { $snippet "n" } "th most element from the top of the stack in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." }
{ $notes
@ -571,7 +571,7 @@ HELP: MATH:
{ $description "Defines a new generic word which uses the " { $link math-combination } " method combination." } ;
HELP: HOOK:
{ $syntax "HOOK: word variable" }
{ $syntax "HOOK: word variable" "HOOK: word variable ( stack -- effect ) " }
{ $values { "word" "a new word to define" } { "variable" word } }
{ $description "Defines a new hook word in the current vocabulary. Hook words are generic words which dispatch on the value of a variable, so methods are defined with " { $link POSTPONE: M: } ". Hook words differ from other generic words in that the dispatch value is removed from the stack before the chosen method is called." }
{ $examples

View File

@ -18,6 +18,15 @@
(require 'fuel-eval)
(require 'fuel-log)
;;; Aux:
(defvar fuel-completion--minibuffer-map
(let ((map (make-keymap)))
(set-keymap-parent map minibuffer-local-completion-map)
(define-key map "?" 'self-insert-command)
map))
;;; Vocabs dictionary:
@ -33,7 +42,8 @@
fuel-completion--vocabs)
(defun fuel-completion--read-vocab (&optional reload init-input history)
(let ((vocabs (fuel-completion--vocabs reload)))
(let ((minibuffer-local-completion-map fuel-completion--minibuffer-map)
(vocabs (fuel-completion--vocabs reload)))
(completing-read "Vocab name: " vocabs nil nil init-input history)))
(defsubst fuel-completion--vocab-list (prefix)
@ -170,12 +180,23 @@ terminates a current completion."
(cons completions partial)))
(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)
nil nil nil
history
(or default (fuel-syntax-symbol-at-point))))
(let ((minibuffer-local-completion-map fuel-completion--minibuffer-map))
(completing-read prompt
(if all fuel-completion--all-words-list-func
fuel-completion--word-list-func)
nil nil nil
history
(or default (fuel-syntax-symbol-at-point)))))
(defvar fuel-completion--vocab-history nil)
(defun fuel-completion--read-vocab (refresh)
(let ((minibuffer-local-completion-map fuel-completion--minibuffer-map)
(vocabs (fuel-completion--vocabs refresh))
(prompt "Vocabulary name: "))
(if vocabs
(completing-read prompt vocabs nil nil nil fuel-completion--vocab-history)
(read-string prompt nil fuel-completion--vocab-history))))
(defun fuel-completion--complete-symbol ()
"Complete the symbol at point.

View File

@ -144,8 +144,12 @@
(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))
(defadvice comint-redirect-setup
(after fuel-con--advice (output-buffer comint-buffer finished-regexp &optional echo))
(with-current-buffer comint-buffer
(when fuel-con--connection
(setq comint-redirect-finished-regexp fuel-con--comint-finished-regex))))
(ad-activate 'comint-redirect-setup)
(defun fuel-con--comint-preoutput-filter (str)
(when (string-match fuel-con--comint-finished-regex str)

View File

@ -57,13 +57,6 @@
(fuel-edit--visit-file (car loc) fuel-edit-word-method)
(goto-line (if (numberp (cadr loc)) (cadr loc) 1))))
(defun fuel-edit--read-vocabulary-name (refresh)
(let* ((vocabs (fuel-completion--vocabs refresh))
(prompt "Vocabulary name: "))
(if vocabs
(completing-read prompt vocabs nil nil nil fuel-edit--vocab-history)
(read-string prompt nil fuel-edit--vocab-history))))
(defun fuel-edit--edit-article (name)
(let ((cmd `(:fuel* (,name fuel-get-article-location) "fuel" t)))
(fuel-edit--try-edit (fuel-eval--send/wait cmd))))
@ -72,7 +65,6 @@
;;; Editing commands:
(defvar fuel-edit--word-history nil)
(defvar fuel-edit--vocab-history nil)
(defvar fuel-edit--previous-location nil)
(defun fuel-edit-vocabulary (&optional refresh vocab)
@ -80,7 +72,7 @@
When called interactively, asks for vocabulary with completion.
With prefix argument, refreshes cached vocabulary list."
(interactive "P")
(let* ((vocab (or vocab (fuel-edit--read-vocabulary-name refresh)))
(let* ((vocab (or vocab (fuel-completion--read-vocab refresh)))
(cmd `(:fuel* (,vocab fuel-get-vocab-location) "fuel" t)))
(fuel-edit--try-edit (fuel-eval--send/wait cmd))))

View File

@ -257,7 +257,7 @@ buffer."
(defun fuel-help-vocab (vocab)
"Ask for a vocabulary name and show its help page."
(interactive (list (fuel-edit--read-vocabulary-name nil)))
(interactive (list (fuel-completion--read-vocab nil)))
(fuel-help--get-vocab vocab))
(defun fuel-help-next (&optional forget-current)

View File

@ -32,7 +32,7 @@
(defcustom fuel-listener-factor-binary
(expand-file-name (cond ((eq system-type 'windows-nt)
"factor.exe")
"factor.com")
((eq system-type 'darwin)
"Factor.app/Contents/MacOS/factor")
(t "factor"))

View File

@ -282,7 +282,8 @@
(fuel-markup--insert-newline)
(dolist (s (cdr e))
(fuel-markup--snippet (list '$snippet s))
(newline)))
(newline))
(newline))
(defun fuel-markup--markup-example (e)
(fuel-markup--insert-newline)

View File

@ -71,7 +71,7 @@ You can configure `fuel-scaffold-developer-name' (set by default to
`user-full-name') for the name to be inserted in the generated file."
(interactive "P")
(let* ((vocab (or (and (not arg) (fuel-syntax--current-vocab))
(fuel-edit--read-vocabulary-name nil)))
(fuel-completion--read-vocab nil)))
(cmd `(:fuel* (,vocab ,fuel-scaffold-developer-name fuel-scaffold-help)
"fuel"))
(ret (fuel-eval--send/wait cmd))

View File

@ -244,7 +244,7 @@ With prefix argument, force reload of vocabulary list."
With prefix argument, ask for the vocab."
(interactive "P")
(let ((vocab (or (and (not arg) (fuel-syntax--current-vocab))
(fuel-edit--read-vocabulary-name))))
(fuel-completion--read-vocab nil))))
(when vocab
(fuel-xref--show-vocab-words vocab
(fuel-syntax--file-has-private)))))