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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Alex @ 2019-03-14 14:57 UTC (permalink / raw)
  To: 33880

agrambot@gmail.com writes:

> 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?

Ping.  Is this okay to apply to master?





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  0 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2019-03-14 15:14 UTC (permalink / raw)
  To: Alex; +Cc: 33880

> From: Alex <agrambot@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Thu, 14 Mar 2019 08:57:13 -0600
> 
> agrambot@gmail.com writes:
> 
> > 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?
> 
> Ping.  Is this okay to apply to master?

Sorry for not responding earlier.

I don't think compressing *.ps files is a good idea, because then they
cannot be printed without manually uncompressing them.

As for NEWS, I don't have a strong opinion, but it sounds like a very
small gain for the trouble.  What do others think?  Perhaps this
should be discussed on emacs-devel first.

Thanks.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-14 15:14   ` Eli Zaretskii
@ 2019-03-14 15:43     ` Alex
  2019-03-14 15:54     ` Michael Albinus
  1 sibling, 0 replies; 14+ messages in thread
From: Alex @ 2019-03-14 15:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33880

Eli Zaretskii <eliz@gnu.org> writes:

> Sorry for not responding earlier.

No worries.

> I don't think compressing *.ps files is a good idea, because then they
> cannot be printed without manually uncompressing them.

That makes sense; I just saw the TODO and figured that I might as well
do it while I was there.

> As for NEWS, I don't have a strong opinion, but it sounds like a very
> small gain for the trouble.  What do others think?  Perhaps this
> should be discussed on emacs-devel first.
>
> Thanks.

I don't think it's much trouble (though I admit that a MB isn't much of
a deal these days), especially after the patch has already been made.

I'll make a thread over there.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2019-03-14 15:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33880, Alex

Eli Zaretskii <eliz@gnu.org> writes:

> As for NEWS, I don't have a strong opinion, but it sounds like a very
> small gain for the trouble.  What do others think?  Perhaps this
> should be discussed on emacs-devel first.

IIRC, Stefan wrote a small code snippet which scans NEWS files and tries
to determine, when a Lisp object was added to Emacs. I don't know
whether this would still work with compressed NEWS files.

Given, that disk space of 1 MB is nothing today, I'm not in favour of
such a compression. I don't know what it is good for, honestly.

> Thanks.

Best regards, Michael.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-14 15:54     ` Michael Albinus
@ 2019-03-14 16:23       ` Alex
  2019-03-14 17:59         ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Alex @ 2019-03-14 16:23 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 33880

Michael Albinus <michael.albinus@gmx.de> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> As for NEWS, I don't have a strong opinion, but it sounds like a very
>> small gain for the trouble.  What do others think?  Perhaps this
>> should be discussed on emacs-devel first.
>
> IIRC, Stefan wrote a small code snippet which scans NEWS files and tries
> to determine, when a Lisp object was added to Emacs. I don't know
> whether this would still work with compressed NEWS files.

It should work similarly to scanning *.el.gz files. Depending on how the
snippet was made (e.g., with a regex that accepts *.gz NEWS files), it
might even work with no changes.

> Given, that disk space of 1 MB is nothing today, I'm not in favour of
> such a compression. I don't know what it is good for, honestly.

It's indeed barely anything, but I also don't see much of a reason to
not do it. If we're already compressing a bunch of files, why not
compress the stale NEWS files at the same time?





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-14 16:23       ` Alex
@ 2019-03-14 17:59         ` Eli Zaretskii
  2019-03-14 21:33           ` Alex
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2019-03-14 17:59 UTC (permalink / raw)
  To: Alex; +Cc: 33880, michael.albinus

> From: Alex <agrambot@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  33880@debbugs.gnu.org
> Date: Thu, 14 Mar 2019 10:23:16 -0600
> 
> It's indeed barely anything, but I also don't see much of a reason to
> not do it. If we're already compressing a bunch of files, why not
> compress the stale NEWS files at the same time?

FWIW, I use those "stale" NEWS files all the time, because I
frequently need to establish what was a version of Emacs where some
feature was first introduced or announced.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  0 siblings, 2 replies; 14+ messages in thread
From: Alex @ 2019-03-14 21:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33880, michael.albinus

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  33880@debbugs.gnu.org
>> Date: Thu, 14 Mar 2019 10:23:16 -0600
>> 
>> It's indeed barely anything, but I also don't see much of a reason to
>> not do it. If we're already compressing a bunch of files, why not
>> compress the stale NEWS files at the same time?
>
> FWIW, I use those "stale" NEWS files all the time, because I
> frequently need to establish what was a version of Emacs where some
> feature was first introduced or announced.

