From d50d191e6e9fdb3d4f4521ea85edd426124f9797 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 9 Jun 2012 14:24:22 +0200 Subject: [PATCH] Support for user-defined Guile info nodes In my debian machine, the info nodes for guile live in the "guile-2.0" node, rather than plain "guile". A new customizable variable, geiser-guile-manual-lookup-nodes, lets now specify additional names, and we only add indexes to the info-lookup mode definition when the node actually exists. --- doc/parens.texi | 14 ++++++++++---- elisp/geiser-guile.el | 25 +++++++++++++++++++------ elisp/geiser-repl.el | 4 ++-- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/doc/parens.texi b/doc/parens.texi index a41057a..b4df02e 100644 --- a/doc/parens.texi +++ b/doc/parens.texi @@ -376,15 +376,21 @@ will open your web browser displaying the corresponding reference's page (using Emacs' @code{browser-url} command), while in Guile a lookup will be performed in the texinfo manual. -@cindex opening manual pages -You can also jump directly to the manual page for the symbol at point -with the command @code{geiser-doc-look-up-manual}, bound to @kbd{C-c C-d -i}. +@cindex Guile info nodes +For Guile, the manual lookup uses the info indexes in the standard +Guile info nodes, which are usually named ``guile'' or ``guile-2.0''. +If yours are named differently, just add your name to the customizable +variable @code{geiser-guile-manual-lookup-nodes}. A list of all navigation commands in the documentation browser is available in @altr{Documentation browser,our cheat-sheet,Documentation browser,.} +@cindex opening manual pages +You can also skip the documentation browser and jump directly to the +manual page for the symbol at point with the command +@code{geiser-doc-look-up-manual}, bound to @kbd{C-c C-d i}. + @node To eval or not to eval, To err perchance to debug, Documentation helpers, Between the parens @section To eval or not to eval diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index da14b4e..54443b8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -109,6 +109,11 @@ effect on new REPLs. For existing ones, use the command :type 'boolean :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-manual-lookup-nodes '("Guile" "guile-2.0") + "List of info nodes that, when present, are used for manual lookups" + :type '(repeat string) + :group 'geiser-guile) + ;;; REPL support: @@ -302,14 +307,22 @@ it spawn a server thread." ;;; Manual lookup + +(defun geiser-guile--info-spec (&optional 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) + (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")))))) + + (info-lookup-add-help :topic 'symbol :mode 'geiser-guile-mode :ignore-case nil :regexp "[^()`',\" \n]+" - :doc-spec - '(("(r5rs)Index" nil "^[ ]+-+ [^:]+:[ ]*" "\\b") - ("(Guile)R5RS Index" nil "^ - [^:]+: " "\\b") - ("(Guile)Procedure Index" nil "^ - [^:]+: " "\\b") - ("(Guile)Variable Index" nil "^ - [^:]+: " "\\b"))) + :doc-spec (geiser-guile--info-spec)) (defun guile--manual-look-up (id mod) (let ((info-lookup-other-window-flag diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 7badaf0..14d71cc 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -350,8 +350,8 @@ module command as a string") (setq geiser-eval--default-connection-function 'geiser-repl--connection) (defun geiser-repl--prepare-send () - (geiser-con--connection-deactivate geiser-repl--connection) - (geiser-autodoc--inhibit-autodoc)) + (geiser-autodoc--inhibit-autodoc) + (geiser-con--connection-deactivate geiser-repl--connection)) (defun geiser-repl--send (cmd) (when (and cmd (eq major-mode 'geiser-repl-mode)) -- 2.11.4.GIT