From 9ab8feaa541efe3ee223c8d18797ea02be3c5ff9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 17 Jun 2009 03:14:45 +0200 Subject: PLT: buttonize errors implemented. --- elisp/geiser-plt.el | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'elisp/geiser-plt.el') diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el index 44312b9..6c50c99 100644 --- a/elisp/geiser-plt.el +++ b/elisp/geiser-plt.el @@ -24,6 +24,8 @@ ;;; Code: +(require 'geiser-edit) +(require 'geiser-doc) (require 'geiser-eval) (require 'geiser-syntax) (require 'geiser-custom) @@ -121,12 +123,47 @@ This function uses `geiser-plt-init-file' if it exists." ;;; External help + (defun geiser-plt-external-help (symbol module) (message "Requesting help for '%s'..." symbol) - (geiser-eval--send/wait `(:eval (get-help ',symbol (:module ,module)) geiser/autodoc)) + (geiser-eval--send/wait + `(:eval (get-help ',symbol (:module ,module)) geiser/autodoc)) (minibuffer-message "%s done" (current-message)) t) + +;;; Error display + +(defconst geiser-plt--file-rx-0 "^\\([^:\n\"]+\\):\\([0-9]+\\):\\([0-9]+\\)") +(defconst geiser-plt--file-rx-1 "path:\"?\\([^>\"\n]+\\)\"?>") +(defconst geiser-plt--file-rx-2 "module: \"\\([^>\"\n]+\\)\"") + +(defun geiser-plt--find-files (rx) + (save-excursion + (while (re-search-forward rx nil t) + (geiser-edit--make-link (match-beginning 1) + (match-end 1) + (match-string 1) + (match-string 2) + (match-string 3))))) + +(defun geiser-plt-display-error (module key msg) + (insert "Error: ") + (when key (geiser-doc--insert-button key nil 'plt)) + (newline 2) + (when msg + (let ((p (point))) + (insert msg) + (let ((end (point))) + (goto-char p) + (geiser-plt--find-files geiser-plt--file-rx-0) + (geiser-plt--find-files geiser-plt--file-rx-1) + (geiser-plt--find-files geiser-plt--file-rx-2) + (goto-char end) + (fill-region p end) + (newline)))) + t) + ;;; Trying to ascertain whether a buffer is mzscheme scheme: -- cgit v1.2.3 From 75797be249aeae5b5f65850a5c2fe05e855aa1f8 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 17 Jun 2009 03:25:44 +0200 Subject: Refactoring. --- elisp/geiser-plt.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'elisp/geiser-plt.el') diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el index 6c50c99..2fbfb22 100644 --- a/elisp/geiser-plt.el +++ b/elisp/geiser-plt.el @@ -134,9 +134,9 @@ This function uses `geiser-plt-init-file' if it exists." ;;; Error display -(defconst geiser-plt--file-rx-0 "^\\([^:\n\"]+\\):\\([0-9]+\\):\\([0-9]+\\)") -(defconst geiser-plt--file-rx-1 "path:\"?\\([^>\"\n]+\\)\"?>") -(defconst geiser-plt--file-rx-2 "module: \"\\([^>\"\n]+\\)\"") +(defconst geiser-plt--file-rxs '("^\\([^:\n\"]+\\):\\([0-9]+\\):\\([0-9]+\\)" + "path:\"?\\([^>\"\n]+\\)\"?>" + "module: \"\\([^>\"\n]+\\)\"")) (defun geiser-plt--find-files (rx) (save-excursion @@ -148,17 +148,16 @@ This function uses `geiser-plt-init-file' if it exists." (match-string 3))))) (defun geiser-plt-display-error (module key msg) - (insert "Error: ") - (when key (geiser-doc--insert-button key nil 'plt)) - (newline 2) + (when key + (insert "Error: ") + (geiser-doc--insert-button key nil 'plt) + (newline 2)) (when msg (let ((p (point))) (insert msg) (let ((end (point))) (goto-char p) - (geiser-plt--find-files geiser-plt--file-rx-0) - (geiser-plt--find-files geiser-plt--file-rx-1) - (geiser-plt--find-files geiser-plt--file-rx-2) + (mapc 'geiser-plt--find-files geiser-plt--file-rxs) (goto-char end) (fill-region p end) (newline)))) -- cgit v1.2.3 From a16ac6bd5df86e3541892982d7694f7c1385c5e9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 18 Jun 2009 17:41:18 +0200 Subject: PLT: Bug fix in implementation guessing. --- elisp/geiser-plt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elisp/geiser-plt.el') diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el index 2fbfb22..b497d05 100644 --- a/elisp/geiser-plt.el +++ b/elisp/geiser-plt.el @@ -171,7 +171,7 @@ This function uses `geiser-plt-init-file' if it exists." (goto-char (point-min)) (re-search-forward "#lang " nil t)) (geiser-plt--explicit-module) - (string-equal (file-name-extension (buffer-file-name)) "ss"))) + (string-equal (file-name-extension (or (buffer-file-name) "")) "ss"))) (provide 'geiser-plt) -- cgit v1.2.3 From 69b30de19af8cc0d58fa177ef9d40057c15f6951 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 18 Aug 2009 23:46:05 +0200 Subject: PLT: bug fix in (module) recognition. --- elisp/geiser-plt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elisp/geiser-plt.el') diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el index b497d05..8810250 100644 --- a/elisp/geiser-plt.el +++ b/elisp/geiser-plt.el @@ -111,7 +111,7 @@ This function uses `geiser-plt-init-file' if it exists." :f))) (defun geiser-plt-get-module (&optional module) - (cond ((and (null module) (geiser-plt--explicit-module))) + (cond ((and (null module) (buffer-file-name))) ;; (geiser-plt--explicit-module) ((null module) (geiser-plt--implicit-module)) ((symbolp module) module) ((and (stringp module) (file-name-absolute-p module)) module) -- cgit v1.2.3