diff options
| author | Lars Ingebrigtsen | 2022-06-05 16:36:25 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-06-05 16:36:34 +0200 |
| commit | 9d2f4a8d5a92fdfab80ce9faf0dcfa159189916b (patch) | |
| tree | e594acec129ce3637dd49e22ad8f771e3b247fd7 | |
| parent | ac6660a2d026e89214814768990d0d232f0a9d06 (diff) | |
| download | emacs-9d2f4a8d5a92fdfab80ce9faf0dcfa159189916b.tar.gz emacs-9d2f4a8d5a92fdfab80ce9faf0dcfa159189916b.zip | |
Add convenience functions for generating Emacs Lisp files
* lisp/url/url-cookie.el (url-cookie-write-file):
* lisp/international/titdic-cnv.el (tit-process-header):
* 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): Use the new functions.
* lisp/emacs-lisp/generate-file.el: New file to provide
convenience functions for generated files. It's not always
trivial to know which parts of the trailer that has to be
obfuscated to avoid not getting byte-compiled etc, and some parts
of the headers/trailers are usually forgotten when hand-coding
these.
| -rw-r--r-- | admin/unidata/unidata-gen.el | 44 | ||||
| -rw-r--r-- | lisp/emacs-lisp/generate-file.el | 111 | ||||
| -rw-r--r-- | lisp/emacs-lisp/loaddefs-gen.el | 41 | ||||
| -rw-r--r-- | lisp/international/emoji.el | 18 | ||||
| -rw-r--r-- | lisp/international/ja-dic-cnv.el | 16 | ||||
| -rw-r--r-- | lisp/international/titdic-cnv.el | 28 | ||||
| -rw-r--r-- | lisp/url/url-cookie.el | 6 |
7 files changed, 160 insertions, 104 deletions
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index 149f7535588..dc8c071999e 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el | |||
| @@ -89,6 +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 | 93 | ||
| 93 | (defvar unidata-list nil) | 94 | (defvar unidata-list nil) |
| 94 | 95 | ||
| @@ -1422,13 +1423,14 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | |||
| 1422 | (or elt (user-error "Unknown output file: %s" basename)) | 1423 | (or elt (user-error "Unknown output file: %s" basename)) |
| 1423 | (or noninteractive (message "Generating %s..." file)) | 1424 | (or noninteractive (message "Generating %s..." file)) |
| 1424 | (with-temp-file file | 1425 | (with-temp-file file |
| 1425 | (insert ";;; " basename " -*- lexical-binding:t -*- | 1426 | (generate-file-heading |
| 1426 | ;; " copyright " | 1427 | basename |
| 1427 | ;; Generated from Unicode data files by unidata-gen.el. | 1428 | :text (concat copyright " \ |
| 1428 | ;; The sources for this file are found in the admin/unidata/ directory in | 1429 | Generated from Unicode data files by unidata-gen.el. \ |
| 1429 | ;; the Emacs sources. The Unicode data files are used under the | 1430 | The sources for this file are found in the admin/unidata/ directory in \ |
| 1430 | ;; Unicode Terms of Use, as contained in the file copyright.html in that | 1431 | the Emacs sources. The Unicode data files are used under the \ |
| 1431 | ;; same directory.\n") | 1432 | Unicode Terms of Use, as contained in the file copyright.html in that \ |
| 1433 | same directory.")) | ||
| 1432 | (dolist (proplist (cdr elt)) | 1434 | (dolist (proplist (cdr elt)) |
| 1433 | (let ((prop (unidata-prop-prop proplist)) | 1435 | (let ((prop (unidata-prop-prop proplist)) |
| 1434 | (index (unidata-prop-index proplist)) | 1436 | (index (unidata-prop-index proplist)) |
| @@ -1446,21 +1448,15 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | |||
| 1446 | (set-char-table-extra-slot table 3 describer)) | 1448 | (set-char-table-extra-slot table 3 describer)) |
| 1447 | (insert (format "(define-char-code-property '%S\n %S\n %S)\n" | 1449 | (insert (format "(define-char-code-property '%S\n %S\n %S)\n" |
| 1448 | prop table docstring)))) | 1450 | prop table docstring)))) |
| 1449 | (insert ";; Local Variables:\n" | 1451 | (generate-file-trailer basename :inhibit-provide t)))) |
| 1450 | ";; coding: utf-8\n" | ||
| 1451 | ";; version-control: never\n" | ||
| 1452 | ";; no-byte-compile: t\n" | ||
| 1453 | ";; no-update-autoloads: t\n" | ||
| 1454 | ";; End:\n\n" | ||
| 1455 | (format ";;; %s ends here\n" basename))))) | ||
| 1456 | (or noninteractive (message "Generating %s...done" file))) | 1452 | (or noninteractive (message "Generating %s...done" file))) |
| 1457 | 1453 | ||
| 1458 | (defun unidata-gen-charprop (&optional charprop-file text) | 1454 | (defun unidata-gen-charprop (&optional charprop-file text) |
| 1459 | (or charprop-file (setq charprop-file (pop command-line-args-left))) | 1455 | (or charprop-file (setq charprop-file (pop command-line-args-left))) |
| 1460 | (with-temp-file charprop-file | 1456 | (with-temp-file charprop-file |
| 1461 | (insert ";; Automatically generated by unidata-gen.el." | 1457 | (generate-file-heading |
| 1462 | " -*- lexical-binding: t -*-\n" | 1458 | charprop-file |
| 1463 | ";; See the admin/unidata/ directory in the Emacs sources.\n") | 1459 | :text "Automatically generated by unidata-gen.el. See the admin/unidata/ directory in the Emacs sources.") |
| 1464 | (if text | 1460 | (if text |
| 1465 | (insert text) | 1461 | (insert text) |
| 1466 | (dolist (elt unidata-file-alist) | 1462 | (dolist (elt unidata-file-alist) |
| @@ -1469,19 +1465,7 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | |||
| 1469 | (unidata-prop-prop proplist) (car elt) | 1465 | (unidata-prop-prop proplist) (car elt) |
| 1470 | (unidata-prop-docstring proplist)))))) | 1466 | (unidata-prop-docstring proplist)))))) |
| 1471 | (or noninteractive (message "Writing %s..." charprop-file)) | 1467 | (or noninteractive (message "Writing %s..." charprop-file)) |
| 1472 | (insert "\n" | 1468 | (generate-file-trailer charprop-file))) |
| 1473 | (format "(provide '%s)\n" | ||
| 1474 | (file-name-sans-extension | ||
| 1475 | (file-name-nondirectory charprop-file))) | ||
| 1476 | "\n" | ||
| 1477 | ";; Local Variables:\n" | ||
| 1478 | ";; coding: utf-8\n" | ||
| 1479 | ";; version-control: never\n" | ||
| 1480 | ";; no-byte-compile: t\n" | ||
| 1481 | ";; no-update-autoloads: t\n" | ||
| 1482 | ";; End:\n\n" | ||
| 1483 | (format ";;; %s ends here\n" | ||
| 1484 | (file-name-nondirectory charprop-file))))) | ||
| 1485 | 1469 | ||
| 1486 | (defun unidata-gen-scripts (&optional file) | 1470 | (defun unidata-gen-scripts (&optional file) |
| 1487 | ;; Running from Makefile. | 1471 | ;; Running from Makefile. |
diff --git a/lisp/emacs-lisp/generate-file.el b/lisp/emacs-lisp/generate-file.el new file mode 100644 index 00000000000..456503df6a3 --- /dev/null +++ b/lisp/emacs-lisp/generate-file.el | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | ;;; generate-file.el --- utility functions for generated files -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2022 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Keywords: maint | ||
| 6 | ;; Package: emacs | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | |||
| 27 | (eval-when-compile (require 'cl-lib)) | ||
| 28 | |||
| 29 | (cl-defun generate-file-heading (file &key description text (code t)) | ||
| 30 | "Insert a standard header for FILE. | ||
| 31 | This header will specify that this is a generated file that | ||
| 32 | should not be edited. | ||
| 33 | |||
| 34 | If `standard-output' is bound to a buffer, insert in that buffer. | ||
| 35 | If no, insert at point in the current buffer. | ||
| 36 | |||
| 37 | DESCRIPTION (if any) will be used in the first line. | ||
| 38 | |||
| 39 | TEXT (if given) will be inserted as a comment. | ||
| 40 | |||
| 41 | If CODE is non-nil (which is the default), a Code: line is | ||
| 42 | inserted." | ||
| 43 | (with-current-buffer (if (bufferp standard-output) | ||
| 44 | standard-output | ||
| 45 | (current-buffer)) | ||
| 46 | (insert ";;; " (file-name-nondirectory file) | ||
| 47 | " --- " | ||
| 48 | (or description "automatically generated") | ||
| 49 | " (do not edit) " | ||
| 50 | " -*- lexical-binding: t -*-\n\n" | ||
| 51 | ";; This file is part of GNU Emacs.\n\n") | ||
| 52 | (when text | ||
| 53 | (insert ";;; Commentary:\n\n") | ||
| 54 | (let ((start (point)) | ||
| 55 | (fill-prefix ";; ")) | ||
| 56 | (insert ";; " text) | ||
| 57 | (fill-region start (point)))) | ||
| 58 | (ensure-empty-lines 1) | ||
| 59 | (when code | ||
| 60 | (insert ";;; Code:\n\n")))) | ||
| 61 | |||
| 62 | (cl-defun generate-file-trailer (file &key version inhibit-provide | ||
| 63 | (coding 'utf-8-emacs-unix) autoloads | ||
| 64 | compile provide) | ||
| 65 | "Insert a standard trailer for FILE. | ||
| 66 | By default, this trailer inhibits version control, byte | ||
| 67 | compilation, updating autoloads, and uses a `utf-8-emacs-unix' | ||
| 68 | coding system. These can be inhibited by providing non-nil | ||
| 69 | values to the VERSION, NO-PROVIDE, AUTOLOADS and COMPILE | ||
| 70 | keyword arguments. | ||
| 71 | |||
| 72 | CODING defaults to `utf-8-emacs-unix'. Use a nil value to | ||
| 73 | inhibit generating this setting, or a coding system value to use | ||
| 74 | that. | ||
| 75 | |||
| 76 | If PROVIDE is non-nil, use that in the `provide' statement | ||
| 77 | instead of using FILE as the basis. | ||
| 78 | |||
| 79 | If `standard-output' is bound to a buffer, insert in that buffer. | ||
| 80 | If no, insert at point in the current buffer." | ||
| 81 | (with-current-buffer (if (bufferp standard-output) | ||
| 82 | standard-output | ||
| 83 | (current-buffer)) | ||
| 84 | (ensure-empty-lines 1) | ||
| 85 | (unless inhibit-provide | ||
| 86 | (insert (format "(provide '%s)\n\n" | ||
| 87 | (or provide | ||
| 88 | (file-name-sans-extension | ||
| 89 | (file-name-nondirectory file)))))) | ||
| 90 | ;; Some of the strings below are chopped into bits to inhibit | ||
| 91 | ;; automatic scanning tools from thinking that they are actual | ||
| 92 | ;; directives. | ||
| 93 | (insert ";; Local " "Variables:\n") | ||
| 94 | (unless version | ||
| 95 | (insert ";; version-control: never\n")) | ||
| 96 | (unless compile | ||
| 97 | (insert ";; no-byte-" "compile: t\n")) ;; #$ is byte-compiled into nil. | ||
| 98 | (unless autoloads | ||
| 99 | (insert ";; no-update-autoloads: t\n")) | ||
| 100 | (when coding | ||
| 101 | (insert (format ";; coding: %s\n" | ||
| 102 | (if (eq coding t) | ||
| 103 | 'utf-8-emacs-unix | ||
| 104 | coding)))) | ||
| 105 | (insert | ||
| 106 | ";; End:\n\n" | ||
| 107 | ";;; " (file-name-nondirectory file) " ends here\n"))) | ||
| 108 | |||
| 109 | (provide 'generate-file) | ||
| 110 | |||
| 111 | ;;; generate-file.el ends here | ||
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index dce5466be2d..9aa2967d7b3 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el | |||
| @@ -40,6 +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 | 44 | ||
| 44 | (defvar autoload-compute-prefixes t | 45 | (defvar autoload-compute-prefixes t |
| 45 | "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. |
| @@ -437,32 +438,20 @@ but adds an extra line to the output to modify `load-path'. | |||
| 437 | If FEATURE is non-nil, FILE will provide a feature. FEATURE may | 438 | If FEATURE is non-nil, FILE will provide a feature. FEATURE may |
| 438 | be a string naming the feature, otherwise it will be based on | 439 | be a string naming the feature, otherwise it will be based on |
| 439 | FILE's name." | 440 | FILE's name." |
| 440 | (let ((basename (file-name-nondirectory file)) | 441 | (let ((lp (and (equal type "package") (setq type "autoloads")))) |
| 441 | (lp (if (equal type "package") (setq type "autoloads")))) | 442 | (with-temp-buffer |
| 442 | (concat ";;; " basename | 443 | (generate-file-heading |
| 443 | " --- automatically extracted " (or type "autoloads") | 444 | file |
| 444 | " -*- lexical-binding: t -*-\n" | 445 | :description (concat "automatically extracted " (or type "autoloads")) |
| 445 | (when (string-match "/lisp/loaddefs\\.el\\'" file) | 446 | :text (and (string-match "/lisp/loaddefs\\.el\\'" file) |
| 446 | ";; This file will be copied to ldefs-boot.el and checked in periodically.\n") | 447 | "This file will be copied to ldefs-boot.el and checked in periodically.")) |
| 447 | ";;\n" | 448 | (when lp |
| 448 | ";;; Code:\n\n" | 449 | (insert "(add-to-list 'load-path (directory-file-name |
| 449 | (if lp | 450 | (or (file-name-directory #$) (car load-path))))\n\n")) |
| 450 | "(add-to-list 'load-path (directory-file-name | 451 | (insert "\n;;; End of scraped data\n\n") |
| 451 | (or (file-name-directory #$) (car load-path))))\n\n") | 452 | (generate-file-trailer file :provide (and (stringp feature) feature) |
| 452 | "\n;;; End of scraped data\n\n" | 453 | :inhibit-provide (not feature)) |
| 453 | ;; This is used outside of autoload.el, eg cus-dep, finder. | 454 | (buffer-string)))) |
| 454 | (if feature | ||
| 455 | (format "(provide '%s)\n" | ||
| 456 | (if (stringp feature) feature | ||
| 457 | (file-name-sans-extension basename)))) | ||
| 458 | ";; Local Variables:\n" | ||
| 459 | ";; version-control: never\n" | ||
| 460 | ";; no-byte-compile: t\n" ;; #$ is byte-compiled into nil. | ||
| 461 | ";; no-update-autoloads: t\n" | ||
| 462 | ";; coding: utf-8-emacs-unix\n" | ||
| 463 | ";; End:\n" | ||
| 464 | ";;; " basename | ||
| 465 | " ends here\n"))) | ||
| 466 | 455 | ||
| 467 | (defun loaddefs-generate--insert-section-header (outbuf autoloads | 456 | (defun loaddefs-generate--insert-section-header (outbuf autoloads |
| 468 | load-name file time) | 457 | load-name file time) |
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index df488708afa..d53b01173d5 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el | |||
| @@ -31,6 +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 | 35 | ||
| 35 | (defgroup emoji nil | 36 | (defgroup emoji nil |
| 36 | "Inserting Emojis." | 37 | "Inserting Emojis." |
| @@ -415,8 +416,8 @@ the name is not known." | |||
| 415 | (dolist (glyph glyphs) | 416 | (dolist (glyph glyphs) |
| 416 | (remhash glyph emoji--derived))) | 417 | (remhash glyph emoji--derived))) |
| 417 | (with-temp-buffer | 418 | (with-temp-buffer |
| 418 | (insert ";; Generated file -- do not edit. -*- lexical-binding:t -*- | 419 | (generate-file-heading file) |
| 419 | ;; Copyright © 1991-2021 Unicode, Inc. | 420 | (insert ";; Copyright © 1991-2021 Unicode, Inc. |
| 420 | ;; Generated from Unicode data files by emoji.el. | 421 | ;; Generated from Unicode data files by emoji.el. |
| 421 | ;; 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 |
| 422 | ;; file in the Emacs sources. The Unicode data files are used under the | 423 | ;; file in the Emacs sources. The Unicode data files are used under the |
| @@ -426,18 +427,7 @@ the name is not known." | |||
| 426 | (insert (format "(defconst %s '" var)) | 427 | (insert (format "(defconst %s '" var)) |
| 427 | (pp (symbol-value var) (current-buffer)) | 428 | (pp (symbol-value var) (current-buffer)) |
| 428 | (insert (format "\n) ;; End %s\n\n" var))) | 429 | (insert (format "\n) ;; End %s\n\n" var))) |
| 429 | (insert ";; Local" " Variables: | 430 | (generate-file-trailer file) |
| 430 | ;; coding: utf-8 | ||
| 431 | ;; version-control: never | ||
| 432 | ;; no-byte-" | ||
| 433 | ;; Obfuscate to not inhibit compilation of this file, too. | ||
| 434 | "compile: t | ||
| 435 | ;; no-update-autoloads: t | ||
| 436 | ;; End: | ||
| 437 | |||
| 438 | \(provide 'emoji-labels) | ||
| 439 | |||
| 440 | \;;; emoji-labels.el ends here\n") | ||
| 441 | (write-region (point-min) (point-max) file))) | 431 | (write-region (point-min) (point-max) file))) |
| 442 | 432 | ||
| 443 | (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 7f7c0261dca..563eba6682b 100644 --- a/lisp/international/ja-dic-cnv.el +++ b/lisp/international/ja-dic-cnv.el | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | 44 | ||
| 45 | ;;; Code: | 45 | ;;; Code: |
| 46 | 46 | ||
| 47 | (require 'generate-file) | ||
| 48 | |||
| 47 | ;; Name of a file to generate from SKK dictionary. | 49 | ;; Name of a file to generate from SKK dictionary. |
| 48 | (defvar ja-dic-filename "ja-dic.el") | 50 | (defvar ja-dic-filename "ja-dic.el") |
| 49 | 51 | ||
| @@ -340,13 +342,11 @@ Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)." | |||
| 340 | (with-current-buffer buf | 342 | (with-current-buffer buf |
| 341 | (erase-buffer) | 343 | (erase-buffer) |
| 342 | (buffer-disable-undo) | 344 | (buffer-disable-undo) |
| 343 | (insert ";;; ja-dic.el --- dictionary for Japanese input method" | 345 | (generate-file-heading ja-dic-filename :code nil) |
| 344 | " -*- lexical-binding:t -*-\n" | 346 | (insert ";;\tGenerated by the `skkdic-convert' function.\n" |
| 345 | ";;\tGenerated by the command `skkdic-convert'\n" | ||
| 346 | ";;\tOriginal SKK dictionary file: " | 347 | ";;\tOriginal SKK dictionary file: " |
| 347 | (file-relative-name (expand-file-name filename) dirname) | 348 | (file-relative-name (expand-file-name filename) dirname) |
| 348 | "\n\n" | 349 | "\n\n" |
| 349 | ";; This file is part of GNU Emacs.\n\n" | ||
| 350 | ";;; Start of the header of the original SKK dictionary.\n\n") | 350 | ";;; Start of the header of the original SKK dictionary.\n\n") |
| 351 | (set-buffer skkbuf) | 351 | (set-buffer skkbuf) |
| 352 | (goto-char 1) | 352 | (goto-char 1) |
| @@ -394,13 +394,7 @@ Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)." | |||
| 394 | ;; Postfix | 394 | ;; Postfix |
| 395 | (with-current-buffer buf | 395 | (with-current-buffer buf |
| 396 | (goto-char (point-max)) | 396 | (goto-char (point-max)) |
| 397 | (insert ";;\n(provide 'ja-dic)\n\n" | 397 | (generate-file-trailer ja-dic-filename :compile t))) |
| 398 | ";; Local Variables:\n" | ||
| 399 | ";; version-control: never\n" | ||
| 400 | ";; no-update-autoloads: t\n" | ||
| 401 | ";; coding: utf-8\n" | ||
| 402 | ";; End:\n\n" | ||
| 403 | ";;; ja-dic.el ends here\n"))) | ||
| 404 | 398 | ||
| 405 | ;; Save the working buffer. | 399 | ;; Save the working buffer. |
| 406 | (set-buffer buf) | 400 | (set-buffer buf) |
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index a3b62667915..bdb77ca7026 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | ;;; Code: | 62 | ;;; Code: |
| 63 | 63 | ||
| 64 | (require 'quail) | 64 | (require 'quail) |
| 65 | (require 'generate-file) | ||
| 65 | 66 | ||
| 66 | ;; List of values of key "ENCODE:" and the corresponding Emacs | 67 | ;; List of values of key "ENCODE:" and the corresponding Emacs |
| 67 | ;; coding-system and language environment name. | 68 | ;; coding-system and language environment name. |
| @@ -269,13 +270,12 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, | |||
| 269 | (tit-moveleft ",<") | 270 | (tit-moveleft ",<") |
| 270 | (tit-keyprompt nil)) | 271 | (tit-keyprompt nil)) |
| 271 | 272 | ||
| 272 | (princ (format ";;; %s -*- lexical-binding:t -*-\n" | 273 | (generate-file-heading filename :code nil) |
| 273 | (file-name-nondirectory filename))) | ||
| 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 | 277 | (princ (substitute-command-keys |
| 278 | ";; Generated by the command `titdic-convert'\n")) | 278 | ";; Generated by the `titdic-convert' function.\n")) |
| 279 | (princ ";;\tOriginal TIT dictionary file: ") | 279 | (princ ";;\tOriginal TIT dictionary file: ") |
| 280 | (princ (file-name-nondirectory filename)) | 280 | (princ (file-name-nondirectory filename)) |
| 281 | (princ "\n\n") | 281 | (princ "\n\n") |
| @@ -521,11 +521,8 @@ the generated Quail package is saved." | |||
| 521 | 521 | ||
| 522 | ;; Process the body part | 522 | ;; Process the body part |
| 523 | (tit-process-body) | 523 | (tit-process-body) |
| 524 | 524 | (generate-file-trailer | |
| 525 | (princ ";; Local Variables:\n") | 525 | filename :inhibit-provide t :compile t :coding nil)))))) |
| 526 | (princ ";; version-control: never\n") | ||
| 527 | (princ ";; no-update-autoloads: t\n") | ||
| 528 | (princ ";; End:\n")))))) | ||
| 529 | 526 | ||
| 530 | ;;;###autoload | 527 | ;;;###autoload |
| 531 | (defun batch-titdic-convert (&optional force) | 528 | (defun batch-titdic-convert (&optional force) |
| @@ -1135,11 +1132,10 @@ the generated Quail package is saved." | |||
| 1135 | ;; Explicitly set eol format to `unix'. | 1132 | ;; Explicitly set eol format to `unix'. |
| 1136 | (setq coding-system-for-write 'utf-8-unix) | 1133 | (setq coding-system-for-write 'utf-8-unix) |
| 1137 | (with-temp-file (expand-file-name quailfile dirname) | 1134 | (with-temp-file (expand-file-name quailfile dirname) |
| 1138 | (insert (format ";;; %s -*- lexical-binding:t -*-\n" | 1135 | (generate-file-heading quailfile) |
| 1139 | (file-name-nondirectory quailfile))) | ||
| 1140 | (insert (format-message ";; Quail package `%s'\n" name)) | 1136 | (insert (format-message ";; Quail package `%s'\n" name)) |
| 1141 | (insert (format-message | 1137 | (insert (format-message |
| 1142 | ";; Generated by the command `miscdic-convert'\n")) | 1138 | ";; Generated by the `miscdic-convert' function.\n")) |
| 1143 | (insert ";; Source dictionary file: " dicfile "\n") | 1139 | (insert ";; Source dictionary file: " dicfile "\n") |
| 1144 | (insert ";; Copyright notice of the source file\n") | 1140 | (insert ";; Copyright notice of the source file\n") |
| 1145 | (insert ";;------------------------------------------------------\n") | 1141 | (insert ";;------------------------------------------------------\n") |
| @@ -1161,11 +1157,8 @@ the generated Quail package is saved." | |||
| 1161 | (let ((dicbuf (current-buffer))) | 1157 | (let ((dicbuf (current-buffer))) |
| 1162 | (with-current-buffer dstbuf | 1158 | (with-current-buffer dstbuf |
| 1163 | (funcall converter dicbuf))))) | 1159 | (funcall converter dicbuf))))) |
| 1164 | (insert ";; Local Variables:\n" | 1160 | (generate-file-trailer |
| 1165 | ";; version-control: never\n" | 1161 | quailfile :inhibit-provide t :compile t :coding nil))) |
| 1166 | ";; no-update-autoloads: t\n" | ||
| 1167 | ";; End:\n\n" | ||
| 1168 | ";;; " quailfile " ends here\n"))) | ||
| 1169 | (setq tail (cdr tail))))) | 1162 | (setq tail (cdr tail))))) |
| 1170 | 1163 | ||
| 1171 | (defun batch-miscdic-convert () | 1164 | (defun batch-miscdic-convert () |
| @@ -1228,7 +1221,4 @@ The library is named pinyin.el, and contains the constant | |||
| 1228 | (insert "(provide 'pinyin)\n")) | 1221 | (insert "(provide 'pinyin)\n")) |
| 1229 | (kill-emacs 0))) | 1222 | (kill-emacs 0))) |
| 1230 | 1223 | ||
| 1231 | ;; Prevent "Local Variables" above confusing Emacs. | ||
| 1232 | |||
| 1233 | |||
| 1234 | ;;; titdic-cnv.el ends here | 1224 | ;;; titdic-cnv.el ends here |
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index 42e1fa22fac..dab367485e9 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el | |||
| @@ -26,6 +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 | 30 | ||
| 30 | (eval-when-compile (require 'cl-lib)) | 31 | (eval-when-compile (require 'cl-lib)) |
| 31 | 32 | ||
| @@ -158,10 +159,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." | |||
| 158 | (insert ")\n(setq url-cookie-secure-storage\n '") | 159 | (insert ")\n(setq url-cookie-secure-storage\n '") |
| 159 | (pp url-cookie-secure-storage (current-buffer))) | 160 | (pp url-cookie-secure-storage (current-buffer))) |
| 160 | (insert ")\n") | 161 | (insert ")\n") |
| 161 | (insert "\n;; Local Variables:\n" | 162 | (generate-file-trailer fname :inhibit-provide t :autoloads t) |
| 162 | ";; version-control: never\n" | ||
| 163 | ";; no-byte-compile: t\n" | ||
| 164 | ";; End:\n") | ||
| 165 | (setq-local version-control 'never) | 163 | (setq-local version-control 'never) |
| 166 | (write-file fname)) | 164 | (write-file fname)) |
| 167 | (setq url-cookies-changed-since-last-save nil)))) | 165 | (setq url-cookies-changed-since-last-save nil)))) |