summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-06 00:53:07 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-06 00:53:07 +0200
commit8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5 (patch)
tree89dbd8bce912052d93ba4855a3c9307727960a75
parent2b0ff9f520839d7389ddb9e2354c709a1ce401d4 (diff)
downloadgeiser-chez-8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5.tar.gz
geiser-chez-8170fdab0cf35cf12d1dc091b6232ac4d22fe1a5.tar.bz2
Use cl only at compile time
-rw-r--r--elisp/geiser-autodoc.el2
-rw-r--r--elisp/geiser-base.el16
-rw-r--r--elisp/geiser-completion.el9
-rw-r--r--elisp/geiser-syntax.el57
4 files changed, 40 insertions, 44 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 628b408..bf57187 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -148,7 +148,7 @@ when `geiser-autodoc-display-module-p' is on."
(erase-buffer)
(insert (format "(%s" (geiser-autodoc--id-name proc module)))
(let ((pos (or (cadr desc) 0))
- (prev (caddr desc)))
+ (prev (car (cddr desc))))
(dolist (a args)
(when (not (member a (cdr (member a args))))
(geiser-autodoc--insert-args a pos prev)
diff --git a/elisp/geiser-base.el b/elisp/geiser-base.el
index 4793616..41fb6fc 100644
--- a/elisp/geiser-base.el
+++ b/elisp/geiser-base.el
@@ -14,8 +14,6 @@
;;; Emacs compatibility:
-(require 'cl)
-
(eval-after-load "ring"
'(when (not (fboundp 'ring-member))
(defun ring-member (ring item)
@@ -24,15 +22,6 @@
(when (equal item (ring-ref ring ind))
(throw 'found ind)))))))
-(when (not (fboundp 'completion-table-dynamic))
- (defun completion-table-dynamic (fun)
- (lexical-let ((fun fun))
- (lambda (string pred action)
- (with-current-buffer (let ((win (minibuffer-selected-window)))
- (if (window-live-p win) (window-buffer win)
- (current-buffer)))
- (complete-with-action action (funcall fun string) string pred))))))
-
(when (not (fboundp 'looking-at-p))
(defsubst looking-at-p (regexp)
(let ((inhibit-changing-match-data t))
@@ -76,6 +65,11 @@
(put 'geiser--save-msg 'lisp-indent-function 0)
+(defun geiser--del-dups (lst)
+ (let (result)
+ (dolist (e lst (nreverse result))
+ (unless (member e result) (push e result)))))
+
(provide 'geiser-base)
;;; geiser-base.el ends here
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el
index dea4a57..314e749 100644
--- a/elisp/geiser-completion.el
+++ b/elisp/geiser-completion.el
@@ -17,8 +17,6 @@
(require 'geiser-syntax)
(require 'geiser-base)
-(require 'cl)
-
;;; Completions window handling, heavily inspired in slime's:
@@ -72,7 +70,7 @@ terminates a current completion."
(remove-hook 'pre-command-hook
'geiser-completion--maybe-restore-window-cfg)
(condition-case err
- (cond ((find last-command-event "()\"'`,# \r\n:")
+ (cond ((memq last-command-event '(?( ?) ?\" ?' ?` ?, ?# ? ?\r ?\n ?:))
(geiser-completion--restore-window-cfg))
((not (geiser-completion--window-active-p))
(geiser-completion--forget-window-cfg))
@@ -153,10 +151,9 @@ terminates a current completion."
geiser-completion--binding-forms*)))
(defun geiser-completion--symbol-list (prefix)
- (delete-duplicates
+ (geiser--del-dups
(append (all-completions prefix (geiser-completion--locals))
- (geiser-eval--send/result `(:eval ((:ge completions) ,prefix))))
- :test 'string=))
+ (geiser-eval--send/result `(:eval ((:ge completions) ,prefix))))))
(defsubst geiser-completion--module-list (prefix)
(geiser-eval--send/result `(:eval ((:ge module-completions) ,prefix))))
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 551ee6a..ae6c072 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -17,6 +17,8 @@
(require 'scheme)
+(eval-when-compile (require 'cl))
+
;;; Indentation:
@@ -248,34 +250,37 @@
(defsubst geiser-syntax--binding-form*-p (sbfs f)
(or (eq 'let* f) (memq f sbfs)))
+(defsubst geiser-syntax--if-symbol (x) (and (symbolp x) x))
+(defsubst geiser-syntax--if-list (x) (and (listp x) x))
+(defsubst geiser-syntax--normalize (vars)
+ (mapcar (lambda (i) (if (listp i) (car i) i)) vars))
+
(defun geiser-syntax--scan-locals (bfs sbfs form partial locals)
- (flet ((if-symbol (x) (and (symbolp x) x))
- (if-list (x) (and (listp x) x))
- (normalize (vars) (mapcar (lambda (i) (if (listp i) (car i) i)) vars)))
- (let ((form (if (listp form) (normalize form) form)))
- (cond ((or (null form) (not (listp form))) (normalize locals))
- ((not (geiser-syntax--binding-form-p bfs sbfs (car form)))
+ (let ((form (if (listp form) (geiser-syntax--normalize form) form)))
+ (cond ((or (null form) (not (listp form)))
+ (geiser-syntax--normalize locals))
+ ((not (geiser-syntax--binding-form-p bfs sbfs (car form)))
+ (geiser-syntax--scan-locals bfs sbfs
+ (car (last form)) partial locals))
+ (t
+ (let* ((head (car form))
+ (name (geiser-syntax--if-symbol (cadr form)))
+ (names (if name (geiser-syntax--if-list (caddr form))
+ (geiser-syntax--if-list (cadr form))))
+ (rest (if name (cdddr form) (cddr form)))
+ (use-names (or rest
+ (not partial)
+ (geiser-syntax--binding-form*-p sbfs
+ head))))
+ (when name (push name locals))
+ (when use-names (dolist (n names) (push n locals)))
+ (dolist (f (butlast rest))
+ (when (and (listp f) (eq (car f) 'define))
+ (push (cadr f) locals)))
(geiser-syntax--scan-locals bfs sbfs
- (car (last form)) partial locals))
- (t
- (let* ((head (car form))
- (name (if-symbol (cadr form)))
- (names (if name (if-list (caddr form))
- (if-list (cadr form))))
- (rest (if name (cdddr form) (cddr form)))
- (use-names (or rest
- (not partial)
- (geiser-syntax--binding-form*-p sbfs
- head))))
- (when name (push name locals))
- (when use-names (dolist (n names) (push n locals)))
- (dolist (f (butlast rest))
- (when (and (listp f) (eq (car f) 'define))
- (push (cadr f) locals)))
- (geiser-syntax--scan-locals bfs sbfs
- (car (last (or rest names)))
- partial
- locals)))))))
+ (car (last (or rest names)))
+ partial
+ locals))))))
(defun geiser-syntax--locals-around-point (bfs sbfs)
(when (eq major-mode 'scheme-mode)