diff mbox series

[bug#36999,1/4] gnu: emacs-magit: Update to 2.90.1-1.c761d28.

Message ID 20191005191929.7356-2-go.wigust@gmail.com
State Accepted
Headers show
Series More test and then merge to master | expand

Commit Message

Oleg Pykhalov Oct. 5, 2019, 7:19 p.m. UTC
* gnu/packages/emacs-xyz.scm (emacs-magit): Update to 2.90.1-1.c761d28.
[arguments]: Add patch phase.
---
 gnu/packages/emacs-xyz.scm | 50 ++++++++++++++++++++++++++++++++++----
 1 file changed, 45 insertions(+), 5 deletions(-)

Comments

Kyle Meyer Oct. 7, 2019, 1:03 a.m. UTC | #1
Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> writes:

>           #:phases
>           (modify-phases %standard-phases
> +           (add-after 'unpack 'patch
> +             (lambda _
> +               (chmod "lisp/magit-extras.el" #o644)
> +               (emacs-batch-edit-file "lisp/magit-extras.el"
> +                 `(progn (progn
> +                          (goto-char (point-min))
> +                          (re-search-forward "(defun magit-copy-buffer-revision ()")
> +                          (forward-sexp 2)
> +                          (kill-sexp)
> +                          (insert ,(format #f "~S"
> +                                           '(if (use-region-p)
> +                                                (copy-region-as-kill nil nil 'region)
> +                                                (when-let ((rev (cl-case major-mode
> +                                                                         ((magit-cherry-mode
> +                                                                           magit-log-select-mode
> +                                                                           magit-reflog-mode
> +                                                                           magit-refs-mode
> +                                                                           magit-revision-mode
> +                                                                           magit-stash-mode
> +                                                                           magit-stashes-mode)
> +                                                                          (car magit-refresh-args))
> +                                                                         ((magit-diff-mode magit-log-mode)
> +                                                                          (let ((r (caar magit-refresh-args)))
> +                                                                            (if (string-match "\\.\\.\\.?\\(.+\\)" r)
> +                                                                                (match-string 1 r)
> +                                                                                r)))
> +                                                                         (magit-status-mode "HEAD"))))
> +                                                          (when (magit-commit-p rev)
> +                                                            (setq rev (magit-rev-parse rev))
> +                                                            (push (list rev default-directory) magit-revision-stack)
> +                                                            (kill-new (message "%s" rev))))))))
> +                         (basic-save-buffer)))
> +               #t))

I didn't spot an explanation in either the commit message or comments
about what problem this patch phase is addressing.  If it's still an
issue with Magit's current master, would you please submit an issue
upstream?  If it's not, why not just go with a newer Magit revision?
Oleg Pykhalov Oct. 7, 2019, 8:01 a.m. UTC | #2
Hi Kyle,

Kyle Meyer <kyle@kyleam.com> writes:

[…]

> I didn't spot an explanation in either the commit message or comments
> about what problem this patch phase is addressing.  If it's still an
> issue with Magit's current master

Wrong argument type while calling magit-copy-buffer-revision.

magit-copy-buffer-revision is different in master.

> If it's not, why not just go with a newer Magit revision?

Sorry, what revision do you mean?  

I tried stick closer to release v2.90.1 because of compatibility with
other packages which require Magit.
Kyle Meyer Oct. 7, 2019, 1:21 p.m. UTC | #3
Oleg Pyhalov <go.wigust@gmail.com> writes:

> Hi Kyle,
>
> Kyle Meyer <kyle@kyleam.com> writes:
>
> […]
>
>> I didn't spot an explanation in either the commit message or comments
>> about what problem this patch phase is addressing.  If it's still an
>> issue with Magit's current master
>
> Wrong argument type while calling magit-copy-buffer-revision.
>
> magit-copy-buffer-revision is different in master.
>
>> If it's not, why not just go with a newer Magit revision?
>
> Sorry, what revision do you mean?  

Sorry for not being clear.  I meant why not build the package from a
later commit in Magit that doesn't show the issue.  Anyway, you answered
that next.  Thanks.

> I tried stick closer to release v2.90.1 because of compatibility with
> other packages which require Magit.

I see.
diff mbox series

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index afa21ee19e..7044b92240 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -265,21 +265,28 @@  on stdout instead of using a socket as the Emacsclient does.")
     (license license:gpl3+)))
 
 (define-public emacs-magit
-  ;; Version 2.90.1 has trouble loading the transient library,
-  ;; so we use a more recent commit that fixes it.
-  (let ((commit "b4aec016b5577afa8d889f258b499814d1bb1d94"))
+  ;; `magit-setup-buffer' macro introduced in c761d28d and required in
+  ;; `emacs-forge'.
+  (let ((commit "c761d28d49e5238037512b898db0ec9b40d85770"))
     (package
       (name "emacs-magit")
       (version (git-version "2.90.1" "1" commit))
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "https://github.com/magit/magit")
+                      (url "https://github.com/magit/magit.git")
                       (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "0zl7v6z0y50pcgqsf2r8c1k3r5nwjad9ba7r6sgrnf4rc62br7jv"))))
+                  "16qx0404l05q1m6w7y5j8ck1z5nfmpinm00w0p2yh1hn5zzwy6dd"))
+                (modules '((guix build utils)))
+                (snippet
+                 '(begin
+                    ;; Fix syntax error
+                    (substitute* "lisp/magit-extras.el"
+                      (("rev\\)\\)\\)\\)\\)\\)") "rev)))))"))
+                    #t))))
       (build-system gnu-build-system)
       (native-inputs `(("texinfo" ,texinfo)
                        ("emacs" ,emacs-minimal)))
@@ -318,6 +325,39 @@  on stdout instead of using a socket as the Emacsclient does.")
 
          #:phases
          (modify-phases %standard-phases
+           (add-after 'unpack 'patch
+             (lambda _
+               (chmod "lisp/magit-extras.el" #o644)
+               (emacs-batch-edit-file "lisp/magit-extras.el"
+                 `(progn (progn
+                          (goto-char (point-min))
+                          (re-search-forward "(defun magit-copy-buffer-revision ()")
+                          (forward-sexp 2)
+                          (kill-sexp)
+                          (insert ,(format #f "~S"
+                                           '(if (use-region-p)
+                                                (copy-region-as-kill nil nil 'region)
+                                                (when-let ((rev (cl-case major-mode
+                                                                         ((magit-cherry-mode
+                                                                           magit-log-select-mode
+                                                                           magit-reflog-mode
+                                                                           magit-refs-mode
+                                                                           magit-revision-mode
+                                                                           magit-stash-mode
+                                                                           magit-stashes-mode)
+                                                                          (car magit-refresh-args))
+                                                                         ((magit-diff-mode magit-log-mode)
+                                                                          (let ((r (caar magit-refresh-args)))
+                                                                            (if (string-match "\\.\\.\\.?\\(.+\\)" r)
+                                                                                (match-string 1 r)
+                                                                                r)))
+                                                                         (magit-status-mode "HEAD"))))
+                                                          (when (magit-commit-p rev)
+                                                            (setq rev (magit-rev-parse rev))
+                                                            (push (list rev default-directory) magit-revision-stack)
+                                                            (kill-new (message "%s" rev))))))))
+                         (basic-save-buffer)))
+               #t))
            (delete 'configure)
            (add-before
                'build 'patch-exec-paths