]> gitweb.factorcode.org Git - factor.git/commitdiff
FUEL: More navigation keys for the help buffer.
authorJose A. Ortega Ruiz <jao@gnu.org>
Thu, 18 Dec 2008 16:07:36 +0000 (17:07 +0100)
committerJose A. Ortega Ruiz <jao@gnu.org>
Thu, 18 Dec 2008 16:07:36 +0000 (17:07 +0100)
misc/fuel/README
misc/fuel/fuel-help.el

index cc938a60ff65861ccaab7fd08e65f87ce9d794ab..5073980dbd7b1322050a2fa52db105c8e4ee8a7c 100644 (file)
@@ -90,5 +90,7 @@ C-cC-eC-r is the same as C-cC-er)).
  - 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
 
index 3bfd788702b5ad7d06efd22016ce65b8ce49bedd..2154cbebd63a2e18eb0c10ca9c50d02e62b17d97 100644 (file)
@@ -186,6 +186,35 @@ displayed in the minibuffer."
     (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:
 
@@ -223,8 +252,18 @@ buffer."
       (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)))
@@ -235,36 +274,17 @@ buffer."
     (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.