diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-10-31 15:13:19 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-10-31 15:13:19 +0100 |
commit | c2ebb3b25951f4b2f7e161ede9bd250f3870fedb (patch) | |
tree | 2817b33c2dbc25d39fb1c83fb3672c971b1e19f0 | |
parent | 55c0dc91f8410fbc96c766fde3b5e43c3b2b00f7 (diff) | |
download | geiser-c2ebb3b25951f4b2f7e161ede9bd250f3870fedb.tar.gz geiser-c2ebb3b25951f4b2f7e161ede9bd250f3870fedb.tar.bz2 |
Always fallback to edit-module in M-.
-rw-r--r-- | elisp/geiser-completion.el | 5 | ||||
-rw-r--r-- | elisp/geiser-edit.el | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el index 5c2f604..d346190 100644 --- a/elisp/geiser-completion.el +++ b/elisp/geiser-completion.el @@ -214,6 +214,11 @@ we're looking for a module name.") (defsubst geiser-completion--symbol-begin (module) (funcall geiser-completion--symbol-begin-function module)) +(defun geiser-completion--module-at-point () + (save-excursion + (goto-char (geiser-completion--symbol-begin t)) + (ignore-errors (thing-at-point 'sexp)))) + (defsubst geiser-completion--prefix (module) (buffer-substring-no-properties (geiser-completion--symbol-begin module) (point))) diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el index e8e439c..4d61edc 100644 --- a/elisp/geiser-edit.el +++ b/elisp/geiser-edit.el @@ -205,8 +205,10 @@ With prefix, asks for the symbol to edit." (geiser-completion--read-symbol "Edit symbol: "))) (cmd `(:eval (:ge symbol-location ',symbol))) (marker (point-marker))) - (geiser-edit--try-edit symbol (geiser-eval--send/wait cmd)) - (when marker (ring-insert find-tag-marker-ring marker)))) + (condition-case nil + (progn (geiser-edit--try-edit symbol (geiser-eval--send/wait cmd)) + (when marker (ring-insert find-tag-marker-ring marker))) + (error (geiser-edit-module-at-point))))) (defun geiser-pop-symbol-stack () "Pop back to where \\[geiser-edit-symbol-at-point] was last invoked." @@ -221,6 +223,16 @@ With prefix, asks for the symbol to edit." (let ((cmd `(:eval (:ge module-location '(:module ,module))))) (geiser-edit--try-edit module (geiser-eval--send/wait cmd) method))) + +(defun geiser-edit-module-at-point () + "Opens a new window visiting the module at point." + (interactive) + (let ((marker (point-marker))) + (geiser-edit-module (or (geiser-completion--module-at-point) + (geiser-completion--read-module))) + (when marker (ring-insert find-tag-marker-ring marker)))) + + (provide 'geiser-edit) ;;; geiser-edit.el ends here |