diff mbox series

[bug#42738,v4] gnu: emacs: Update to 27.1.

Message ID DM5PR1001MB210589E35972B5314D4D8381C5550@DM5PR1001MB2105.namprd10.prod.outlook.com
State Accepted
Headers show
Series [bug#42738,v4] gnu: emacs: Update to 27.1. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Morgan Smith Aug. 27, 2020, 9:59 p.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs.scm (emacs): Update to 27.1.
[arguments]: Add --with-cairo and --with-modules to #:configure-flags. Add
restore-emacs-pdump phase.
[inputs]: Add cairo, libxaw, jansson, gmp, and harfbuzz. Remove imagemagick
and libxft.
[native-inputs]: Add texlive.
(emacs-wide-int): Mark as deprecated package.
(emacs-no-x):
[arguments]: Add --with-jpeg=no --with-gif=no --with-tiff=no
to #:configure-flags.
---

Hello!

Your patch didn't build for me so I made some slight changes.  I added
libxaw as an input, and added some configure flags to emacs-no-x.

I'm now using this patch to run Emacs 27.1 on my main machine
(inadvisable I know), and my personal config is running flawlessy with
the exception of emacs-clojure-mode, emacs-elisp-regs, and
emacs-helpful.

Hopefully this helps!

Morgan


 gnu/packages/emacs.scm | 76 +++++++++++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 30 deletions(-)

Comments

Jack Hill Aug. 28, 2020, 5:35 a.m. UTC | #1
Hi Morgan,

On Thu, 27 Aug 2020, Morgan.J.Smith@outlook.com wrote:

> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * gnu/packages/emacs.scm (emacs): Update to 27.1.
> [arguments]: Add --with-cairo and --with-modules to #:configure-flags. Add
> restore-emacs-pdump phase.
> [inputs]: Add cairo, libxaw, jansson, gmp, and harfbuzz. Remove imagemagick
> and libxft.
> [native-inputs]: Add texlive.
> (emacs-wide-int): Mark as deprecated package.
> (emacs-no-x):
> [arguments]: Add --with-jpeg=no --with-gif=no --with-tiff=no
> to #:configure-flags.
> ---
>
> Hello!
>
> Your patch didn't build for me so I made some slight changes.  I added
> libxaw as an input, and added some configure flags to emacs-no-x.
>
> I'm now using this patch to run Emacs 27.1 on my main machine
> (inadvisable I know), and my personal config is running flawlessy with
> the exception of emacs-clojure-mode, emacs-elisp-regs, and
> emacs-helpful.
>
> Hopefully this helps!

Indeed it is, thank you!

Best,
Jack
Ludovic Courtès Aug. 28, 2020, 2:18 p.m. UTC | #2
Hi Morgan, Mark, and all,

Morgan.J.Smith@outlook.com skribis:

> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * gnu/packages/emacs.scm (emacs): Update to 27.1.
> [arguments]: Add --with-cairo and --with-modules to #:configure-flags. Add
> restore-emacs-pdump phase.
> [inputs]: Add cairo, libxaw, jansson, gmp, and harfbuzz. Remove imagemagick
> and libxft.
> [native-inputs]: Add texlive.
> (emacs-wide-int): Mark as deprecated package.
> (emacs-no-x):
> [arguments]: Add --with-jpeg=no --with-gif=no --with-tiff=no
> to #:configure-flags.

I see that Mark committed a similar patch just yesterday:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?id=36a09d185343375a5cba370431870f9c4435d623

I suppose Mark hadn’t seen the ongoing discussion.

Mark, Morgan: could you see if there’s anything we’re missing from the
patch Morgan submitted?

At any rate, thanks a lot for the work everyone put in!

Ludo’, a happy Emacs user.
Pierre Neidhardt Aug. 28, 2020, 2:38 p.m. UTC | #3
I confirm that with Mark's commit 
emacs-clojure-mode and emacs-elisp-refs are also broken.

Cheers!
Brett Gilio Aug. 28, 2020, 5 p.m. UTC | #4
Ludovic Courtès <ludo@gnu.org> writes:

> Hi Morgan, Mark, and all,
>
> Morgan.J.Smith@outlook.com skribis:
>
>> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>>
>> * gnu/packages/emacs.scm (emacs): Update to 27.1.
>> [arguments]: Add --with-cairo and --with-modules to #:configure-flags. Add
>> restore-emacs-pdump phase.
>> [inputs]: Add cairo, libxaw, jansson, gmp, and harfbuzz. Remove imagemagick
>> and libxft.
>> [native-inputs]: Add texlive.
>> (emacs-wide-int): Mark as deprecated package.
>> (emacs-no-x):
>> [arguments]: Add --with-jpeg=no --with-gif=no --with-tiff=no
>> to #:configure-flags.
>
> I see that Mark committed a similar patch just yesterday:
>
>   https://git.savannah.gnu.org/cgit/guix.git/commit/?id=36a09d185343375a5cba370431870f9c4435d623
>
> I suppose Mark hadn’t seen the ongoing discussion.
>
> Mark, Morgan: could you see if there’s anything we’re missing from the
> patch Morgan submitted?
>
> At any rate, thanks a lot for the work everyone put in!
>
> Ludo’, a happy Emacs user.

Also, are we planning to keep emacs-next and have it track 28.x or
remove it?

Brett Gilio
Jack Hill Aug. 28, 2020, 5:08 p.m. UTC | #5
On Fri, 28 Aug 2020, Brett Gilio wrote:

> Also, are we planning to keep emacs-next and have it track 28.x or
> remove it?

I believe bandali was planning to track 28.x.

Best,
Jack
Mark H Weaver Aug. 28, 2020, 6:57 p.m. UTC | #6
Hello Guix,

Ludovic Courtès <ludo@gnu.org> wrote:

> Morgan.J.Smith@outlook.com skribis:
>
>> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>>
>> * gnu/packages/emacs.scm (emacs): Update to 27.1.
>> [arguments]: Add --with-cairo and --with-modules to #:configure-flags. Add
>> restore-emacs-pdump phase.
>> [inputs]: Add cairo, libxaw, jansson, gmp, and harfbuzz. Remove imagemagick
>> and libxft.
>> [native-inputs]: Add texlive.
>> (emacs-wide-int): Mark as deprecated package.
>> (emacs-no-x):
>> [arguments]: Add --with-jpeg=no --with-gif=no --with-tiff=no
>> to #:configure-flags.
>
> I see that Mark committed a similar patch just yesterday:
>
>   https://git.savannah.gnu.org/cgit/guix.git/commit/?id=36a09d185343375a5cba370431870f9c4435d623
>
> I suppose Mark hadn’t seen the ongoing discussion.

Indeed, I hadn't.  Gah, I'm terribly sorry about this.  I had done some
quick web searches for preexisting work on this, but clearly they were
insufficient, and I've never subscribed to the patches list.  In the
future, I'll know not to rely on web search engines for this.

> Mark, Morgan: could you see if there’s anything we’re missing from the
> patch Morgan submitted?

Looking now, here are the main differences I see between our patches:

* I found that I had to remove the 'restore-emacs-pdump' phase from most
  of the other emacs variants, namely the ones that use
  'gnu-build-system', because otherwise the inherited
  'restore-emacs-pdump' phase would fail.  Morgan's patch seems not to
  consider most of the other emacs variants, and I'm not sure if they
  were tested.  I briefly tested all of them except for 'guile-emacs'.

* Morgan removed the snippet code that deletes "eshell/esh-groups.el",
  whereas I replaced it with a call to 'find-files' to remove it only if
  present, as the previous comment suggested.  I'm not sure if this is
  still needed, though.

* Morgan's patch adds "libxaw" to inputs and "texinfo" to native-inputs.
  What's the rationale for these?

* I added 'pango' to the inputs, because the Emacs NEWS mentioned that
  Pango was used for font rendering when "--with-cairo" is used.
  However, it may be that "pango" finds its way into the build inputs
  without being explicitly mentioned.

* Morgan removed 'libxft' from the inputs of 'emacs', whereas I didn't.
  This was an oversight on my part.  However, if we remove it, it's
  possible that we might need to add it back to 'emacs-no-x-toolkit'.
  The references that I see to Pango in the Emacs code are within
  "#ifdef HAVE_GTK3".

* In 'emacs-no-x', my patch removes the new graphical library inputs
  (cairo, pango, and harfbuzz) and the "--with-cairo" flag, whereas
  Morgan's patch leaves "cairo" and "harfbuzz" as inputs, and overwrites
  the inherited configure-flags to be precisely ("--with-jpeg=no"
  "--with-gif=no" "--with-tiff=no"), apparently discarding the inherited
  "--with-modules" and "--disable-build-details" flags.

* Morgan made 'emacs-wide-int' into a deprecated package, whereas I
  thought that it might still be useful.  My rationale was this: from a
  brief skim, it looks like '--with-wide-int' might make *immediate*
  integers wider, which for some applications might perform much better
  than the heap-allocated arbitrary-size integers supported by Emacs 27.
  However, I didn't look carefully at this.

* I updated "emacs-exec-path.patch" and removed
  "emacs27-exec-path.patch", whereas Morgan's patch keeps both files and
  possibly leaves "emacs-exec-path.patch" orphaned.

* I updated the patches to apply cleanly to Emacs 27, although this was
  not strictly needed.

* I updated 'notmuch' in the previous commit to a version that builds
  successfully with Emacs 27.

Pierre Neidhardt <mail@ambrevar.xyz> wrote:
> I confirm that with Mark's commit
> emacs-clojure-mode and emacs-elisp-refs are also broken.

Sorry about that.  If the Emacs 27 update breaks important packages, it
might be that reverting it is the proper action.  If the maintainers
decide to do this, I would not object.

   Best regards,
       Mark
Morgan Smith Aug. 28, 2020, 9:10 p.m. UTC | #7
Hello!

It seems I am taking some credit for Jack Hill's patch. I simply took
Jack's patch (labeled as patch v3 in the debbugs thread) and attempted
to build it with my personal config. I noticed that it wouldn't build
properly since emacs wanted libxaw and emacs-no-x wanted some image
librarys (libtiff, libjpeg, etc). The only contributions I made, where
to add libxaw to emacs and to add the configure flags to emacs-no-x. I
made these changes and posted them as patch v4. However, the patch Mark
committed does build for me so you can ignore my contributions (which
weren't well thought out to begin with).

The rest of your questions should be directed to Jack.

(Also just my 2 cents, we should have upgraded emacs-next to 27.1 and
only upgraded emacs a week later. Emacs deserves more care than most
packages due to its dependence on so many other packages. Not trying to
shame anyone, just something to think of for next time.)

Thanks,
Morgan

On 8/28/20 2:57 PM, Mark H Weaver wrote:
> Looking now, here are the main differences I see between our patches:
> 
> * I found that I had to remove the 'restore-emacs-pdump' phase from most
>   of the other emacs variants, namely the ones that use
>   'gnu-build-system', because otherwise the inherited
>   'restore-emacs-pdump' phase would fail.  Morgan's patch seems not to
>   consider most of the other emacs variants, and I'm not sure if they
>   were tested.  I briefly tested all of them except for 'guile-emacs'.
> 
> * Morgan removed the snippet code that deletes "eshell/esh-groups.el",
>   whereas I replaced it with a call to 'find-files' to remove it only if
>   present, as the previous comment suggested.  I'm not sure if this is
>   still needed, though.
> 
> * Morgan's patch adds "libxaw" to inputs and "texinfo" to native-inputs.
>   What's the rationale for these?
> 
> * I added 'pango' to the inputs, because the Emacs NEWS mentioned that
>   Pango was used for font rendering when "--with-cairo" is used.
>   However, it may be that "pango" finds its way into the build inputs
>   without being explicitly mentioned.
> 
> * Morgan removed 'libxft' from the inputs of 'emacs', whereas I didn't.
>   This was an oversight on my part.  However, if we remove it, it's
>   possible that we might need to add it back to 'emacs-no-x-toolkit'.
>   The references that I see to Pango in the Emacs code are within
>   "#ifdef HAVE_GTK3".
> 
> * In 'emacs-no-x', my patch removes the new graphical library inputs
>   (cairo, pango, and harfbuzz) and the "--with-cairo" flag, whereas
>   Morgan's patch leaves "cairo" and "harfbuzz" as inputs, and overwrites
>   the inherited configure-flags to be precisely ("--with-jpeg=no"
>   "--with-gif=no" "--with-tiff=no"), apparently discarding the inherited
>   "--with-modules" and "--disable-build-details" flags.
> 
> * Morgan made 'emacs-wide-int' into a deprecated package, whereas I
>   thought that it might still be useful.  My rationale was this: from a
>   brief skim, it looks like '--with-wide-int' might make *immediate*
>   integers wider, which for some applications might perform much better
>   than the heap-allocated arbitrary-size integers supported by Emacs 27.
>   However, I didn't look carefully at this.
> 
> * I updated "emacs-exec-path.patch" and removed
>   "emacs27-exec-path.patch", whereas Morgan's patch keeps both files and
>   possibly leaves "emacs-exec-path.patch" orphaned.
> 
> * I updated the patches to apply cleanly to Emacs 27, although this was
>   not strictly needed.
> 
> * I updated 'notmuch' in the previous commit to a version that builds
>   successfully with Emacs 27.
> 
> Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>> I confirm that with Mark's commit
>> emacs-clojure-mode and emacs-elisp-refs are also broken.
> 
> Sorry about that.  If the Emacs 27 update breaks important packages, it
> might be that reverting it is the proper action.  If the maintainers
> decide to do this, I would not object.
> 
>    Best regards,
>        Mark
>
Giovanni Biscuolo Aug. 29, 2020, 5:19 p.m. UTC | #8
Mark H Weaver <mhw@netris.org> writes:

[...]

> Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>> I confirm that with Mark's commit
>> emacs-clojure-mode

I've filed bug#43090 with a trivial patch for emacs-clojure-mode, no
need to revert Emacs 27.1 for this bug IMHO.

> and emacs-elisp-refs are also broken.

is there a specific bug report for this plz?

there is also bug#43093 for emacs-ess

can we coordinate our efforts in order to avoid to revert emacs 27.1 by
tagging relevant [1] open emacs packages bugs as critical? [2]

[...]


Thanks! Gio'


[1] can we define "relevant" as: all bugs that breaks a previously
compiling emacs package?

[2]
https://issues.guix.gnu.org/search?query=subject%3Aemacs+is%3Aopen+severity%3Acritical
Mark H Weaver Aug. 29, 2020, 8:35 p.m. UTC | #9
Hi Morgan,

Morgan Smith <Morgan.J.Smith@outlook.com> wrote:
> It seems I am taking some credit for Jack Hill's patch. I simply took
> Jack's patch (labeled as patch v3 in the debbugs thread) and attempted
> to build it with my personal config.

Indeed, I see that now.  Sorry for the mistake.  I suppose it happened
because it was presented to me as "the patch Morgan submitted", but it
would have been better if I had taken the time to read the bug report
more carefully.

Also, I regret if my comments on the preliminary patch made anyone feel
badly.  To be clear, there's no shame in submitting an unfinished patch
for review.  On the contrary, it is a *very* useful contribution.  In
this case, it makes sense to start by updating the main 'emacs' package,
and to worry about the other variants later.  There's no fault in that.

The only fault here lies with me.  I should have looked more carefully
for prior work, and I probably also pushed it prematurely.

> (Also just my 2 cents, we should have upgraded emacs-next to 27.1 and
> only upgraded emacs a week later. Emacs deserves more care than most
> packages due to its dependence on so many other packages. Not trying to
> shame anyone, just something to think of for next time.)

Agreed, or perhaps 'emacs' itself should have been updated on a separate
branch.  In the past, when this was a smaller community and there were
far fewer emacs packages in Guix, I did major updates of Emacs a few
times without causing any obvious problems, but that was a different
time.  It's also possible that Emacs 27 was a more disruptive update
than usual.

Thanks very much for your comments and contributions.

   Best regards,
       Mark
Brett Gilio Aug. 30, 2020, 1:50 a.m. UTC | #10
Mark H Weaver <mhw@netris.org> writes:

> Agreed, or perhaps 'emacs' itself should have been updated on a separate
> branch.

+1 for WIP-emacs branch in future.

Brett Gilio
Pierre Neidhardt Sept. 4, 2020, 9:03 a.m. UTC | #11
emacs-helpful still seems to be broken on master.
Any idea?
I'll try to fix it later today.
Pierre Neidhardt Sept. 4, 2020, 9:16 a.m. UTC | #12
Looks like an upstream issue:

https://github.com/Wilfred/helpful/issues/248
Giovanni Biscuolo Sept. 4, 2020, 10:20 a.m. UTC | #13
Hi Pierre,

thank you for working on this!

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Looks like an upstream issue:
>
> https://github.com/Wilfred/helpful/issues/248

This thread is getting hard to follow, should we open a specific bug on
bug-guix?

WDYT?
Pierre Neidhardt Sept. 7, 2020, 9:44 a.m. UTC | #14
Done in 43254@debbugs.gnu.org.
diff mbox series

Patch

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ad8d4b0606..48ae899dcf 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -58,9 +58,9 @@ 
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages image)
-  #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages linux)     ; alsa-lib
   #:use-module (gnu packages mail)      ; for mailutils
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages texinfo)
@@ -75,15 +75,14 @@ 
 (define-public emacs
   (package
     (name "emacs")
-    (version "26.3")
+    (version "27.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/emacs/emacs-"
                                   version ".tar.xz"))
               (sha256
-               (base32
-                "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
-              (patches (search-patches "emacs-exec-path.patch"
+               (base32 "0h9f2wpmp6rb5rfwvqwv1ia1nw86h74p7hnz3vb3gjazj67i4k2a"))
+              (patches (search-patches "emacs27-exec-path.patch"
                                        "emacs-fix-scheme-indent-function.patch"
                                        "emacs-ignore-empty-xim-styles.patch"
                                        "emacs-source-date-epoch.patch"))
@@ -94,16 +93,7 @@ 
                   ;; autoloads.
                   (for-each delete-file
                             (append (find-files "." "\\.elc$")
-                                    (find-files "." "loaddefs\\.el$")
-                                    ;; This is the only "autoloads" file that
-                                    ;; does not have "*loaddefs.el" name.
-                                    ;; TODO: Next time changing this package,
-                                    ;; replace the following with a call to
-                                    ;; `find-files', so that `delete-file'
-                                    ;; wouldn't error out when the file is
-                                    ;; missing, making the entire snippet field
-                                    ;; reusable as-is for `emacs-next' below.
-                                    '("eshell/esh-groups.el")))
+                                    (find-files "." "loaddefs\\.el$")))
 
                   ;; Make sure Tramp looks for binaries in the right places on
                   ;; remote Guix System machines, where 'getconf PATH' returns
@@ -130,6 +120,9 @@ 
     (arguments
      `(#:tests? #f                      ; no check target
        #:configure-flags (list "--with-modules"
+                               ;; --with-cairo will become the default in
+                               ;; Emacs 28
+                               "--with-cairo"
                                "--disable-build-details")
        #:phases
        (modify-phases %standard-phases
@@ -180,9 +173,35 @@ 
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
                ;; Byte compile the site-start files.
-               (emacs-byte-compile-directory lisp-dir)))))))
+               (emacs-byte-compile-directory lisp-dir))))
+         ;; Needed when building from git
+         (add-before
+             'reset-gzip-timestamps
+             'make-compressed-files-writable
+           (lambda _
+             (for-each make-file-writable
+                       (find-files %output ".*\\.t?gz$"))
+             #t))
+         ;; restore the dump file that Emacs installs somewhere in
+         ;; libexec/ to its original state
+         (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
+           (lambda* (#:key outputs target #:allow-other-keys)
+             (let* ((libexec (string-append (assoc-ref outputs "out")
+                                            "/libexec"))
+                    ;; each of these find-files should return one file
+                    (pdmp (find-files libexec "^emacs\\.pdmp$"))
+                    (pdmp-real (find-files libexec
+                                           "^\\.emacs\\.pdmp-real$")))
+               (when (not (null? pdmp-real))
+                 (for-each (lambda (wrapper real)
+                             (delete-file wrapper)
+                             (rename-file real wrapper))
+                           pdmp pdmp-real))
+               #t))))))
     (inputs
      `(("gnutls" ,gnutls)
+       ("jansson" ,jansson)
+       ("harfbuzz" ,harfbuzz)
        ("ncurses" ,ncurses)
 
        ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
@@ -190,13 +209,14 @@ 
        ("mailutils" ,mailutils)
 
        ;; TODO: Add the optional dependencies.
+       ("cairo" ,cairo)
        ("libx11" ,libx11)
+       ("libxaw" ,libxaw)
        ("gtk+" ,gtk+)
-       ("libxft" ,libxft)
        ("libtiff" ,libtiff)
        ("giflib" ,giflib)
+       ("gmp" ,gmp)
        ("libjpeg" ,libjpeg-turbo)
-       ("imagemagick" ,imagemagick)
        ("acl" ,acl)
 
        ;; When looking for libpng `configure' links with `-lpng -lz', so we
@@ -360,7 +380,8 @@  languages.")
      `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
        ("ncurses" ,ncurses)))
     (native-inputs
-     `(("pkg-config" ,pkg-config)))))
+     `(("pkg-config" ,pkg-config)
+       ("texinfo" ,texinfo)))))
 
 (define-public emacs-xwidgets
   (package
@@ -384,11 +405,14 @@  editor (with xwidgets support)")
     (synopsis "The extensible, customizable, self-documenting text
 editor (console only)")
     (build-system gnu-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs)
+       ((#:configure-flags flags ''())
+        `(list "--with-jpeg=no" "--with-gif=no" "--with-tiff=no"))))
     (inputs (fold alist-delete
                   (package-inputs emacs)
                   '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
-                    "imagemagick" "libpng" "librsvg" "libxpm" "libice"
-                    "libsm"
+                    "libpng" "librsvg" "libxpm" "libice" "libsm"
 
                     ;; These depend on libx11, so remove them as well.
                     "libotf" "m17n-lib" "dbus")))))
@@ -407,15 +431,7 @@  editor (without an X toolkit)" )
             `(cons "--with-x-toolkit=no" ,cf)))))))
 
 (define-public emacs-wide-int
-  (package
-    (inherit emacs)
-    (name "emacs-wide-int")
-    (synopsis "The extensible, customizable, self-documenting text
-editor (with wide ints)" )
-    (arguments
-     (substitute-keyword-arguments (package-arguments emacs)
-       ((#:configure-flags flags)
-        `(cons "--with-wide-int" ,flags))))))
+  (deprecated-package "emacs-wide-int" emacs))
 
 (define-public guile-emacs
   (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")