FUEL: 'h' for help on word at point in xref buffers.
parent
a0f3a44aa0
commit
fd35c362ef
|
@ -100,6 +100,7 @@ beast.
|
|||
- bb : display bookmarks
|
||||
- bd : delete bookmark at point
|
||||
- n/p : next/previous page
|
||||
- l : previous page
|
||||
- SPC/S-SPC : scroll up/down
|
||||
- TAB/S-TAB : next/previous link
|
||||
- k : kill current page and go to previous or next
|
||||
|
@ -113,4 +114,5 @@ beast.
|
|||
|
||||
- TAB/BACKTAB : navigate links
|
||||
- RET/mouse click : follow link
|
||||
- h : show help for word at point
|
||||
- q : bury buffer
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
(require 'fuel-eval)
|
||||
(require 'fuel-markup)
|
||||
(require 'fuel-autodoc)
|
||||
(require 'fuel-xref)
|
||||
(require 'fuel-completion)
|
||||
(require 'fuel-syntax)
|
||||
(require 'fuel-font-lock)
|
||||
(require 'fuel-popup)
|
||||
(require 'fuel-base)
|
||||
|
@ -114,10 +114,9 @@
|
|||
(let* ((def (fuel-syntax-symbol-at-point))
|
||||
(prompt (format "See%s help on%s: " (if see " short" "")
|
||||
(if def (format " (%s)" def) "")))
|
||||
(ask (or (not (memq major-mode '(factor-mode fuel-help-mode)))
|
||||
(not def)
|
||||
fuel-help-always-ask)))
|
||||
(if ask (fuel-completion--read-word prompt
|
||||
(ask (or (not def) fuel-help-always-ask)))
|
||||
(if ask
|
||||
(fuel-completion--read-word prompt
|
||||
def
|
||||
'fuel-help--prompt-history
|
||||
t)
|
||||
|
@ -284,6 +283,7 @@ With prefix, the current page is deleted from 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 "l" 'fuel-help-last)
|
||||
(define-key map "p" 'fuel-help-previous)
|
||||
(define-key map "r" 'fuel-help-refresh)
|
||||
(define-key map (kbd "SPC") 'scroll-up)
|
||||
|
@ -293,6 +293,16 @@ With prefix, the current page is deleted from history."
|
|||
(define-key map "\C-c\C-z" 'run-factor)
|
||||
map))
|
||||
|
||||
|
||||
;;; IN: support
|
||||
|
||||
(defun fuel-help--find-in ()
|
||||
(save-excursion
|
||||
(or (fuel-syntax--find-in)
|
||||
(and (goto-char (point-min))
|
||||
(re-search-forward "Vocabulary: \\(.+\\)$" nil t)
|
||||
(match-string-no-properties 1)))))
|
||||
|
||||
|
||||
;;; Help mode definition:
|
||||
|
||||
|
@ -306,6 +316,7 @@ With prefix, the current page is deleted from history."
|
|||
(set-syntax-table fuel-syntax--syntax-table)
|
||||
(setq mode-name "FUEL Help")
|
||||
(setq major-mode 'fuel-help-mode)
|
||||
(setq fuel-syntax--current-vocab-function 'fuel-help--find-in)
|
||||
(setq fuel-markup--follow-link-function 'fuel-help--follow-link)
|
||||
(setq buffer-read-only t))
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'fuel-help)
|
||||
(require 'fuel-eval)
|
||||
(require 'fuel-syntax)
|
||||
(require 'fuel-popup)
|
||||
|
@ -72,7 +73,8 @@ cursor at the first ocurrence of the used word."
|
|||
|
||||
(make-local-variable (defvar fuel-xref--word nil))
|
||||
|
||||
(defvar fuel-xref--help-string "(Press RET or click to follow crossrefs)")
|
||||
(defvar fuel-xref--help-string
|
||||
"(Press RET or click to follow crossrefs, or h for help on word at point)")
|
||||
|
||||
(defun fuel-xref--title (word cc count)
|
||||
(put-text-property 0 (length word) 'font-lock-face 'bold word)
|
||||
|
@ -138,10 +140,16 @@ cursor at the first ocurrence of the used word."
|
|||
|
||||
;;; Xref mode:
|
||||
|
||||
(defun fuel-xref-show-help ()
|
||||
(interactive)
|
||||
(let ((fuel-help-always-ask nil))
|
||||
(fuel-help)))
|
||||
|
||||
(defvar fuel-xref-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(suppress-keymap map)
|
||||
(set-keymap-parent map button-buffer-map)
|
||||
(define-key map "h" 'fuel-xref-show-help)
|
||||
map))
|
||||
|
||||
(defun fuel-xref-mode ()
|
||||
|
|
Loading…
Reference in New Issue