aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-06-05 17:48:29 +0200
committerLars Ingebrigtsen2022-06-05 17:48:39 +0200
commit98d454627ca2e9a6cdb906895b044e7221db3f2f (patch)
treef264b97e754941b55a9bfa6b65c330e46fecfe42
parente8a941cf705f26cf9571e1eba4d23bbc63a056e4 (diff)
downloademacs-98d454627ca2e9a6cdb906895b044e7221db3f2f.tar.gz
emacs-98d454627ca2e9a6cdb906895b044e7221db3f2f.zip
Rename generate-file to generate-lisp-file
* lisp/url/url-cookie.el (url-cookie-write-file): * lisp/international/titdic-cnv.el (tit-process-header) (miscdic-convert): * lisp/international/ja-dic-cnv.el (skkdic-convert): * lisp/international/emoji.el (emoji--generate-file): * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--rubric): * admin/unidata/unidata-gen.el (unidata-gen-file) (unidata-gen-charprop): Adjust callers. * lisp/emacs-lisp/generate-lisp-file.el: Renamed from generate-file.el. Also rename some keyword parameters and require a generator function.
-rw-r--r--admin/unidata/unidata-gen.el19
-rw-r--r--lisp/emacs-lisp/generate-lisp-file.el (renamed from lisp/emacs-lisp/generate-file.el)26
-rw-r--r--lisp/emacs-lisp/loaddefs-gen.el17
-rw-r--r--lisp/international/emoji.el6
-rw-r--r--lisp/international/ja-dic-cnv.el9
-rw-r--r--lisp/international/titdic-cnv.el14
-rw-r--r--lisp/url/url-cookie.el4
7 files changed, 46 insertions, 49 deletions
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index dc8c071999e..0a9fd5108ce 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -89,7 +89,7 @@
89;; PROPn: string representing the nth property value 89;; PROPn: string representing the nth property value
90 90
91(eval-when-compile (require 'cl-lib)) 91(eval-when-compile (require 'cl-lib))
92(require 'generate-file) 92(require 'generate-lisp-file)
93 93
94(defvar unidata-list nil) 94(defvar unidata-list nil)
95 95
@@ -1423,10 +1423,9 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)."
1423 (or elt (user-error "Unknown output file: %s" basename)) 1423 (or elt (user-error "Unknown output file: %s" basename))
1424 (or noninteractive (message "Generating %s..." file)) 1424 (or noninteractive (message "Generating %s..." file))
1425 (with-temp-file file 1425 (with-temp-file file
1426 (generate-file-heading 1426 (generate-lisp-file-heading
1427 basename 1427 basename 'unidata-gen-file
1428 :text (concat copyright " \ 1428 :commentary (concat copyright " \
1429Generated from Unicode data files by unidata-gen.el. \
1430The sources for this file are found in the admin/unidata/ directory in \ 1429The sources for this file are found in the admin/unidata/ directory in \
1431the Emacs sources. The Unicode data files are used under the \ 1430the Emacs sources. The Unicode data files are used under the \
1432Unicode Terms of Use, as contained in the file copyright.html in that \ 1431Unicode Terms of Use, as contained in the file copyright.html in that \
@@ -1448,15 +1447,15 @@ same directory."))
1448 (set-char-table-extra-slot table 3 describer)) 1447 (set-char-table-extra-slot table 3 describer))
1449 (insert (format "(define-char-code-property '%S\n %S\n %S)\n" 1448 (insert (format "(define-char-code-property '%S\n %S\n %S)\n"
1450 prop table docstring)))) 1449 prop table docstring))))
1451 (generate-file-trailer basename :inhibit-provide t)))) 1450 (generate-lisp-file-trailer basename :inhibit-provide t))))
1452 (or noninteractive (message "Generating %s...done" file))) 1451 (or noninteractive (message "Generating %s...done" file)))
1453 1452
1454(defun unidata-gen-charprop (&optional charprop-file text) 1453(defun unidata-gen-charprop (&optional charprop-file text)
1455 (or charprop-file (setq charprop-file (pop command-line-args-left))) 1454 (or charprop-file (setq charprop-file (pop command-line-args-left)))
1456 (with-temp-file charprop-file 1455 (with-temp-file charprop-file
1457 (generate-file-heading 1456 (generate-lisp-file-heading
1458 charprop-file 1457 charprop-file 'unidata-gen-charprop
1459 :text "Automatically generated by unidata-gen.el. See the admin/unidata/ directory in the Emacs sources.") 1458 :commentary "See the admin/unidata/ directory in the Emacs sources.")
1460 (if text 1459 (if text
1461 (insert text) 1460 (insert text)
1462 (dolist (elt unidata-file-alist) 1461 (dolist (elt unidata-file-alist)
@@ -1465,7 +1464,7 @@ same directory."))
1465 (unidata-prop-prop proplist) (car elt) 1464 (unidata-prop-prop proplist) (car elt)
1466 (unidata-prop-docstring proplist)))))) 1465 (unidata-prop-docstring proplist))))))
1467 (or noninteractive (message "Writing %s..." charprop-file)) 1466 (or noninteractive (message "Writing %s..." charprop-file))
1468 (generate-file-trailer charprop-file))) 1467 (generate-lisp-file-trailer charprop-file)))
1469 1468
1470(defun unidata-gen-scripts (&optional file) 1469(defun unidata-gen-scripts (&optional file)
1471 ;; Running from Makefile. 1470 ;; Running from Makefile.
diff --git a/lisp/emacs-lisp/generate-file.el b/lisp/emacs-lisp/generate-lisp-file.el
index 456503df6a3..8896a3f7019 100644
--- a/lisp/emacs-lisp/generate-file.el
+++ b/lisp/emacs-lisp/generate-lisp-file.el
@@ -1,4 +1,4 @@
1;;; generate-file.el --- utility functions for generated files -*- lexical-binding: t -*- 1;;; generate-lisp-file.el --- utility functions for generated files -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2022 Free Software Foundation, Inc. 3;; Copyright (C) 2022 Free Software Foundation, Inc.
4 4
@@ -26,17 +26,18 @@
26 26
27(eval-when-compile (require 'cl-lib)) 27(eval-when-compile (require 'cl-lib))
28 28
29(cl-defun generate-file-heading (file &key description text (code t)) 29(cl-defun generate-lisp-file-heading (file generator
30 "Insert a standard header for FILE. 30 &key title commentary (code t))
31 "Insert a standard header for FILE created by GENERATOR.
31This header will specify that this is a generated file that 32This header will specify that this is a generated file that
32should not be edited. 33should not be edited.
33 34
34If `standard-output' is bound to a buffer, insert in that buffer. 35If `standard-output' is bound to a buffer, insert in that buffer.
35If no, insert at point in the current buffer. 36If no, insert at point in the current buffer.
36 37
37DESCRIPTION (if any) will be used in the first line. 38TITLE (if any) will be used in the first line.
38 39
39TEXT (if given) will be inserted as a comment. 40COMMENTARY (if given) will be inserted as a comment.
40 41
41If CODE is non-nil (which is the default), a Code: line is 42If CODE is non-nil (which is the default), a Code: line is
42inserted." 43inserted."
@@ -45,21 +46,22 @@ inserted."
45 (current-buffer)) 46 (current-buffer))
46 (insert ";;; " (file-name-nondirectory file) 47 (insert ";;; " (file-name-nondirectory file)
47 " --- " 48 " --- "
48 (or description "automatically generated") 49 (or title "automatically generated")
49 " (do not edit) " 50 " (do not edit) "
50 " -*- lexical-binding: t -*-\n\n" 51 " -*- lexical-binding: t -*-\n"
52 (format ";; Generated by the `%s' function.\n\n" generator)
51 ";; This file is part of GNU Emacs.\n\n") 53 ";; This file is part of GNU Emacs.\n\n")
52 (when text 54 (when commentary
53 (insert ";;; Commentary:\n\n") 55 (insert ";;; Commentary:\n\n")
54 (let ((start (point)) 56 (let ((start (point))
55 (fill-prefix ";; ")) 57 (fill-prefix ";; "))
56 (insert ";; " text) 58 (insert ";; " commentary)
57 (fill-region start (point)))) 59 (fill-region start (point))))
58 (ensure-empty-lines 1) 60 (ensure-empty-lines 1)
59 (when code 61 (when code
60 (insert ";;; Code:\n\n")))) 62 (insert ";;; Code:\n\n"))))
61 63
62(cl-defun generate-file-trailer (file &key version inhibit-provide 64(cl-defun generate-lisp-file-trailer (file &key version inhibit-provide
63 (coding 'utf-8-emacs-unix) autoloads 65 (coding 'utf-8-emacs-unix) autoloads
64 compile provide) 66 compile provide)
65 "Insert a standard trailer for FILE. 67 "Insert a standard trailer for FILE.
@@ -106,6 +108,6 @@ If no, insert at point in the current buffer."
106 ";; End:\n\n" 108 ";; End:\n\n"
107 ";;; " (file-name-nondirectory file) " ends here\n"))) 109 ";;; " (file-name-nondirectory file) " ends here\n")))
108 110
109(provide 'generate-file) 111(provide 'generate-lisp-file)
110 112
111;;; generate-file.el ends here 113;;; generate-lisp-file.el ends here
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 9aa2967d7b3..7661f60e0ba 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -40,7 +40,7 @@
40 40
41(require 'radix-tree) 41(require 'radix-tree)
42(require 'lisp-mnt) 42(require 'lisp-mnt)
43(require 'generate-file) 43(require 'generate-lisp-file)
44 44
45(defvar autoload-compute-prefixes t 45(defvar autoload-compute-prefixes t
46 "If non-nil, autoload will add code to register the prefixes used in a file. 46 "If non-nil, autoload will add code to register the prefixes used in a file.
@@ -440,17 +440,18 @@ be a string naming the feature, otherwise it will be based on
440FILE's name." 440FILE's name."
441 (let ((lp (and (equal type "package") (setq type "autoloads")))) 441 (let ((lp (and (equal type "package") (setq type "autoloads"))))
442 (with-temp-buffer 442 (with-temp-buffer
443 (generate-file-heading 443 (generate-lisp-file-heading
444 file 444 file 'loaddefs-generate--rubric
445 :description (concat "automatically extracted " (or type "autoloads")) 445 :title (concat "automatically extracted " (or type "autoloads"))
446 :text (and (string-match "/lisp/loaddefs\\.el\\'" file) 446 :commentary (and (string-match "/lisp/loaddefs\\.el\\'" file)
447 "This file will be copied to ldefs-boot.el and checked in periodically.")) 447 "This file will be copied to ldefs-boot.el and checked in periodically."))
448 (when lp 448 (when lp
449 (insert "(add-to-list 'load-path (directory-file-name 449 (insert "(add-to-list 'load-path (directory-file-name
450 (or (file-name-directory #$) (car load-path))))\n\n")) 450 (or (file-name-directory #$) (car load-path))))\n\n"))
451 (insert " \n;;; End of scraped data\n\n") 451 (insert " \n;;; End of scraped data\n\n")
452 (generate-file-trailer file :provide (and (stringp feature) feature) 452 (generate-lisp-file-trailer
453 :inhibit-provide (not feature)) 453 file :provide (and (stringp feature) feature)
454 :inhibit-provide (not feature))
454 (buffer-string)))) 455 (buffer-string))))
455 456
456(defun loaddefs-generate--insert-section-header (outbuf autoloads 457(defun loaddefs-generate--insert-section-header (outbuf autoloads
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index d53b01173d5..8970a466b7c 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -31,7 +31,7 @@
31(require 'cl-extra) 31(require 'cl-extra)
32(require 'transient) 32(require 'transient)
33(require 'multisession) 33(require 'multisession)
34(require 'generate-file) 34(require 'generate-lisp-file)
35 35
36(defgroup emoji nil 36(defgroup emoji nil
37 "Inserting Emojis." 37 "Inserting Emojis."
@@ -416,7 +416,7 @@ the name is not known."
416 (dolist (glyph glyphs) 416 (dolist (glyph glyphs)
417 (remhash glyph emoji--derived))) 417 (remhash glyph emoji--derived)))
418 (with-temp-buffer 418 (with-temp-buffer
419 (generate-file-heading file) 419 (generate-lisp-file-heading file 'emoji--generate-file)
420 (insert ";; Copyright © 1991-2021 Unicode, Inc. 420 (insert ";; Copyright © 1991-2021 Unicode, Inc.
421;; Generated from Unicode data files by emoji.el. 421;; Generated from Unicode data files by emoji.el.
422;; The source for this file is found in the admin/unidata/emoji-test.txt 422;; The source for this file is found in the admin/unidata/emoji-test.txt
@@ -427,7 +427,7 @@ the name is not known."
427 (insert (format "(defconst %s '" var)) 427 (insert (format "(defconst %s '" var))
428 (pp (symbol-value var) (current-buffer)) 428 (pp (symbol-value var) (current-buffer))
429 (insert (format "\n) ;; End %s\n\n" var))) 429 (insert (format "\n) ;; End %s\n\n" var)))
430 (generate-file-trailer file) 430 (generate-lisp-file-trailer file)
431 (write-region (point-min) (point-max) file))) 431 (write-region (point-min) (point-max) file)))
432 432
433(defun emoji--base-name (name derivations) 433(defun emoji--base-name (name derivations)
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index 563eba6682b..1bbc664e756 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -44,7 +44,7 @@
44 44
45;;; Code: 45;;; Code:
46 46
47(require 'generate-file) 47(require 'generate-lisp-file)
48 48
49;; Name of a file to generate from SKK dictionary. 49;; Name of a file to generate from SKK dictionary.
50(defvar ja-dic-filename "ja-dic.el") 50(defvar ja-dic-filename "ja-dic.el")
@@ -342,9 +342,8 @@ Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)."
342 (with-current-buffer buf 342 (with-current-buffer buf
343 (erase-buffer) 343 (erase-buffer)
344 (buffer-disable-undo) 344 (buffer-disable-undo)
345 (generate-file-heading ja-dic-filename :code nil) 345 (generate-lisp-file-heading ja-dic-filename 'skkdic-convert :code nil)
346 (insert ";;\tGenerated by the `skkdic-convert' function.\n" 346 (insert ";; Original SKK dictionary file: "
347 ";;\tOriginal SKK dictionary file: "
348 (file-relative-name (expand-file-name filename) dirname) 347 (file-relative-name (expand-file-name filename) dirname)
349 "\n\n" 348 "\n\n"
350 ";;; Start of the header of the original SKK dictionary.\n\n") 349 ";;; Start of the header of the original SKK dictionary.\n\n")
@@ -394,7 +393,7 @@ Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)."
394 ;; Postfix 393 ;; Postfix
395 (with-current-buffer buf 394 (with-current-buffer buf
396 (goto-char (point-max)) 395 (goto-char (point-max))
397 (generate-file-trailer ja-dic-filename :compile t))) 396 (generate-lisp-file-trailer ja-dic-filename :compile t)))
398 397
399 ;; Save the working buffer. 398 ;; Save the working buffer.
400 (set-buffer buf) 399 (set-buffer buf)
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index bdb77ca7026..2a91e7cb5ec 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -62,7 +62,7 @@
62;;; Code: 62;;; Code:
63 63
64(require 'quail) 64(require 'quail)
65(require 'generate-file) 65(require 'generate-lisp-file)
66 66
67;; List of values of key "ENCODE:" and the corresponding Emacs 67;; List of values of key "ENCODE:" and the corresponding Emacs
68;; coding-system and language environment name. 68;; coding-system and language environment name.
@@ -270,12 +270,10 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲,
270 (tit-moveleft ",<") 270 (tit-moveleft ",<")
271 (tit-keyprompt nil)) 271 (tit-keyprompt nil))
272 272
273 (generate-file-heading filename :code nil) 273 (generate-lisp-file-heading filename 'titdic-convert :code nil)
274 (princ ";; Quail package `") 274 (princ ";; Quail package `")
275 (princ package) 275 (princ package)
276 (princ "\n") 276 (princ "\n")
277 (princ (substitute-command-keys
278 ";; Generated by the `titdic-convert' function.\n"))
279 (princ ";;\tOriginal TIT dictionary file: ") 277 (princ ";;\tOriginal TIT dictionary file: ")
280 (princ (file-name-nondirectory filename)) 278 (princ (file-name-nondirectory filename))
281 (princ "\n\n") 279 (princ "\n\n")
@@ -521,7 +519,7 @@ the generated Quail package is saved."
521 519
522 ;; Process the body part 520 ;; Process the body part
523 (tit-process-body) 521 (tit-process-body)
524 (generate-file-trailer 522 (generate-lisp-file-trailer
525 filename :inhibit-provide t :compile t :coding nil)))))) 523 filename :inhibit-provide t :compile t :coding nil))))))
526 524
527;;;###autoload 525;;;###autoload
@@ -1132,10 +1130,8 @@ the generated Quail package is saved."
1132 ;; Explicitly set eol format to `unix'. 1130 ;; Explicitly set eol format to `unix'.
1133 (setq coding-system-for-write 'utf-8-unix) 1131 (setq coding-system-for-write 'utf-8-unix)
1134 (with-temp-file (expand-file-name quailfile dirname) 1132 (with-temp-file (expand-file-name quailfile dirname)
1135 (generate-file-heading quailfile) 1133 (generate-lisp-file-heading quailfile 'miscdic-convert)
1136 (insert (format-message ";; Quail package `%s'\n" name)) 1134 (insert (format-message ";; Quail package `%s'\n" name))
1137 (insert (format-message
1138 ";; Generated by the `miscdic-convert' function.\n"))
1139 (insert ";; Source dictionary file: " dicfile "\n") 1135 (insert ";; Source dictionary file: " dicfile "\n")
1140 (insert ";; Copyright notice of the source file\n") 1136 (insert ";; Copyright notice of the source file\n")
1141 (insert ";;------------------------------------------------------\n") 1137 (insert ";;------------------------------------------------------\n")
@@ -1157,7 +1153,7 @@ the generated Quail package is saved."
1157 (let ((dicbuf (current-buffer))) 1153 (let ((dicbuf (current-buffer)))
1158 (with-current-buffer dstbuf 1154 (with-current-buffer dstbuf
1159 (funcall converter dicbuf))))) 1155 (funcall converter dicbuf)))))
1160 (generate-file-trailer 1156 (generate-lisp-file-trailer
1161 quailfile :inhibit-provide t :compile t :coding nil))) 1157 quailfile :inhibit-provide t :compile t :coding nil)))
1162 (setq tail (cdr tail))))) 1158 (setq tail (cdr tail)))))
1163 1159
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index dab367485e9..15c78512c64 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -26,7 +26,7 @@
26(require 'url-util) 26(require 'url-util)
27(require 'url-parse) 27(require 'url-parse)
28(require 'url-domsuf) 28(require 'url-domsuf)
29(require 'generate-file) 29(require 'generate-lisp-file)
30 30
31(eval-when-compile (require 'cl-lib)) 31(eval-when-compile (require 'cl-lib))
32 32
@@ -159,7 +159,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
159 (insert ")\n(setq url-cookie-secure-storage\n '") 159 (insert ")\n(setq url-cookie-secure-storage\n '")
160 (pp url-cookie-secure-storage (current-buffer))) 160 (pp url-cookie-secure-storage (current-buffer)))
161 (insert ")\n") 161 (insert ")\n")
162 (generate-file-trailer fname :inhibit-provide t :autoloads t) 162 (generate-lisp-file-trailer fname :inhibit-provide t :autoloads t)
163 (setq-local version-control 'never) 163 (setq-local version-control 'never)
164 (write-file fname)) 164 (write-file fname))
165 (setq url-cookies-changed-since-last-save nil)))) 165 (setq url-cookies-changed-since-last-save nil))))