unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33880: [PATCH] Compress past NEWS files during installation
@ 2018-12-26 19:49 agrambot
  2019-03-14 14:57 ` Alex
  0 siblings, 1 reply; 14+ messages in thread
From: agrambot @ 2018-12-26 19:49 UTC (permalink / raw)
  To: 33880

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

This shaves off just over a MB off of the installation using gzip -9.
While I was at it, I put in the compression of etc/refcards/*.ps, which
covers part of a TODO.

I wanted to compress etc/refcards/*.tex as well, but I noticed that it
would affect the Makefile that is also installed. It appears to be the
only Makefile that's installed; if there's little or no reason for it,
would it be okay to remove it during installation and compress the *.tex
files as well?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Compress-past-NEWS-files-and-etc-refcards-.ps.patch --]
[-- Type: text/x-patch, Size: 4420 bytes --]

From 40bd26ccbbae7c486dc2be39fe21147694889af4 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Mon, 24 Dec 2018 18:06:30 -0600
Subject: [PATCH] Compress past NEWS files and etc/refcards/*.ps

Do not compress NEWS or ORG-NEWS as those are actively updated and
shouldn't rely on decompression support to be viewed.

* Makefile.in (install-arch-indep): Do it.

* lisp/help.el (view-emacs-news): Refactor slightly, and support
compressed NEWS files when `auto-compression-mode' is enabled.
---
 Makefile.in  |  9 ++++++---
 etc/NEWS     |  3 +++
 lisp/help.el | 28 +++++++++++++++++-----------
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index f0b2b66c88..bbb028a74a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -541,8 +541,7 @@ set_installuser=
 ## install-etcdoc installs the relevant DOC.
 
 ## Note that we install etc/refcards/*.ps if present.
-## TODO we should compress these if GZIP_PROG is set.
-## It would be simpler to have a separate install rule for etc/refcards
+## TODO It would be simpler to have a separate install rule for etc/refcards
 ## (maybe move it to doc/refcards?).
 
 ## Note that the Makefiles in the etc directory are potentially useful
@@ -616,7 +615,11 @@ install-arch-indep:
 	  for f in `find . -name "*.elc" -print | sed 's/.elc$$/.el/'`; do \
 	    ${GZIP_PROG} -9n "$$f"; \
 	  done; \
-	  ${GZIP_PROG} -9n "../etc/publicsuffix.txt"; \
+	  cd "$(DESTDIR)${etcdir}" && \
+	  for f in `find . -maxdepth 1 -name "*NEWS*" -not -name NEWS \
+	-not -name ORG-NEWS` `find refcards -name "*.ps"` "publicsuffix.txt"; do \
+	    ${GZIP_PROG} -9n "$$f"; \
+	  done; \
 	}
 	-chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
 
diff --git a/etc/NEWS b/etc/NEWS
index e427e84780..586e7065d1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -37,6 +37,9 @@ functions 'json-serialize', 'json-insert', 'json-parse-string', and
 'json-parse-buffer' are typically much faster than their Lisp
 counterparts from json.el.
 
+** NEWS files for past Emacs versions and packages are now compressed
+by default.
+
 ** The etags program now uses the C library's regular expression matcher
 when possible, and a compatible regex substitute otherwise.  This will
 let developers maintain Emacs's own regex code without having to also
diff --git a/lisp/help.el b/lisp/help.el
index ad782f74ca..e0738da485 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -350,16 +350,18 @@ view-emacs-news
 	      (mapc
 	       (lambda (file)
 		 (with-temp-buffer
-		   (insert-file-contents
-		    (expand-file-name file data-directory))
-		   (while (re-search-forward
-			   (if (member file '("NEWS.18" "NEWS.1-17"))
-			       "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
-			     "^\\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)
-		     (setq res (cons (match-string-no-properties 1) res)))))
-	       (cons "NEWS"
-		     (directory-files data-directory nil
-				      "^NEWS\\.[0-9][-0-9]*$" nil)))
+		   (insert-file-contents file)
+                   (let ((section (if (string-match "\\`NEWS\\.\\(1-17\\|18\\)"
+                                                    (file-name-nondirectory file))
+                                      "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
+			            "^\\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)")))
+                     (while (re-search-forward section nil t)
+                       (setq res (cons (match-string-no-properties 1) res))))))
+	       (cons (expand-file-name "NEWS" data-directory)
+		     (directory-files data-directory
+                                      t
+				      (format "^NEWS\\.[0-9][-0-9]*%s\\'"
+                                              (regexp-opt load-file-rep-suffixes)))))
 	      (sort (delete-dups res) #'string>)))
 	   (current (car all-versions)))
       (setq version (completing-read
@@ -385,7 +387,11 @@ view-emacs-news
 		((< vn 18) "NEWS.1-17")
 		(t (format "NEWS.%d" vn))))
 	 res)
-    (view-file (expand-file-name file data-directory))
+    (view-file (or (locate-file file
+                                (list data-directory)
+                                load-file-rep-suffixes)
+                   (error "Requested NEWS file is compressed; please enable \
+`auto-compression-mode' and try again")))
     (widen)
     (goto-char (point-min))
     (when (stringp version)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-06-23 20:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26 19:49 bug#33880: [PATCH] Compress past NEWS files during installation agrambot
2019-03-14 14:57 ` Alex
2019-03-14 15:14   ` Eli Zaretskii
2019-03-14 15:43     ` Alex
2019-03-14 15:54     ` Michael Albinus
2019-03-14 16:23       ` Alex
2019-03-14 17:59         ` Eli Zaretskii
2019-03-14 21:33           ` Alex
2019-03-14 22:00             ` Glenn Morris
2019-03-15  4:53             ` Eli Zaretskii
2019-03-16 18:28               ` Alex
2019-03-16 18:51                 ` Eli Zaretskii
2019-03-16 20:08                 ` Michael Albinus
2019-06-23 20:02                   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).