diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-autodoc.el | 2 | ||||
-rw-r--r-- | elisp/geiser-completion.el | 15 | ||||
-rw-r--r-- | elisp/geiser-custom.el | 11 | ||||
-rw-r--r-- | elisp/geiser-doc.el | 52 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 9 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 1 |
6 files changed, 75 insertions, 15 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el index d7d6a08..7a63ef4 100644 --- a/elisp/geiser-autodoc.el +++ b/elisp/geiser-autodoc.el @@ -39,7 +39,7 @@ "Options for displaying autodoc strings in the echo area." :group 'geiser) -(geiser-custom--defface fuel-font-lock-markup-title +(geiser-custom--defface autodoc-current-arg 'bold geiser-autodoc "highlighting current argument in autodoc messages") (defcustom geiser-autodoc-delay 0.2 diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el index 814a587..22b36a1 100644 --- a/elisp/geiser-completion.el +++ b/elisp/geiser-completion.el @@ -26,6 +26,7 @@ (require 'geiser-eval) (require 'geiser-log) +(require 'geiser-syntax) (require 'geiser-base) @@ -172,13 +173,13 @@ terminates a current completion." (defvar geiser-completion--module-history nil) -(defun geiser-completion--read-module () - (let ((minibuffer-local-completion-map geiser-completion--module-minibuffer-map) - (modules (geiser-completion--module-list)) - (prompt "Module name: ")) - (if modules - (completing-read prompt modules nil nil nil geiser-completion--module-history) - (read-string prompt nil geiser-completion--module-history)))) +(defun geiser-completion--read-module (&optional prompt default history) + (let ((minibuffer-local-completion-map geiser-completion--module-minibuffer-map)) + (completing-read (or prompt "Module name: ") + (geiser-completion--module-list) + nil nil + (or default (geiser-syntax--buffer-module)) + (or history geiser-completion--module-history)))) (defun geiser--respecting-message (format &rest format-args) "Display TEXT as a message, without hiding any minibuffer contents." diff --git a/elisp/geiser-custom.el b/elisp/geiser-custom.el index 591d11a..27bcd33 100644 --- a/elisp/geiser-custom.el +++ b/elisp/geiser-custom.el @@ -43,11 +43,12 @@ :group 'faces) (defmacro geiser-custom--defface (face def group doc) - `(defface ,face (face-default-spec ,def) - ,(format "Face for %s." doc) - :group ',group - :group 'geiser-faces - :group 'faces)) + (let ((face (intern (format "geiser-font-lock-%s" face)))) + `(defface ,face (face-default-spec ,def) + ,(format "Face for %s." doc) + :group ',group + :group 'geiser-faces + :group 'faces))) (put 'geiser-custom--defface 'lisp-indent-function 1) diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el index 9dcb951..6bb1d10 100644 --- a/elisp/geiser-doc.el +++ b/elisp/geiser-doc.el @@ -26,10 +26,25 @@ (require 'geiser-completion) (require 'geiser-eval) +(require 'geiser-syntax) (require 'geiser-popup) +(require 'geiser-custom) (require 'geiser-base) +;;; Customization: + +(defgroup geiser-doc nil + "Options for documentation buffers." + :group 'geiser) + +(geiser-custom--defface doc-title + 'bold geiser-doc "article titles in documentation buffers") + +(geiser-custom--defface doc-link + 'link geiser-doc "links in documentation buffers") + + ;;; Documentation buffer: (geiser-popup--define doc "*Geiser documentation*" fundamental-mode) @@ -40,6 +55,26 @@ (defun geiser-doc--get-docstring (symbol) (geiser-eval--send/result `(:gs ((:ge docstring) ',symbol)))) +(defun geiser-doc--get-module-children (module) + (geiser-eval--send/result `(:gs ((:ge module-children) (quote (:scm ,module)))))) + + +;;; Auxiliary functions: + +(defun geiser-doc--insert-title (title) + (let ((p (point))) + (insert title) + (put-text-property p (point) 'face 'geiser-font-lock-doc-title)) + (newline)) + +(defun geiser-doc--insert-list (title lst) + (when lst + (geiser-doc--insert-title title) + (newline) + (dolist (w lst) + (insert (format "\t- %s\n" w))) + (newline))) + ;;; Commands: @@ -58,6 +93,23 @@ With prefix argument, ask for symbol (with completion)." (insert ds)) (geiser-doc--pop-to-buffer)))))) +(defun geiser-doc-module (module) + "Display information about a given module." + (interactive (list (geiser-completion--read-module))) + (let ((children (geiser-doc--get-module-children module))) + (if (not children) + (message "No info available for %s" module) + (geiser-doc--with-buffer + (erase-buffer) + (geiser-doc--insert-title (format "%s" module)) + (newline) + (geiser-doc--insert-list "Procedures:" (cdr (assoc 'procs children))) + (geiser-doc--insert-list "Variables:" (cdr (assoc 'vars children))) + (geiser-doc--insert-list "Submodules:" (cdr (assoc 'modules children))) + (goto-char (point-min))) + (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 84455e7..b023c3d 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -147,6 +147,10 @@ interacting with the Geiser REPL is at your disposal. ;;; Keys: +(defun geiser-mode--triple-chord (p k c) + (define-key geiser-mode-map (vector '(control ?c) `(control ,p) k) c) + (define-key geiser-mode-map (vector '(control ?c) `(control ,p) `(control ,k)) c)) + (define-key geiser-mode-map "\C-c\C-z" 'switch-to-guile) (define-key geiser-mode-map "\C-c\C-l" 'geiser-load-current-buffer) (define-key geiser-mode-map "\C-c\C-k" 'geiser-compile-current-buffer) @@ -162,8 +166,9 @@ interacting with the Geiser REPL is at your disposal. (define-key geiser-mode-map "\C-c\C-r" 'geiser-send-region) (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) +(geiser-mode--triple-chord ?d ?a 'geiser-autodoc-mode) +(geiser-mode--triple-chord ?d ?d 'geiser-doc-symbol-at-point) +(geiser-mode--triple-chord ?d ?m 'geiser-doc-module) (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 5b58a0a..ea424e3 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -150,6 +150,7 @@ REPL buffer." (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-cm" 'geiser-doc-module) (define-key geiser-repl-mode-map "\C-ck" 'geiser-compile-file) (define-key geiser-repl-mode-map "\C-cl" 'geiser-load-file) |