summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elisp/geiser-completion.el4
-rw-r--r--elisp/geiser-doc.el63
-rw-r--r--elisp/geiser-mode.el2
-rw-r--r--elisp/geiser-repl.el1
4 files changed, 69 insertions, 1 deletions
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el
index dd0c33c..3a36187 100644
--- a/elisp/geiser-completion.el
+++ b/elisp/geiser-completion.el
@@ -183,12 +183,14 @@ terminates a current completion."
(partial (if (eq partial t) prefix partial)))
(cons completions partial)))
+(defvar geiser-completion--symbol-history nil)
+
(defun geiser-completion--read-symbol (prompt &optional default history)
(let ((minibuffer-local-completion-map geiser-completion--minibuffer-map))
(completing-read prompt
geiser-completion--symbol-list-func
nil nil nil
- history
+ (or history geiser-completion--symbol-history)
(or default (symbol-at-point)))))
(defun geiser--respecting-message (format &rest format-args)
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
new file mode 100644
index 0000000..7113b25
--- /dev/null
+++ b/elisp/geiser-doc.el
@@ -0,0 +1,63 @@
+;; geiser-doc.el -- accessing documentation
+
+;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
+
+;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
+;; Start date: Sat Feb 14, 2009 14:09
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Comentary:
+
+;; Utilities for accessing docstrings and texinfo documentation.
+
+;;; Code:
+
+(require 'geiser-completion)
+(require 'geiser-eval)
+(require 'geiser-popup)
+(require 'geiser-base)
+
+
+;;; Documentation buffer:
+
+(geiser-popup--define doc "*Geiser documentation*" fundamental-mode)
+
+
+;;; Docstrings:
+
+(defun geiser-doc--get-docstring (symbol)
+ (geiser-eval--send/result `(:gs ((:ge docstring) ',symbol))))
+
+
+;;; Commands:
+
+(defun geiser-doc-symbol-at-point (&optional arg)
+ "Get docstring for symbol at point.
+With prefix argument, ask for symbol (with completion)."
+ (interactive "P")
+ (let ((symbol (or (and (not arg) (symbol-at-point))
+ (geiser-completion--read-symbol "Symbol: " (symbol-at-point)))))
+ (when symbol
+ (let ((ds (geiser-doc--get-docstring symbol)))
+ (if (not (stringp ds))
+ (message "No docstring available for '%s'" symbol)
+ (geiser-doc--with-buffer
+ (erase-buffer)
+ (insert ds))
+ (geiser-doc--pop-to-buffer))))))
+
+
+(provide 'geiser-doc)
+;;; geiser-doc.el ends here
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index aed018f..812810a 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -25,6 +25,7 @@
;;; Code:
+(require 'geiser-doc)
(require 'geiser-compile)
(require 'geiser-completion)
(require 'geiser-edit)
@@ -154,6 +155,7 @@ interacting with the Geiser REPL is at your disposal.
(define-key geiser-mode-map "\C-c\M-r" 'geiser-send-region-and-go)
(define-key geiser-mode-map "\C-c\C-a" 'geiser-autodoc-mode)
+(define-key geiser-mode-map "\C-c\C-d" 'geiser-doc-symbol-at-point)
(define-key geiser-mode-map "\C-c\M-c" 'geiser-compile-definition)
(define-key geiser-mode-map "\C-c\C-c" 'geiser-compile-definition-and-go)
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 80b637a..671c798 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -143,6 +143,7 @@ the Geiser REPL buffer."
(define-key geiser-repl-mode-map "\C-c\C-z" 'run-guile)
(define-key geiser-repl-mode-map "\C-a" 'geiser-repl--bol)
(define-key geiser-repl-mode-map "\C-ca" 'geiser-autodoc-mode)
+(define-key geiser-repl-mode-map "\C-cd" 'geiser-doc-symbol-at-point)
(define-key geiser-repl-mode-map "\C-ck" 'geiser-compile-file)
(define-key geiser-repl-mode-map "\C-cl" 'geiser-load-file)