From 11a64e7405ade65d48c28c578dfb18d15f9499d1 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 14 Feb 2009 20:52:27 +0100 Subject: New command to get docstrings (C-cC-d). --- elisp/geiser-doc.el | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 elisp/geiser-doc.el (limited to 'elisp/geiser-doc.el') 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 +;; 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 . + +;;; 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 -- cgit v1.2.3