From 404401056c9526e2e96e08617b92f735a7e160fd Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 9 Mar 2009 23:52:04 +0100 Subject: Support for multiple Scheme implementations, Chapter 1. * Evaluation system is now pluggable * The rest of the system understands said pluggability * Guile provides its own implementation (geiser-guile) * The reload system is aware of the new kids on the block --- elisp/geiser-guile.el | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 elisp/geiser-guile.el diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el new file mode 100644 index 0000000..fde2954 --- /dev/null +++ b/elisp/geiser-guile.el @@ -0,0 +1,105 @@ +;; geiser-guile.el -- guile's implementation of the geiser protocols + +;; Copyright (C) 2009 Jose Antonio Ortega Ruiz + +;; Author: Jose Antonio Ortega Ruiz +;; Start date: Sun Mar 08, 2009 23:03 + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Comentary: + +;; Implementation of all required Elisp Geiser protocols for Guile. + +;;; Code: + +(require 'geiser-impl) +(require 'geiser-syntax) +(require 'geiser-custom) +(require 'geiser-base) + + +;;; Customization: + +(defgroup geiser-guile nil + "Customization for Geiser's Guile flavour." + :group 'geiser) + +(defcustom geiser-guile-binary + (cond ((eq system-type 'windows-nt) "guile.exe") + ((eq system-type 'darwin) "guile") + (t "guile")) + "Name to use to call the Guile executable when starting a REPL." + :type 'string + :group 'geiser-guile) + +(defcustom geiser-guile-init-file "~/.guile-geiser" + "Initialization file with user code for the Guile REPL." + :type 'string + :group 'geiser-guile) + + +;;; REPL support: + +(defun geiser-guile-parameters () + "Return a list with all parameters needed to start Guile. +This function uses `geiser-guile-init-file' if it exists." + (let ((init-file (and (stringp geiser-guile-init-file) + (expand-file-name geiser-guile-init-file)))) + `("-p" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) + +(defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") + + +;;; Evaluation support: + +(defun geiser-guile-geiser-procedure (proc) + "Translate a bare procedure symbol to one executable in Guile's +context. Return NULL for unsupported ones; at the very least, +EVAL, COMPILE, LOAD-FILE and COMPILE-FILE should be supported." + (let ((proc (intern (format "ge:%s" proc)))) + `(@ (geiser emacs) ,proc))) + +(defconst geiser-guile--module-re + "(define-module +\\(([^)]+)\\)") + +(defun geiser-guile-get-module (&optional module) + "Return a scheme datum representing the current module. +If MODULE is provided, transform it to such a datum." + (cond ((null module) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward geiser-guile--module-re nil t) + (geiser-guile-get-module (match-string-no-properties 1)) + :f))) + ((listp module) module) + ((stringp module) (or (ignore-errors (car (read-from-string module))) :f)) + (t :f))) + + +;;; Trying to ascertain whether a buffer is Guile Scheme: + +(defun geiser-guile-guess () + "Return `t' if the current buffer looks like a Guile file." + (and (geiser-guile-get-module) t)) + + +;;; Register this implementation: + +(geiser-impl--register 'guile) + + +(provide 'geiser-guile) +;;; geiser-guile.el ends here -- cgit v1.2.3 From c52771f91d3e61a2e94743e79368ed711177ae80 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 11 Mar 2009 04:06:57 +0100 Subject: Support for multiple Scheme implementations, Chapter 2. * The REPL is aware of multiple implementations... * and it knows how to create more than one connection for guile; * but it's not been tested with more than one implementation. * geiser-mode seems to be able to keep track of active REPLs. --- elisp/geiser-guile.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index fde2954..a34e4d6 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -57,11 +57,20 @@ This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file)))) - `("-p" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + `("-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) (defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") +(defun switch-to-guile (&optional ask) + (interactive "P") + (switch-to-geiser ask 'guile)) + +(defun run-guile () + "Run Geiser using Guile." + (interactive) + (run-geiser 'guile)) + ;;; Evaluation support: -- cgit v1.2.3 From 38da2b330dce33eb03e38f7376a90a1efb4d54db Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 17 Mar 2009 13:36:40 +0100 Subject: Misc nits and work in progress. --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a34e4d6..d3928b4 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -102,7 +102,7 @@ If MODULE is provided, transform it to such a datum." (defun geiser-guile-guess () "Return `t' if the current buffer looks like a Guile file." - (and (geiser-guile-get-module) t)) + (listp (geiser-guile-get-module))) ;;; Register this implementation: -- cgit v1.2.3 From f48e83fe58246c9726aea0031e5a2027c5998759 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 17 Mar 2009 14:01:06 +0100 Subject: Accept a list as Guile binary. --- elisp/geiser-guile.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index d3928b4..f7e5540 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -41,7 +41,7 @@ ((eq system-type 'darwin) "guile") (t "guile")) "Name to use to call the Guile executable when starting a REPL." - :type 'string + :type '(choice string (repeat string)) :group 'geiser-guile) (defcustom geiser-guile-init-file "~/.guile-geiser" @@ -52,12 +52,16 @@ ;;; REPL support: +(defun geiser-guile-binary () + (if (listp geiser-guile-binary) (car geiser-guile-binary) geiser-guile-binary)) + (defun geiser-guile-parameters () "Return a list with all parameters needed to start Guile. This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file)))) - `("-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) + "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) (defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3 From e1e77ab8c5de4d6c257f53c7ece4c94e4522abfd Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 19 Mar 2009 01:52:52 +0100 Subject: Guile: use the compiler by default to perform evaluations. --- elisp/geiser-guile.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f7e5540..a34f401 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -49,6 +49,13 @@ :type 'string :group 'geiser-guile) +(defcustom geiser-guile-use-compiler-in-eval t + "When enable, always use Guile's compiler to perform evaluation. +Recommended, since the compiler usually collects better metadata +than the interpreter." + :type 'boolean + :group 'geiser-guile) + ;;; REPL support: @@ -82,7 +89,11 @@ This function uses `geiser-guile-init-file' if it exists." "Translate a bare procedure symbol to one executable in Guile's context. Return NULL for unsupported ones; at the very least, EVAL, COMPILE, LOAD-FILE and COMPILE-FILE should be supported." - (let ((proc (intern (format "ge:%s" proc)))) + (let ((proc (intern (format "ge:%s" + (if (and geiser-guile-use-compiler-in-eval + (eq proc 'eval)) + 'compile + proc))))) `(@ (geiser emacs) ,proc))) (defconst geiser-guile--module-re -- cgit v1.2.3 From 4eeb06824b74d3392b699935ef5ea7d9d2c95560 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 8 May 2009 01:48:52 +0200 Subject: Module completion generalized and implemented for PLT. --- elisp/geiser-guile.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a34f401..bfdca31 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -112,6 +112,12 @@ If MODULE is provided, transform it to such a datum." ((stringp module) (or (ignore-errors (car (read-from-string module))) :f)) (t :f))) +(defun geiser-guile-symbol-begin (module) + (if module + (max (save-excursion (beginning-of-line) (point)) + (save-excursion (skip-syntax-backward "^(>") (1- (point)))) + (save-excursion (skip-syntax-backward "^-()>") (point)))) + ;;; Trying to ascertain whether a buffer is Guile Scheme: -- cgit v1.2.3 From 936a20e354b03c8a22fd8447c64e8a0eaef0ee65 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 14 May 2009 13:07:54 +0200 Subject: Fixing the mess during initialization. --- elisp/geiser-guile.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index bfdca31..f4362ca 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -24,7 +24,6 @@ ;;; Code: -(require 'geiser-impl) (require 'geiser-syntax) (require 'geiser-custom) (require 'geiser-base) @@ -125,11 +124,6 @@ If MODULE is provided, transform it to such a datum." "Return `t' if the current buffer looks like a Guile file." (listp (geiser-guile-get-module))) - -;;; Register this implementation: - -(geiser-impl--register 'guile) - (provide 'geiser-guile) ;;; geiser-guile.el ends here -- cgit v1.2.3 From 54484ab8145b2bed708e1e51f7d88b4b445e9fbc Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 20 May 2009 22:40:36 +0200 Subject: Fixes for module names reading and evaluation result display. --- elisp/geiser-guile.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f4362ca..e6e0c9a 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -85,9 +85,6 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Evaluation support: (defun geiser-guile-geiser-procedure (proc) - "Translate a bare procedure symbol to one executable in Guile's -context. Return NULL for unsupported ones; at the very least, -EVAL, COMPILE, LOAD-FILE and COMPILE-FILE should be supported." (let ((proc (intern (format "ge:%s" (if (and geiser-guile-use-compiler-in-eval (eq proc 'eval)) @@ -99,8 +96,6 @@ EVAL, COMPILE, LOAD-FILE and COMPILE-FILE should be supported." "(define-module +\\(([^)]+)\\)") (defun geiser-guile-get-module (&optional module) - "Return a scheme datum representing the current module. -If MODULE is provided, transform it to such a datum." (cond ((null module) (save-excursion (goto-char (point-min)) -- cgit v1.2.3 From bb5b1cb5e97e3e0cc7fd49411826df09c3f74f4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 23 May 2009 22:20:53 +0200 Subject: Guile: customizable load path. --- elisp/geiser-guile.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e6e0c9a..c6c165b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -43,6 +43,12 @@ :type '(choice string (repeat string)) :group 'geiser-guile) +(defcustom geiser-guile-load-path nil + "A list of paths to be added to Guile's load path when it's +started." + :type '(repeat file) + :group 'geiser-guile) + (defcustom geiser-guile-init-file "~/.guile-geiser" "Initialization file with user code for the Guile REPL." :type 'string @@ -68,6 +74,7 @@ This function uses `geiser-guile-init-file' if it exists." (expand-file-name geiser-guile-init-file)))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) (defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3 From b14ac49fd2c306bf24911313ca362fef94a9b8d1 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 13 Jun 2009 03:50:23 +0200 Subject: Guile: rewriting stack trace captures - not yet complete. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index c6c165b..44a4e9f 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -110,7 +110,8 @@ This function uses `geiser-guile-init-file' if it exists." (geiser-guile-get-module (match-string-no-properties 1)) :f))) ((listp module) module) - ((stringp module) (or (ignore-errors (car (read-from-string module))) :f)) + ((stringp module) + (or (ignore-errors (car (read-from-string module))) :f)) (t :f))) (defun geiser-guile-symbol-begin (module) -- cgit v1.2.3 From 9ff314036298b6267fbba3b403ec934ce2d45f36 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 19 Jun 2009 16:52:03 +0200 Subject: Guile: backtrace buttonization. --- elisp/geiser-guile.el | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 44a4e9f..ed2a555 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -120,6 +120,44 @@ This function uses `geiser-guile-init-file' if it exists." (save-excursion (skip-syntax-backward "^(>") (1- (point)))) (save-excursion (skip-syntax-backward "^-()>") (point)))) + +;;; Error display +(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) + +(defun geiser-guile--resolve-file (file) + (when (and (stringp file) (not (string-equal file "unknown file"))) + (if (file-name-absolute-p file) file + (or (gethash file geiser-guile--file-cache) + (puthash file + (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + geiser-guile--file-cache))))) + +(defconst geiser-guile--file-rx + "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") + +(defun geiser-guile--find-files () + (save-excursion + (while (re-search-forward geiser-guile--file-rx nil t) + (let ((file (match-string 1)) + (beg (match-beginning 1)) + (end (match-end 1)) + (line (string-to-number (or (match-string 2) "0")))) + (let ((file (geiser-guile--resolve-file file))) + (when file + (geiser-edit--make-link beg end file line 0))))))) + +(defun geiser-guile-display-error (module key msg) + (when key + (insert "Error: ") + (geiser--insert-with-face (format "%s" key) 'bold) + (newline 2)) + (when msg + (let ((p (point))) + (insert msg) + (goto-char p) + (geiser-guile--find-files))) + t) + ;;; Trying to ascertain whether a buffer is Guile Scheme: -- cgit v1.2.3 From 360343e4a2f29c25d4dbd95f4321de128f7004e0 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 23 Aug 2009 02:59:09 +0200 Subject: Fixes for all byte-compilation warnings. --- elisp/geiser-guile.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index ed2a555..ed14e87 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -27,6 +27,9 @@ (require 'geiser-syntax) (require 'geiser-custom) (require 'geiser-base) +(require 'geiser-eval) +(require 'geiser-edit) +(require 'geiser) ;;; Customization: -- cgit v1.2.3 From d5840a06d011fa88433be218262dd8787941e3db Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 11 Sep 2009 01:16:08 +0200 Subject: BSD relicensing: elisp code. --- elisp/geiser-guile.el | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index ed14e87..489dc63 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -2,27 +2,14 @@ ;; Copyright (C) 2009 Jose Antonio Ortega Ruiz -;; Author: Jose Antonio Ortega Ruiz -;; Start date: Sun Mar 08, 2009 23:03 - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3 of the License, or -;; (at your option) any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the Modified BSD License. You should +;; have received a copy of the license along with this program. If +;; not, see . -;;; Comentary: - -;; Implementation of all required Elisp Geiser protocols for Guile. +;; Start date: Sun Mar 08, 2009 23:03 -;;; Code: + (require 'geiser-syntax) (require 'geiser-custom) -- cgit v1.2.3 From 387d557d779f634d16683d81363094063248183f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 11 Sep 2009 22:01:14 +0200 Subject: Reload: we now remember user customizations and restore them during geiser-reload. --- elisp/geiser-guile.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 489dc63..849fabf 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -25,7 +25,7 @@ "Customization for Geiser's Guile flavour." :group 'geiser) -(defcustom geiser-guile-binary +(geiser-custom--defcustom geiser-guile-binary (cond ((eq system-type 'windows-nt) "guile.exe") ((eq system-type 'darwin) "guile") (t "guile")) @@ -33,18 +33,18 @@ :type '(choice string (repeat string)) :group 'geiser-guile) -(defcustom geiser-guile-load-path nil +(geiser-custom--defcustom geiser-guile-load-path nil "A list of paths to be added to Guile's load path when it's started." :type '(repeat file) :group 'geiser-guile) -(defcustom geiser-guile-init-file "~/.guile-geiser" +(geiser-custom--defcustom geiser-guile-init-file "~/.guile-geiser" "Initialization file with user code for the Guile REPL." :type 'string :group 'geiser-guile) -(defcustom geiser-guile-use-compiler-in-eval t +(geiser-custom--defcustom geiser-guile-use-compiler-in-eval t "When enable, always use Guile's compiler to perform evaluation. Recommended, since the compiler usually collects better metadata than the interpreter." -- cgit v1.2.3 From 236ec5f042d70836db8eeba819b528989b477fac Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 15 Sep 2009 00:30:06 +0200 Subject: Guile: define-module forms are now individually evaluable (e.g. using C-M-x or C-x C-e). --- elisp/geiser-guile.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 849fabf..fca4b01 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -95,8 +95,11 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile-get-module (&optional module) (cond ((null module) (save-excursion - (goto-char (point-min)) - (if (re-search-forward geiser-guile--module-re nil t) + (ignore-errors + (backward-sexp) + (while (not (zerop (geiser-syntax--nesting-level))) + (backward-up-list))) + (if (re-search-backward geiser-guile--module-re nil t) (geiser-guile-get-module (match-string-no-properties 1)) :f))) ((listp module) module) @@ -152,9 +155,9 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Trying to ascertain whether a buffer is Guile Scheme: (defun geiser-guile-guess () - "Return `t' if the current buffer looks like a Guile file." - (listp (geiser-guile-get-module))) - + (save-excursion + (goto-char (point-min)) + (re-search-forward geiser-guile--module-re nil t))) (provide 'geiser-guile) ;;; geiser-guile.el ends here -- cgit v1.2.3 From 19f55b0b94c727a5eb34d39274c2f1038c122d95 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 22 Sep 2009 22:43:28 +0200 Subject: New implementation registration mechanism, for the elisp side of things. Implementations must invoke define-geiser-implementation with an appropriate set of methods. Simple inheritance is supported. Each geiser module defines and registers the method names it uses. --- elisp/geiser-guile.el | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index fca4b01..806bc97 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -69,15 +69,6 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") -(defun switch-to-guile (&optional ask) - (interactive "P") - (switch-to-geiser ask 'guile)) - -(defun run-guile () - "Run Geiser using Guile." - (interactive) - (run-geiser 'guile)) - ;;; Evaluation support: @@ -158,6 +149,22 @@ This function uses `geiser-guile-init-file' if it exists." (save-excursion (goto-char (point-min)) (re-search-forward geiser-guile--module-re nil t))) + + +;;; Implementation definition: + +(define-geiser-implementation guile + (binary geiser-guile-binary) + (arglist geiser-guile-parameters) + (startup) + (prompt-regexp geiser-guile-prompt-regexp) + (marshall-procedure geiser-guile-geiser-procedure) + (find-module geiser-guile-get-module) + (find-symbol-begin geiser-guile-symbol-begin) + (display-error geiser-guile-display-error) + (display-help) + (check-buffer geiser-guile-guess)) + (provide 'geiser-guile) ;;; geiser-guile.el ends here -- cgit v1.2.3 From 58ae3a1f432c71030dbdaf392d71e105a056c693 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 27 Sep 2009 23:51:18 +0200 Subject: Cosmetics. --- elisp/geiser-guile.el | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 806bc97..332454f 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -44,20 +44,13 @@ started." :type 'string :group 'geiser-guile) -(geiser-custom--defcustom geiser-guile-use-compiler-in-eval t - "When enable, always use Guile's compiler to perform evaluation. -Recommended, since the compiler usually collects better metadata -than the interpreter." - :type 'boolean - :group 'geiser-guile) - ;;; REPL support: -(defun geiser-guile-binary () +(defun geiser-guile--binary () (if (listp geiser-guile-binary) (car geiser-guile-binary) geiser-guile-binary)) -(defun geiser-guile-parameters () +(defun geiser-guile--parameters () "Return a list with all parameters needed to start Guile. This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) @@ -67,23 +60,19 @@ This function uses `geiser-guile-init-file' if it exists." ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) -(defconst geiser-guile-prompt-regexp "^[^() \n]+@([^)]*?)> ") +(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") ;;; Evaluation support: -(defun geiser-guile-geiser-procedure (proc) - (let ((proc (intern (format "ge:%s" - (if (and geiser-guile-use-compiler-in-eval - (eq proc 'eval)) - 'compile - proc))))) +(defun geiser-guile--geiser-procedure (proc) + (let ((proc (intern (format "ge:%s" (if (eq proc 'eval) 'compile proc))))) `(@ (geiser emacs) ,proc))) (defconst geiser-guile--module-re "(define-module +\\(([^)]+)\\)") -(defun geiser-guile-get-module (&optional module) +(defun geiser-guile--get-module (&optional module) (cond ((null module) (save-excursion (ignore-errors @@ -91,14 +80,14 @@ This function uses `geiser-guile-init-file' if it exists." (while (not (zerop (geiser-syntax--nesting-level))) (backward-up-list))) (if (re-search-backward geiser-guile--module-re nil t) - (geiser-guile-get-module (match-string-no-properties 1)) + (geiser-guile--get-module (match-string-no-properties 1)) :f))) ((listp module) module) ((stringp module) (or (ignore-errors (car (read-from-string module))) :f)) (t :f))) -(defun geiser-guile-symbol-begin (module) +(defun geiser-guile--symbol-begin (module) (if module (max (save-excursion (beginning-of-line) (point)) (save-excursion (skip-syntax-backward "^(>") (1- (point)))) @@ -130,7 +119,7 @@ This function uses `geiser-guile-init-file' if it exists." (when file (geiser-edit--make-link beg end file line 0))))))) -(defun geiser-guile-display-error (module key msg) +(defun geiser-guile--display-error (module key msg) (when key (insert "Error: ") (geiser--insert-with-face (format "%s" key) 'bold) @@ -145,7 +134,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Trying to ascertain whether a buffer is Guile Scheme: -(defun geiser-guile-guess () +(defun geiser-guile--guess () (save-excursion (goto-char (point-min)) (re-search-forward geiser-guile--module-re nil t))) @@ -154,16 +143,16 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Implementation definition: (define-geiser-implementation guile - (binary geiser-guile-binary) - (arglist geiser-guile-parameters) + (binary geiser-guile--binary) + (arglist geiser-guile--parameters) (startup) - (prompt-regexp geiser-guile-prompt-regexp) - (marshall-procedure geiser-guile-geiser-procedure) - (find-module geiser-guile-get-module) - (find-symbol-begin geiser-guile-symbol-begin) - (display-error geiser-guile-display-error) + (prompt-regexp geiser-guile--prompt-regexp) + (marshall-procedure geiser-guile--geiser-procedure) + (find-module geiser-guile--get-module) + (find-symbol-begin geiser-guile--symbol-begin) + (display-error geiser-guile--display-error) (display-help) - (check-buffer geiser-guile-guess)) + (check-buffer geiser-guile--guess)) (provide 'geiser-guile) -- cgit v1.2.3 From ed29f9f4f9661a71cf5ee3f1fd3b2f6fb0a6bd37 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 18 Dec 2009 00:24:16 +0100 Subject: Guile: bug in backtrace display fixed. --- elisp/geiser-guile.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 332454f..c173f4d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -109,15 +109,16 @@ This function uses `geiser-guile-init-file' if it exists." "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") (defun geiser-guile--find-files () - (save-excursion - (while (re-search-forward geiser-guile--file-rx nil t) - (let ((file (match-string 1)) - (beg (match-beginning 1)) - (end (match-end 1)) - (line (string-to-number (or (match-string 2) "0")))) - (let ((file (geiser-guile--resolve-file file))) - (when file - (geiser-edit--make-link beg end file line 0))))))) + (with--geiser-implementation 'guile + (save-excursion + (while (re-search-forward geiser-guile--file-rx nil t) + (let ((file (match-string 1)) + (beg (match-beginning 1)) + (end (match-end 1)) + (line (string-to-number (or (match-string 2) "0")))) + (let ((file (geiser-guile--resolve-file file))) + (when file + (geiser-edit--make-link beg end file line 0)))))))) (defun geiser-guile--display-error (module key msg) (when key -- cgit v1.2.3 From 5835dc58d7dc06b68103fd3a726b8723b7b55936 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 24 Jan 2010 20:31:21 +0100 Subject: Guile: Geiser now behaves correctly in buffers for unloaded modules. --- elisp/geiser-guile.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index c173f4d..ccc048c 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -76,7 +76,6 @@ This function uses `geiser-guile-init-file' if it exists." (cond ((null module) (save-excursion (ignore-errors - (backward-sexp) (while (not (zerop (geiser-syntax--nesting-level))) (backward-up-list))) (if (re-search-backward geiser-guile--module-re nil t) -- cgit v1.2.3 From 55c37c72c7a0c04c1ca2e1642776c673c6c6a3a7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 26 Jan 2010 18:08:39 +0100 Subject: Guile: Minimal support for the new REPL debug mode. We just don't hang when the REPL enters its debug mode, and salute any attempt at using a Geiser command with a warning (and no result). --- elisp/geiser-guile.el | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index ccc048c..3008878 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -48,7 +48,9 @@ started." ;;; REPL support: (defun geiser-guile--binary () - (if (listp geiser-guile-binary) (car geiser-guile-binary) geiser-guile-binary)) + (if (listp geiser-guile-binary) + (car geiser-guile-binary) + geiser-guile-binary)) (defun geiser-guile--parameters () "Return a list with all parameters needed to start Guile. @@ -62,10 +64,32 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") + +;;; Catching the debugger +(make-variable-buffer-local + (defvar geiser-guile--is-debugging nil)) + +(defun geiser-guile--is-debugging () + (with-current-buffer (geiser-repl--get-repl geiser-impl--implementation) + geiser-guile--is-debugging)) + +(defvar geiser-guile--debugger-prompt-regexp "[0-9]+ debug> *$") +(defun geiser-guile--watch-debugger (str) + (setq geiser-guile--is-debugging + (string-match-p geiser-guile--debugger-prompt-regexp str))) + +(defun geiser-guile--startup () + (add-hook 'comint-output-filter-functions + 'geiser-guile--watch-debugger + nil + t)) + ;;; Evaluation support: (defun geiser-guile--geiser-procedure (proc) + (when (geiser-guile--is-debugging) + (error "(Guile REPL is in debug mode)")) (let ((proc (intern (format "ge:%s" (if (eq proc 'eval) 'compile proc))))) `(@ (geiser emacs) ,proc))) @@ -145,7 +169,7 @@ This function uses `geiser-guile-init-file' if it exists." (define-geiser-implementation guile (binary geiser-guile--binary) (arglist geiser-guile--parameters) - (startup) + (startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) -- cgit v1.2.3 From c34995d238fc6e2253c6a453a5e49110de3b5957 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 28 Jan 2010 14:54:42 +0100 Subject: Guile: support for the REPL debugger On errors, we switch to the REPL, where the debugger is active. --- elisp/geiser-guile.el | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3008878..89b80d7 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -63,33 +63,12 @@ This function uses `geiser-guile-init-file' if it exists." ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) (defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") - - -;;; Catching the debugger -(make-variable-buffer-local - (defvar geiser-guile--is-debugging nil)) - -(defun geiser-guile--is-debugging () - (with-current-buffer (geiser-repl--get-repl geiser-impl--implementation) - geiser-guile--is-debugging)) - -(defvar geiser-guile--debugger-prompt-regexp "[0-9]+ debug> *$") -(defun geiser-guile--watch-debugger (str) - (setq geiser-guile--is-debugging - (string-match-p geiser-guile--debugger-prompt-regexp str))) - -(defun geiser-guile--startup () - (add-hook 'comint-output-filter-functions - 'geiser-guile--watch-debugger - nil - t)) +(defconst geiser-guile--debugger-prompt-regexp "[0-9]+ debug> *") ;;; Evaluation support: (defun geiser-guile--geiser-procedure (proc) - (when (geiser-guile--is-debugging) - (error "(Guile REPL is in debug mode)")) (let ((proc (intern (format "ge:%s" (if (eq proc 'eval) 'compile proc))))) `(@ (geiser emacs) ,proc))) @@ -163,6 +142,14 @@ This function uses `geiser-guile-init-file' if it exists." (goto-char (point-min)) (re-search-forward geiser-guile--module-re nil t))) + +;;; Compilation shell regexps +(defun geiser-guile--startup () + (set (make-local-variable 'compilation-error-regexp-alist) + '(("^In \\([^:]+\\):" 1) + ("^ \\([0-9]+\\): " nil 1))) + (compilation-setup t)) + ;;; Implementation definition: @@ -171,6 +158,7 @@ This function uses `geiser-guile-init-file' if it exists." (arglist geiser-guile--parameters) (startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) + (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) (find-symbol-begin geiser-guile--symbol-begin) -- cgit v1.2.3 From 19acc6507f535b5a3513c087a3547ed51e597c0e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 7 Mar 2010 05:16:20 +0100 Subject: New command to switch to REPL and put it in current module. --- elisp/geiser-guile.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 89b80d7..13fdc49 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -89,6 +89,9 @@ This function uses `geiser-guile-init-file' if it exists." (or (ignore-errors (car (read-from-string module))) :f)) (t :f))) +(defun geiser-guile--enter-command (module) + (and module (format ",m %s\n" (geiser-guile--get-module module)))) + (defun geiser-guile--symbol-begin (module) (if module (max (save-excursion (beginning-of-line) (point)) @@ -154,6 +157,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Implementation definition: (define-geiser-implementation guile + (unsupported-procedures '(enter-command)) (binary geiser-guile--binary) (arglist geiser-guile--parameters) (startup geiser-guile--startup) @@ -161,6 +165,7 @@ This function uses `geiser-guile-init-file' if it exists." (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) + ;; (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) -- cgit v1.2.3 From e8d1ca57ee4fca4cca1bc534d970a4f23e1b2cab Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 7 Mar 2010 21:39:41 +0100 Subject: Guile: switch to REPL and module activated. --- elisp/geiser-guile.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 13fdc49..b4a27bf 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -90,7 +90,7 @@ This function uses `geiser-guile-init-file' if it exists." (t :f))) (defun geiser-guile--enter-command (module) - (and module (format ",m %s\n" (geiser-guile--get-module module)))) + (and module (format ",m %s" (geiser-guile--get-module module)))) (defun geiser-guile--symbol-begin (module) (if module @@ -157,7 +157,6 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Implementation definition: (define-geiser-implementation guile - (unsupported-procedures '(enter-command)) (binary geiser-guile--binary) (arglist geiser-guile--parameters) (startup geiser-guile--startup) @@ -165,7 +164,7 @@ This function uses `geiser-guile-init-file' if it exists." (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) - ;; (enter-command geiser-guile--enter-command) + (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) -- cgit v1.2.3 From 32e7fbd6626e7a6be1e325277684b251febbe431 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 8 Mar 2010 02:14:35 +0100 Subject: Guile: 'bt' when entering the debugger. --- elisp/geiser-guile.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index b4a27bf..b359dcc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -107,7 +107,8 @@ This function uses `geiser-guile-init-file' if it exists." (if (file-name-absolute-p file) file (or (gethash file geiser-guile--file-cache) (puthash file - (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + (geiser-eval--send/result + `(:eval ((:ge find-file) ,file))) geiser-guile--file-cache))))) (defconst geiser-guile--file-rx @@ -126,16 +127,18 @@ This function uses `geiser-guile-init-file' if it exists." (geiser-edit--make-link beg end file line 0)))))))) (defun geiser-guile--display-error (module key msg) - (when key - (insert "Error: ") - (geiser--insert-with-face (format "%s" key) 'bold) - (newline 2)) - (when msg - (let ((p (point))) - (insert msg) - (goto-char p) - (geiser-guile--find-files))) - t) + (if (eq key 'geiser-debugger) + (comint-send-string nil "bt\n") + (when key + (insert "Error: ") + (geiser--insert-with-face (format "%s" key) 'bold) + (newline 2)) + (when msg + (let ((p (point))) + (insert msg) + (goto-char p) + (geiser-guile--find-files))) + t)) ;;; Trying to ascertain whether a buffer is Guile Scheme: -- cgit v1.2.3 From a9f26f1391aa6edaa728df5e05c6bcac8039289c Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 8 Mar 2010 02:45:02 +0100 Subject: Guile: slightly better compilation error regexps. --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index b359dcc..0523dfe 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -152,8 +152,8 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Compilation shell regexps (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) - '(("^In \\([^:]+\\):" 1) - ("^ \\([0-9]+\\): " nil 1))) + '(("^In \\(/[^:\n]+\\):\n +\\([0-9]+\\): +" 1 2) + ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) (compilation-setup t)) -- cgit v1.2.3 From 1c9457aa15b00a9a9f058a5677370305aa68da79 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 13 Mar 2010 03:49:22 +0100 Subject: Guile: heuristically resolving relative paths in REPL errors. --- elisp/geiser-guile.el | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 0523dfe..db4b27d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -150,11 +150,44 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Compilation shell regexps + +(defconst geiser-guile--path-rx "^In \\([^:\n]+\\):\n") + +(defconst geiser-guile--rel-path-rx + "^In \\([^/\n]+.+?/module/\\([^:\n]+\\)\\):\n") + +(make-variable-buffer-local + (defvar geiser-guile--load-path nil)) + +(defun geiser-guile--load-path () + (geiser-eval--send/result `(:eval (:scm "%load-path")))) + +(defun geiser-guile--find-in-load-path (f ps) + (when ps + (let ((c (expand-file-name f (car ps)))) + (or (and (file-exists-p c) c) + (geiser-guile--find-in-load-path f (cdr ps)))))) + +(defun geiser-guile--resolve-file-x () + (let ((f (match-string-no-properties 1))) + (if (file-name-absolute-p f) + (list f) + (let ((p (match-string-no-properties 0))) + (when (string-match geiser-guile--rel-path-rx p) + (let ((f (geiser-guile--find-in-load-path + (match-string-no-properties 2 p) + geiser-guile--load-path))) + (and f (list f)))))))) + (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) - '(("^In \\(/[^:\n]+\\):\n +\\([0-9]+\\): +" 1 2) + `((,geiser-guile--path-rx geiser-guile--resolve-file-x) + ("^ +\\([0-9]+\\): +" nil 1) ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) - (compilation-setup t)) + (setq geiser-guile--load-path (geiser-guile--load-path)) + (compilation-setup t) + (font-lock-add-keywords + nil `((,geiser-guile--path-rx 1 compilation-error-face)))) ;;; Implementation definition: -- cgit v1.2.3 From 9e3824769052e15996dd7583f61b9389dc6f88b8 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 1 Apr 2010 03:33:59 +0200 Subject: Using the scheme reader to read modules names. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index db4b27d..0bbf9b7 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -86,7 +86,8 @@ This function uses `geiser-guile-init-file' if it exists." :f))) ((listp module) module) ((stringp module) - (or (ignore-errors (car (read-from-string module))) :f)) + (or (ignore-errors + (car (geiser-syntax--read-from-string module))) :f)) (t :f))) (defun geiser-guile--enter-command (module) -- cgit v1.2.3 From 5d49d078b354a55720da52c657eeae79d532852e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 6 Jun 2010 06:01:27 +0200 Subject: Guile: fixes for error navigation. --- elisp/geiser-guile.el | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 0bbf9b7..2c49fd6 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -152,10 +152,9 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Compilation shell regexps -(defconst geiser-guile--path-rx "^In \\([^:\n]+\\):\n") +(defconst geiser-guile--path-rx "^In \\([^:\n ]+\\):\n") -(defconst geiser-guile--rel-path-rx - "^In \\([^/\n]+.+?/module/\\([^:\n]+\\)\\):\n") +(defconst geiser-guile--rel-path-rx "^In +\\([^/\n :]+\\):\n") (make-variable-buffer-local (defvar geiser-guile--load-path nil)) @@ -173,22 +172,20 @@ This function uses `geiser-guile-init-file' if it exists." (let ((f (match-string-no-properties 1))) (if (file-name-absolute-p f) (list f) - (let ((p (match-string-no-properties 0))) - (when (string-match geiser-guile--rel-path-rx p) - (let ((f (geiser-guile--find-in-load-path - (match-string-no-properties 2 p) - geiser-guile--load-path))) - (and f (list f)))))))) + (message "looking for %s" f) + (let ((f (geiser-guile--find-in-load-path f geiser-guile--load-path))) + (and f (list f)))))) (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) - ("^ +\\([0-9]+\\): +" nil 1) + ("^ *\\([0-9]+\\): +" nil 1) ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) (setq geiser-guile--load-path (geiser-guile--load-path)) (compilation-setup t) - (font-lock-add-keywords - nil `((,geiser-guile--path-rx 1 compilation-error-face)))) + (font-lock-add-keywords nil + `((,geiser-guile--path-rx 1 + compilation-error-face)))) ;;; Implementation definition: -- cgit v1.2.3 From d41ac93939fa4de543f4fd5cf52e4b4794ecf262 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 6 Jun 2010 06:12:14 +0200 Subject: Debugging leftover. --- elisp/geiser-guile.el | 1 - 1 file changed, 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 2c49fd6..badfcfa 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -172,7 +172,6 @@ This function uses `geiser-guile-init-file' if it exists." (let ((f (match-string-no-properties 1))) (if (file-name-absolute-p f) (list f) - (message "looking for %s" f) (let ((f (geiser-guile--find-in-load-path f geiser-guile--load-path))) (and f (list f)))))) -- cgit v1.2.3 From 567f3ba667f2b708f1b9dbf76eede1fad0fd6b1d Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 7 Jun 2010 02:21:06 +0200 Subject: Guile: dead elisp code elimination. --- elisp/geiser-guile.el | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index badfcfa..9855a11 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -99,48 +99,6 @@ This function uses `geiser-guile-init-file' if it exists." (save-excursion (skip-syntax-backward "^(>") (1- (point)))) (save-excursion (skip-syntax-backward "^-()>") (point)))) - -;;; Error display -(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) - -(defun geiser-guile--resolve-file (file) - (when (and (stringp file) (not (string-equal file "unknown file"))) - (if (file-name-absolute-p file) file - (or (gethash file geiser-guile--file-cache) - (puthash file - (geiser-eval--send/result - `(:eval ((:ge find-file) ,file))) - geiser-guile--file-cache))))) - -(defconst geiser-guile--file-rx - "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") - -(defun geiser-guile--find-files () - (with--geiser-implementation 'guile - (save-excursion - (while (re-search-forward geiser-guile--file-rx nil t) - (let ((file (match-string 1)) - (beg (match-beginning 1)) - (end (match-end 1)) - (line (string-to-number (or (match-string 2) "0")))) - (let ((file (geiser-guile--resolve-file file))) - (when file - (geiser-edit--make-link beg end file line 0)))))))) - -(defun geiser-guile--display-error (module key msg) - (if (eq key 'geiser-debugger) - (comint-send-string nil "bt\n") - (when key - (insert "Error: ") - (geiser--insert-with-face (format "%s" key) 'bold) - (newline 2)) - (when msg - (let ((p (point))) - (insert msg) - (goto-char p) - (geiser-guile--find-files))) - t)) - ;;; Trying to ascertain whether a buffer is Guile Scheme: @@ -199,7 +157,7 @@ This function uses `geiser-guile-init-file' if it exists." (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) - (display-error geiser-guile--display-error) + (display-error) (display-help) (check-buffer geiser-guile--guess)) -- cgit v1.2.3 From 574559bd819faafb8954fe2fdd8a318b9980db10 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 7 Jun 2010 02:26:44 +0200 Subject: Oops, it wasn't dead. --- elisp/geiser-guile.el | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 9855a11..b76228e 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -99,6 +99,47 @@ This function uses `geiser-guile-init-file' if it exists." (save-excursion (skip-syntax-backward "^(>") (1- (point)))) (save-excursion (skip-syntax-backward "^-()>") (point)))) + +;;; Error display +(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) + +(defun geiser-guile--resolve-file (file) + (when (and (stringp file) (not (string-equal file "unknown file"))) + (if (file-name-absolute-p file) file + (or (gethash file geiser-guile--file-cache) + (puthash file + (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + geiser-guile--file-cache))))) + +(defconst geiser-guile--file-rx + "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") + +(defun geiser-guile--find-files () + (with--geiser-implementation 'guile + (save-excursion + (while (re-search-forward geiser-guile--file-rx nil t) + (let ((file (match-string 1)) + (beg (match-beginning 1)) + (end (match-end 1)) + (line (string-to-number (or (match-string 2) "0")))) + (let ((file (geiser-guile--resolve-file file))) + (when file + (geiser-edit--make-link beg end file line 0)))))))) + +(defun geiser-guile--display-error (module key msg) + (if (eq key 'geiser-debugger) + (comint-send-string nil "bt\n") + (when key + (insert "Error: ") + (geiser--insert-with-face (format "%s" key) 'bold) + (newline 2)) + (when msg + (let ((p (point))) + (insert msg) + (goto-char p) + (geiser-guile--find-files))) + t)) + ;;; Trying to ascertain whether a buffer is Guile Scheme: @@ -157,7 +198,7 @@ This function uses `geiser-guile-init-file' if it exists." (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) (find-symbol-begin geiser-guile--symbol-begin) - (display-error) + (display-error geiser-guile--display-error) (display-help) (check-buffer geiser-guile--guess)) -- cgit v1.2.3 From 216897ade20e6a1cc73c245908911301bc25865a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 7 Jun 2010 03:35:33 +0200 Subject: Guile: displaying the debugger preamble. --- elisp/geiser-guile.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index b76228e..da488bc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -128,7 +128,14 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--display-error (module key msg) (if (eq key 'geiser-debugger) - (comint-send-string nil "bt\n") + (progn + (comint-send-string nil "0\n") + (accept-process-output nil 0.1) + (when msg + (goto-char (point-max)) + (comint-previous-prompt 1) + (insert "\n" msg) + (goto-char (point-max)))) (when key (insert "Error: ") (geiser--insert-with-face (format "%s" key) 'bold) @@ -137,8 +144,8 @@ This function uses `geiser-guile-init-file' if it exists." (let ((p (point))) (insert msg) (goto-char p) - (geiser-guile--find-files))) - t)) + (geiser-guile--find-files)))) + t) ;;; Trying to ascertain whether a buffer is Guile Scheme: -- cgit v1.2.3 From 044c88e5396381ae0130b2907d393079474b4eb5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Jun 2010 00:08:38 +0200 Subject: Guile: small tweak. --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index da488bc..cfcba80 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -130,7 +130,7 @@ This function uses `geiser-guile-init-file' if it exists." (if (eq key 'geiser-debugger) (progn (comint-send-string nil "0\n") - (accept-process-output nil 0.1) + (accept-process-output nil 0.01) (when msg (goto-char (point-max)) (comint-previous-prompt 1) -- cgit v1.2.3 From 5b1bed8d4c3fda62e2f6dede7a1aa9a7f9505838 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 27 Jun 2010 14:44:16 +0200 Subject: Better switch/import REPL commands. --- elisp/geiser-guile.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index cfcba80..fb49085 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -90,8 +90,18 @@ This function uses `geiser-guile-init-file' if it exists." (car (geiser-syntax--read-from-string module))) :f)) (t :f))) +(defun geiser-guile--module-cmd (module fmt &optional def) + (when module + (let* ((module (geiser-guile--get-module module)) + (module (cond ((or (null module) (eq module :f)) def) + (t (format "%s" module))))) + (and module (format fmt module))))) + +(defun geiser-guile--import-command (module) + (geiser-guile--module-cmd module ",i %s")) + (defun geiser-guile--enter-command (module) - (and module (format ",m %s" (geiser-guile--get-module module)))) + (geiser-guile--module-cmd module ",m %s" "(guile-user)")) (defun geiser-guile--symbol-begin (module) (if module @@ -204,6 +214,7 @@ This function uses `geiser-guile-init-file' if it exists." (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) + (import-command geiser-guile--import-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) -- cgit v1.2.3 From 03534f183acdeb5463c7052b8d6fe152fc7b4025 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 19 Jul 2010 21:45:32 +0200 Subject: Guile: restoring (minimal) support for debugging REPL. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index fb49085..7fae364 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -63,7 +63,8 @@ This function uses `geiser-guile-init-file' if it exists." ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) (defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") -(defconst geiser-guile--debugger-prompt-regexp "[0-9]+ debug> *") +(defconst geiser-guile--debugger-prompt-regexp + "^[^() \n]+@([^)]*?) \\[[0-9]+\\]> ") ;;; Evaluation support: -- cgit v1.2.3 From 6907aea8232344828a79a7afa89932494b03b321 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 20 Jul 2010 22:20:16 +0200 Subject: Guile: geiser commands working at the debugging prompt. --- elisp/geiser-guile.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 7fae364..91a316b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -65,6 +65,8 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") (defconst geiser-guile--debugger-prompt-regexp "^[^() \n]+@([^)]*?) \\[[0-9]+\\]> ") +(defconst geiser-guile--debugger-preamble-regexp + "^Entering a new prompt\\. ") ;;; Evaluation support: @@ -140,7 +142,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--display-error (module key msg) (if (eq key 'geiser-debugger) (progn - (comint-send-string nil "0\n") + (comint-send-string nil ",locals\n") (accept-process-output nil 0.01) (when msg (goto-char (point-max)) @@ -198,6 +200,7 @@ This function uses `geiser-guile-init-file' if it exists." ("^ *\\([0-9]+\\): +" nil 1) ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) (setq geiser-guile--load-path (geiser-guile--load-path)) + (setq geiser-con--debugging-inhibits-eval nil) (compilation-setup t) (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 @@ -212,6 +215,7 @@ This function uses `geiser-guile-init-file' if it exists." (startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) + (debugger-preamble-regexp geiser-guile--debugger-preamble-regexp) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) -- cgit v1.2.3 From 2128f08e04b5904c1dbbc4a30ecf77688f2569a6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 25 Jul 2010 22:35:41 +0200 Subject: Tweaks to scheme implementation selection, and docs for it. --- elisp/geiser-guile.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 91a316b..a88cf54 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -225,6 +225,8 @@ This function uses `geiser-guile-init-file' if it exists." (display-help) (check-buffer geiser-guile--guess)) +(geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile nil) + (provide 'geiser-guile) ;;; geiser-guile.el ends here -- cgit v1.2.3 From 430e12756c7065595092f4738ccb86725f0a1086 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 30 Aug 2010 03:58:51 +0200 Subject: Guile: display backtrace upon entering debugger. Inserting the banner is disabled for now: it confuses comint badly for reasons i don't understand yet. --- elisp/geiser-guile.el | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a88cf54..a8a7a7c 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -142,13 +142,8 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--display-error (module key msg) (if (eq key 'geiser-debugger) (progn - (comint-send-string nil ",locals\n") - (accept-process-output nil 0.01) - (when msg - (goto-char (point-max)) - (comint-previous-prompt 1) - (insert "\n" msg) - (goto-char (point-max)))) + (goto-char (point-max)) + (comint-send-string nil ",bt\n")) (when key (insert "Error: ") (geiser--insert-with-face (format "%s" key) 'bold) -- cgit v1.2.3 From 855f6f2278d6ce5a116df2c7bfaa9a5f5e55327c Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 31 Aug 2010 16:42:43 +0200 Subject: Guile: fix for import module REPL command --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a8a7a7c..28a0015 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -101,7 +101,7 @@ This function uses `geiser-guile-init-file' if it exists." (and module (format fmt module))))) (defun geiser-guile--import-command (module) - (geiser-guile--module-cmd module ",i %s")) + (geiser-guile--module-cmd module ",use %s")) (defun geiser-guile--enter-command (module) (geiser-guile--module-cmd module ",m %s" "(guile-user)")) -- cgit v1.2.3 From 46e6067f388d7d1ac502f50c5558c9d953d700c7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 31 Aug 2010 16:43:35 +0200 Subject: Guile: show error message upon entering the debugger --- elisp/geiser-guile.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 28a0015..910d3b7 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -44,6 +44,12 @@ started." :type 'string :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-debug-show-bt-p nil + "Whether to autmatically show a full backtrace when entering the debugger. +If `nil', only the last frame is shown." + :type 'boolean + :group 'geiser-guile) + ;;; REPL support: @@ -141,9 +147,13 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--display-error (module key msg) (if (eq key 'geiser-debugger) - (progn + (let ((bt-cmd (format ",%s\n" + (if geiser-guile-debug-show-bt-p "bt" "fr")))) (goto-char (point-max)) - (comint-send-string nil ",bt\n")) + (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") + (comint-send-string nil ",error-message\n") + (comint-send-string nil bt-cmd) + (message "Debug REPL. Enter ,q to quit, ,h for help.")) (when key (insert "Error: ") (geiser--insert-with-face (format "%s" key) 'bold) -- cgit v1.2.3 From a15f00af2677a559f0932f0aa7c6c8e82ac8be26 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 2 Sep 2010 06:15:33 +0200 Subject: Dead code elimination --- elisp/geiser-guile.el | 78 ++++++++++++++------------------------------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 910d3b7..8d8c4f3 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -120,49 +120,16 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Error display -(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) - -(defun geiser-guile--resolve-file (file) - (when (and (stringp file) (not (string-equal file "unknown file"))) - (if (file-name-absolute-p file) file - (or (gethash file geiser-guile--file-cache) - (puthash file - (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) - geiser-guile--file-cache))))) - -(defconst geiser-guile--file-rx - "^In \\([^\n:]+\\):\n *\\([[:digit:]]+\\|\\?\\):") - -(defun geiser-guile--find-files () - (with--geiser-implementation 'guile - (save-excursion - (while (re-search-forward geiser-guile--file-rx nil t) - (let ((file (match-string 1)) - (beg (match-beginning 1)) - (end (match-end 1)) - (line (string-to-number (or (match-string 2) "0")))) - (let ((file (geiser-guile--resolve-file file))) - (when file - (geiser-edit--make-link beg end file line 0)))))))) (defun geiser-guile--display-error (module key msg) - (if (eq key 'geiser-debugger) - (let ((bt-cmd (format ",%s\n" - (if geiser-guile-debug-show-bt-p "bt" "fr")))) - (goto-char (point-max)) - (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") - (comint-send-string nil ",error-message\n") - (comint-send-string nil bt-cmd) - (message "Debug REPL. Enter ,q to quit, ,h for help.")) - (when key - (insert "Error: ") - (geiser--insert-with-face (format "%s" key) 'bold) - (newline 2)) - (when msg - (let ((p (point))) - (insert msg) - (goto-char p) - (geiser-guile--find-files)))) + (when (eq key 'geiser-debugger) + (let ((bt-cmd (format ",%s\n" + (if geiser-guile-debug-show-bt-p "bt" "fr")))) + (goto-char (point-max)) + (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") + (comint-send-string nil ",error-message\n") + (comint-send-string nil bt-cmd) + (message "Debug REPL. Enter ,q to quit, ,h for help."))) t) @@ -180,31 +147,28 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile--rel-path-rx "^In +\\([^/\n :]+\\):\n") -(make-variable-buffer-local - (defvar geiser-guile--load-path nil)) - -(defun geiser-guile--load-path () - (geiser-eval--send/result `(:eval (:scm "%load-path")))) +(defvar geiser-guile--file-cache (make-hash-table :test 'equal)) -(defun geiser-guile--find-in-load-path (f ps) - (when ps - (let ((c (expand-file-name f (car ps)))) - (or (and (file-exists-p c) c) - (geiser-guile--find-in-load-path f (cdr ps)))))) +(defun geiser-guile--resolve-file (file) + (when (and (stringp file) (not (string-equal file "unknown file"))) + (if (file-name-absolute-p file) file + (or (gethash file geiser-guile--file-cache) + (puthash file + (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + geiser-guile--file-cache))))) (defun geiser-guile--resolve-file-x () - (let ((f (match-string-no-properties 1))) - (if (file-name-absolute-p f) - (list f) - (let ((f (geiser-guile--find-in-load-path f geiser-guile--load-path))) - (and f (list f)))))) + (let ((f (geiser-guile--resolve-file (match-string-no-properties 1)))) + (and f (list f)))) + + +;;; REPL startup (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) ("^ *\\([0-9]+\\): +" nil 1) ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) - (setq geiser-guile--load-path (geiser-guile--load-path)) (setq geiser-con--debugging-inhibits-eval nil) (compilation-setup t) (font-lock-add-keywords nil -- cgit v1.2.3 From 0505bdee742ad80d4763e2c0f697a49b2662ac17 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 4 Sep 2010 21:17:12 +0200 Subject: REPL: (optionally) forget old errors on new expressions --- elisp/geiser-guile.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 8d8c4f3..6086dd8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -18,6 +18,8 @@ (require 'geiser-edit) (require 'geiser) +(require 'compile) + ;;; Customization: @@ -125,6 +127,7 @@ This function uses `geiser-guile-init-file' if it exists." (when (eq key 'geiser-debugger) (let ((bt-cmd (format ",%s\n" (if geiser-guile-debug-show-bt-p "bt" "fr")))) + (compilation-forget-errors) (goto-char (point-max)) (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") (comint-send-string nil ",error-message\n") -- cgit v1.2.3 From 7a25131b95a71028fe3b83920a5cd9cf7f77ea7e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 5 Sep 2010 03:33:52 +0200 Subject: Guile: fixes for compilation error regexps --- elisp/geiser-guile.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 6086dd8..af9d589 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -170,8 +170,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) - ("^ *\\([0-9]+\\): +" nil 1) - ("at \\(/[^:\n]+\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)" 1 2 3))) + ("^ +\\([0-9]+\\):\\([0-9]+\\)" nil 1 2))) (setq geiser-con--debugging-inhibits-eval nil) (compilation-setup t) (font-lock-add-keywords nil -- cgit v1.2.3 From 480767e3d4b2dd8771bcd9bbb70ddad88d1d347f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 6 Sep 2010 21:13:12 +0200 Subject: Guile: geiser-guile-jump-on-debug-p, geiser-guile-show-debug-help-p --- elisp/geiser-guile.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index af9d589..8561df7 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -52,6 +52,17 @@ If `nil', only the last frame is shown." :type 'boolean :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-jump-on-debug-p nil + "Whether to autmatically jump to error when entering the debugger. +If `t', Geiser will use `next-error' to jump to the error's location." + :type 'boolean + :group 'geiser-guile) + +(geiser-custom--defcustom geiser-guile-show-debug-help-p t + "Whether to show brief help in the echo area when entering the debugger." + :type 'boolean + :group 'geiser-guile) + ;;; REPL support: @@ -132,7 +143,12 @@ This function uses `geiser-guile-init-file' if it exists." (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") (comint-send-string nil ",error-message\n") (comint-send-string nil bt-cmd) - (message "Debug REPL. Enter ,q to quit, ,h for help."))) + (when geiser-guile-show-debug-help-p + (message "Debug REPL. Enter ,q to quit, ,h for help.")) + (when geiser-guile-jump-on-debug-p + (accept-process-output (get-buffer-process (current-buffer)) + 0.2 nil t) + (ignore-errors (next-error))))) t) -- cgit v1.2.3 From 4766cbcbd3c7e3dbe4a090352d9d8cb2a5916559 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 7 Sep 2010 00:22:37 +0200 Subject: Support for evaluation warnings --- elisp/geiser-guile.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 8561df7..640ef02 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -134,7 +134,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Error display -(defun geiser-guile--display-error (module key msg) +(defun geiser-guile--enter-debugger () (when (eq key 'geiser-debugger) (let ((bt-cmd (format ",%s\n" (if geiser-guile-debug-show-bt-p "bt" "fr")))) @@ -148,8 +148,13 @@ This function uses `geiser-guile-init-file' if it exists." (when geiser-guile-jump-on-debug-p (accept-process-output (get-buffer-process (current-buffer)) 0.2 nil t) - (ignore-errors (next-error))))) - t) + (ignore-errors (next-error)))))) + +(defun geiser-guile--display-error (module key msg) + (newline) + (save-excursion (insert msg)) + (geiser-edit--buttonize-files) + (and (not key) msg (not (zerop (length msg))))) ;;; Trying to ascertain whether a buffer is Guile Scheme: @@ -201,6 +206,7 @@ This function uses `geiser-guile-init-file' if it exists." (arglist geiser-guile--parameters) (startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) + (enter-debugger geiser-guile--enter-debugger) (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (debugger-preamble-regexp geiser-guile--debugger-preamble-regexp) (marshall-procedure geiser-guile--geiser-procedure) -- cgit v1.2.3 From b95b4870027fc8bde3ccd550e8e68b58070e4e34 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 7 Sep 2010 00:32:22 +0200 Subject: Guile: fix bug in error display --- elisp/geiser-guile.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 640ef02..15c40cc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -152,8 +152,9 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--display-error (module key msg) (newline) - (save-excursion (insert msg)) - (geiser-edit--buttonize-files) + (when (stringp msg) + (save-excursion (insert msg)) + (geiser-edit--buttonize-files)) (and (not key) msg (not (zerop (length msg))))) -- cgit v1.2.3 From 2fd5d5bdeb75f452a0a97208e262cc0da8e45c5a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 7 Sep 2010 05:58:22 +0200 Subject: Guile: configurable warning level --- elisp/geiser-guile.el | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 15c40cc..55116d3 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -63,6 +63,29 @@ If `t', Geiser will use `next-error' to jump to the error's location." :type 'boolean :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-warning-level 'medium + "Verbosity of the warnings reported by Guile. + +You can choose either one of the predefined warning sets, or +provide a list of symbols identifying the ones you want. Possible +choices are arity-mismatch, unbound-variable, unused-variable and +unused-toplevel. Unrecognised symbols are ignored. + +The predefined levels are: + + - Medium: arity-mismatch, unbound-variable + - High: arity-mismatch, unbound-variable, unused-variable + - None: no warnings + +Changes to the value of this variable will automatically take +effect on new REPLs. For existing ones, use the command +\\[geiser-guile-update-warning-level]." + :type '(choice (const :tag "Medium (arity and unbound vars)" medium) + (const :tag "High (also unused vars)" high) + (const :tag "No warnings" none) + (repeat :tag "Custom" symbol)) + :group 'geiser-guile) + ;;; REPL support: @@ -189,6 +212,14 @@ This function uses `geiser-guile-init-file' if it exists." ;;; REPL startup +(defun geiser-guile-update-warning-level () + "Update the warning level used by the REPL. +The new level is set using the value of `geiser-guile-warning-level'." + (interactive) + (let ((code `(:eval (ge:set-warnings ',geiser-guile-warning-level) + (geiser evaluation)))) + (geiser-eval--send/result code))) + (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) @@ -197,7 +228,8 @@ This function uses `geiser-guile-init-file' if it exists." (compilation-setup t) (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 - compilation-error-face)))) + compilation-error-face))) + (geiser-guile-update-warning-level)) ;;; Implementation definition: -- cgit v1.2.3 From b1db6b49d1c42f9ab40317ccbadcc3ad5005aa98 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 8 Sep 2010 01:34:48 +0200 Subject: Better REPL exit command --- elisp/geiser-guile.el | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 55116d3..7f73efe 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -148,6 +148,9 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--enter-command (module) (geiser-guile--module-cmd module ",m %s" "(guile-user)")) + +(defun geiser-guile--exit-command () ",q") + (defun geiser-guile--symbol-begin (module) (if module (max (save-excursion (beginning-of-line) (point)) @@ -158,20 +161,19 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Error display (defun geiser-guile--enter-debugger () - (when (eq key 'geiser-debugger) - (let ((bt-cmd (format ",%s\n" - (if geiser-guile-debug-show-bt-p "bt" "fr")))) - (compilation-forget-errors) - (goto-char (point-max)) - (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") - (comint-send-string nil ",error-message\n") - (comint-send-string nil bt-cmd) - (when geiser-guile-show-debug-help-p - (message "Debug REPL. Enter ,q to quit, ,h for help.")) - (when geiser-guile-jump-on-debug-p - (accept-process-output (get-buffer-process (current-buffer)) - 0.2 nil t) - (ignore-errors (next-error)))))) + (let ((bt-cmd (format ",%s\n" + (if geiser-guile-debug-show-bt-p "bt" "fr")))) + (compilation-forget-errors) + (goto-char (point-max)) + (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") + (comint-send-string nil ",error-message\n") + (comint-send-string nil bt-cmd) + (when geiser-guile-show-debug-help-p + (message "Debug REPL. Enter ,q to quit, ,h for help.")) + (when geiser-guile-jump-on-debug-p + (accept-process-output (get-buffer-process (current-buffer)) + 0.2 nil t) + (ignore-errors (next-error))))) (defun geiser-guile--display-error (module key msg) (newline) @@ -245,6 +247,7 @@ The new level is set using the value of `geiser-guile-warning-level'." (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) + (exit-command geiser-guile--exit-command) (import-command geiser-guile--import-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) -- cgit v1.2.3 From 23e1ec29f9865a72d62c253c48d01e772287c627 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 6 Oct 2010 00:45:48 +0200 Subject: Documentation nits --- elisp/geiser-guile.el | 1 + 1 file changed, 1 insertion(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 7f73efe..7dfb9ad 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -11,6 +11,7 @@ +(require 'geiser-connection) (require 'geiser-syntax) (require 'geiser-custom) (require 'geiser-base) -- cgit v1.2.3 From 7004a7338626d1d1b2d29655222aadb12c4649c4 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 11 Oct 2010 02:25:34 +0200 Subject: Guile: remote REPLs (connect-to-guile) geiser-connect (or its specialisation, connect-to-guile) working for Guile, where the external process is started with the new --listen flag. --- elisp/geiser-guile.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 7dfb9ad..d831bbf 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -101,7 +101,7 @@ This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file)))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) - "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + "-q" ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) @@ -223,6 +223,13 @@ The new level is set using the value of `geiser-guile-warning-level'." (geiser evaluation)))) (geiser-eval--send/result code))) +(defun connect-to-guile () + "Start a Guile REPL connected to a remote process. + +Start the external Guile process with the flag --listen to make +it spawn a server thread." + (geiser-connect 'guile)) + (defun geiser-guile--startup () (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) @@ -232,6 +239,9 @@ The new level is set using the value of `geiser-guile-warning-level'." (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) + (geiser-eval--send/result + `(:scm ,(format "(set! %%load-path (cons %S %%load-path))" + (expand-file-name "guile/" geiser-scheme-dir)))) (geiser-guile-update-warning-level)) -- cgit v1.2.3 From 72290ad87cb0524a28dcf96ee4b99c4b67e6e6d5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 11 Oct 2010 12:46:36 +0200 Subject: Bug fix: connect-to-guile wasn't interactive --- elisp/geiser-guile.el | 1 + 1 file changed, 1 insertion(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index d831bbf..6eb2641 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -224,6 +224,7 @@ The new level is set using the value of `geiser-guile-warning-level'." (geiser-eval--send/result code))) (defun connect-to-guile () + (interactive) "Start a Guile REPL connected to a remote process. Start the external Guile process with the flag --listen to make -- cgit v1.2.3 From 60480414b9da01e29b9df25373fd81958d85601d Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 11 Oct 2010 12:47:28 +0200 Subject: Fix for the fix --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 6eb2641..d788edd 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -224,11 +224,11 @@ The new level is set using the value of `geiser-guile-warning-level'." (geiser-eval--send/result code))) (defun connect-to-guile () - (interactive) "Start a Guile REPL connected to a remote process. Start the external Guile process with the flag --listen to make it spawn a server thread." + (interactive) (geiser-connect 'guile)) (defun geiser-guile--startup () -- cgit v1.2.3 From 35e8b30e2699061c00219de07162e358b389273e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 23 Oct 2010 16:12:02 +0200 Subject: Using smart tab mode in REPL --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index d788edd..e6cf8f1 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -132,8 +132,8 @@ This function uses `geiser-guile-init-file' if it exists." :f))) ((listp module) module) ((stringp module) - (or (ignore-errors - (car (geiser-syntax--read-from-string module))) :f)) + (or (ignore-errors (car (geiser-syntax--read-from-string module))) + :f)) (t :f))) (defun geiser-guile--module-cmd (module fmt &optional def) -- cgit v1.2.3 From d1d05b74f9b7613cd42c4bcd0173bb617e50647f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 30 Oct 2010 04:58:57 +0200 Subject: Guile: using the new syntax for sending eval requests --- elisp/geiser-guile.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e6cf8f1..3e1c03f 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -114,9 +114,16 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Evaluation support: -(defun geiser-guile--geiser-procedure (proc) - (let ((proc (intern (format "ge:%s" (if (eq proc 'eval) 'compile proc))))) - `(@ (geiser emacs) ,proc))) +(defun geiser-guile--geiser-procedure (proc &rest args) + (case proc + ((eval compile) (format "((@ (geiser emacs) ge:compile) '%s '%s)" + (mapconcat 'identity (cdr args) " ") + (or (car args) "#f"))) + ((load-file compile-file) + (format "((@ (geiser emacs) ge:%s) %s)" proc (car args))) + ((no-values) "((@ (guile) values))") + (t (format "(apply (@ (geiser emacs) ge:%s) (list %s))" + proc (mapconcat 'identity args ""))))) (defconst geiser-guile--module-re "(define-module +\\(([^)]+)\\)") @@ -205,7 +212,7 @@ This function uses `geiser-guile-init-file' if it exists." (if (file-name-absolute-p file) file (or (gethash file geiser-guile--file-cache) (puthash file - (geiser-eval--send/result `(:eval ((:ge find-file) ,file))) + (geiser-eval--send/result `(:eval (:ge find-file ,file))) geiser-guile--file-cache))))) (defun geiser-guile--resolve-file-x () -- cgit v1.2.3 From 855240471c4d479c7770db599db8cbe7d225de3a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 30 Oct 2010 22:46:12 +0200 Subject: Guile: using meta-commands to talk with Guile --- elisp/geiser-guile.el | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3e1c03f..e07fb1b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -113,17 +113,25 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Evaluation support: +(defun geiser-guile--linearize (str) + (if (string-match "\n" str) + (with-temp-buffer + (insert str) + (subst-char-in-region (point-min) (point-max) ?\n ? t) + (buffer-string)) + str)) + +(defsubst geiser-guile--linearize-args (args) + (mapconcat 'geiser-guile--linearize args " ")) (defun geiser-guile--geiser-procedure (proc &rest args) (case proc - ((eval compile) (format "((@ (geiser emacs) ge:compile) '%s '%s)" - (mapconcat 'identity (cdr args) " ") - (or (car args) "#f"))) - ((load-file compile-file) - (format "((@ (geiser emacs) ge:%s) %s)" proc (car args))) - ((no-values) "((@ (guile) values))") - (t (format "(apply (@ (geiser emacs) ge:%s) (list %s))" - proc (mapconcat 'identity args ""))))) + ((eval compile) (format ",geiser-eval %s %s" + (or (car args) "#f") + (geiser-guile--linearize-args (cdr args)))) + ((load-file compile-file) (format ",geiser-load-file %s" (car args))) + ((no-values) ",geiser-no-values") + (t (format "ge:%s %s" proc (geiser-guile--linearize-args args))))) (defconst geiser-guile--module-re "(define-module +\\(([^)]+)\\)") @@ -247,9 +255,10 @@ it spawn a server thread." (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) - (geiser-eval--send/result - `(:scm ,(format "(set! %%load-path (cons %S %%load-path))" - (expand-file-name "guile/" geiser-scheme-dir)))) + (geiser-eval--send/wait + (format "(set! %%load-path (cons %S %%load-path))" + (expand-file-name "guile/" geiser-scheme-dir))) + (geiser-eval--send/wait ",use (geiser emacs)") (geiser-guile-update-warning-level)) -- cgit v1.2.3 From 9ad7d3a695d4543bd530e42252d36456914be5be Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 30 Oct 2010 22:51:45 +0200 Subject: Guile: recognizing R6RS libraries as modules --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e07fb1b..51de947 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -134,7 +134,7 @@ This function uses `geiser-guile-init-file' if it exists." (t (format "ge:%s %s" proc (geiser-guile--linearize-args args))))) (defconst geiser-guile--module-re - "(define-module +\\(([^)]+)\\)") + "(\\(?:define-module\\|library\\) +\\(([^)]+)\\)") (defun geiser-guile--get-module (&optional module) (cond ((null module) -- cgit v1.2.3 From 6b31cd5a246ada814327aaffd3fcfe38eaa7dbcf Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 30 Oct 2010 23:48:18 +0200 Subject: Guile: really support R6RS libs --- elisp/geiser-guile.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 51de947..c406d88 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -134,7 +134,10 @@ This function uses `geiser-guile-init-file' if it exists." (t (format "ge:%s %s" proc (geiser-guile--linearize-args args))))) (defconst geiser-guile--module-re - "(\\(?:define-module\\|library\\) +\\(([^)]+)\\)") + "(define-module +\\(([^)]+)\\)") + +(defconst geiser-guile--library-re + "(library +\\(([^)]+)\\)") (defun geiser-guile--get-module (&optional module) (cond ((null module) @@ -142,7 +145,8 @@ This function uses `geiser-guile-init-file' if it exists." (ignore-errors (while (not (zerop (geiser-syntax--nesting-level))) (backward-up-list))) - (if (re-search-backward geiser-guile--module-re nil t) + (if (or (re-search-backward geiser-guile--module-re nil t) + (looking-at geiser-guile--library-re)) (geiser-guile--get-module (match-string-no-properties 1)) :f))) ((listp module) module) -- cgit v1.2.3 From 4f0c19c4bacdd7173a9c3b31a3e065996f78f1a0 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 31 Oct 2010 01:46:29 +0200 Subject: Guile: reactivating the debugger during evaluation --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index c406d88..8f8d7af 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -185,7 +185,7 @@ This function uses `geiser-guile-init-file' if it exists." (if geiser-guile-debug-show-bt-p "bt" "fr")))) (compilation-forget-errors) (goto-char (point-max)) - (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") + (comint-send-string nil ",geiser-newline\n") (comint-send-string nil ",error-message\n") (comint-send-string nil bt-cmd) (when geiser-guile-show-debug-help-p -- cgit v1.2.3 From 061559ee48e45d1f7ecb8082346b5ef1f5f523ae Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 1 Nov 2010 00:03:31 +0100 Subject: Guile: suppress embedded comments when sending multi-line sexps --- elisp/geiser-guile.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 8f8d7af..3f8aa4b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -116,7 +116,14 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--linearize (str) (if (string-match "\n" str) (with-temp-buffer + (set-syntax-table scheme-mode-syntax-table) (insert str) + (goto-char (point-min)) + (let ((kill-whole-line nil)) + (while (> (skip-syntax-forward "^<") 0) + (let ((p (point))) + (end-of-line) + (kill-region p (point))))) (subst-char-in-region (point-min) (point-max) ?\n ? t) (buffer-string)) str)) -- cgit v1.2.3 From ce57385a794978cc5ee2279289d83a120e6ca621 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 1 Nov 2010 00:19:23 +0100 Subject: Guile: shorten a bit more multi-line sexps sent to REPL --- elisp/geiser-guile.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3f8aa4b..363c061 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -124,7 +124,9 @@ This function uses `geiser-guile-init-file' if it exists." (let ((p (point))) (end-of-line) (kill-region p (point))))) - (subst-char-in-region (point-min) (point-max) ?\n ? t) + (goto-char (point-min)) + (while (re-search-forward "[ \t\n\r][ \t\n\r]+" nil t) + (replace-match " " nil nil)) (buffer-string)) str)) -- cgit v1.2.3 From d5252a159bb218181f440e04b159f1b08fda398a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 1 Nov 2010 00:43:10 +0100 Subject: Guile: fix for the argument shortening algorithm --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 363c061..f0d090d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -125,8 +125,8 @@ This function uses `geiser-guile-init-file' if it exists." (end-of-line) (kill-region p (point))))) (goto-char (point-min)) - (while (re-search-forward "[ \t\n\r][ \t\n\r]+" nil t) - (replace-match " " nil nil)) + (while (search-forward-regexp "\n[ \t\r\n]*" nil t) + (replace-match " ")) (buffer-string)) str)) -- cgit v1.2.3 From cd2cfae323665c99f56528a9d67fd8c386fac541 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 1 Nov 2010 01:45:58 +0100 Subject: Guile: better meta-command args handling --- elisp/geiser-guile.el | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f0d090d..93d1237 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -113,34 +113,18 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Evaluation support: -(defun geiser-guile--linearize (str) - (if (string-match "\n" str) - (with-temp-buffer - (set-syntax-table scheme-mode-syntax-table) - (insert str) - (goto-char (point-min)) - (let ((kill-whole-line nil)) - (while (> (skip-syntax-forward "^<") 0) - (let ((p (point))) - (end-of-line) - (kill-region p (point))))) - (goto-char (point-min)) - (while (search-forward-regexp "\n[ \t\r\n]*" nil t) - (replace-match " ")) - (buffer-string)) - str)) - (defsubst geiser-guile--linearize-args (args) - (mapconcat 'geiser-guile--linearize args " ")) + (mapconcat 'identity args " ")) (defun geiser-guile--geiser-procedure (proc &rest args) (case proc - ((eval compile) (format ",geiser-eval %s %s" + ((eval compile) (format ",geiser-eval %s %s%s" (or (car args) "#f") - (geiser-guile--linearize-args (cdr args)))) + (geiser-guile--linearize-args (cdr args)) + (if (cddr args) "" " ()"))) ((load-file compile-file) (format ",geiser-load-file %s" (car args))) ((no-values) ",geiser-no-values") - (t (format "ge:%s %s" proc (geiser-guile--linearize-args args))))) + (t (format "ge:%s (%s)" proc (geiser-guile--linearize-args args))))) (defconst geiser-guile--module-re "(define-module +\\(([^)]+)\\)") -- cgit v1.2.3 From d2d5f62786add57cec8e48782b84a8a45c0f5b78 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 4 Nov 2010 22:02:54 +0100 Subject: Implementation guessing for scripts with #! ... guile --- elisp/geiser-guile.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3e1c03f..f13fab6 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -193,10 +193,14 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Trying to ascertain whether a buffer is Guile Scheme: +(defconst geiser-guile--guess-re + (format "\\(%s\\|#! *.+\\(/\\| \\)guile\\( *\\\\\\)?\\)" + geiser-guile--module-re)) + (defun geiser-guile--guess () (save-excursion (goto-char (point-min)) - (re-search-forward geiser-guile--module-re nil t))) + (re-search-forward geiser-guile--guess-re nil t))) ;;; Compilation shell regexps -- cgit v1.2.3 From a77bf8bc32f6c795b4399699e5bdc56518d7c3ff Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 9 Nov 2010 02:38:49 +0100 Subject: Elisp buggettes and warnings --- elisp/geiser-guile.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f13fab6..1c39f14 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -139,8 +139,9 @@ This function uses `geiser-guile-init-file' if it exists." :f))) ((listp module) module) ((stringp module) - (or (ignore-errors (car (geiser-syntax--read-from-string module))) - :f)) + (condition-case nil + (car (geiser-syntax--read-from-string module)) + (error :f))) (t :f))) (defun geiser-guile--module-cmd (module fmt &optional def) @@ -251,7 +252,7 @@ it spawn a server thread." (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) - (geiser-eval--send/result + (geiser-eval--send/wait `(:scm ,(format "(set! %%load-path (cons %S %%load-path))" (expand-file-name "guile/" geiser-scheme-dir)))) (geiser-guile-update-warning-level)) -- cgit v1.2.3 From 7082042d262ee3d82ebe32d16f3593418b06f454 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 11 Nov 2010 03:31:15 +0100 Subject: Elisp support for inferior schemes --- elisp/geiser-guile.el | 1 - 1 file changed, 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 1c39f14..d58821b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -247,7 +247,6 @@ it spawn a server thread." (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) ("^ +\\([0-9]+\\):\\([0-9]+\\)" nil 1 2))) - (setq geiser-con--debugging-inhibits-eval nil) (compilation-setup t) (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 -- cgit v1.2.3 From 1eebcce8c6da5164394225d13bd08ca5826daa9a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 12 Nov 2010 01:33:09 +0100 Subject: Guile reconnected (but not debuggable (yet)) Or the importance of EOL. Switching to a transaction queue for communication with the Scheme process means that i had to care about sending eols in the queries... Guile was waiting for ever reading a metacommand taking a variable number of arguments. Argh: this has taken me a few hours -- i'm getting old. --- elisp/geiser-guile.el | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3979688..1295bac 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -101,15 +101,14 @@ This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file)))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) - "-q" + "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) -(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") +;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") +(defconst geiser-guile--prompt-regexp "[^@()]+@([^)]*?)> ") (defconst geiser-guile--debugger-prompt-regexp - "^[^() \n]+@([^)]*?) \\[[0-9]+\\]> ") -(defconst geiser-guile--debugger-preamble-regexp - "^Entering a new prompt\\. ") + "^[^@()]+@([^)]*?) \\[[0-9]+\\]> ") ;;; Evaluation support: @@ -118,7 +117,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--geiser-procedure (proc &rest args) (case proc - ((eval compile) (format ",geiser-eval %s %s%s" + ((eval compile) (format ",geiser-eval %s %s%s\n" (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) (if (cddr args) "" " ()"))) @@ -248,7 +247,14 @@ it spawn a server thread." (interactive) (geiser-connect 'guile)) -(defun geiser-guile--startup () +(defun geiser-guile--load-path-string () + (let* ((path (expand-file-name "guile/" geiser-scheme-dir)) + (witness "geiser/emacs.scm") + (code `(if (not (%search-load-path ,witness)) + (set! %load-path (cons ,path %load-path))))) + (geiser-eval--scheme-str code))) + +(defun geiser-guile--startup (remote) (set (make-local-variable 'compilation-error-regexp-alist) `((,geiser-guile--path-rx geiser-guile--resolve-file-x) ("^ +\\([0-9]+\\):\\([0-9]+\\)" nil 1 2))) @@ -256,23 +262,26 @@ it spawn a server thread." (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) - (geiser-eval--send/wait - (format "(set! %%load-path (cons %S %%load-path))" - (expand-file-name "guile/" geiser-scheme-dir))) - (geiser-eval--send/wait ",use (geiser emacs)") + (when remote + (geiser-eval--send/wait (concat (geiser-guile--load-path-string) "\n")) + (geiser-eval--send/wait ",use (geiser emacs)\n")) (geiser-guile-update-warning-level)) +(defconst geiser-guile--init-server-command + ",use (geiser emacs)\n,geiser-start-server") + ;;; Implementation definition: (define-geiser-implementation guile (binary geiser-guile--binary) (arglist geiser-guile--parameters) - (startup geiser-guile--startup) + (repl-startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) - (enter-debugger geiser-guile--enter-debugger) + (inferior-prompt-regexp geiser-guile--prompt-regexp) + (init-server-command geiser-guile--init-server-command) (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) - (debugger-preamble-regexp geiser-guile--debugger-preamble-regexp) + (enter-debugger geiser-guile--enter-debugger) (marshall-procedure geiser-guile--geiser-procedure) (find-module geiser-guile--get-module) (enter-command geiser-guile--enter-command) -- cgit v1.2.3 From 6d52afb6318b2a826b7ba4d7ee76755fdf144df2 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 12 Nov 2010 02:20:14 +0100 Subject: Better EOT token for more robust communication --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 1295bac..afb7992 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -263,8 +263,8 @@ it spawn a server thread." `((,geiser-guile--path-rx 1 compilation-error-face))) (when remote - (geiser-eval--send/wait (concat (geiser-guile--load-path-string) "\n")) - (geiser-eval--send/wait ",use (geiser emacs)\n")) + (geiser-repl--send-silent (geiser-guile--load-path-string)) + (geiser-repl--send-silent ",use (geiser emacs)")) (geiser-guile-update-warning-level)) (defconst geiser-guile--init-server-command -- cgit v1.2.3 From 9d26fb34c24677e1db45a96ec88cca94ea1c4542 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 12 Nov 2010 15:41:06 +0100 Subject: Debugger support, and Guile using it --- elisp/geiser-guile.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index afb7992..3d42d24 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -108,7 +108,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") (defconst geiser-guile--prompt-regexp "[^@()]+@([^)]*?)> ") (defconst geiser-guile--debugger-prompt-regexp - "^[^@()]+@([^)]*?) \\[[0-9]+\\]> ") + "[^@()]+@([^)]*?) \\[[0-9]+\\]> ") ;;; Evaluation support: @@ -117,7 +117,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--geiser-procedure (proc &rest args) (case proc - ((eval compile) (format ",geiser-eval %s %s%s\n" + ((eval compile) (format ",geiser-eval %s %s%s" (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) (if (cddr args) "" " ()"))) @@ -178,6 +178,7 @@ This function uses `geiser-guile-init-file' if it exists." (if geiser-guile-debug-show-bt-p "bt" "fr")))) (compilation-forget-errors) (goto-char (point-max)) + (geiser-repl--swap) (comint-send-string nil ",geiser-newline\n") (comint-send-string nil ",error-message\n") (comint-send-string nil bt-cmd) @@ -226,7 +227,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--resolve-file-x () (let ((f (geiser-guile--resolve-file (match-string-no-properties 1)))) - (and f (list f)))) + (and (stringp f) (list f)))) ;;; REPL startup -- cgit v1.2.3 From c8dcc2472b230bf1c0b17b78369c516fe802aea5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 12 Nov 2010 22:55:40 +0100 Subject: Make do with a single connection Separate connections for the REPL and Geiser commands was kind of neat, but it had the problem of synchronising the current namespace for both connections. A quick fix would have been to ask the scheme for the current namespace for every Geiser command in the REPL, but that, besides clunky, would add potentially prohibitive overhead for (real) remote connections. As it happens, using a single connection turned out to be not that difficult and relatively clean code-wise. We could even turn back to not use inferior schemes, and the net result of this refactoring would be the replacement of comint-redirect (which wasn't able to match the whole EOT token if it didn't arrive all at once) by transaction queues (which also makes geiser-connection's implementation cleaner). But using an inferior scheme has a dog-food value, and allows external processes to connect to the scheme being used by Geiser without further ado, which could be useful for debugging (although this is a lame excuse: nothing prevents you from starting a REPL server from emacs if you want). We'll see. --- elisp/geiser-guile.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 3d42d24..687bf34 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -174,13 +174,11 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Error display (defun geiser-guile--enter-debugger () - (let ((bt-cmd (format ",%s\n" + (let ((bt-cmd (format ",geiser-newline\n,error-message\n,%s\n" (if geiser-guile-debug-show-bt-p "bt" "fr")))) (compilation-forget-errors) (goto-char (point-max)) - (geiser-repl--swap) - (comint-send-string nil ",geiser-newline\n") - (comint-send-string nil ",error-message\n") + (geiser-repl--prepare-send) (comint-send-string nil bt-cmd) (when geiser-guile-show-debug-help-p (message "Debug REPL. Enter ,q to quit, ,h for help.")) @@ -266,10 +264,16 @@ it spawn a server thread." (when remote (geiser-repl--send-silent (geiser-guile--load-path-string)) (geiser-repl--send-silent ",use (geiser emacs)")) - (geiser-guile-update-warning-level)) - -(defconst geiser-guile--init-server-command - ",use (geiser emacs)\n,geiser-start-server") + (geiser-guile-update-warning-level) + ) + +(defun geiser-guile--init-server-command () + (comint-kill-region (point-min) (point-max)) + (setq comint-prompt-regexp "inferior-guile> ") + (comint-send-string nil ",option prompt \"inferior-guile> \"\n") + (comint-send-string nil ",use (geiser emacs)\n") + (geiser-inf--wait-for-prompt 10000) + ",geiser-start-server") ;;; Implementation definition: -- cgit v1.2.3 From 2ea6d9d90e72e26e00ebe84785064f237dfaf0ee Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 13 Nov 2010 02:07:19 +0100 Subject: Superior schemes Inferior schemes weren't really a good idea, were they? With remote connections one can launch an external scheme to debug Geiser anyway. And everything is (ahem, will be) simpler when we add new implementations. --- elisp/geiser-guile.el | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 687bf34..a53395d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -262,18 +262,9 @@ it spawn a server thread." `((,geiser-guile--path-rx 1 compilation-error-face))) (when remote - (geiser-repl--send-silent (geiser-guile--load-path-string)) - (geiser-repl--send-silent ",use (geiser emacs)")) - (geiser-guile-update-warning-level) - ) - -(defun geiser-guile--init-server-command () - (comint-kill-region (point-min) (point-max)) - (setq comint-prompt-regexp "inferior-guile> ") - (comint-send-string nil ",option prompt \"inferior-guile> \"\n") - (comint-send-string nil ",use (geiser emacs)\n") - (geiser-inf--wait-for-prompt 10000) - ",geiser-start-server") + (geiser-repl--send-silent (geiser-guile--load-path-string))) + (geiser-repl--send-silent ",use (geiser emacs)") + (geiser-guile-update-warning-level)) ;;; Implementation definition: @@ -283,8 +274,6 @@ it spawn a server thread." (arglist geiser-guile--parameters) (repl-startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) - (inferior-prompt-regexp geiser-guile--prompt-regexp) - (init-server-command geiser-guile--init-server-command) (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) (enter-debugger geiser-guile--enter-debugger) (marshall-procedure geiser-guile--geiser-procedure) -- cgit v1.2.3 From 0d3b1f8c0dcbb3a585a39bb60cc8ca6bd61d3df9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 14 Nov 2010 20:19:10 +0100 Subject: Support for implementation-specific font lock keywords Spinning up from correct fontification of [else in this brave Racket world. I'm keeping the list of extra keywords lean and mean, but making it customizable in both Racket and Guile. --- elisp/geiser-guile.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a53395d..865c7fc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -87,6 +87,11 @@ effect on new REPLs. For existing ones, use the command (repeat :tag "Custom" symbol)) :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-extra-keywords nil + "Extra keywords highlighted in Guile scheme buffers." + :type '(repeat string) + :group 'geiser-guile) + ;;; REPL support: @@ -206,6 +211,13 @@ This function uses `geiser-guile-init-file' if it exists." (goto-char (point-min)) (re-search-forward geiser-guile--guess-re nil t))) + +;;; Keywords +(defun geiser-guile--keywords () + (when geiser-guile-extra-keywords + `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) + . 1)))) + ;;; Compilation shell regexps @@ -284,7 +296,8 @@ it spawn a server thread." (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) - (check-buffer geiser-guile--guess)) + (check-buffer geiser-guile--guess) + (keywords geiser-guile--keywords)) (geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile nil) -- cgit v1.2.3 From 92dadf9e5fcec2a61c243f766e3d24558cb7042e Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 14 Nov 2010 20:59:26 +0100 Subject: Typo --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 865c7fc..9e6446d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -67,7 +67,7 @@ If `t', Geiser will use `next-error' to jump to the error's location." (geiser-custom--defcustom geiser-guile-warning-level 'medium "Verbosity of the warnings reported by Guile. -You can choose either one of the predefined warning sets, or +You can either choose one of the predefined warning sets, or provide a list of symbols identifying the ones you want. Possible choices are arity-mismatch, unbound-variable, unused-variable and unused-toplevel. Unrecognised symbols are ignored. -- cgit v1.2.3 From e25e31f2f838c0e00f1c786c50c933e983998115 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 22 Nov 2010 00:46:28 +0100 Subject: Fix for error in Guile initialisation --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 9e6446d..35548f3 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -246,7 +246,7 @@ This function uses `geiser-guile-init-file' if it exists." "Update the warning level used by the REPL. The new level is set using the value of `geiser-guile-warning-level'." (interactive) - (let ((code `(:eval (ge:set-warnings ',geiser-guile-warning-level) + (let ((code `(:eval (:ge set-warnings ',geiser-guile-warning-level) (geiser evaluation)))) (geiser-eval--send/result code))) -- cgit v1.2.3 From 3618844e887e3f7388e07f9b77f033f414d76bfd Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 24 Nov 2010 02:14:11 +0100 Subject: Guile: button for texinfo lookup in doc browser --- elisp/geiser-guile.el | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 35548f3..fe32acd 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -20,6 +20,7 @@ (require 'geiser) (require 'compile) +(require 'info-look) ;;; Customization: @@ -92,6 +93,11 @@ effect on new REPLs. For existing ones, use the command :type '(repeat string) :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-manual-lookup-other-window-p nil + "Non-nil means pop up the Info buffer in another window." + :type 'boolean + :group 'geiser-guile) + ;;; REPL support: @@ -278,6 +284,26 @@ it spawn a server thread." (geiser-repl--send-silent ",use (geiser emacs)") (geiser-guile-update-warning-level)) + +;;; Manual lookup +(info-lookup-add-help :topic 'symbol :mode 'geiser-guile-mode + :ignore-case nil + :regexp "[^()`',\" \n]+" + :doc-spec + '(("(r5rs)Index" nil "^[ ]+-+ [^:]+:[ ]*" "\\b") + ("(Guile)R5RS Index" nil "^ - [^:]+: " "\\b") + ("(Guile)Procedure Index" nil "^ - [^:]+: " "\\b") + ("(Guile)Variable Index" nil "^ - [^:]+: " "\\b"))) + +(defun guile--manual-look-up (id mod) + (let ((info-lookup-other-window-flag + geiser-guile-manual-lookup-other-window-p)) + (info-lookup-symbol id 'geiser-guile-mode)) + (when geiser-guile-manual-lookup-other-window-p + (switch-to-buffer-other-window "*info*")) + (search-forward (format "%s" id) nil t)) + + ;;; Implementation definition: @@ -295,7 +321,7 @@ it spawn a server thread." (import-command geiser-guile--import-command) (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) - (display-help) + (external-help guile--manual-look-up) (check-buffer geiser-guile--guess) (keywords geiser-guile--keywords)) -- cgit v1.2.3 From b5f0316c9bdff5cc926fdb2a156bc3c21ed24313 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 25 Nov 2010 00:04:11 +0100 Subject: Guile: logging initialisation process Today, W was seeing errors when connecting to Guile, which of course immediately disappeared when we tried to reproduce them and get some logs. I'm logging Guile's initialisation unconditionally, to make sure the problem doesn't repeat. Much easier than fixing the bug. --- elisp/geiser-guile.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index fe32acd..6e14e88 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -17,6 +17,7 @@ (require 'geiser-base) (require 'geiser-eval) (require 'geiser-edit) +(require 'geiser-log) (require 'geiser) (require 'compile) @@ -279,10 +280,14 @@ it spawn a server thread." (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) - (when remote - (geiser-repl--send-silent (geiser-guile--load-path-string))) - (geiser-repl--send-silent ",use (geiser emacs)") - (geiser-guile-update-warning-level)) + (let ((geiser-log-verbose-p t)) + (when remote + (geiser-log--info + "Guile: initialising load path... %s" + (geiser-repl--send-silent (geiser-guile--load-path-string)))) + (geiser-log--info "Guile: using (geiser emacs)... %s" + (geiser-repl--send-silent ",use (geiser emacs)")) + (geiser-guile-update-warning-level))) ;;; Manual lookup @@ -329,4 +334,3 @@ it spawn a server thread." (provide 'geiser-guile) -;;; geiser-guile.el ends here -- cgit v1.2.3 From 52e8e125f1443d85cf3b836f5f935e833dc363e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 25 Nov 2010 01:29:06 +0100 Subject: Guile: fix for connect-to-guile problems Was a real bug, after all, and quite reproducible. Sending an ,use metacommand was not returning a prompt, and we were waiting for ever to start (or almost). Now, connect-to-guile is not only right, but spiffy again. --- elisp/geiser-guile.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 6e14e88..e4473d8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -235,7 +235,8 @@ This function uses `geiser-guile-init-file' if it exists." (defvar geiser-guile--file-cache (make-hash-table :test 'equal)) (defun geiser-guile--resolve-file (file) - (when (and (stringp file) (not (string-equal file "unknown file"))) + (when (and (stringp file) + (not (member file '("socket" "stdin" "unknown file")))) (if (file-name-absolute-p file) file (or (gethash file geiser-guile--file-cache) (puthash file @@ -265,12 +266,13 @@ it spawn a server thread." (interactive) (geiser-connect 'guile)) -(defun geiser-guile--load-path-string () +(defun geiser-guile--set-load-path () (let* ((path (expand-file-name "guile/" geiser-scheme-dir)) (witness "geiser/emacs.scm") - (code `(if (not (%search-load-path ,witness)) - (set! %load-path (cons ,path %load-path))))) - (geiser-eval--scheme-str code))) + (code `(begin (if (not (%search-load-path ,witness)) + (set! %load-path (cons ,path %load-path))) + 'done))) + (geiser-eval--send/wait code))) (defun geiser-guile--startup (remote) (set (make-local-variable 'compilation-error-regexp-alist) @@ -281,12 +283,8 @@ it spawn a server thread." `((,geiser-guile--path-rx 1 compilation-error-face))) (let ((geiser-log-verbose-p t)) - (when remote - (geiser-log--info - "Guile: initialising load path... %s" - (geiser-repl--send-silent (geiser-guile--load-path-string)))) - (geiser-log--info "Guile: using (geiser emacs)... %s" - (geiser-repl--send-silent ",use (geiser emacs)")) + (when remote (geiser-guile--set-load-path)) + (geiser-eval--send/wait ",use (geiser emacs)\n'done") (geiser-guile-update-warning-level))) -- cgit v1.2.3 From 4732e10453cbddd41c4577db7a54f42353bd9b11 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 26 Nov 2010 14:45:00 +0100 Subject: Bug fix: don't intern symbols read by scheme reader We were calling `intern' instead of `make-symbol', polluting emacs' obarray. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e4473d8..432c0fc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -114,7 +114,8 @@ This function uses `geiser-guile-init-file' if it exists." (expand-file-name geiser-guile-init-file)))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) - ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) + geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3 From 36e105fe0b7fa70d6c7751d98ab5083371603747 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 26 Nov 2010 15:19:49 +0100 Subject: Revert "Bug fix: don't intern symbols read by scheme reader" This reverts commit 801422d1558f488059ede4f9abab5163ca610900. We cannot blindly substitute make-symbol for intern in the scheme reader, because we rely on symbol equality elsewhere, often. The fix will have to be much more careful. --- elisp/geiser-guile.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 432c0fc..e4473d8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -114,8 +114,7 @@ This function uses `geiser-guile-init-file' if it exists." (expand-file-name geiser-guile-init-file)))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) - ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) - geiser-guile-load-path)) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3 From cf8498d21dae1b4dcdef1b8798ee9ddda86c230b Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 9 Feb 2011 14:21:24 +0100 Subject: Guile: 'format' added to the warning list --- elisp/geiser-guile.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e4473d8..abf6afb 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -76,8 +76,8 @@ unused-toplevel. Unrecognised symbols are ignored. The predefined levels are: - - Medium: arity-mismatch, unbound-variable - - High: arity-mismatch, unbound-variable, unused-variable + - Medium: arity-mismatch, unbound-variable, format + - High: arity-mismatch, unbound-variable, unused-variable, format - None: no warnings Changes to the value of this variable will automatically take -- cgit v1.2.3 From f0174547304250c5201e95a17eb91fd79506cb8d Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 14 Feb 2011 16:48:38 +0100 Subject: Bug fix: don't override customized geiser-implementations-alist --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index abf6afb..4d7727c 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -328,7 +328,7 @@ it spawn a server thread." (check-buffer geiser-guile--guess) (keywords geiser-guile--keywords)) -(geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile nil) +(geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile t) (provide 'geiser-guile) -- cgit v1.2.3 From a6dccbebde0fbc28f7fc0c2712467978dbc07857 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Mar 2011 20:51:28 +0100 Subject: Guile: new option for loading ~/.guile (see issue #32681) The new custom variable, geiser-guile-load-init-file-p, will be gone once Guile adquires the ability to specify the path to its init file. --- elisp/geiser-guile.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 4d7727c..169ac30 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -45,10 +45,20 @@ started." :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-init-file "~/.guile-geiser" - "Initialization file with user code for the Guile REPL." + "Initialization file with user code for the Guile REPL. +If all you want is to load ~/.guile, set +`geiser-guile-load-init-file-p' instead." :type 'string :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-load-init-file-p nil + "Whether to load ~/.guile when starting Guile. +Note that, due to peculiarities in the way Guile loads its init +file, using `geiser-guile-init-file' is not equivalent to setting +this variable to t." + :type 'boolean + :group 'geiser-guile) + (geiser-custom--defcustom geiser-guile-debug-show-bt-p nil "Whether to autmatically show a full backtrace when entering the debugger. If `nil', only the last frame is shown." @@ -111,10 +121,12 @@ effect on new REPLs. For existing ones, use the command "Return a list with all parameters needed to start Guile. This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) - (expand-file-name geiser-guile-init-file)))) + (expand-file-name geiser-guile-init-file))) + (q-flags (or geiser-guile-load-init-file-p '("-q")))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) - "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) - ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) + ,@q-flags "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) + geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3 From b9a89803f260af99451432db7372628d8889d179 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Mar 2011 22:03:45 +0100 Subject: Guile: what if i do what i meant to do? Thanks Jon! --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 169ac30..648c64e 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -122,7 +122,7 @@ effect on new REPLs. For existing ones, use the command This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file))) - (q-flags (or geiser-guile-load-init-file-p '("-q")))) + (q-flags (and (not geiser-guile-load-init-file-p) '("-q")))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) ,@q-flags "-L" ,(expand-file-name "guile/" geiser-scheme-dir) ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) -- cgit v1.2.3 From 1421a7172cd41e3660a5f2eab23b32bb652ebaf9 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 23 Jun 2011 01:29:09 +0200 Subject: Guile: find module when cursor is before define-module (#33497) If we didn't find a define-module form after the cursor, or an enclosing R6RS library form, we search forward for a module definition. That way, things like C-c C-a work also from the top of the file. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 648c64e..da14b4e 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -162,7 +162,8 @@ This function uses `geiser-guile-init-file' if it exists." (while (not (zerop (geiser-syntax--nesting-level))) (backward-up-list))) (if (or (re-search-backward geiser-guile--module-re nil t) - (looking-at geiser-guile--library-re)) + (looking-at geiser-guile--library-re) + (re-search-forward geiser-guile--module-re nil t)) (geiser-guile--get-module (match-string-no-properties 1)) :f))) ((listp module) module) -- cgit v1.2.3 From b81b23ca475bd4945bfa4096418da7a13fc814bc Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 9 Jun 2012 14:24:22 +0200 Subject: Support for user-defined Guile info nodes In my debian machine, the info nodes for guile live in the "guile-2.0" node, rather than plain "guile". A new customizable variable, geiser-guile-manual-lookup-nodes, lets now specify additional names, and we only add indexes to the info-lookup mode definition when the node actually exists. --- elisp/geiser-guile.el | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index da14b4e..54443b8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -109,6 +109,11 @@ effect on new REPLs. For existing ones, use the command :type 'boolean :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-manual-lookup-nodes '("Guile" "guile-2.0") + "List of info nodes that, when present, are used for manual lookups" + :type '(repeat string) + :group 'geiser-guile) + ;;; REPL support: @@ -302,14 +307,22 @@ it spawn a server thread." ;;; Manual lookup + +(defun geiser-guile--info-spec (&optional nodes) + (let* ((nrx "^[ ]+-+ [^:]+:[ ]*") + (drx "\\b") + (res (when (Info-find-file "r5rs" t) `(("(r5rs)Index" nil ,nrx ,drx))))) + (dolist (node (or nodes geiser-guile-manual-lookup-nodes) res) + (when (Info-find-file node t) + (mapc (lambda (idx) + (add-to-list 'res (list (format "(%s)%s" node idx) nil nrx drx))) + '("Variable Index" "Procedure Index" "R5RS Index")))))) + + (info-lookup-add-help :topic 'symbol :mode 'geiser-guile-mode :ignore-case nil :regexp "[^()`',\" \n]+" - :doc-spec - '(("(r5rs)Index" nil "^[ ]+-+ [^:]+:[ ]*" "\\b") - ("(Guile)R5RS Index" nil "^ - [^:]+: " "\\b") - ("(Guile)Procedure Index" nil "^ - [^:]+: " "\\b") - ("(Guile)Variable Index" nil "^ - [^:]+: " "\\b"))) + :doc-spec (geiser-guile--info-spec)) (defun guile--manual-look-up (id mod) (let ((info-lookup-other-window-flag -- cgit v1.2.3 From 09e2247047614d1f1b2285e84bed47dd17143480 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 24 Oct 2012 04:17:19 +0200 Subject: Little clean-ups to the indentation rules Splitting better the specially indented forms between our two implementations, so that users of a single one don't get weird indentations for froms without a special meaning in their scheme. Ideally, we should make these indentation rules buffer-local, so that when a user is in a, say, Guile buffer, module+ has no special indentation (as is the case now if that user also has activated support for Racket). --- elisp/geiser-guile.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 54443b8..00c44d5 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -237,12 +237,24 @@ This function uses `geiser-guile-init-file' if it exists." (re-search-forward geiser-guile--guess-re nil t))) -;;; Keywords +;;; Keywords and syntax + (defun geiser-guile--keywords () (when geiser-guile-extra-keywords `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) . 1)))) +(geiser-syntax--scheme-indent + (c-declare 0) + (c-lambda 2) + (pmatch defun) + (sigaction 1) + (with-fluid* 1) + (with-fluids 1) + (with-fluids* 1) + (with-method 1)) + + ;;; Compilation shell regexps -- cgit v1.2.3 From 6324b94c9984bb3dc017e8b0119e270c69532688 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 1 Mar 2013 04:24:21 +0100 Subject: Configurable keyword case sensitivity By default, keywords are now not fontified in Scheme buffers unless they have the correct (lower) case. This behaviour can be altered by new, per-implementation customization variables. Thanks to Diogo F. S. Ramos for pointing this out. --- elisp/geiser-guile.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 00c44d5..f8c76b7 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011, 2012 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -104,6 +104,11 @@ effect on new REPLs. For existing ones, use the command :type '(repeat string) :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-case-sensitive-p t + "Non-nil means keyword highlighting is case-sensitive." + :type 'boolean + :group 'geiser-guile) + (geiser-custom--defcustom geiser-guile-manual-lookup-other-window-p nil "Non-nil means pop up the Info buffer in another window." :type 'boolean @@ -323,11 +328,13 @@ it spawn a server thread." (defun geiser-guile--info-spec (&optional nodes) (let* ((nrx "^[ ]+-+ [^:]+:[ ]*") (drx "\\b") - (res (when (Info-find-file "r5rs" t) `(("(r5rs)Index" nil ,nrx ,drx))))) + (res (when (Info-find-file "r5rs" t) + `(("(r5rs)Index" nil ,nrx ,drx))))) (dolist (node (or nodes geiser-guile-manual-lookup-nodes) res) (when (Info-find-file node t) (mapc (lambda (idx) - (add-to-list 'res (list (format "(%s)%s" node idx) nil nrx drx))) + (add-to-list 'res + (list (format "(%s)%s" node idx) nil nrx drx))) '("Variable Index" "Procedure Index" "R5RS Index")))))) @@ -364,7 +371,8 @@ it spawn a server thread." (display-error geiser-guile--display-error) (external-help guile--manual-look-up) (check-buffer geiser-guile--guess) - (keywords geiser-guile--keywords)) + (keywords geiser-guile--keywords) + (case-sensitive geiser-guile-case-sensitive-p)) (geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile t) -- cgit v1.2.3 From d6fca59c8ed5aa8d14de248e16b468ee422a602e Mon Sep 17 00:00:00 2001 From: Aleix Conchillo Flaque Date: Wed, 8 May 2013 22:22:24 -0700 Subject: guile: lambda* indentation --- elisp/geiser-guile.el | 1 + 1 file changed, 1 insertion(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f8c76b7..17a6b4c 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -252,6 +252,7 @@ This function uses `geiser-guile-init-file' if it exists." (geiser-syntax--scheme-indent (c-declare 0) (c-lambda 2) + (lambda* 1) (pmatch defun) (sigaction 1) (with-fluid* 1) -- cgit v1.2.3 From 129d6ded3831c020b944da82f7299575c78ad1e5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 15 Jun 2013 19:06:58 +0200 Subject: Missing require cl for case --- elisp/geiser-guile.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 17a6b4c..99ef7b9 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -23,6 +23,8 @@ (require 'compile) (require 'info-look) +(eval-when-compile (require 'cl)) + ;;; Customization: -- cgit v1.2.3 From 452e096b040ca6dd26389906e2ae451f60198527 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 27 Jun 2013 19:18:26 +0200 Subject: White space, really --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 99ef7b9..d512185 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -116,7 +116,8 @@ effect on new REPLs. For existing ones, use the command :type 'boolean :group 'geiser-guile) -(geiser-custom--defcustom geiser-guile-manual-lookup-nodes '("Guile" "guile-2.0") +(geiser-custom--defcustom geiser-guile-manual-lookup-nodes + '("Guile" "guile-2.0") "List of info nodes that, when present, are used for manual lookups" :type '(repeat string) :group 'geiser-guile) -- cgit v1.2.3 From 7d17a3cc9a9a637bd87d8c87fee3e342b88ee286 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Fri, 13 Sep 2013 20:36:56 +0200 Subject: Guile: augmenting %load-compiled-path too We add the paths in geiser-guile-load-path also to %load-compiled-path, and new directories added to the load path via geiser-add-to-load-path are added to both %load-path and %load-compiled-path. Here's hope Ludovic will like all these additions! --- elisp/geiser-guile.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index d512185..994ea6b 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -305,7 +305,7 @@ it spawn a server thread." (interactive) (geiser-connect 'guile)) -(defun geiser-guile--set-load-path () +(defun geiser-guile--set-geiser-load-path () (let* ((path (expand-file-name "guile/" geiser-scheme-dir)) (witness "geiser/emacs.scm") (code `(begin (if (not (%search-load-path ,witness)) @@ -318,12 +318,15 @@ it spawn a server thread." `((,geiser-guile--path-rx geiser-guile--resolve-file-x) ("^ +\\([0-9]+\\):\\([0-9]+\\)" nil 1 2))) (compilation-setup t) - (font-lock-add-keywords nil - `((,geiser-guile--path-rx 1 - compilation-error-face))) + (font-lock-add-keywords nil `((,geiser-guile--path-rx + 1 compilation-error-face))) (let ((geiser-log-verbose-p t)) - (when remote (geiser-guile--set-load-path)) + (when remote (geiser-guile--set-geiser-load-path)) (geiser-eval--send/wait ",use (geiser emacs)\n'done") + (mapcar (lambda (dir) + (let ((dir (expand-file-name dir))) + (geiser-eval--send/wait `(:eval (:ge add-to-load-path ,dir))))) + geiser-guile-load-path) (geiser-guile-update-warning-level))) -- cgit v1.2.3 From af0122ccb4fb2d47eced9cf63a6ba53d992ba3d7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 19 Sep 2013 02:19:45 +0200 Subject: Fix: not using mapcar for effect --- elisp/geiser-guile.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 994ea6b..9182807 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -323,10 +323,9 @@ it spawn a server thread." (let ((geiser-log-verbose-p t)) (when remote (geiser-guile--set-geiser-load-path)) (geiser-eval--send/wait ",use (geiser emacs)\n'done") - (mapcar (lambda (dir) - (let ((dir (expand-file-name dir))) - (geiser-eval--send/wait `(:eval (:ge add-to-load-path ,dir))))) - geiser-guile-load-path) + (dolist (dir geiser-guile-load-path) + (let ((dir (expand-file-name dir))) + (geiser-eval--send/wait `(:eval (:ge add-to-load-path ,dir))))) (geiser-guile-update-warning-level))) -- cgit v1.2.3 From 48e2b0059f7c92f6010cd338d76e6b4d9c69c2a9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 25 Sep 2013 05:10:00 +0200 Subject: Scheme version checks And, if you happen to be launching it all the time, a way of skipping them via a customizable variable. Should address issue #15. --- elisp/geiser-guile.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 9182807..bc96973 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -289,6 +289,11 @@ This function uses `geiser-guile-init-file' if it exists." ;;; REPL startup +(defconst geiser-guile-minimum-version "2.0") + +(defun geiser-guile--version (binary) + (shell-command-to-string (format "%s -c '(display (version))'" binary))) + (defun geiser-guile-update-warning-level () "Update the warning level used by the REPL. The new level is set using the value of `geiser-guile-warning-level'." @@ -364,6 +369,8 @@ it spawn a server thread." (define-geiser-implementation guile (binary geiser-guile--binary) (arglist geiser-guile--parameters) + (version-command geiser-guile--version) + (minimum-version geiser-guile-minimum-version) (repl-startup geiser-guile--startup) (prompt-regexp geiser-guile--prompt-regexp) (debugger-prompt-regexp geiser-guile--debugger-prompt-regexp) -- cgit v1.2.3 From 467aded542e8428b90549727dafbb4d6bcb07cd4 Mon Sep 17 00:00:00 2001 From: "Diogo F. S. Ramos" Date: Fri, 28 Feb 2014 17:43:35 -0300 Subject: Highlight `define-once' Guile's `define-once' allows defining a variable only once, but its syntax is different from `define', so its highlight is different. --- elisp/geiser-guile.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index bc96973..5bfff4d 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -248,9 +248,13 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Keywords and syntax (defun geiser-guile--keywords () - (when geiser-guile-extra-keywords - `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) - . 1)))) + (append + (when geiser-guile-extra-keywords + `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) + . 1))) + `((,(rx "(" (group "define-once") eow (* space) (? (group (+ word)))) + (1 font-lock-keyword-face) + (2 font-lock-variable-name-face nil t))))) (geiser-syntax--scheme-indent (c-declare 0) -- cgit v1.2.3 From 362354d4dca7809c79b37873ed2da05cbdcf459b Mon Sep 17 00:00:00 2001 From: "Diogo F. S. Ramos" Date: Wed, 26 Mar 2014 03:22:12 -0300 Subject: Indent Guile's `with-mutex' Follow the convention for `with-' procedures. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 5bfff4d..78ceb83 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -265,7 +265,8 @@ This function uses `geiser-guile-init-file' if it exists." (with-fluid* 1) (with-fluids 1) (with-fluids* 1) - (with-method 1)) + (with-method 1) + (with-mutex 1)) -- cgit v1.2.3 From 3ba4ad466a577d8b6d468d7e7ad3c46be6896d53 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 3 Jun 2014 03:10:23 +0200 Subject: Guile: font lock for all components of module names --- elisp/geiser-guile.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 78ceb83..fbe6075 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -254,7 +254,10 @@ This function uses `geiser-guile-init-file' if it exists." . 1))) `((,(rx "(" (group "define-once") eow (* space) (? (group (+ word)))) (1 font-lock-keyword-face) - (2 font-lock-variable-name-face nil t))))) + (2 font-lock-variable-name-face nil t)) + ("(\\(define-module\\) +(\\([^)]+\\))" + (1 font-lock-keyword-face) + (2 font-lock-type-face nil t))))) (geiser-syntax--scheme-indent (c-declare 0) -- cgit v1.2.3 From 5ed0541617ba1616fa52b1a973eb7673954b4937 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 5 Jun 2014 06:14:44 +0200 Subject: Possible fix for scanning problem Apparently, the nesting level returned by emacs's syntax parser can be negative (presumably when it gets confused), and we were not avoiding calling backward-up-list when that happened. Could or could not address issue #41... --- elisp/geiser-guile.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index fbe6075..e8eb11a 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -171,9 +171,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--get-module (&optional module) (cond ((null module) (save-excursion - (ignore-errors - (while (not (zerop (geiser-syntax--nesting-level))) - (backward-up-list))) + (geiser-syntax--pop-to-top) (if (or (re-search-backward geiser-guile--module-re nil t) (looking-at geiser-guile--library-re) (re-search-forward geiser-guile--module-re nil t)) -- cgit v1.2.3 From 15af81d8d23d9ab1c2b5f6037db99ab4a5dce76b Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 16 Sep 2015 21:34:24 +0300 Subject: Add 'geiser-syntax--simple-keywords' Use this function instead of repeating the same code in each implementation. --- elisp/geiser-guile.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e8eb11a..941fe81 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -247,9 +247,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--keywords () (append - (when geiser-guile-extra-keywords - `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) - . 1))) + (geiser-syntax--simple-keywords geiser-guile-extra-keywords) `((,(rx "(" (group "define-once") eow (* space) (? (group (+ word)))) (1 font-lock-keyword-face) (2 font-lock-variable-name-face nil t)) -- cgit v1.2.3 From 51b62a7322e3257bbee46fc0319174a39170e1ba Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Thu, 24 Sep 2015 22:16:49 +0300 Subject: Add 'geiser-guile--builtin-keywords' --- elisp/geiser-guile.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 941fe81..d75089f 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -245,9 +245,32 @@ This function uses `geiser-guile-init-file' if it exists." ;;; Keywords and syntax +(defconst geiser-guile--builtin-keywords + '("call-with-input-file" + "call-with-output-file" + "call-with-input-string" + "call-with-output-string" + "define-accessor" + "define-class" + "define-enumeration" + "define-inlinable" + "lambda*" + "use-modules" + "with-error-to-file" + "with-error-to-port" + "with-error-to-string" + "with-fluid*" + "with-fluids" + "with-fluids*" + "with-input-from-port" + "with-input-from-string" + "with-output-to-port" + "with-output-to-string")) + (defun geiser-guile--keywords () (append (geiser-syntax--simple-keywords geiser-guile-extra-keywords) + (geiser-syntax--simple-keywords geiser-guile--builtin-keywords) `((,(rx "(" (group "define-once") eow (* space) (? (group (+ word)))) (1 font-lock-keyword-face) (2 font-lock-variable-name-face nil t)) -- cgit v1.2.3 From 3bf45a47e9e38319dedac1a59d27b473fe1dde81 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sun, 27 Sep 2015 11:57:48 +0300 Subject: Clean up indentation rules Move general indentation rules to "geiser-syntax". --- elisp/geiser-guile.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index d75089f..f942930 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -281,14 +281,21 @@ This function uses `geiser-guile-init-file' if it exists." (geiser-syntax--scheme-indent (c-declare 0) (c-lambda 2) + (call-with-input-string 1) + (call-with-output-string 0) (lambda* 1) (pmatch defun) (sigaction 1) + (with-error-to-file 1) + (with-error-to-port 1) + (with-error-to-string 0) (with-fluid* 1) (with-fluids 1) (with-fluids* 1) + (with-input-from-string 1) (with-method 1) - (with-mutex 1)) + (with-mutex 1) + (with-output-to-string 0)) -- cgit v1.2.3 From 6cef62b80fb292eaa90548689eaa3ce85e110ac4 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 30 Sep 2015 02:40:20 +0200 Subject: Follow suit and complete quoted symbols in all schemes I kind of dislike completion on symbols, because a quote reads to me as 'stop evaluating', and a symbol per se has infinite possible conversions. But, on the other hand, not completing has no practical advantage, and, moreover, we're already completing symbols inside quoted lists (e.g. try M-TAB next to `'(defi`)), so my prejudices are not even consistent. So here we go! --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index f942930..699ed9a 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -204,7 +204,7 @@ This function uses `geiser-guile-init-file' if it exists." (if module (max (save-excursion (beginning-of-line) (point)) (save-excursion (skip-syntax-backward "^(>") (1- (point)))) - (save-excursion (skip-syntax-backward "^-()>") (point)))) + (save-excursion (skip-syntax-backward "^'-()>") (point)))) ;;; Error display -- cgit v1.2.3 From 9fb965fe0cec51443541044a9cd65cc8f6f6c44a Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 3 Oct 2015 16:45:43 +0300 Subject: Add more highlighting/indentation for Guile --- elisp/geiser-guile.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 699ed9a..e70ca30 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -247,14 +247,19 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile--builtin-keywords '("call-with-input-file" - "call-with-output-file" "call-with-input-string" + "call-with-output-file" "call-with-output-string" + "call-with-prompt" + "call-with-trace" "define-accessor" "define-class" "define-enumeration" "define-inlinable" + "define-syntax-parameter" + "eval-when" "lambda*" + "syntax-parameterize" "use-modules" "with-error-to-file" "with-error-to-port" @@ -283,9 +288,13 @@ This function uses `geiser-guile-init-file' if it exists." (c-lambda 2) (call-with-input-string 1) (call-with-output-string 0) + (call-with-prompt 1) + (call-with-trace 0) + (eval-when 1) (lambda* 1) (pmatch defun) (sigaction 1) + (syntax-parameterize 1) (with-error-to-file 1) (with-error-to-port 1) (with-error-to-string 0) @@ -295,8 +304,8 @@ This function uses `geiser-guile-init-file' if it exists." (with-input-from-string 1) (with-method 1) (with-mutex 1) - (with-output-to-string 0)) - + (with-output-to-string 0) + (with-throw-handler 1)) ;;; Compilation shell regexps -- cgit v1.2.3 From 08d452400aef746552de69e0fa12dd7e6fe014f0 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 21 Oct 2015 02:29:46 +0200 Subject: Use OS-specific quotes when asking for versions Fixes #95. This is @kovrik's patch, with 80-columns max formatting. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index e70ca30..697a045 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -335,7 +335,8 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile-minimum-version "2.0") (defun geiser-guile--version (binary) - (shell-command-to-string (format "%s -c '(display (version))'" binary))) + (shell-command-to-string + (format "%s -c %s" binary (shell-quote-argument "(display (version))")))) (defun geiser-guile-update-warning-level () "Update the warning level used by the REPL. -- cgit v1.2.3 From f5fee3bddd264d84b2c40614053cef83ca072352 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 26 Dec 2015 23:47:31 +0100 Subject: Quoting binary on version checks (issue #117) We could probably be even more robust, but i am being a bit lazy instead. --- elisp/geiser-guile.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 697a045..c4f6293 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -336,7 +336,9 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--version (binary) (shell-command-to-string - (format "%s -c %s" binary (shell-quote-argument "(display (version))")))) + (format "%s -c %s" + (shell-quote-argument binary) + (shell-quote-argument "(display (version))")))) (defun geiser-guile-update-warning-level () "Update the warning level used by the REPL. -- cgit v1.2.3 From b3341745723a21210b3d337ea7b20dc0e743b663 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 11 Jun 2016 18:37:36 +0200 Subject: Cleanups to the show/jump debug buffer mess Let's see if i finally got this right... --- elisp/geiser-guile.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index c4f6293..de2e23f 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -224,11 +224,10 @@ This function uses `geiser-guile-init-file' if it exists." (ignore-errors (next-error))))) (defun geiser-guile--display-error (module key msg) - (newline) (when (stringp msg) (save-excursion (insert msg)) (geiser-edit--buttonize-files)) - (and (not key) msg (not (zerop (length msg))))) + (and (not key) (not (zerop (length msg))) msg)) ;;; Trying to ascertain whether a buffer is Guile Scheme: -- cgit v1.2.3 From dc8a7929f4cfcffe59cbb3a83d61cf9273207112 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 21 Sep 2016 10:07:21 -0400 Subject: Use (car (process-lines ...)) instead of (shell-command ...) `shell-command` assumes Bourne-shell-compatible quoting, which doesn't work when the user isn't using a Bourne-compatible shell. Instead of futzing about with quoting, we can just use `process-lines` to execute a process and pass it arguments directly. --- elisp/geiser-guile.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index de2e23f..dacca55 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -334,10 +334,7 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile-minimum-version "2.0") (defun geiser-guile--version (binary) - (shell-command-to-string - (format "%s -c %s" - (shell-quote-argument binary) - (shell-quote-argument "(display (version))")))) + (car (process-lines binary "-c" "(display (version))"))) (defun geiser-guile-update-warning-level () "Update the warning level used by the REPL. -- cgit v1.2.3 From b57f4bb08c3375e21ae55e7d64b80d6bdecab897 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 26 Nov 2016 05:14:36 +0100 Subject: Make guile's load-file happier with ~ abrevs An attempt to address #194. --- elisp/geiser-guile.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index dacca55..0b71edf 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -158,7 +158,8 @@ This function uses `geiser-guile-init-file' if it exists." (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) (if (cddr args) "" " ()"))) - ((load-file compile-file) (format ",geiser-load-file %s" (car args))) + ((load-file compile-file) + (format ",geiser-load-file %s" (expand-file-name (car args)))) ((no-values) ",geiser-no-values") (t (format "ge:%s (%s)" proc (geiser-guile--linearize-args args))))) -- cgit v1.2.3 From b3d0caa7e3d4d7eed9233d10b6119d49ca18ec8f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 3 Dec 2016 01:57:51 +0100 Subject: Bug fix: expanding file name at the right time We were expanding the path of files to be loaded at the wrong place in the wrong way. This should be better and address bug #196. --- elisp/geiser-guile.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 0b71edf..dacca55 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -158,8 +158,7 @@ This function uses `geiser-guile-init-file' if it exists." (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) (if (cddr args) "" " ()"))) - ((load-file compile-file) - (format ",geiser-load-file %s" (expand-file-name (car args)))) + ((load-file compile-file) (format ",geiser-load-file %s" (car args))) ((no-values) ",geiser-no-values") (t (format "ge:%s (%s)" proc (geiser-guile--linearize-args args))))) -- cgit v1.2.3 From 60c7b015e7ae0a3d59553264cce717bbc7a996f6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 1 Feb 2017 23:55:35 +0100 Subject: A note on dir-locals and load-path variables With that in the documentation, i'd taken less time to remember the very existence of geiser-guile-load-path, and the fact that paths are added also to the compiled load path... but then i guess it's nice to re-read my code once in a while. --- elisp/geiser-guile.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index dacca55..5dd0c54 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009-2017 Jose Antonio Ortega Ruiz ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -41,8 +41,10 @@ :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-load-path nil - "A list of paths to be added to Guile's load path when it's -started." + "A list of paths to be added to Guile's load path when it's started. +The paths are added to both %load-path and %load-compiled path, +and only if they are not already present. This variable is a +good candidate for an entry in your project's .dir-locals.el." :type '(repeat file) :group 'geiser-guile) -- cgit v1.2.3 From be00e7a8f7d2b716627eaf03837b5c1c83232a9d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 10 Oct 2017 21:43:59 +0200 Subject: guile: fix manual symbol lookup. * elisp/geiser-guile.el (guile--manual-look-up): Change parameters for info-lookup-symbol to string and 'scheme-mode. Fixes lookup. --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 5dd0c54..6b39435 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,7 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols ;; Copyright (C) 2009-2017 Jose Antonio Ortega Ruiz +;; Copyright (C) 2017 Jan Nieuwenhuizen ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the Modified BSD License. You should @@ -401,12 +402,11 @@ it spawn a server thread." (defun guile--manual-look-up (id mod) (let ((info-lookup-other-window-flag geiser-guile-manual-lookup-other-window-p)) - (info-lookup-symbol id 'geiser-guile-mode)) + (info-lookup-symbol (symbol-name id) 'scheme-mode)) (when geiser-guile-manual-lookup-other-window-p (switch-to-buffer-other-window "*info*")) (search-forward (format "%s" id) nil t)) - ;;; Implementation definition: -- cgit v1.2.3 From f6f254f07b09e412d06646aa2136df576c1a18f7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 30 Jan 2018 23:45:41 +0100 Subject: guile 2.2: program-arities and program-module reloaded Those two procedures are gone in these 2.2 times, and things like autodoc and xref were broken as a result. With Andy's help, apparently good enough approximations of their functionality are now in place: let's see how they go. --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 6b39435..160f40c 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009-2017 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009-2018 Jose Antonio Ortega Ruiz ;; Copyright (C) 2017 Jan Nieuwenhuizen ;; This program is free software; you can redistribute it and/or @@ -334,7 +334,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;; REPL startup -(defconst geiser-guile-minimum-version "2.0") +(defconst geiser-guile-minimum-version "2.2") (defun geiser-guile--version (binary) (car (process-lines binary "-c" "(display (version))"))) -- cgit v1.2.3 From ef3fb349700b60c5c697e8be10211360ebf88e07 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 4 Feb 2020 16:45:03 +0000 Subject: Really fix #252 And by a new pair of glasses in the process. --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 160f40c..198fde2 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -402,7 +402,7 @@ it spawn a server thread." (defun guile--manual-look-up (id mod) (let ((info-lookup-other-window-flag geiser-guile-manual-lookup-other-window-p)) - (info-lookup-symbol (symbol-name id) 'scheme-mode)) + (info-lookup-symbol (symbol-name id) 'geiser-guile-mode)) (when geiser-guile-manual-lookup-other-window-p (switch-to-buffer-other-window "*info*")) (search-forward (format "%s" id) nil t)) -- cgit v1.2.3 From f23e0751bd9b2e4249af9ed76cce3f9e1e420979 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 13 Feb 2020 03:17:08 +0000 Subject: Guile: use load paths defined in dir-local variables (fixes #268) A similar idea should probably be used with other schemes, but right now i feel ashamed of having taken so long to fix this one (assuming it's fixed!), so let's rush this commit for a change. --- elisp/geiser-guile.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 198fde2..44d32e4 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,6 +1,6 @@ ;; geiser-guile.el -- guile's implementation of the geiser protocols -;; Copyright (C) 2009-2018 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009-2018, 2020 Jose Antonio Ortega Ruiz ;; Copyright (C) 2017 Jan Nieuwenhuizen ;; This program is free software; you can redistribute it and/or @@ -370,10 +370,13 @@ it spawn a server thread." (compilation-setup t) (font-lock-add-keywords nil `((,geiser-guile--path-rx 1 compilation-error-face))) - (let ((geiser-log-verbose-p t)) + (let ((geiser-log-verbose-p t) + (g-load-path (buffer-local-value 'geiser-guile-load-path + (or geiser-repl--last-scm-buffer + (current-buffer))))) (when remote (geiser-guile--set-geiser-load-path)) (geiser-eval--send/wait ",use (geiser emacs)\n'done") - (dolist (dir geiser-guile-load-path) + (dolist (dir g-load-path) (let ((dir (expand-file-name dir))) (geiser-eval--send/wait `(:eval (:ge add-to-load-path ,dir))))) (geiser-guile-update-warning-level))) -- cgit v1.2.3 From 0355cd691ddef4b8fd840535452da2fa71a4f6ea Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 25 Feb 2020 14:29:01 +0100 Subject: Begin the summary lines of all elisp libraries with three semicolons It's the convention and by following it we make a big step towards supporting outline navigation. --- elisp/geiser-guile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 44d32e4..7a29761 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -1,4 +1,4 @@ -;; geiser-guile.el -- guile's implementation of the geiser protocols +;;; geiser-guile.el -- guile's implementation of the geiser protocols ;; Copyright (C) 2009-2018, 2020 Jose Antonio Ortega Ruiz ;; Copyright (C) 2017 Jan Nieuwenhuizen -- cgit v1.2.3 From f7483fd2e8eff2124db11939177cef8bc9732e7e Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 25 Feb 2020 14:32:18 +0100 Subject: Mark the beginning of code part of elisp libraries with Code: heading It's the convention and by following it we make a big step towards supporting outline navigation. The convention doesn't say much about what parts of the code are supposed to be part of that sections and what parts belong in a subsequent section. Here we put the `require' forms in this section and maybe some setup code, that's a popular approach. In most cases there was " " where we now insert "Code:". They both serve a similar purpose and we keep the former because some users depend on that for navigation. We even add this " " in libraries where it previously was missing. In some cases the permission statement was followed by a commentary, which obviously does not belong in the "Code:" section. In such cases add the conventional "Commentary:" section. --- elisp/geiser-guile.el | 1 + 1 file changed, 1 insertion(+) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 7a29761..9fec9a8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -11,6 +11,7 @@ ;; Start date: Sun Mar 08, 2009 23:03 +;;; Code: (require 'geiser-connection) (require 'geiser-syntax) -- cgit v1.2.3 From 8bf1a8b9233262adc8cf0dc47a677651e9b6cb92 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 25 Feb 2020 14:48:04 +0100 Subject: Fix indentation --- elisp/geiser-guile.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 9fec9a8..1710052 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -35,9 +35,9 @@ :group 'geiser) (geiser-custom--defcustom geiser-guile-binary - (cond ((eq system-type 'windows-nt) "guile.exe") - ((eq system-type 'darwin) "guile") - (t "guile")) + (cond ((eq system-type 'windows-nt) "guile.exe") + ((eq system-type 'darwin) "guile") + (t "guile")) "Name to use to call the Guile executable when starting a REPL." :type '(choice string (repeat string)) :group 'geiser-guile) @@ -121,7 +121,7 @@ effect on new REPLs. For existing ones, use the command :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-manual-lookup-nodes - '("Guile" "guile-2.0") + '("Guile" "guile-2.0") "List of info nodes that, when present, are used for manual lookups" :type '(repeat string) :group 'geiser-guile) @@ -140,11 +140,11 @@ This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) (expand-file-name geiser-guile-init-file))) (q-flags (and (not geiser-guile-load-init-file-p) '("-q")))) - `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) - ,@q-flags "-L" ,(expand-file-name "guile/" geiser-scheme-dir) - ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) - geiser-guile-load-path)) - ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) + `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) + ,@q-flags "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) + geiser-guile-load-path)) + ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") (defconst geiser-guile--prompt-regexp "[^@()]+@([^)]*?)> ") @@ -280,8 +280,8 @@ This function uses `geiser-guile-init-file' if it exists." (geiser-syntax--simple-keywords geiser-guile-extra-keywords) (geiser-syntax--simple-keywords geiser-guile--builtin-keywords) `((,(rx "(" (group "define-once") eow (* space) (? (group (+ word)))) - (1 font-lock-keyword-face) - (2 font-lock-variable-name-face nil t)) + (1 font-lock-keyword-face) + (2 font-lock-variable-name-face nil t)) ("(\\(define-module\\) +(\\([^)]+\\))" (1 font-lock-keyword-face) (2 font-lock-type-face nil t))))) @@ -386,7 +386,7 @@ it spawn a server thread." ;;; Manual lookup (defun geiser-guile--info-spec (&optional nodes) - (let* ((nrx "^[ ]+-+ [^:]+:[ ]*") + (let* ((nrx "^[ ]+-+ [^:]+:[ ]*") (drx "\\b") (res (when (Info-find-file "r5rs" t) `(("(r5rs)Index" nil ,nrx ,drx))))) @@ -400,7 +400,7 @@ it spawn a server thread." (info-lookup-add-help :topic 'symbol :mode 'geiser-guile-mode :ignore-case nil - :regexp "[^()`',\" \n]+" + :regexp "[^()`',\" \n]+" :doc-spec (geiser-guile--info-spec)) (defun guile--manual-look-up (id mod) -- cgit v1.2.3 From b52307215ab6e9530848b847513f757958ccb5e9 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Fri, 27 Mar 2020 23:13:37 +0100 Subject: Use cl-lib instead of cl Starting with Emacs 27 cl is fully deprecated, including at compile-time. --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 1710052..cb67f41 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -25,7 +25,7 @@ (require 'compile) (require 'info-look) -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) ;;; Customization: @@ -157,7 +157,7 @@ This function uses `geiser-guile-init-file' if it exists." (mapconcat 'identity args " ")) (defun geiser-guile--geiser-procedure (proc &rest args) - (case proc + (cl-case proc ((eval compile) (format ",geiser-eval %s %s%s" (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) -- cgit v1.2.3 From 527fd8fa40b68c8b0ff96b14230df2b313150a57 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 26 Apr 2020 23:52:31 +0200 Subject: Fix typos --- elisp/geiser-guile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index cb67f41..522c4eb 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -66,13 +66,13 @@ this variable to t." :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-debug-show-bt-p nil - "Whether to autmatically show a full backtrace when entering the debugger. + "Whether to automatically show a full backtrace when entering the debugger. If `nil', only the last frame is shown." :type 'boolean :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-jump-on-debug-p nil - "Whether to autmatically jump to error when entering the debugger. + "Whether to automatically jump to error when entering the debugger. If `t', Geiser will use `next-error' to jump to the error's location." :type 'boolean :group 'geiser-guile) -- cgit v1.2.3