FUEL: when browsing vocab documentation, use the fuel-help--buffer-link variable to determine what vocabulary we are "in"
parent
189bc7a409
commit
079d2e41db
|
@ -343,9 +343,15 @@ With prefix, the current page is deleted from history."
|
|||
|
||||
;;; 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 ()
|
||||
(save-excursion
|
||||
(or (factor-find-in)
|
||||
(fuel-help--find-in-buffer-link)
|
||||
(and (goto-char (point-min))
|
||||
(re-search-forward "Vocabulary: \\(.+\\)$" nil t)
|
||||
(match-string-no-properties 1)))))
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
(add-to-list 'load-path (file-name-directory load-file-name))
|
||||
|
||||
(require 'ert)
|
||||
(require 'fuel-help)
|
||||
(require 'fuel-markup)
|
||||
|
||||
;; fuel-markup
|
||||
|
@ -33,3 +34,19 @@
|
|||
(fuel-markup--quotation quot)
|
||||
(buffer-string))
|
||||
"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")))
|
||||
|
|
Loading…
Reference in New Issue