diff options
| author | Suhail <425284-suhailsingh@users.noreply.gitlab.com> | 2024-08-10 22:54:07 -0400 | 
|---|---|---|
| committer | Suhail <425284-suhailsingh@users.noreply.gitlab.com> | 2024-08-11 11:19:39 -0400 | 
| commit | f90be894cfaea172d8b938654fa8248c33063ee6 (patch) | |
| tree | 6d40703a5d1bf002e12604c479cbbb03315cb32a | |
| parent | a5223455ce774a22d699ae018f3503fbf841927f (diff) | |
| download | geiser-guile-f90be894cfaea172d8b938654fa8248c33063ee6.tar.gz geiser-guile-f90be894cfaea172d8b938654fa8248c33063ee6.tar.bz2 | |
Update info-lookup-alist via geiser-guile-manual-lookup-alist (#47)
* geiser-guile.el (geiser-guile-manual-lookup-alist): New variable.
(geiser-guile-manual-lookup-indices): Obsolete variable.
(geiser-guile-manual-lookup-nodes): Obsolete variable.
(geiser-guile--info-spec): Inlined into the :set function of
geiser-guile-manual-lookup-nodes.
| -rw-r--r-- | geiser-guile.el | 54 | 
1 files changed, 35 insertions, 19 deletions
| diff --git a/geiser-guile.el b/geiser-guile.el index 58febbc..6d61010 100644 --- a/geiser-guile.el +++ b/geiser-guile.el @@ -169,11 +169,46 @@ effect on new REPLs.  For existing ones, use the command    "List of info nodes that, when present, are used for manual lookups."    :type '(repeat string)) +(make-obsolete-variable 'geiser-guile-manual-lookup-nodes +                        'geiser-guile-manual-lookup-alist +                        "0.28.2") +  (geiser-custom--defcustom geiser-guile-manual-lookup-indices      '("R5RS Index" "Concept Index" "Procedure Index" "Variable Index")    "List of info index nodes that, when present, are used for manual lookups."    :type '(repeat string)) +(make-obsolete-variable 'geiser-guile-manual-lookup-indices +                        'geiser-guile-manual-lookup-alist +                        "0.28.2") + +(geiser-custom--defcustom geiser-guile-manual-lookup-alist +    (append (mapcar (lambda (x) (cons x geiser-guile-manual-lookup-indices)) +                    geiser-guile-manual-lookup-nodes) +            '(("r5rs" . ("Index")))) +  "Alist of Info nodes and their indices that are used for manual lookups. +Each element looks like (NODE . INDICES).  NODE is an Info node +and INDICES is a list of index nodes corresponding to NODE." +  :type '(alist :key-type string :value-type (repeat string)) +  :set (lambda (sym val) +         "Update `info-lookup-alist' based on VAL. +Also, update the toplevel default value of SYM to VAL." +         (let ((nrx "^[       ]+-+ [^:]+:[    ]*") +               (drx "\\b") +               (spec)) +           (dolist (row val spec) +             (when-let ((file (car row)) +                        ((Info-find-file file t)) +                        (indices (cdr row))) +               (dolist (ix indices) +                 (push (list (format "(%s)%s" file ix) nil nrx drx) spec)))) +           (info-lookup-add-help :topic 'symbol +                                 :mode 'geiser-guile-mode +                                 :ignore-case nil +                                 :regexp "[^()`',\"        \n]+" +                                 :doc-spec spec)) +         (set-default-toplevel-value sym val))) +  (geiser-custom--defcustom geiser-guile-doc-process-texinfo nil    "Non-nil means try to convert docstrings from texinfo into plain-text. @@ -652,25 +687,6 @@ See `geiser-guile-use-declarative-modules'."  ;;; Manual lookup -(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 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))) -              geiser-guile-manual-lookup-indices))))) - -(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)) | 
