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

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

[elpa] externals/dash a6b16ea 286/316: Localize 'nil -> '() replacement


From: ELPA Syncer
Subject: [elpa] externals/dash a6b16ea 286/316: Localize 'nil -> '() replacement in Texinfo
Date: Mon, 15 Feb 2021 15:58:18 -0500 (EST)

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

    Localize 'nil -> '() replacement in Texinfo
    
    * dev/examples-to-info.el (create-info-file): Move 'nil -> '()
    replacement from here...
    (dash--print-lisp-as-texi): ...to here.
    (example-to-string): Disable case folding to be on the safe side.
    (dash--replace-all): Remove regexp argument; no longer used.
---
 dev/examples-to-info.el | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el
index b896e13..ecb1f62 100644
--- a/dev/examples-to-info.el
+++ b/dev/examples-to-info.el
@@ -33,6 +33,7 @@
   (save-excursion (prin1 obj))
   (while (re-search-forward (rx (| (group "\\?")
                                    (group (in "{}"))
+                                   (group ?\' symbol-start "nil" symbol-end)
                                    (not (in ?\n print))))
                             nil 'move)
     (cond ((match-beginning 1)
@@ -43,13 +44,16 @@
            (backward-char)
            (insert ?@)
            (forward-char))
+          ;; Don't let '() be printed as 'nil.
+          ((match-beginning 3) (replace-match "'()" t t))
+          ;; Translate unprintable characters such as ?\^A.
           ((let ((desc (text-char-description (preceding-char))))
-             ;; Translate unprintable characters such as ?\^A.
              (replace-match (concat "\\" desc) t t))))))
 
 (defun example-to-string (example)
   (pcase-let* ((`(,actual ,err ,expected) example)
-               (err (eq err '!!>)))
+               (err (eq err '!!>))
+               (case-fold-search nil))
     (and err (consp expected)
          (setq expected (error-message-string expected)))
     (with-output-to-string
@@ -135,12 +139,10 @@ Based on `describe-function-1'."
      (concat "\n@node " function "\n@section " function))
     (_ (concat "\n" function))))
 
-(defun dash--replace-all (old new &optional regexp)
-  "Replace occurrences of OLD with NEW in current buffer.
-If REGEXP is non-nil, interpret OLD as a regexp."
-  (or regexp (setq old (regexp-quote old)))
+(defun dash--replace-all (old new)
+  "Replace occurrences of OLD with NEW in current buffer."
   (goto-char (point-min))
-  (while (re-search-forward old nil t)
+  (while (search-forward old nil t)
     (replace-match new t t)))
 
 (defun create-info-file ()
@@ -162,8 +164,6 @@ If REGEXP is non-nil, interpret OLD as a regexp."
                   "\n"))
 
       (dash--replace-all "@c [[ function-docs ]]"
-                         (mapconcat #'function-to-info functions "\n"))
-
-      (dash--replace-all (rx (or "'nil" "(quote nil)")) "'()" t))))
+                         (mapconcat #'function-to-info functions "\n")))))
 
 ;;; examples-to-info.el ends here



reply via email to

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