branch: elpa/go-mode
commit eed4af3e3f7e51148ac466e14e4e30d566e63cf5
Author: John Shahid <[email protected]>
Commit: Dominik Honnef <[email protected]>
autocompletion while seting guru scope using `completing-read-multiple'
Closes: gh-249 [via git-merge-pr]
---
go-guru.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/go-guru.el b/go-guru.el
index 89e7e7d..e030168 100644
--- a/go-guru.el
+++ b/go-guru.el
@@ -138,6 +138,11 @@
"---"
["Set pointer analysis scope..." go-guru-set-scope t]))
+(defun go-guru--read-scope ()
+ "Read go-guru-scope from the minibuffer."
+ (completing-read-multiple "guru-scope (comma-separated): "
+ (go-packages) nil nil nil 'go-guru--scope-history))
+
;;;###autoload
(defun go-guru-set-scope ()
"Set the scope for the Go guru, prompting the user to edit the previous
scope.
@@ -152,14 +157,10 @@ A pattern preceded by '-' is negative, so the scope
encoding/...,-encoding/xml
matches all encoding packages except encoding/xml."
(interactive)
- (let ((scope (read-from-minibuffer "Go guru scope: "
- go-guru-scope
- nil
- nil
- 'go-guru--scope-history)))
- (if (string-equal "" scope)
- (error "You must specify a non-empty scope for the Go guru"))
- (setq go-guru-scope scope)))
+ (let ((scope (go-guru--read-scope)))
+ (unless scope
+ (error "You must specify a non-empty scope for the Go guru"))
+ (setq go-guru-scope (string-join scope ","))))
(defun go-guru--set-scope-if-empty ()
(if (string-equal "" go-guru-scope)