diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-26 12:23:53 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-26 12:23:53 +0200 |
commit | e7cdf10b94d7f5e66a5b3a6e7e65439ef35f874f (patch) | |
tree | 9e8a158bc843df47047dde625b432e037936b40b /elisp | |
parent | 69643a0d6d214a164117a49696b08073cfbe58e5 (diff) | |
download | geiser-e7cdf10b94d7f5e66a5b3a6e7e65439ef35f874f.tar.gz geiser-e7cdf10b94d7f5e66a5b3a6e7e65439ef35f874f.tar.bz2 |
Company's go to location working also for locations in same file.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-company.el | 10 | ||||
-rw-r--r-- | elisp/geiser-edit.el | 16 |
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) |