[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-gauche 8e737d2 110/119: Improve completion
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-gauche 8e737d2 110/119: Improve completion |
Date: |
Sun, 1 Aug 2021 18:28:07 -0400 (EDT) |
branch: elpa/geiser-gauche
commit 8e737d2dc7cd663c9357996daf36590f3387657e
Author: András Simonyi <andras.simonyi@gmail.com>
Commit: András Simonyi <andras.simonyi@gmail.com>
Improve completion
---
geiser-gauche.el | 2 +-
geiser-gauche.scm | 35 ++++++++++++++++++++++++++---------
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/geiser-gauche.el b/geiser-gauche.el
index 601bba3..2ac4e59 100644
--- a/geiser-gauche.el
+++ b/geiser-gauche.el
@@ -212,7 +212,7 @@
(cl-case proc
;; Autodoc and symbol-location makes use of the {{cur-module}} cookie to
;; pass current module information
- ((autodoc symbol-location)
+ ((autodoc symbol-location completions)
(format "(eval '(geiser:%s %s {{cur-module}}) (find-module 'geiser))"
proc (mapconcat 'identity args " ")))
;; Eval and compile are (module) context sensitive
diff --git a/geiser-gauche.scm b/geiser-gauche.scm
index 56f73d7..0f1b959 100644
--- a/geiser-gauche.scm
+++ b/geiser-gauche.scm
@@ -93,15 +93,29 @@
;;;; Completions
-(define (geiser:completions prefix . rest)
- (delete-duplicates
- (remove
- (^x (or (string=? x "")
- (string-prefix? "(" x)))
- (string-split
- (with-output-to-string
- (cut apropos (string->regexp (string-append "^" prefix))))
- #/\s+/))))
+(define (geiser:completions prefix m . rest)
+ (let* ((module (or (and (symbol? m )
+ (find-module m))
+ (find-module 'user)))
+ (symbols (module-visible-symbols module))
+ (strings (map symbol->string symbols)))
+ (filter! (cut string-prefix? prefix <>) strings)))
+
+;;; Return the list of symbols defined by MODULE
+(define (module-symbols module)
+ (hash-table-keys (module-table module)))
+
+;;; Return the list of symbols visible from MODULE
+(define (module-visible-symbols module)
+ (let* ((imports (module-imports module))
+ (inherits (module-precedence-list module))
+ (imported-syms (concatenate!
+ (map module-exports imports)))
+ (inherited-syms (concatenate!
+ (map module-symbols inherits)))
+ (own-syms (module-symbols module)))
+ (delete-duplicates! (concatenate!
+ (list imported-syms inherited-syms own-syms)))))
(define (geiser:module-completions prefix . rest)
(filter
@@ -265,3 +279,6 @@
`(("file" . ,(car paths)) ("line") ("column"))
'(("file") ("line") ("column"))))))
+
+
+
- [nongnu] elpa/geiser-gauche 9a26b8f 072/119: Aesthetic changes toward MELPA, (continued)
- [nongnu] elpa/geiser-gauche 9a26b8f 072/119: Aesthetic changes toward MELPA, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 83c9949 069/119: Minor improvement, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 93a7c9d 073/119: Add Cask file, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche eae0506 082/119: Finish autoload related changes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche fb927ed 084/119: Update README.md, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche bdaeb16 097/119: Fix comletion bug, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche b8a5c0d 091/119: Minor README update, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 45ee16c 100/119: Minor README improvement, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche abd3353 101/119: Add TOC to README, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche dfc3090 106/119: Correctly detect version with Gauche 0.9.6, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 8e737d2 110/119: Improve completion,
Philip Kaludercic <=
- [nongnu] elpa/geiser-gauche 5a2f9c6 118/119: Update README, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 2d3992e 117/119: Update README, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 6b79b43 036/119: Cleanup, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 524b594 046/119: Start work on module documentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche a1ef874 049/119: Finish module info for now, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 4027a84 053/119: Minor fix, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 2e6dbc4 076/119: Aesthetic changes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 6806302 077/119: Cosmetic changes for MELPA, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche 0be6e0a 081/119: Add setup elisp file, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-gauche a3b2e3f 009/119: Remove test line, Philip Kaludercic, 2021/08/01