FUEL: New command fuel-help-kill-page (bound to 'k' in help browser).

db4
Jose A. Ortega Ruiz 2009-01-05 06:22:36 +01:00
parent c7b589f712
commit a0f3a44aa0
5 changed files with 34 additions and 19 deletions

View File

@ -4,9 +4,9 @@
USING: accessors arrays assocs classes.tuple combinators USING: accessors arrays assocs classes.tuple combinators
compiler.units continuations debugger definitions help help.crossref compiler.units continuations debugger definitions help help.crossref
help.markup help.topics io io.pathnames io.streams.string kernel lexer help.markup help.topics io io.pathnames io.streams.string kernel lexer
make math math.order memoize namespaces parser prettyprint sequences make math math.order memoize namespaces parser quotations prettyprint
sets sorting source-files strings summary tools.crossref tools.vocabs sequences sets sorting source-files strings summary tools.crossref
vectors vocabs vocabs.parser words ; tools.vocabs vectors vocabs vocabs.parser words ;
IN: fuel IN: fuel
@ -74,6 +74,8 @@ M: sequence fuel-pprint
M: tuple fuel-pprint tuple>array fuel-pprint ; inline M: tuple fuel-pprint tuple>array fuel-pprint ; inline
M: quotation fuel-pprint pprint ; inline
M: continuation fuel-pprint drop ":continuation" write ; inline M: continuation fuel-pprint drop ":continuation" write ; inline
M: restart fuel-pprint name>> fuel-pprint ; inline M: restart fuel-pprint name>> fuel-pprint ; inline

View File

@ -102,6 +102,7 @@ beast.
- n/p : next/previous page - n/p : next/previous page
- SPC/S-SPC : scroll up/down - SPC/S-SPC : scroll up/down
- TAB/S-TAB : next/previous link - TAB/S-TAB : next/previous link
- k : kill current page and go to previous or next
- r : refresh page - r : refresh page
- c : clean browsing history - c : clean browsing history
- M-. : edit word at point in Emacs - M-. : edit word at point in Emacs

View File

@ -1,6 +1,6 @@
;;; fuel-connection.el -- asynchronous comms with the fuel listener ;;; fuel-connection.el -- asynchronous comms with the fuel listener
;; Copyright (C) 2008 Jose Antonio Ortega Ruiz ;; Copyright (C) 2008, 2009 Jose Antonio Ortega Ruiz
;; See http://factorcode.org/license.txt for BSD license. ;; See http://factorcode.org/license.txt for BSD license.
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> ;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
@ -193,7 +193,7 @@
(condition-case cerr (condition-case cerr
(with-current-buffer (or buffer (current-buffer)) (with-current-buffer (or buffer (current-buffer))
(funcall cont (fuel-con--comint-buffer-form)) (funcall cont (fuel-con--comint-buffer-form))
(fuel-log--info "<%s>: processed\n\t%s" id req)) (fuel-log--info "<%s>: processed" id))
(error (fuel-log--error (error (fuel-log--error
"<%s>: continuation failed %S \n\t%s" id rstr cerr)))))) "<%s>: continuation failed %S \n\t%s" id rstr cerr))))))

View File

