From 1ce070ad142fa9a9e04009aaa7540e53bfc55524 Mon Sep 17 00:00:00 2001 From: Sean O'Rourke Date: Fri, 20 Apr 2012 08:22:01 -0600 Subject: [PATCH] Make sepia-arg-choices its own function. --- sepia.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sepia.el b/sepia.el index 09980f0..6ebde3f 100644 --- 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)) -- 2.11.4.GIT