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

View File

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

View File

@ -1,6 +1,6 @@
;;; 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.
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
@ -193,7 +193,7 @@
(condition-case cerr
(with-current-buffer (or buffer (current-buffer))
(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
"<%s>: continuation failed %S \n\t%s" id rstr cerr))))))

View File

@ -1,6 +1,6 @@
;;; 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.
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
@ -13,9 +13,10 @@
;;; Code:
(require 'fuel-base)
(require 'fuel-syntax)
(require 'fuel-connection)
(require 'fuel-log)
(require 'fuel-base)
(eval-when-compile (require 'cl))
@ -125,6 +126,7 @@
(fuel-eval--retort-make (cons 'fuel-parse-retort-error str) nil))
(defun fuel-eval--parse-retort (ret)
(fuel-log--info "RETORT: %S" ret)
(if (fuel-eval--retort-p ret) ret
(fuel-eval--make-parse-error-retort ret)))

View File

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