summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-10 15:12:31 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-10 15:12:31 +0100
commit710d1f8be59066f0b52d07b0f43343b3ab671ffa (patch)
treed5abfc54dc8ba242e7b020d471f57cd664baaf99
parent8b2b6e02b5a7ceaf7b6f91dd302a42141c4ade8a (diff)
downloadgeiser-guile-710d1f8be59066f0b52d07b0f43343b3ab671ffa.tar.gz
geiser-guile-710d1f8be59066f0b52d07b0f43343b3ab671ffa.tar.bz2
Sort completion list in scheme's side.
-rw-r--r--elisp/geiser-completion.el7
-rw-r--r--elisp/geiser-eval.el13
-rw-r--r--scheme/geiser/introspection.scm11
3 files changed, 18 insertions, 13 deletions
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el
index 8b58b2b..dd0c33c 100644
--- a/elisp/geiser-completion.el
+++ b/elisp/geiser-completion.el
@@ -169,9 +169,8 @@ terminates a current completion."
;;; Completion functionality:
-(defun geiser-completion--symbol-list (prefix)
- (geiser-eval--retort-result
- (geiser-eval--send/wait `(:gs ((:ge completions) ,prefix)))))
+(defsubst geiser-completion--symbol-list (prefix)
+ (geiser-eval--send/result `(:gs ((:ge completions) ,prefix))))
(defvar geiser-completion--symbol-list-func
(completion-table-dynamic 'geiser-completion--symbol-list))
@@ -204,7 +203,7 @@ terminates a current completion."
Perform completion similar to Emacs' complete-symbol."
(interactive)
(let* ((end (point))
- (beg (save-excursion (beginning-of-sexp) (point)))
+ (beg (save-excursion (skip-syntax-backward "^-()") (point)))
(prefix (buffer-substring-no-properties beg end))
(result (geiser-completion--complete prefix nil))
(completions (car result))
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index ee04139..38b1f7f 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -79,6 +79,12 @@
(defun geiser-eval--set-sync-retort (s)
(setq geiser-eval--sync-retort (geiser-eval--log s)))
+(defsubst geiser-eval--send (code cont &optional buffer)
+ (geiser-con--send-string (geiser-eval--proc)
+ (geiser-eval--code-str code)
+ `(lambda (s) (,cont (geiser-eval--log s)))
+ buffer))
+
(defun geiser-eval--send/wait (code &optional timeout buffer)
(setq geiser-eval--sync-retort nil)
(geiser-con--send-string/wait (geiser-eval--proc)
@@ -88,11 +94,8 @@
buffer)
geiser-eval--sync-retort)
-(defsubst geiser-eval--send (code cont &optional buffer)
- (geiser-con--send-string (geiser-eval--proc)
- (geiser-eval--code-str code)
- `(lambda (s) (,cont (geiser-eval--log s)))
- buffer))
+(defsubst geiser-eval--send/result (code &optional timeout buffer)
+ (geiser-eval--retort-result (geiser-eval--send/wait code timeout buffer)))
;;; Retort parsing:
diff --git a/scheme/geiser/introspection.scm b/scheme/geiser/introspection.scm
index 991b62d..4565464 100644
--- a/scheme/geiser/introspection.scm
+++ b/scheme/geiser/introspection.scm
@@ -44,9 +44,10 @@
(let* ((arity (program-arity program))
(arg-no (first arity))
(opt (> (second arity) 0))
- (args (map first (take (program-bindings program) arg-no)))
- (module (program-module program)))
- (format-args (if opt (drop-right args 1) args) (and opt (last args)) module)))
+ (args (map first (take (program-bindings program) arg-no))))
+ (format-args (if opt (drop-right args 1) args)
+ (and opt (last args))
+ (program-module program))))
(define (procedure-args proc)
(let* ((arity (procedure-property proc 'arity))
@@ -71,6 +72,8 @@
(cons 'module (if module (module-name module) '()))))
(define (completions prefix)
- (map symbol->string (apropos-internal (string-append "^" prefix))))
+ (sort! (map symbol->string
+ (apropos-internal (string-append "^" prefix)))
+ string<?))
;;; introspection.scm ends here