summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-20 01:35:28 +0000
committerjao <jao@gnu.org>2021-12-20 01:35:28 +0000
commit0c21febe08a49b9705c62392fe443cac83c252b0 (patch)
tree749e5efbb65f7f686af1be7c19b9f312887894a9
parentc5a4a60480abf26db68e2a820189daef1d87fb4b (diff)
downloadgeiser-guile-0c21febe08a49b9705c62392fe443cac83c252b0.tar.gz
geiser-guile-0c21febe08a49b9705c62392fe443cac83c252b0.tar.bz2
Manual search: include Concept Index and non-symbol searches
Fixes issue #5, and then more.
-rw-r--r--geiser-guile.el27
1 files changed, 16 insertions, 11 deletions
diff --git a/geiser-guile.el b/geiser-guile.el
index e809f31..84fe23c 100644
--- a/geiser-guile.el
+++ b/geiser-guile.el
@@ -441,33 +441,38 @@ See `geiser-guile-use-declarative-modules-p'."
;;; Manual lookup
-(defun geiser-guile--info-spec (&optional nodes)
+(defun geiser-guile--info-spec ()
"Return info specification for given NODES."
(let* ((nrx "^[ ]+-+ [^:]+:[ ]*")
(drx "\\b")
(res (when (Info-find-file "r5rs" t)
`(("(r5rs)Index" nil ,nrx ,drx)))))
- (dolist (node (or nodes geiser-guile-manual-lookup-nodes) res)
+ (dolist (node geiser-guile-manual-lookup-nodes res)
(when (Info-find-file node t)
(mapc (lambda (idx)
(add-to-list 'res
(list (format "(%s)%s" node idx) nil nrx drx)))
- '("Variable Index" "Procedure Index" "R5RS Index"))))))
+ '("R5RS Index" "Concept Index" "Procedure Index" "Variable Index"))))))
-
-(info-lookup-add-help :topic 'symbol :mode 'geiser-guile-mode
+(info-lookup-add-help :topic 'symbol
+ :mode 'geiser-guile-mode
:ignore-case nil
:regexp "[^()`',\" \n]+"
:doc-spec (geiser-guile--info-spec))
+(defun geiser-guile--info-lookup (id)
+ (cond ((null id) (info "guile"))
+ ((ignore-errors (info-lookup-symbol (format "%s" id) 'geiser-guile-mode) t))
+ ((and (listp id) (geiser-guile--info-lookup (car (last id)))))
+ (t (geiser-guile--info-lookup (when (listp id) (butlast id))))))
+
(defun geiser-guile--manual-look-up (id _mod)
"Look for ID in the Guile manuals."
- (let ((info-lookup-other-window-flag
- geiser-guile-manual-lookup-other-window-p))
- (info-lookup-symbol (symbol-name id) 'geiser-guile-mode))
- (when geiser-guile-manual-lookup-other-window-p
- (switch-to-buffer-other-window "*info*"))
- (search-forward (format "%s" id) nil t))
+ (let ((info-lookup-other-window-flag geiser-guile-manual-lookup-other-window-p))
+ (geiser-guile--info-lookup id)
+ (when geiser-guile-manual-lookup-other-window-p
+ (switch-to-buffer-other-window "*info*"))
+ (search-forward (format "%s" id) nil t)))
;;; Implementation definition: