From 8c2b378b439d24ec7d3f4417c602a1b22e693709 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 27 Dec 2014 23:37:55 -0200 Subject: Implement sx--multiple-read for reading multiple strings --- sx.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sx.el') diff --git a/sx.el b/sx.el index c2d1164..2824b4d 100644 --- a/sx.el +++ b/sx.el @@ -189,6 +189,25 @@ All ARGS are passed to `completing-read' or `ido-completing-read'." (apply (if ido-mode #'ido-completing-read #'completing-read) args)) +(defun sx--multiple-read (prompt hist-var) + "Interactively query gthe user for a list of strings. +Call `read-string' multiple times, until the input is empty. + +PROMPT is a string displayed to the user. and should not +end with a space nor a colon. +HIST-VAR is a quoted symbol, indicating a list in which to store +input history." + (let (list input) + (while (not (string= + "" + (setq input (read-string + (concat prompt " [" + (mapconcat #'identity list ",") + "]: ") + "" hist-var)))) + (push input list)) + list)) + (defmacro sx-sorted-insert-skip-first (newelt list &optional predicate) "Inserted NEWELT into LIST sorted by PREDICATE. This is designed for the (site id id ...) lists. So the first car -- cgit v1.2.3 From 80541f53ab81695f5878055ac4404ee212766b11 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Thu, 1 Jan 2015 23:20:34 -0500 Subject: Checkdoc --- sx.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sx.el') diff --git a/sx.el b/sx.el index b31b22f..e6215b4 100644 --- a/sx.el +++ b/sx.el @@ -74,7 +74,7 @@ DATA can also be the link itself." "\\1\\2" link)))) (defun sx--ensure-site (data) - "Add a `site' property to DATA if it doesn't have one. Return DATA. + "Add a `site' property to DATA if it doesn't have one. Return DATA. DATA can be a question, answer, comment, or user (or any object with a `link' property)." (when data @@ -132,8 +132,9 @@ with a `link' property)." result)) (defmacro sx-assoc-let (alist &rest body) - "Identical to `let-alist', except `.site' has a special meaning. -If ALIST doesn't have a `site' property, one is created using the + "Use ALIST with `let-alist' to execute BODY. +`.site' has a special meaning, thanks to `sx--ensure-site'. If +ALIST doesn't have a `site' property, one is created using the `link' property." (declare (indent 1) (debug t)) (require 'let-alist) @@ -191,13 +192,12 @@ All ARGS are passed to `completing-read' or `ido-completing-read'." args)) (defun sx--multiple-read (prompt hist-var) - "Interactively query gthe user for a list of strings. + "Interactively query the user for a list of strings. Call `read-string' multiple times, until the input is empty. -PROMPT is a string displayed to the user. and should not -end with a space nor a colon. -HIST-VAR is a quoted symbol, indicating a list in which to store -input history." +PROMPT is a string displayed to the user and should not end with +a space nor a colon. HIST-VAR is a quoted symbol, indicating a +list in which to store input history." (let (list input) (while (not (string= "" @@ -336,7 +336,7 @@ Return the result of BODY." ("ĥ" . "h") ("ĵ" . "j") ("^[:ascii:]" . "")) - "List of replacements to use for non-ascii characters + "List of replacements to use for non-ascii characters. Used to convert user names into @mentions.") (defun sx--user-@name (user) -- cgit v1.2.3 From 0325369632523a81e4246533e4067ebd57f7a0e7 Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Fri, 2 Jan 2015 12:09:06 -0500 Subject: Fix docstring Branch: search --- sx.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sx.el') diff --git a/sx.el b/sx.el index 2605f27..62484b7 100644 --- a/sx.el +++ b/sx.el @@ -138,8 +138,8 @@ with a `link' property)." (defmacro sx-assoc-let (alist &rest body) "Use ALIST with `let-alist' to execute BODY. -`.site' has a special meaning, thanks to `sx--ensure-site'. If -ALIST doesn't have a `site' property, one is created using the +`.site_par' has a special meaning, thanks to `sx--ensure-site'. +If ALIST doesn't have a `site' property, one is created using the `link' property." (declare (indent 1) (debug t)) (require 'let-alist) -- cgit v1.2.3