@ -1,6 +1,6 @@
;;; fuel-eval.el --- evaluating Factor expressions ;;; fuel-eval.el --- evaluating Factor expressions
;; Copyright (C) 2008 Jose Antonio Ortega Ruiz ;; Copyright (C) 2008, 2009 Jose Antonio Ortega Ruiz
;; See http://factorcode.org/license.txt for BSD license. ;; See http://factorcode.org/license.txt for BSD license.
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org> ;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
@ -13,9 +13,10 @@
;;; Code: ;;; Code:
(require 'fuel-base)
(require 'fuel-syntax) (require 'fuel-syntax)
(require 'fuel-connection) (require 'fuel-connection)
(require 'fuel-log)
(require 'fuel-base)
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
@ -125,6 +126,7 @@
(fuel-eval--retort-make (cons 'fuel-parse-retort-error str) nil)) (fuel-eval--retort-make (cons 'fuel-parse-retort-error str) nil))
(defun fuel-eval--parse-retort (ret) (defun fuel-eval--parse-retort (ret)
(fuel-log--info "RETORT: %S" ret)
(if (fuel-eval--retort-p ret) ret (if (fuel-eval--retort-p ret) ret
(fuel-eval--make-parse-error-retort ret))) (fuel-eval--make-parse-error-retort ret)))

View File

@ -67,15 +67,15 @@
(setcar fuel-help--history link)))) (setcar fuel-help--history link))))
link) link)
(defun fuel-help--history-next () (defun fuel-help--history-next (&optional forget-current)
(when (not (ring-empty-p (nth 2 fuel-help--history))) (when (not (ring-empty-p (nth 2 fuel-help--history)))
(when (car fuel-help--history) (when (and (car fuel-help--history) (not forget-current))
(ring-insert (nth 1 fuel-help--history) (car fuel-help--history))) (ring-insert (nth 1 fuel-help--history) (car fuel-help--history)))
(setcar fuel-help--history (ring-remove (nth 2 fuel-help--history) 0)))) (setcar fuel-help--history (ring-remove (nth 2 fuel-help--history) 0))))
(defun fuel-help--history-previous () (defun fuel-help--history-previous (&optional forget-current)
(when (not (ring-empty-p (nth 1 fuel-help--history))) (when (not (ring-empty-p (nth 1 fuel-help--history)))
(when (car fuel-help--history) (when (and (car fuel-help--history) (not forget-current))
(ring-insert (nth 2 fuel-help--history) (car fuel-help--history))) (ring-insert (nth 2 fuel-help--history) (car fuel-help--history)))
(setcar fuel-help--history (ring-remove (nth 1 fuel-help--history) 0)))) (setcar fuel-help--history (ring-remove (nth 1 fuel-help--history) 0))))
@ -231,20 +231,29 @@ buffer."
(interactive) (interactive)
(fuel-help--word-help)) (fuel-help--word-help))
(defun fuel-help-next () (defun fuel-help-next (&optional forget-current)
"Go to next page in help browser." "Go to next page in help browser.
(interactive) With prefix, the current page is deleted from history."
(let ((item (fuel-help--history-next))) (interactive "P")
(let ((item (fuel-help--history-next forget-current)))
(unless item (error "No next page")) (unless item (error "No next page"))
(apply 'fuel-help--follow-link item))) (apply 'fuel-help--follow-link item)))
(defun fuel-help-previous () (defun fuel-help-previous (&optional forget-current)
"Go to previous page in help browser." "Go to previous page in help browser.
(interactive) With prefix, the current page is deleted from history."
(let ((item (fuel-help--history-previous))) (interactive "P")
(let ((item (fuel-help--history-previous forget-current)))
(unless item (error "No previous page")) (unless item (error "No previous page"))
(apply 'fuel-help--follow-link item))) (apply 'fuel-help--follow-link item)))
(defun fuel-help-kill-page ()
"Kill current page if a previous or next one exists."
(interactive)
(condition-case nil
(fuel-help-previous t)
(error (fuel-help-next t))))
(defun fuel-help-refresh () (defun fuel-help-refresh ()
"Refresh the contents of current page." "Refresh the contents of current page."
(interactive) (interactive)
@ -273,6 +282,7 @@ buffer."
(define-key map "bd" 'fuel-help-delete-bookmark) (define-key map "bd" 'fuel-help-delete-bookmark)
(define-key map "c" 'fuel-help-clean-history) (define-key map "c" 'fuel-help-clean-history)
(define-key map "h" 'fuel-help) (define-key map "h" 'fuel-help)
(define-key map "k" 'fuel-help-kill-page)
(define-key map "n" 'fuel-help-next) (define-key map "n" 'fuel-help-next)
(define-key map "p" 'fuel-help-previous) (define-key map "p" 'fuel-help-previous)
(define-key map "r" 'fuel-help-refresh) (define-key map "r" 'fuel-help-refresh)