Oh, I didn't mean that "no one uses these dusty old files", but rather
"no one often uses these files outside of Emacs". If you view them in
Emacs, then `auto-compression-mode' decompresses the files on the fly. I
think compression here is less of an issue than it is for Emacs Lisp
files, which are already compressed and used for source code lookup all
the time.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-14 21:33           ` Alex
@ 2019-03-14 22:00             ` Glenn Morris
  2019-03-15  4:53             ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Glenn Morris @ 2019-03-14 22:00 UTC (permalink / raw)
  To: Alex; +Cc: 33880, michael.albinus


FWIW, I think files like NEWS belong in /usr/share/doc
(bug#25781, I haven't found any time to work on it yet).
I think compressing the files installed there would be very natural.
(Eg Debian seems to compress text files in /usr/share/doc by default.
Looks like Red Hat does not, though.)





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2019-03-15  4:53 UTC (permalink / raw)
  To: Alex; +Cc: 33880, michael.albinus

> From: Alex <agrambot@gmail.com>
> Cc: michael.albinus@gmx.de,  33880@debbugs.gnu.org
> Date: Thu, 14 Mar 2019 15:33:24 -0600
> 
> If you view them in Emacs, then `auto-compression-mode' decompresses
> the files on the fly.

I usually grep them outside Emacs.





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  0 siblings, 2 replies; 14+ messages in thread
From: Alex @ 2019-03-16 18:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 33880

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: michael.albinus@gmx.de,  33880@debbugs.gnu.org
>> Date: Thu, 14 Mar 2019 15:33:24 -0600
>> 
>> If you view them in Emacs, then `auto-compression-mode' decompresses
>> the files on the fly.
>
> I usually grep them outside Emacs.

Any chance you have zgrep on your system?

If not, then do you not have an uncompressed git repository directory to
grep?





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-16 18:28               ` Alex
@ 2019-03-16 18:51                 ` Eli Zaretskii
  2019-03-16 20:08                 ` Michael Albinus
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2019-03-16 18:51 UTC (permalink / raw)
  To: Alex; +Cc: 33880

> From: Alex <agrambot@gmail.com>
> Cc: 33880@debbugs.gnu.org
> Date: Sat, 16 Mar 2019 12:28:16 -0600
> 
> > I usually grep them outside Emacs.
> 
> Any chance you have zgrep on your system?

It's a Posix shell script, so not very useful on MS-Windows.

> If not, then do you not have an uncompressed git repository directory to
> grep?

Not on every machine I work on.  Besides, sometimes I need to look in
a released Emacs, whose sources are in a separate tree.






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

* bug#33880: [PATCH] Compress past NEWS files during installation
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2019-03-16 20:08 UTC (permalink / raw)
  To: Alex; +Cc: 33880

Alex <agrambot@gmail.com> writes:

Hi Alex,

>>> If you view them in Emacs, then `auto-compression-mode' decompresses
>>> the files on the fly.
>>
>> I usually grep them outside Emacs.
>
> Any chance you have zgrep on your system?

I believe we could find a solution for all these problems. But I still
don't understand why we should.

Maybe you said it already, and I didn't care enough: could you pls say,
what is the advantage of compressed NEWS files, that we must do this.

Best regards, Michael





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

* bug#33880: [PATCH] Compress past NEWS files during installation
  2019-03-16 20:08                 ` Michael Albinus
@ 2019-06-23 20:02                   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 20:02 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 33880, Alex

Michael Albinus <michael.albinus@gmx.de> writes:

> Alex <agrambot@gmail.com> writes:
>
> Hi Alex,
>
>>>> If you view them in Emacs, then `auto-compression-mode' decompresses
>>>> the files on the fly.
>>>
>>> I usually grep them outside Emacs.
>>
>> Any chance you have zgrep on your system?
>
> I believe we could find a solution for all these problems. But I still
> don't understand why we should.
>
> Maybe you said it already, and I didn't care enough: could you pls say,
> what is the advantage of compressed NEWS files, that we must do this.

The space gain here was quite small, and there are drawbacks to
compressing the NEWS files, and nobody seemed really enthusiastic about
it, so I think the decision is not to do this, and I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[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).