emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash 7a9c937 250/316: Translate non-printable chars in


From: ELPA Syncer
Subject: [elpa] externals/dash 7a9c937 250/316: Translate non-printable chars in docs
Date: Mon, 15 Feb 2021 15:58:11 -0500 (EST)

branch: externals/dash
commit 7a9c9378772b687a452966ce4745c54afb19a2fc
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Translate non-printable chars in docs
    
    * dev/examples-to-docs.el (example-to-string):
    * dev/examples-to-info.el (example-to-string): Translate chars like
    \^A to their printable representations.
    * dev/examples.el (-cut): Evaluate quoted lambda in example.
    
    * README.md:
    * dash.texi: Regenerate docs.
---
 README.md               | 4 ++--
 dash.texi               | 6 +++---
 dev/examples-to-docs.el | 7 ++++---
 dev/examples-to-info.el | 8 ++++++--
 dev/examples.el         | 4 ++--
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index 4310c1a..430e737 100644
--- a/README.md
+++ b/README.md
@@ -2875,8 +2875,8 @@ See `srfi-26` for detailed description.
 
 ```el
 (funcall (-cut list 1 <> 3 <> 5) 2 4) ;; => '(1 2 3 4 5)
-(-map (-cut funcall <> 5) '(1+ 1- (lambda (x) (/ 1.0 x)))) ;; => '(6 4 0.2)
-(-map (-cut <> 1 2 3) (list 'list 'vector 'string)) ;; => '((1 2 3) [1 2 3] 
"")
+(-map (-cut funcall <> 5) `(1+ 1- ,(lambda (x) (/ 1.0 x)))) ;; => '(6 4 0.2)
+(-map (-cut <> 1 2 3) '(list vector string)) ;; => '((1 2 3) [1 2 3] 
"\^A\^B\^C")
 ```
 
 #### -not `(pred)`
diff --git a/dash.texi b/dash.texi
index 97969a6..77ee980 100644
--- a/dash.texi
+++ b/dash.texi
@@ -4383,12 +4383,12 @@ See @var{srfi-26} for detailed description.
     @result{} '(1 2 3 4 5)
 @end group
 @group
-(-map (-cut funcall <> 5) '(1+ 1- (lambda (x) (/ 1.0 x))))
+(-map (-cut funcall <> 5) `(1+ 1- ,(lambda (x) (/ 1.0 x))))
     @result{} '(6 4 0.2)
 @end group
 @group
-(-map (-cut <> 1 2 3) (list 'list 'vector 'string))
-    @result{} '((1 2 3) [1 2 3] "")
+(-map (-cut <> 1 2 3) '(list vector string))
+    @result{} '((1 2 3) [1 2 3] "\^A\^B\^C")
 @end group
 @end example
 @end defmac
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index fbc65d9..764b002 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -38,9 +38,10 @@
           ((error "Invalid test case: %S" example)))
       (format "%S ;; %s" actual it)
       (replace-regexp-in-string "\\\\\\?" "?" it t t)
-      (replace-regexp-in-string "\n" "\\n" it t t)
-      (replace-regexp-in-string "\t" "\\t" it t t)
-      (replace-regexp-in-string "\r" "\\r" it t t))))
+      (replace-regexp-in-string
+       "[^\n[:print:]]"
+       (lambda (s) (concat "\\" (text-char-description (string-to-char s))))
+       it t t))))
 
 (defun docs--signature (function)
   "Given FUNCTION (a symbol), return its argument list.
diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el
index a1460b6..67de701 100644
--- a/dev/examples-to-info.el
+++ b/dev/examples-to-info.el
@@ -38,13 +38,17 @@
          (setq expected (error-message-string expected)))
     (--> (format "@group\n%S\n    %s %S\n@end group"
                  actual (if err "@error{}" "@result{}") expected)
-      (replace-regexp-in-string "\\\\\\?" "?" it)
+      (replace-regexp-in-string "\\\\\\?" "?" it t t)
       (replace-regexp-in-string "{\"" "@{\"" it t t)
       (replace-regexp-in-string "}\"" "@}\"" it t t)
       (replace-regexp-in-string " {" " @{" it t t)
       (replace-regexp-in-string "\"{" "\"@{" it t t)
       (replace-regexp-in-string "}," "@{," it t t)
-      (replace-regexp-in-string "}@}" "@}@}" it t t))))
+      (replace-regexp-in-string "}@}" "@}@}" it t t)
+      (replace-regexp-in-string
+       "[^\n[:print:]]"
+       (lambda (s) (concat "\\" (text-char-description (string-to-char s))))
+       it t t))))
 
 (defun docs--signature (function)
   "Given FUNCTION (a symbol), return its argument list.
diff --git a/dev/examples.el b/dev/examples.el
index f298300..27fd012 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -1558,8 +1558,8 @@ value rather than consuming a list to produce a single 
value."
 
     (defexamples -cut
       (funcall (-cut list 1 <> 3 <> 5) 2 4) => '(1 2 3 4 5)
-      (-map (-cut funcall <> 5) '(1+ 1- (lambda (x) (/ 1.0 x)))) => '(6 4 0.2)
-      (-map (-cut <> 1 2 3) (list 'list 'vector 'string)) => '((1 2 3) [1 2 3] 
"")
+      (-map (-cut funcall <> 5) `(1+ 1- ,(lambda (x) (/ 1.0 x)))) => '(6 4 0.2)
+      (-map (-cut <> 1 2 3) '(list vector string)) => '((1 2 3) [1 2 3] "")
       (-filter (-cut < <> 5) '(1 3 5 7 9)) => '(1 3))
 
     (defexamples -not



reply via email to

[Prev in Thread] Current Thread [Next in Thread]