From b34ddf5de07560ee81f1e271bfeae4aca9966b30 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 5 Jan 2021 01:27:50 +0000 Subject: [PATCH] Improve formatting of ellipses * dash.el (-let): Fix ellipses in docstring. * dev/examples-to-info.el (format-docstring): Replace ellipses with @dots{} or @enddots{} as appropriate. * README.md: * dash.texi: Regenerate docs. --- README.md | 6 +++--- dash.el | 6 +++--- dash.texi | 44 ++++++++++++++++++++--------------------- dev/examples-to-info.el | 6 +++++- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 2c8411b..079d584 100644 --- a/README.md +++ b/README.md @@ -2352,11 +2352,11 @@ If `varlist` only contains one (`pattern` `source`) element, you can optionally specify it using a vector and discarding the outer-most parens. Thus - (-let ((`pattern` `source`)) ..) + (-let ((`pattern` `source`)) ...) becomes - (-let [`pattern` `source`] ..). + (-let [`pattern` `source`] ...). [`-let`](#-let-varlist-rest-body) uses a convention of not binding places (symbols) starting with _ whenever it's possible. You can use this to skip over @@ -2381,7 +2381,7 @@ Conses and lists: (a b) - bind car of list to `a` and `cadr` to `b` - (a1 a2 a3 ...) - bind 0th car of list to `a1`, 1st to `a2`, 2nd to `a3` ... + (a1 a2 a3 ...) - bind 0th car of list to `a1`, 1st to `a2`, 2nd to `a3`... (a1 a2 a3 ... aN . rest) - as above, but bind the Nth cdr to `rest`. diff --git a/dash.el b/dash.el index c605df2..843f2e8 100644 --- a/dash.el +++ b/dash.el @@ -1960,11 +1960,11 @@ If VARLIST only contains one (PATTERN SOURCE) element, you can optionally specify it using a vector and discarding the outer-most parens. Thus - (-let ((PATTERN SOURCE)) ..) + (-let ((PATTERN SOURCE)) ...) becomes - (-let [PATTERN SOURCE] ..). + (-let [PATTERN SOURCE] ...). `-let' uses a convention of not binding places (symbols) starting with _ whenever it's possible. You can use this to skip over @@ -1989,7 +1989,7 @@ Conses and lists: (a b) - bind car of list to A and `cadr' to B - (a1 a2 a3 ...) - bind 0th car of list to A1, 1st to A2, 2nd to A3 ... + (a1 a2 a3 ...) - bind 0th car of list to A1, 1st to A2, 2nd to A3... (a1 a2 a3 ... aN . rest) - as above, but bind the Nth cdr to REST. diff --git a/dash.texi b/dash.texi index 6da2309..b3644ea 100644 --- a/dash.texi +++ b/dash.texi @@ -1611,7 +1611,7 @@ Return a list of iterated applications of @var{fun} to @var{init}. This means a list of form: - (init (fun init) (fun (fun init)) ...) + (init (fun init) (fun (fun init)) @dots{}) @var{n} is the length of the returned list. @@ -2751,7 +2751,7 @@ Unzip @var{lists}. This works just like @code{-zip} (@pxref{-zip}) but takes a list of lists instead of a variable number of arguments, such that - (-unzip (-zip @var{l1} @var{l2} @var{l3} ...)) + (-unzip (-zip @var{l1} @var{l2} @var{l3} @dots{})) is identity (given that the lists are the same length). @@ -3630,11 +3630,11 @@ If @var{varlist} only contains one (@var{pattern} @var{source}) element, you can optionally specify it using a vector and discarding the outer-most parens. Thus - (-let ((@var{pattern} @var{source})) ..) + (-let ((@var{pattern} @var{source})) @dots{}) becomes - (-let [@var{pattern} @var{source}] ..). + (-let [@var{pattern} @var{source}] @dots{}). @code{-let} (@pxref{-let}) uses a convention of not binding places (symbols) starting with _ whenever it's possible. You can use this to skip over @@ -3659,40 +3659,40 @@ Conses and lists: (a b) - bind car of list to @var{a} and @code{cadr} to @var{b} - (a1 a2 a3 ...) - bind 0th car of list to @var{a1}, 1st to @var{a2}, 2nd to @var{a3} ... + (a1 a2 a3 @dots{}) - bind 0th car of list to @var{a1}, 1st to @var{a2}, 2nd to @var{a3}@enddots{} - (a1 a2 a3 ... aN . rest) - as above, but bind the Nth cdr to @var{rest}. + (a1 a2 a3 @dots{} aN . rest) - as above, but bind the Nth cdr to @var{rest}. Vectors: [a] - bind 0th element of a non-list sequence to @var{a} (works with - vectors, strings, bit arrays...) + vectors, strings, bit arrays@dots{}) - [a1 a2 a3 ...] - bind 0th element of non-list sequence to @var{a0}, 1st to - @var{a1}, 2nd to @var{a2}, ... + [a1 a2 a3 @dots{}] - bind 0th element of non-list sequence to @var{a0}, 1st to + @var{a1}, 2nd to @var{a2}, @enddots{} If the @var{pattern} is shorter than @var{source}, the values at places not in @var{pattern} are ignored. If the @var{pattern} is longer than @var{source}, an @code{error} is thrown. - [a1 a2 a3 ... &rest rest] - as above, but bind the rest of + [a1 a2 a3 @dots{} &rest rest] - as above, but bind the rest of the sequence to @var{rest}. This is conceptually the same as improper list - matching (a1 a2 ... aN . rest) + matching (a1 a2 @dots{} aN . rest) Key/value stores: - (&plist key0 a0 ... keyN aN) - bind value mapped by keyK in the + (&plist key0 a0 @dots{} keyN aN) - bind value mapped by keyK in the @var{source} plist to aK. If the value is not found, aK is nil. Uses @code{plist-get} to fetch values. - (&alist key0 a0 ... keyN aN) - bind value mapped by keyK in the + (&alist key0 a0 @dots{} keyN aN) - bind value mapped by keyK in the @var{source} alist to aK. If the value is not found, aK is nil. Uses @code{assoc} to fetch values. - (&hash key0 a0 ... keyN aN) - bind value mapped by keyK in the + (&hash key0 a0 @dots{} keyN aN) - bind value mapped by keyK in the @var{source} hash table to aK. If the value is not found, aK is nil. Uses @code{gethash} to fetch values. @@ -3701,9 +3701,9 @@ Further, special keyword &keys supports "inline" matching of plist-like key-value pairs, similarly to &keys keyword of @code{cl-defun}. - (a1 a2 ... aN &keys key1 b1 ... keyN bK) + (a1 a2 @dots{} aN &keys key1 b1 @dots{} keyN bK) -This binds @var{n} values from the list to a1 ... aN, then interprets +This binds @var{n} values from the list to a1 @dots{} aN, then interprets the cdr as a plist (see key/value matching above). @var{a} shorthand notation for kv-destructuring exists which allows the @@ -3830,7 +3830,7 @@ Note that you have to enclose the @var{match-form} in a pair of parens, such that: (-lambda (x) body) - (-lambda (x y ...) body) + (-lambda (x y @dots{}) body) has the usual semantics of @code{lambda}. Furthermore, these get translated into normal lambda, so there is no performance @@ -3875,7 +3875,7 @@ expands roughly speaking to the following code Care is taken to only evaluate each @var{val} once so that in case of multiple assignments it does not cause unexpected side effects. -(fn [@var{match-form} @var{val}]...) +(fn [@var{match-form} @var{val}]@dots{}) @example @group @@ -4432,10 +4432,10 @@ In types (for n=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d) This function satisfies the following laws: - (-compose (-prodfn f g ...) (-prodfn f' g' ...)) = (-prodfn (-compose f f') (-compose g g') ...) - (-prodfn f g ...) = (-juxt (-compose f (-partial 'nth 0)) (-compose g (-partial 'nth 1)) ...) - (-compose (-prodfn f g ...) (-juxt f' g' ...)) = (-juxt (-compose f f') (-compose g g') ...) - (-compose (-partial 'nth n) (-prod f1 f2 ...)) = (-compose fn (-partial 'nth n)) + (-compose (-prodfn f g @dots{}) (-prodfn f' g' @dots{})) = (-prodfn (-compose f f') (-compose g g') @dots{}) + (-prodfn f g @dots{}) = (-juxt (-compose f (-partial 'nth 0)) (-compose g (-partial 'nth 1)) @dots{}) + (-compose (-prodfn f g @dots{}) (-juxt f' g' @dots{})) = (-juxt (-compose f f') (-compose g g') @dots{}) + (-compose (-partial 'nth n) (-prod f1 f2 @dots{})) = (-compose fn (-partial 'nth n)) @example @group diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el index 8e9d5a3..f38eeff 100644 --- a/dev/examples-to-info.el +++ b/dev/examples-to-info.el @@ -98,7 +98,11 @@ FUNCTION may reference an elisp function, alias, macro or a subr." (replace-regexp-in-string "\\b\\([A-Z][A-Z-]*[0-9]*\\)\\b" 'quote-and-downcase it t) (replace-regexp-in-string "`\\([^ ]+\\)'" 'unquote-and-link it t) (replace-regexp-in-string "{,@}" "{,@@}" it t) - (replace-regexp-in-string "^ " " " it)))) + (replace-regexp-in-string "^ " " " it) + (replace-regexp-in-string + "\\.\\.\\.\\($\\)?" + (lambda (_) (if (match-beginning 1) "@enddots{}" "@dots{}")) + it t t)))) (defun function-to-node (function) (when (and (stringp function)