diff options
| author | Stefan Kangas | 2022-09-17 06:30:41 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-09-17 06:30:41 +0200 |
| commit | 34a97f045a13fe6ad279f57ecdc6f7a3bee7caa2 (patch) | |
| tree | ec12e3ec314938f59ae51b40d83d67e3a3e83b0f /admin/admin.el | |
| parent | 637cf3ba4955449bc2510da385d39c21f2e0fc42 (diff) | |
| parent | 320f0cac8008a54b988c0166dbfd195f5de8790f (diff) | |
| download | emacs-34a97f045a13fe6ad279f57ecdc6f7a3bee7caa2.tar.gz emacs-34a97f045a13fe6ad279f57ecdc6f7a3bee7caa2.zip | |
Merge from origin/emacs-28
320f0cac80 ; * etc/NEWS: Fix typo.
5dbe4fa64a Simplify regexp in make-news-html-file
069ffbda09 * admin/admin.el (make-news-html-file): Set id on correct ...
bcc84ac7fe Add version headlines to HTML NEWS export
5d227ae83e ; * etc/NEWS: Fix formatting.
# Conflicts:
# etc/NEWS
Diffstat (limited to 'admin/admin.el')
| -rw-r--r-- | admin/admin.el | 87 |
1 files changed, 53 insertions, 34 deletions
diff --git a/admin/admin.el b/admin/admin.el index 60073f103ba..247bbd5f4e5 100644 --- a/admin/admin.el +++ b/admin/admin.el | |||
| @@ -781,7 +781,7 @@ Optional argument TYPE is type of output (nil means all)." | |||
| 781 | (defvar admin--org-export-headers-format "\ | 781 | (defvar admin--org-export-headers-format "\ |
| 782 | #+title: GNU Emacs %s NEWS -- history of user-visible changes | 782 | #+title: GNU Emacs %s NEWS -- history of user-visible changes |
| 783 | #+author: | 783 | #+author: |
| 784 | #+options: author:nil creator:nil toc:1 num:2 *:nil \\n:t ^:nil tex:nil | 784 | #+options: author:nil creator:nil toc:2 num:3 *:nil \\n:t ^:nil tex:nil |
| 785 | #+language: en | 785 | #+language: en |
| 786 | #+HTML_LINK_HOME: /software/emacs | 786 | #+HTML_LINK_HOME: /software/emacs |
| 787 | #+HTML_LINK_UP: /software/emacs | 787 | #+HTML_LINK_UP: /software/emacs |
| @@ -859,12 +859,13 @@ $Date: %s $ | |||
| 859 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) | 859 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) |
| 860 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) | 860 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) |
| 861 | (admin--require-external-package 'htmlize) | 861 | (admin--require-external-package 'htmlize) |
| 862 | (let* ((orig (expand-file-name "etc/NEWS" root)) | 862 | (let* ((newsfile (expand-file-name "etc/NEWS" root)) |
| 863 | (new (expand-file-name (format "etc/NEWS.%s.org" version) root)) | 863 | (orgfile (expand-file-name (format "etc/NEWS.%s.org" version) root)) |
| 864 | (html-file (format "%s.html" (file-name-base new))) | 864 | (html (format "%s.html" (file-name-base orgfile))) |
| 865 | (copyright-years (format-time-string "%Y"))) | 865 | (copyright-years (format-time-string "%Y"))) |
| 866 | (copy-file orig new t) | 866 | (delete-file orgfile) |
| 867 | (find-file new) | 867 | (copy-file newsfile orgfile t) |
| 868 | (find-file orgfile) | ||
| 868 | 869 | ||
| 869 | ;; Find the copyright range. | 870 | ;; Find the copyright range. |
| 870 | (goto-char (point-min)) | 871 | (goto-char (point-min)) |
| @@ -890,30 +891,17 @@ $Date: %s $ | |||
| 890 | 891 | ||
| 891 | ;; Use Org-mode markers for 'symbols', 'C-x k', etc. | 892 | ;; Use Org-mode markers for 'symbols', 'C-x k', etc. |
| 892 | (replace-regexp-in-region | 893 | (replace-regexp-in-region |
| 893 | (rx-let ((key (seq | 894 | (rx (or (: (group (in " \t\n(")) |
| 894 | ;; Modifier (optional) | 895 | "'" |
| 895 | (? (any "ACHMSs") "-") | 896 | (group (+ (or (not (in "'\n")) |
| 896 | (or | 897 | (: "'" (not (in " .,\t\n)")))))) |
| 897 | ;; single key | 898 | "'" |
| 898 | (not (any " \n")) | 899 | (group (in ",.;:!? \t\n)"))) |
| 899 | ;; "<return>" and "<remap> <foo>" | 900 | ;; Buffer names, e.g. "*scratch*". |
| 900 | (seq "<" | 901 | (: "\"" |
| 901 | (+ (any "A-Za-z-")) | 902 | (group-n 2 "*" (+ (not (in "*\""))) "*") |
| 902 | (+ (seq " " (+ (any "A-Za-z-")))) | 903 | "\""))) |
| 903 | ">") | 904 | "\\1~\\2~\\3" (point-min) (point-max)) |
| 904 | "NUL" "RET" "LFD" "TAB" | ||
| 905 | "ESC" "SPC" "DEL"))) | ||
| 906 | (email (seq (+ (not (any " @\n"))) | ||
| 907 | "@" | ||
| 908 | (+ (not (any " @\n"))))) | ||
| 909 | (lisp-symbol (regexp lisp-mode-symbol-regexp))) | ||
| 910 | (rx "'" (group | ||
| 911 | (or lisp-symbol | ||
| 912 | |||
| 913 | (seq "M-x " lisp-symbol) | ||
| 914 | (seq key (+ " " key)))) | ||
| 915 | "'")) | ||
| 916 | "~\\1~" (point-min) (point-max)) | ||
| 917 | 905 | ||
| 918 | ;; Format code blocks. | 906 | ;; Format code blocks. |
| 919 | (while (re-search-forward "^ " nil t) | 907 | (while (re-search-forward "^ " nil t) |
| @@ -939,6 +927,37 @@ $Date: %s $ | |||
| 939 | (org-mode) | 927 | (org-mode) |
| 940 | (save-buffer) | 928 | (save-buffer) |
| 941 | 929 | ||
| 930 | ;; Make everything one level lower. | ||
| 931 | (goto-char (point-min)) | ||
| 932 | (while (re-search-forward (rx bol (group (+ "*")) " ") nil t) | ||
| 933 | (replace-match "*\\1" nil nil nil 1)) | ||
| 934 | |||
| 935 | ;; Insert anchors for different versions. | ||
| 936 | (goto-char (point-min)) | ||
| 937 | (let (last-major last-minor) | ||
| 938 | (while (re-search-forward (rx bol "** " (+ (not "\n")) "in Emacs " | ||
| 939 | (group digit digit) "." (group digit) | ||
| 940 | eol) | ||
| 941 | nil t) | ||
| 942 | (unless (and (equal (match-string 1) last-major) | ||
| 943 | (equal (match-string 2) last-minor)) | ||
| 944 | (setq last-major (match-string 1)) | ||
| 945 | (setq last-minor (match-string 2)) | ||
| 946 | (forward-line -1) | ||
| 947 | (insert (format | ||
| 948 | (concat | ||
| 949 | "#+HTML: <p> </p>\n" | ||
| 950 | "* Changes in Emacs %s.%s\n" | ||
| 951 | ;; Add anchor to allow linking to | ||
| 952 | ;; e.g. "NEWS.28.html#28.1". | ||
| 953 | ":PROPERTIES:\n" | ||
| 954 | ":CUSTOM_ID: %s.%s\n" | ||
| 955 | ":END:\n") | ||
| 956 | last-major last-minor | ||
| 957 | last-major last-minor))))) | ||
| 958 | |||
| 959 | (save-buffer) | ||
| 960 | |||
| 942 | ;; Make the HTML export. | 961 | ;; Make the HTML export. |
| 943 | (let* ((org-html-postamble | 962 | (let* ((org-html-postamble |
| 944 | (format admin--org-html-postamble | 963 | (format admin--org-html-postamble |
| @@ -950,12 +969,12 @@ $Date: %s $ | |||
| 950 | (org-html-export-as-html)) | 969 | (org-html-export-as-html)) |
| 951 | 970 | ||
| 952 | ;; Write HTML to file. | 971 | ;; Write HTML to file. |
| 953 | (let ((new (expand-file-name html-file (expand-file-name "etc" root)))) | 972 | (let ((html (expand-file-name html (expand-file-name "etc" root)))) |
| 954 | (write-file new) | 973 | (write-file html) |
| 955 | (unless noninteractive | 974 | (unless noninteractive |
| 956 | (find-file new) | 975 | (find-file html) |
| 957 | (html-mode)) | 976 | (html-mode)) |
| 958 | (message "Successfully exported HTML to %s" new)))) | 977 | (message "Successfully exported HTML to %s" html)))) |
| 959 | 978 | ||
| 960 | 979 | ||
| 961 | ;; Stuff to check new `defcustom's got :version tags. | 980 | ;; Stuff to check new `defcustom's got :version tags. |