summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-16 22:21:28 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-16 22:21:28 +0100
commit41d54012368ca33461fe3e8668c2b0e3052af3b8 (patch)
tree52137aa1371e7c1ec81b95508a504eabba3b0bc3
parentfbc65dfc767da1dc3b28262eae041e9d303752c2 (diff)
downloadgeiser-chez-41d54012368ca33461fe3e8668c2b0e3052af3b8.tar.gz
geiser-chez-41d54012368ca33461fe3e8668c2b0e3052af3b8.tar.bz2
New command to open module file.
-rw-r--r--README39
-rw-r--r--elisp/geiser-edit.el16
-rw-r--r--elisp/geiser-eval.el3
-rw-r--r--elisp/geiser-mode.el3
-rw-r--r--elisp/geiser-syntax.el5
-rw-r--r--scheme/guile/geiser/emacs.scm3
-rw-r--r--scheme/guile/geiser/eval.scm6
-rw-r--r--scheme/guile/geiser/introspection.scm11
8 files changed, 49 insertions, 37 deletions
diff --git a/README b/README
index 1a00d09..6eb8c18 100644
--- a/README
+++ b/README
@@ -14,25 +14,26 @@
*** In Scheme buffers:
- |---------------+-------------------------------------------------|
- | C-cC-z | Switch to REPL |
- |---------------+-------------------------------------------------|
- | M-. | Edit symbol at point |
- | M-, | Go back to where M-. was last invoked |
- |---------------+-------------------------------------------------|
- | C-M-x, C-cC-e | Eval definition around point |
- | C-cMe | Eval definition around point and switch to REPL |
- | C-xC-e | Eval sexp before point |
- | C-cC-r | Eval region |
- | C-cM-r | Eval region and switch to REPL |
- |---------------+-------------------------------------------------|
- | C-cC-k | Compile and load current file |
- | C-cC-l | Load current file |
- |---------------+-------------------------------------------------|
- | C-cC-dd | See docstring for symbol at point |
- | C-cC-dm | See module documentation |
- | C-cC-da | Toggle autodoc mode |
- |---------------+-------------------------------------------------|
+ |---------+-------------------------------------------------|
+ | C-cC-z | Switch to REPL |
+ |---------+-------------------------------------------------|
+ | M-. | Edit symbol at point |
+ | M-, | Go back to where M-. was last invoked |
+ | C-cC-em | Ask for a module and open its file |
+ |---------+-------------------------------------------------|
+ | C-M-x | Eval definition around point |
+ | C-cM-e | Eval definition around point and switch to REPL |
+ | C-xC-e | Eval sexp before point |
+ | C-cC-r | Eval region |
+ | C-cM-r | Eval region and switch to REPL |
+ |---------+-------------------------------------------------|
+ | C-cC-k | Compile and load current file |
+ | C-cC-l | Load current file |
+ |---------+-------------------------------------------------|
+ | C-cC-dd | See documentation for symbol at point |
+ | C-cC-dm | See module documentation |
+ | C-cC-da | Toggle autodoc mode |
+ |---------+-------------------------------------------------|
If `geiser-mode-smart-tab-p' is nil
|----------+-------------------------------|
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index fc28d09..5d6ca46 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -63,11 +63,11 @@
(defconst geiser-edit--def-re
(regexp-opt '("define" "defmacro" "define-macro" "define-syntax" "define*")))
-(defsubst geiser-edit--def-re (symbol)
- (format "(%s +(?%s\\_>" geiser-edit--def-re (regexp-quote (symbol-name symbol))))
+(defsubst geiser-edit--def-re (thing)
+ (format "(%s +(?%s\\_>" geiser-edit--def-re (regexp-quote (format "%s" thing))))
-(defsubst geiser-edit--symbol-re (symbol)
- (format "\\_<%s\\_>" (regexp-quote (symbol-name symbol))))
+(defsubst geiser-edit--symbol-re (thing)
+ (format "\\_<%s\\_>" (regexp-quote (format "%s" thing))))
(defun geiser-edit--goto-line (symbol line)
(if (numberp line)
@@ -81,7 +81,7 @@
(let* ((loc (geiser-eval--retort-result ret))
(file (geiser-edit--location-file loc))
(line (geiser-edit--location-line loc)))
- (unless file (error "Couldn't find edit location"))
+ (unless file (error "Couldn't find edit location for '%s'" symbol))
(unless (file-readable-p file) (error "Couldn't open '%s' for read" file))
(geiser-edit--visit-file file geiser-edit-symbol-method)
(geiser-edit--goto-line symbol line)))
@@ -116,6 +116,12 @@ With prefix, asks for the symbol to edit."
(pop-tag-mark)
(error "No previous location for find symbol invocation")))
+(defun geiser-edit-module (module)
+ "Asks for a module and opens it in a new buffer."
+ (interactive (list (geiser-completion--read-module)))
+ (let ((cmd `(:gs ((:ge module-location) (quote (:scm ,module))))))
+ (geiser-edit--try-edit module (geiser-eval--send/wait cmd))))
+
(provide 'geiser-edit)
;;; geiser-edit.el ends here
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 7a729cf..b1bd83b 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -51,7 +51,8 @@
") (quote "
(or (and (nth 1 code)
(geiser-eval--scheme-str (nth 1 code)))
- (geiser-syntax--buffer-module))
+ (geiser-syntax--buffer-module)
+ "#f")
"))"))
(defsubst geiser-eval--ge (proc)
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index b023c3d..cd7a5a6 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -161,7 +161,6 @@ interacting with the Geiser REPL is at your disposal.
(define-key geiser-mode-map "\M-\C-x" 'geiser-send-definition)
(define-key geiser-mode-map "\C-x\C-e" 'geiser-send-last-sexp)
-(define-key geiser-mode-map "\C-c\C-e" 'geiser-send-definition)
(define-key geiser-mode-map "\C-c\M-e" 'geiser-send-definition-and-go)
(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)
@@ -170,6 +169,8 @@ interacting with the Geiser REPL is at your disposal.
(geiser-mode--triple-chord ?d ?d 'geiser-doc-symbol-at-point)
(geiser-mode--triple-chord ?d ?m 'geiser-doc-module)
+(geiser-mode--triple-chord ?e ?m 'geiser-edit-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)
(define-key geiser-mode-map "\C-c\C-t" 'geiser-trace-procedure)
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 1897898..6577152 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -39,9 +39,8 @@
(with-current-buffer buffer
(save-excursion
(goto-char (point-min))
- (if (re-search-forward geiser-syntax--module-definition-re nil t)
- (match-string-no-properties 1)
- "#f")))))
+ (when (re-search-forward geiser-syntax--module-definition-re nil t)
+ (match-string-no-properties 1))))))
;;; Indentation:
diff --git a/scheme/guile/geiser/emacs.scm b/scheme/guile/geiser/emacs.scm
index 0f7b7c7..b5ba284 100644
--- a/scheme/guile/geiser/emacs.scm
+++ b/scheme/guile/geiser/emacs.scm
@@ -32,7 +32,8 @@
ge:load-file
ge:docstring
ge:all-modules
- ge:module-children)
+ ge:module-children
+ ge:module-location)
#:use-module ((geiser introspection)
:renamer (symbol-prefix-proc 'ge:))
#:use-module ((geiser eval)
diff --git a/scheme/guile/geiser/eval.scm b/scheme/guile/geiser/eval.scm
index 0e3c7dc..a74bf29 100644
--- a/scheme/guile/geiser/eval.scm
+++ b/scheme/guile/geiser/eval.scm
@@ -26,7 +26,8 @@
(define-module (geiser eval)
#:export (eval-in comp-file load-file)
- #:use-module (srfi srfi-1))
+ #:use-module (srfi srfi-1)
+ #:no-backtrace)
(define (eval-in form module-name)
"Evals @var{form} in the module designated by @var{module-name}.
@@ -35,7 +36,8 @@ The result is a list of the form ((RESULT . <form-value>) (OUTPUT . <string>))
if no evaluation error happens, or ((ERROR (KEY . <error-key>) <error-arg>...))
in case of errors. Each error arg is a cons (NAME . VALUE), where NAME includes
SUBR, MSG and REST."
- (let ((module (or (and module-name (resolve-module module-name))
+ (let ((module (or (and (list? module-name)
+ (resolve-module module-name))
(current-module))))
(catch #t
(lambda ()
diff --git a/scheme/guile/geiser/introspection.scm b/scheme/guile/geiser/introspection.scm
index 110ab01..2021a32 100644
--- a/scheme/guile/geiser/introspection.scm
+++ b/scheme/guile/geiser/introspection.scm
@@ -30,7 +30,8 @@
symbol-location
docstring
all-modules
- module-children)
+ module-children
+ module-location)
#:use-module (system vm program)
#:use-module (ice-9 session)
#:use-module (ice-9 documentation)
@@ -114,8 +115,11 @@
(apropos-internal (string-append "^" prefix)))
string<?))
+(define (module-location name)
+ (make-location (module-filename name) #f))
+
(define (symbol-location sym)
- (cond ((symbol-module sym) => make-location-from-module-name)
+ (cond ((symbol-module sym) => module-location)
(else '())))
(define (make-location file line)
@@ -124,9 +128,6 @@
(define module-filename (@@ (ice-9 session) module-filename))
-(define (make-location-from-module-name name)
- (make-location (module-filename name) #f))
-
(define (display-docstring sym)
(let ((obj (symbol->obj sym)))
(if obj