FUEL: when browsing vocab documentation, use the fuel-help--buffer-link variable to determine what vocabulary we are "in"

db4
Björn Lindqvist 2014-11-01 23:10:45 +01:00 committed by John Benediktsson
parent 189bc7a409
commit 079d2e41db
2 changed files with 23 additions and 0 deletions

View File

@ -343,9 +343,15 @@ With prefix, the current page is deleted from history."
;;; IN: support ;;; IN: support
(defun fuel-help--find-in-buffer-link ()
(when (and fuel-help--buffer-link
(equal (nth 2 fuel-help--buffer-link) 'vocab))
(car fuel-help--buffer-link)))
(defun fuel-help--find-in () (defun fuel-help--find-in ()
(save-excursion (save-excursion
(or (factor-find-in) (or (factor-find-in)
(fuel-help--find-in-buffer-link)
(and (goto-char (point-min)) (and (goto-char (point-min))
(re-search-forward "Vocabulary: \\(.+\\)$" nil t) (re-search-forward "Vocabulary: \\(.+\\)$" nil t)
(match-string-no-properties 1))))) (match-string-no-properties 1)))))

View File

@ -20,6 +20,7 @@
(add-to-list 'load-path (file-name-directory load-file-name)) (add-to-list 'load-path (file-name-directory load-file-name))
(require 'ert) (require 'ert)
(require 'fuel-help)
(require 'fuel-markup) (require 'fuel-markup)
;; fuel-markup ;; fuel-markup
@ -33,3 +34,19 @@
(fuel-markup--quotation quot) (fuel-markup--quotation quot)
(buffer-string)) (buffer-string))
"a quotation with stack effect ( args kw -- ret )")))) "a quotation with stack effect ( args kw -- ret )"))))
;; fuel-help
(ert-deftest find-in-w/vocabulary ()
(should (equal
(with-temp-buffer
(insert "Vocabulary: imap")
(fuel-help--find-in))
"imap")))
(ert-deftest find-in-w/buffer-link ()
(should (equal
(with-temp-buffer
(setq fuel-help--buffer-link '("foob" "foob" vocab))
(insert "Help page contents")
(fuel-help--find-in))
"foob")))