emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c1e71d3 4/5: Further refactoring in unidata-gen.el


From: Glenn Morris
Subject: [Emacs-diffs] master c1e71d3 4/5: Further refactoring in unidata-gen.el
Date: Tue, 25 Apr 2017 02:07:05 -0400 (EDT)

branch: master
commit c1e71d3899daca49e216dfa3a6e6e07169d02e1e
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Further refactoring in unidata-gen.el
    
    * admin/unidata/unidata-gen.el (unidata-gen-charprop):
    New function, split from unidata-gen-files.
    (unidata-gen-files): Use unidata-gen-charprop.
---
 admin/unidata/unidata-gen.el | 45 ++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index fd398f7..5f3cd1c 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -1434,6 +1434,25 @@ Property value is a symbol `o' (Open), `c' (Close), or 
`n' (None)."
                 (format ";; %s ends here\n" basename)))))
   (or noninteractive (message "Generating %s...done" file)))
 
+(defun unidata-gen-charprop (&optional charprop-file)
+  (or charprop-file (setq charprop-file (pop command-line-args-left)))
+  (with-temp-file charprop-file
+    (insert ";; Automatically generated by unidata-gen.el.\n")
+    (dolist (elt unidata-file-alist)
+      (dolist (proplist (cdr elt))
+       (insert (format "(define-char-code-property '%S %S\n  %S)\n"
+                       (unidata-prop-prop proplist) (car elt)
+                       (unidata-prop-docstring proplist)))))
+    (message "Writing %s..." charprop-file)
+    (insert ";; Local Variables:\n"
+           ";; coding: utf-8\n"
+           ";; version-control: never\n"
+           ";; no-byte-compile: t\n"
+           ";; no-update-autoloads: t\n"
+           ";; End:\n\n"
+           (format ";; %s ends here\n"
+                   (file-name-nondirectory charprop-file)))))
+
 ;; The entry function.  It generates files described in the header
 ;; comment of this file.
 
@@ -1448,30 +1467,12 @@ Property value is a symbol `o' (Open), `c' (Close), or 
`n' (None)."
                                  (expand-file-name "unidata.txt"))))
   (let ((coding-system-for-write 'utf-8-unix)
         (coding-system-for-read 'utf-8)
-       (charprop-file (expand-file-name "charprop.el" dest-dir))
        (unidata-dir data-dir))
     (unidata-setup-list unidata-text-file)
-    (with-temp-file charprop-file
-      (insert ";; Automatically generated by unidata-gen.el.\n")
-      (dolist (elt unidata-file-alist)
-       (let* ((file (expand-file-name (car elt) dest-dir))
-              (basename (file-name-nondirectory file)))
-         (unidata-gen-file file data-dir unidata-text-file)
-         ;; Filename in this comment line is extracted by sed in Makefile.
-         (insert (format ";; FILE: %s\n" basename))
-         (dolist (proplist (cdr elt))
-           (insert (format "(define-char-code-property '%S %S\n  %S)\n"
-                           (unidata-prop-prop proplist) basename
-                           (unidata-prop-docstring proplist))))))
-      (message "Writing %s..." charprop-file)
-      (insert ";; Local Variables:\n"
-             ";; coding: utf-8\n"
-             ";; version-control: never\n"
-             ";; no-byte-compile: t\n"
-             ";; no-update-autoloads: t\n"
-             ";; End:\n\n"
-             (format ";; %s ends here\n"
-                     (file-name-nondirectory charprop-file))))))
+    (dolist (elt unidata-file-alist)
+      (unidata-gen-file (expand-file-name (car elt) dest-dir)
+                       data-dir unidata-text-file))
+    (unidata-gen-charprop (expand-file-name "charprop.el" dest-dir))))
 
 
 



reply via email to

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