summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-26 12:23:53 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-08-26 12:23:53 +0200
commitcee169c2de13d30f213b03578e70ca7c370e2684 (patch)
tree9111729fad059dd1c55527c5d22303a72edba495
parent2f5a1cce9e66e6f931749e5d3df6fe3fb220ad1f (diff)
downloadgeiser-chez-cee169c2de13d30f213b03578e70ca7c370e2684.tar.gz
geiser-chez-cee169c2de13d30f213b03578e70ca7c370e2684.tar.bz2
Company's go to location working also for locations in same file.
-rw-r--r--elisp/geiser-company.el10
-rw-r--r--elisp/geiser-edit.el16
2 files changed, 15 insertions, 11 deletions
diff --git a/elisp/geiser-company.el b/elisp/geiser-company.el
index 15b9cb8..2fb89f4 100644
--- a/elisp/geiser-company.el
+++ b/elisp/geiser-company.el
@@ -41,7 +41,8 @@
(ignore-errors
(if module
(format "%s [module]" id)
- (geiser-autodoc--autodoc (list (list (intern id) 0)) t))))
+ (or (geiser-autodoc--autodoc (list (list (intern id) 0)) t)
+ (format "%s [local id]" id)))))
(defsubst geiser-company--doc-buffer (id module)
nil)
@@ -49,9 +50,10 @@
(defun geiser-company--location (id module)
(ignore-errors
(let ((id (intern id)))
- (save-current-buffer
- (if module (geiser-edit-module id) (geiser-edit-symbol id))
- (cons (current-buffer) (point))))))
+ (save-excursion
+ (if module
+ (geiser-edit-module id 'noselect)
+ (geiser-edit-symbol id 'noselect))))))
(defun geiser-company--prefix-at-point (module)
(when geiser-company--enabled-flag
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index 418b6e3..0ec1669 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -56,6 +56,7 @@ or following links in error buffers.")
(defun geiser-edit--visit-file (file method)
(cond ((eq method 'window) (find-file-other-window file))
((eq method 'frame) (find-file-other-frame file))
+ ((eq method 'noselect) (find-file-noselect file t))
(t (find-file file))))
(defsubst geiser-edit--location-name (loc)
@@ -126,10 +127,11 @@ or following links in error buffers.")
(geiser-edit--goto-line symbol line)
(when col
(beginning-of-line)
- (forward-char col))))
+ (forward-char col))
+ (cons (current-buffer) (point))))
-(defsubst geiser-edit--try-edit (symbol ret)
- (geiser-edit--try-edit-location symbol (geiser-eval--retort-result ret)))
+(defsubst geiser-edit--try-edit (symbol ret &optional method)
+ (geiser-edit--try-edit-location symbol (geiser-eval--retort-result ret) method))
;;; Links
@@ -155,13 +157,13 @@ or following links in error buffers.")
(defvar geiser-edit--symbol-history nil)
-(defun geiser-edit-symbol (symbol)
+(defun geiser-edit-symbol (symbol &optional method)
"Asks for a symbol to edit, with completion."
(interactive (list (geiser-completion--read-symbol "Edit symbol: "
nil
geiser-edit--symbol-history)))
(let ((cmd `(:eval ((:ge symbol-location) ',symbol))))
- (geiser-edit--try-edit symbol (geiser-eval--send/wait cmd))))
+ (geiser-edit--try-edit symbol (geiser-eval--send/wait cmd) method)))
(defun geiser-edit-symbol-at-point (&optional arg)
"Opens a new window visiting the definition of the symbol at point.
@@ -181,11 +183,11 @@ With prefix, asks for the symbol to edit."
(pop-tag-mark)
(error "No previous location for find symbol invocation")))
-(defun geiser-edit-module (module)
+(defun geiser-edit-module (module &optional method)
"Asks for a module and opens it in a new buffer."
(interactive (list (geiser-completion--read-module)))
(let ((cmd `(:eval ((:ge module-location) (:module ,module)))))
- (geiser-edit--try-edit module (geiser-eval--send/wait cmd))))
+ (geiser-edit--try-edit module (geiser-eval--send/wait cmd) method)))
(provide 'geiser-edit)