Make sepia-arg-choices its own function.
authorSean O'Rourke <seano@cpan.org>
Fri, 20 Apr 2012 14:22:01 +0000 (20 08:22 -0600)
committerSean O'Rourke <seano@cpan.org>
Fri, 20 Apr 2012 14:22:01 +0000 (20 08:22 -0600)
sepia.el

index 09980f0..6ebde3f 100644 (file)
--- a/sepia.el
+++ b/sepia.el
@@ -455,6 +455,19 @@ module in question be loaded.")))
 
 (defvar sepia-history nil)
 
+(defun sepia-arg-choices (str &rest blah)
+  (let ((completions (xref-completions
+                      (case sepia-arg-type
+                        (module nil)
+                        (variable "VARIABLE")
+                        (function "CODE")
+                        (t nil))
+                      str)))
+    (when (eq sepia-arg-type 'module)
+      (setq completions
+            (remove-if (lambda (x) (string-match "::$" x)) completions)))
+    completions))
+
 (defun sepia-interactive-arg (&optional sepia-arg-type)
 "Default argument for most Sepia functions.  TYPE is a symbol --
 either 'file to look for a file, or anything else to use the
@@ -463,25 +476,12 @@ symbol at point."
                    (file (or (thing-at-point 'file) (buffer-file-name)))
                     (t (sepia-thing-at-point 'symbol))))
          (text (capitalize (symbol-name sepia-arg-type)))
-         (choices
-          (lambda (str &rest blah)
-            (let ((completions (xref-completions
-                                (case sepia-arg-type
-                                  (module nil)
-                                  (variable "VARIABLE")
-                                  (function "CODE")
-                                  (t nil))
-                                str)))
-              (when (eq sepia-arg-type 'module)
-                (setq completions
-                      (remove-if (lambda (x) (string-match "::$" x)) completions)))
-              completions)))
          (prompt (if default
                      (format "%s [%s]: " text default)
                      (format "%s: " text)))
         (ret (if sepia-use-completion
-                  (completing-read prompt 'blah-choices nil nil nil 'sepia-history
-                                   default)
+                  (completing-read prompt 'sepia-arg-choices nil nil nil
+                                   'sepia-history default)
                  (read-string prompt nil 'sepia-history default))))
     (push ret sepia-history)
     ret))