aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorStefan Kangas2022-09-15 06:30:40 +0200
committerStefan Kangas2022-09-15 06:30:40 +0200
commit41551ccbf63df589ed50129e92fa8dfe457617d0 (patch)
tree393122ad365a8cae044174554b4ed53951c32414 /admin
parentb8e9239b47391c6628d94a4e2e91320c5366d27b (diff)
parent5543aea1b2b8c68481ae0ce2bb501d8484ef7f7c (diff)
downloademacs-41551ccbf63df589ed50129e92fa8dfe457617d0.tar.gz
emacs-41551ccbf63df589ed50129e92fa8dfe457617d0.zip
Merge from origin/emacs-28
5543aea1b2 Automate exporting etc/NEWS to HTML 23a91163ed * Makefile.in (uninstall): Remove the *.eln files. (Bug#5...
Diffstat (limited to 'admin')
-rw-r--r--admin/admin.el130
1 files changed, 130 insertions, 0 deletions
diff --git a/admin/admin.el b/admin/admin.el
index fececc86a4b..07a66c419df 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -778,6 +778,136 @@ Optional argument TYPE is type of output (nil means all)."
778 (if (member type (list nil m)) 778 (if (member type (list nil m))
779 (make-manuals-dist--1 root m)))) 779 (make-manuals-dist--1 root m))))
780 780
781(defun make-news-html-file (root version)
782 "Convert the NEWS file into an HTML file."
783 (interactive (let ((root
784 (if noninteractive
785 (or (pop command-line-args-left)
786 default-directory)
787 (read-directory-name "Emacs root directory: "
788 source-directory nil t))))
789 (list root
790 (read-string "Version number: " emacs-version))))
791 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
792 (user-error "%s doesn't seem to be the root of an Emacs source tree" root))
793 (let* ((dir (make-temp-file "emacs-news-file" t))
794 (orig (expand-file-name "etc/NEWS" root))
795 (new (expand-file-name (format "NEWS.%s.org" version) dir))
796 (html-file (format "%s.html" (file-name-base new)))
797 (copyright-years (format-time-string "%Y")))
798 (unwind-protect
799 (progn
800 (copy-file orig new)
801 (find-file new)
802
803 ;; Find the copyright range:
804 (goto-char (point-min))
805 (re-search-forward "^Copyright (C) \\([0-9-]+\\) Free Software Foundation, Inc.")
806 (setq copyright-years (match-string 1))
807
808 ;; Get rid of some unnecessary stuff:
809 (replace-regexp-in-region "^---$" "" (point-min) (point-max))
810 (replace-regexp-in-region "^\\+\\+\\+$" "" (point-min) (point-max))
811 (dolist (str '(" \n"
812 "GNU Emacs NEWS -- history of user-visible changes."
813 "Temporary note:"
814 "+++ indicates that all relevant manuals in doc/ have been updated."
815 "--- means no change in the manuals is needed."
816 "When you add a new item, use the appropriate mark if you are sure it"
817 "applies, and please also update docstrings as needed."
818 "You can narrow news to a specific version by calling 'view-emacs-news'"
819 "with a prefix argument or by typing 'C-u C-h C-n'."))
820 (replace-string-in-region str "" (point-min) (point-max)))
821
822 ;; Use Org-mode markers for <code>.
823 (replace-regexp-in-region
824 ;; This could probably be improved quite a bit...
825 (rx "'" (group (+ (not (any "'\n")))) "'")
826 "~\\1~" (point-min) (point-max))
827
828 ;; Format Emacs Lisp.
829 (while (re-search-forward "^ " nil t)
830 (backward-paragraph)
831 (insert "\n#+begin_src emacs-lisp")
832 (forward-paragraph)
833 (insert "#+end_src\n"))
834
835 ;; Insert Org-mode export headers.
836 (goto-char (point-min))
837 (insert (format
838 "\
839#+title: GNU Emacs %s NEWS -- history of user-visible changes
840#+author:
841#+options: author:nil creator:nil toc:1 num:2 *:nil \\n:nil
842#+language: en
843#+HTML_LINK_HOME: https://www.gnu.org/software/emacs
844#+html_head_extra: <link rel=\"stylesheet\" type=\"text/css\" href=\"/mini.css\" media=\"handheld\" />
845#+html_head_extra: <link rel=\"stylesheet\" type=\"text/css\" href=\"/layout.min.css\" media=\"screen\" />
846#+html_head_extra: <link rel=\"stylesheet\" type=\"text/css\" href=\"/print.min.css\" media=\"print\" />
847
848#+BEGIN_EXPORT html
849<div style=\"float:right;margin-left:1em;padding:3px;border:0px solid;text-align:center\">
850<a href=\"/graphics/gnu-head.jpg\">
851<img src=\"/graphics/gnu-head-sm.jpg\" alt=\" [image of the head
852of a GNU] \" width=\"129\" height=\"122\"/>
853</a>
854</div>
855#+END_EXPORT\n\n"
856 version))
857 (org-mode)
858 (let ((org-html-postamble
859 (format
860 "
861<p>
862Return to the <a href=\"/software/emacs/emacs.html\">GNU Emacs home page</a>.
863</p>
864
865<div id=\"footer\">
866<div class=\"unprintable\">
867
868<p>
869Please send FSF &amp; GNU inquiries to
870<a href=\"mailto:gnu@gnu.org\">&lt;gnu@gnu.org&gt;</a>.
871There are also <a href=\"/contact/\">other ways to contact</a>
872the FSF.
873Broken links and other corrections or suggestions can be sent to
874<a href=\"mailto:bug-gnu-emacs@gnu.org\">&lt;bug-gnu-emacs@gnu.org&gt;</a>.
875</p>
876</div>
877
878<p>
879 Copyright &copy; %s Free Software Foundation, Inc.
880</p>
881
882<p>This page is licensed under
883a <a href=\"https://creativecommons.org/licenses/by-sa/4.0\">CC-BY-SA</a>
884license.</p>
885
886<!--#include virtual=\"/server/bottom-notes.html\" -->
887
888<p class=\"unprintable\">
889Updated:
890<!-- timestamp start -->
891$Date: %s $
892<!-- timestamp end -->
893</p>
894</div>
895</div>"
896 copyright-years
897 ;; e.g. "2022/09/13 09:13:13"
898 (format-time-string "%Y/%M/%y %H:%m:%S"))))
899 ;; Actually export.
900 (org-html-export-to-html)
901 ;; Kill the .org buffer.
902 (kill-buffer (current-buffer))
903 ;; Move file into place.
904 (let ((old (expand-file-name html-file dir))
905 (new (expand-file-name html-file (expand-file-name "etc" root))))
906 (delete-file new)
907 (copy-file old new)
908 (find-file new))))
909 (delete-directory dir t))))
910
781 911
782;; Stuff to check new `defcustom's got :version tags. 912;; Stuff to check new `defcustom's got :version tags.
783;; Adapted from check-declare.el. 913;; Adapted from check-declare.el.