all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Morgan.J.Smith@outlook.com
To: mail@nicolasgoaziou.fr
Cc: 44249@debbugs.gnu.org, Morgan Smith <Morgan.J.Smith@outlook.com>
Subject: [bug#44249] [PATCH v3] gnu: emacs: Make strip-double-wrap more robust.
Date: Wed,  4 Nov 2020 14:47:13 -0500	[thread overview]
Message-ID: <DM5PR1001MB2105208A37F6D9141D01B0C8C5EF0@DM5PR1001MB2105.namprd10.prod.outlook.com> (raw)
In-Reply-To: <DM5PR1001MB21059362E2A281295A7FA2B2C5160@DM5PR1001MB2105.namprd10.prod.outlook.com>

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs.scm (emacs) [strip-double-wrap]: Use regex to find emacs
executable.  This works even when the version is changed by package
transformations (e.g., version=git.master).
---

(Can you reopen this bug report please?)

So I see 3 possible solutions:
1. Accept my first patch and give up on match
2. Accept this patch and modify almost every emacs varient (I did test building them all)
3. Figure out some proper module inheritence

I think option 3 is the most correct, but I'm lazy so I'm leaning towards option 1.
---
 gnu/packages/emacs.scm | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4963379d74..4d1080f9dd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -123,6 +123,9 @@
     (build-system glib-or-gtk-build-system)
     (arguments
      `(#:tests? #f                      ; no check target
+       #:modules ((guix build glib-or-gtk-build-system)
+                  (guix build utils)
+                  (ice-9 match))
        #:configure-flags (list "--with-modules"
                                "--with-cairo"
                                "--disable-build-details")
@@ -196,17 +199,12 @@
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
              ;; twice.  This also fixes a minor issue, where WMs would not be
-             ;; able to track emacs back to emacs.desktop.  The version is
-             ;; accessed using using THIS-PACKAGE so it "just works" for
-             ;; inherited Emacs packages of different versions.
+             ;; able to track emacs back to emacs.desktop.
              (with-directory-excursion (assoc-ref outputs "out")
-               (copy-file (string-append
-                           "bin/emacs-"
-                           ,(let ((this-version (package-version this-package)))
-                              (or (false-if-exception
-                                   (version-major+minor+point this-version))
-                                  (version-major+minor this-version))))
-                          "bin/emacs")
+               (copy-file
+                (match (find-files "bin" "^emacs-")
+                  ((executable . _) executable))
+                "bin/emacs")
                #t)))
          (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
            ;; The 'reset-gzip-timestamps phase will throw a permission error
@@ -328,7 +326,11 @@ languages.")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))
     (inputs
      `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
        ("ncurses" ,ncurses)))
@@ -348,7 +350,11 @@ editor (with xwidgets support)")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))
     (inputs
      `(("webkitgtk" ,webkitgtk)
        ("libxcomposite" ,libxcomposite)
@@ -375,7 +381,11 @@ editor (console only)")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))))
 
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
@@ -392,7 +402,11 @@ editor (without an X toolkit)" )
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))))
 
 (define-public emacs-wide-int
   (package/inherit emacs
-- 
2.29.1





  parent reply	other threads:[~2020-11-04 19:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  2:01 [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust Morgan.J.Smith
2020-10-27 21:13 ` Nicolas Goaziou
2020-11-02  4:35   ` [bug#44249] [PATCH v2] " Morgan.J.Smith
2020-11-03  9:45     ` bug#44249: " Nicolas Goaziou
2020-11-03 12:48       ` [bug#44249] " Nicolas Goaziou
2020-11-03 14:49         ` Morgan Smith
2020-11-03 21:38           ` Nicolas Goaziou
2020-11-03 22:09             ` zimoun
2020-11-04 19:47 ` Morgan.J.Smith [this message]
2020-11-05 22:33   ` [bug#44249] [PATCH v3] " Nicolas Goaziou
2020-11-07 20:48     ` Marius Bakke
2021-01-15 13:28   ` [bug#44249] [PATCH] " Ludovic Courtès
2021-01-15 19:49     ` Morgan Smith
2021-01-16 21:54       ` Ludovic Courtès
2021-01-16 22:03         ` Morgan Smith
2021-01-31 20:30 ` bug#44249: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR1001MB2105208A37F6D9141D01B0C8C5EF0@DM5PR1001MB2105.namprd10.prod.outlook.com \
    --to=morgan.j.smith@outlook.com \
    --cc=44249@debbugs.gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.