summaryrefslogtreecommitdiff
path: root/elisp/geiser-doc.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-14 20:52:27 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-14 20:52:27 +0100
commit11a64e7405ade65d48c28c578dfb18d15f9499d1 (patch)
treefcdb4501e9654140a2962592ca23250b4cf371bf /elisp/geiser-doc.el
parent93b51a8d4613364e04f52f78914c0f635b681f9f (diff)
downloadgeiser-11a64e7405ade65d48c28c578dfb18d15f9499d1.tar.gz
geiser-11a64e7405ade65d48c28c578dfb18d15f9499d1.tar.bz2
New command to get docstrings (C-cC-d).
Diffstat (limited to 'elisp/geiser-doc.el')
-rw-r--r--elisp/geiser-doc.el63
1 files changed, 63 insertions, 0 deletions
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