From a0f3a44aa064fd3cc99f71069b8700a73397060f Mon Sep 17 00:00:00 2001 From: "Jose A. Ortega Ruiz" Date: Mon, 5 Jan 2009 06:22:36 +0100 Subject: [PATCH] FUEL: New command fuel-help-kill-page (bound to 'k' in help browser). --- extra/fuel/fuel.factor | 8 +++++--- misc/fuel/README | 1 + misc/fuel/fuel-connection.el | 4 ++-- misc/fuel/fuel-eval.el | 6 ++++-- misc/fuel/fuel-help.el | 34 ++++++++++++++++++++++------------ 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/extra/fuel/fuel.factor b/extra/fuel/fuel.factor index 80d8cde654..03896029f1 100644 --- a/extra/fuel/fuel.factor +++ b/extra/fuel/fuel.factor @@ -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 diff --git a/misc/fuel/README b/misc/fuel/README index 6c03c7aa01..7c746ff305 100644 --- a/misc/fuel/README +++ b/misc/fuel/README @@ -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 diff --git a/misc/fuel/fuel-connection.el b/misc/fuel/fuel-connection.el index 05ddad4b1e..09d1ddfb51 100644 --- a/misc/fuel/fuel-connection.el +++ b/misc/fuel/fuel-connection.el @@ -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 @@ -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)))))) diff --git a/misc/fuel/fuel-eval.el b/misc/fuel/fuel-eval.el index 078a7005f8..149e608964 100644 --- a/misc/fuel/fuel-eval.el +++ b/misc/fuel/fuel-eval.el @@ -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 @@ -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))) diff --git a/misc/fuel/fuel-help.el b/misc/fuel/fuel-help.el index 12091ea399..4b8d1e4e16 100644 --- a/misc/fuel/fuel-help.el +++ b/misc/fuel/fuel-help.el @@ -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)