From a10349d2bb09e3a3e0c84f290a7e57989c695467 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 27 Mar 2020 21:20:03 -0400 Subject: gnu: emacs-magit: Update to commit d05545e. * gnu/packages/emacs-xyz.scm (emacs-magit): Update to commit 68b5a13fa1b6b122d4a2547b8c415aadff83d8ca. [origin]: Remove obsoleted patches and snippets. [build-system]: Switch to the emacs-build-system. [arguments]: Remove the #:modules and #:imported-modules arguments. Enable tests. Remove the #:make-flags and #:test-target argument. Specify the \#:test-command argument. [phases]{patch}: Remove phase. {build-info-manual, set-magit-version, configure-git} {disable-tramp-test}: New phases. {configure}: Do not delete phase. {patch-exec-paths}: Adapt file names. * gnu/packages/patches/emacs-magit-log-format-author-margin.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Unregister it. --- gnu/local.mk | 1 - gnu/packages/emacs-xyz.scm | 144 +++++++++------------ .../emacs-magit-log-format-author-margin.patch | 72 ----------- 3 files changed, 63 insertions(+), 154 deletions(-) delete mode 100644 gnu/packages/patches/emacs-magit-log-format-author-margin.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 6be47b9a9a..80cefe5b63 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -887,7 +887,6 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-json-reformat-fix-tests.patch \ %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \ %D%/packages/patches/emacs-libgit-use-system-libgit2.patch \ - %D%/packages/patches/emacs-magit-log-format-author-margin.patch \ %D%/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch \ %D%/packages/patches/emacs-source-date-epoch.patch \ %D%/packages/patches/emacs-telega-test-env.patch \ diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index e6cbd44453..cb699c0197 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -395,12 +395,11 @@ libgit2 bindings for Emacs, intended to boost the performance of Magit.") (license license:gpl3+)))) (define-public emacs-magit - ;; `magit-setup-buffer' macro introduced in c761d28d and required in - ;; `emacs-forge'. - (let ((commit "c761d28d49e5238037512b898db0ec9b40d85770")) + ;; There hasn't been an official release since 2018-11-16. + (let ((commit "d05545ec2fd7edf915eaf1b9c15c785bb08975cc")) (package (name "emacs-magit") - (version (git-version "2.90.1" "3" commit)) + (version (git-version "2.90.1" "4" commit)) (source (origin (method git-fetch) (uri (git-reference @@ -409,93 +408,76 @@ libgit2 bindings for Emacs, intended to boost the performance of Magit.") (file-name (git-file-name name version)) (sha256 (base32 - "16qx0404l05q1m6w7y5j8ck1z5nfmpinm00w0p2yh1hn5zzwy6dd")) - ;; FIXME: emacs-forge uses a function defined in this patch, - ;; which is newer than the current commit. - (patches - (search-patches - "emacs-magit-log-format-author-margin.patch")) - (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))) - (inputs - `(("git" ,git) - ("perl" ,perl))) - (propagated-inputs - `(("dash" ,emacs-dash) - ("with-editor" ,emacs-with-editor) - ("transient" ,emacs-transient))) + "11aqyy4r9hrdi9nlypd70hn8384b6q89c7xavgv8c5q7f2g5z9qg")))) + (build-system emacs-build-system) (arguments - `(#:modules ((guix build gnu-build-system) - (guix build utils) - (guix build emacs-utils)) - #:imported-modules (,@%gnu-build-system-modules - (guix build emacs-utils)) - #:test-target "test" - #:tests? #f ; tests are not included in the release - #:make-flags - (list (string-append "PREFIX=" %output) - ;; Don't put .el files in a sub-directory. - (string-append "lispdir=" %output "/share/emacs/site-lisp")) + `(#:emacs ,emacs-no-x ;module support is required + #:tests? #t + #:test-command '("make" "test") #:phases (modify-phases %standard-phases - (add-after 'unpack 'patch + (add-after 'unpack 'build-info-manual (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))) + (invoke "make" "info") + ;; Copy info files to the lisp directory, which acts as + ;; the root of the project for the emacs-build-system. + (for-each (lambda (f) + (install-file f "lisp")) + (find-files "Documentation" "\\.info$")) + (chdir "lisp") #t)) - (delete 'configure) - (add-before - 'build 'patch-exec-paths + (add-after 'build-info-manual 'set-magit-version + (lambda _ + (make-file-writable "magit.el") + (emacs-substitute-variables "magit.el" + ("magit-version" ,version)) + #t)) + (add-after 'set-magit-version 'patch-exec-paths (lambda* (#:key inputs #:allow-other-keys) (let ((perl (assoc-ref inputs "perl"))) - (make-file-writable "lisp/magit-sequence.el") - (emacs-substitute-variables "lisp/magit-sequence.el" + (make-file-writable "magit-sequence.el") + (emacs-substitute-variables "magit-sequence.el" ("magit-perl-executable" (string-append perl "/bin/perl"))) - #t)))))) + #t))) + (add-before 'check 'configure-git + (lambda _ + ;; Otherwise some tests fail with error "unable to auto-detect + ;; email address". + (setenv "HOME" (getcwd)) + (invoke "git" "config" "--global" "user.name" "toto") + (invoke "git" "config" "--global" "user.email" + "toto@toto.com"))) + (add-after 'configure-git 'disable-tramp-test + (lambda _ + ;; There is an issue causing TRAMP to fail in the build + ;; environment. Setting the tramp-remote-shell parameter of + ;; the sudo-method to the file name of the shell didn't help. + (chdir "..") + (substitute* "t/magit-tests.el" + (("^\\(ert-deftest magit-toplevel:tramp.*" all) + (string-append all " (skip-unless nil)"))) + #t)) + (add-before 'install 'enter-lisp-directory + (lambda _ + (chdir "lisp") + #t))))) + (native-inputs + `(("texinfo" ,texinfo))) + (inputs + `(("git" ,git) + ("perl" ,perl))) + (propagated-inputs + `(("emacs-dash" ,emacs-dash) + ("emacs-libgit" ,emacs-libgit) + ("emacs-transient" ,emacs-transient) + ("emacs-with-editor" ,emacs-with-editor))) (home-page "https://magit.vc/") (synopsis "Emacs interface for the Git version control system") - (description - "With Magit, you can inspect and modify your Git repositories with Emacs. -You can review and commit the changes you have made to the tracked files, for -example, and you can browse the history of past changes. There is support for -cherry picking, reverting, merging, rebasing, and other common Git -operations.") + (description "With Magit, you can inspect and modify your Git +repositories with Emacs. You can review and commit the changes you have made +to the tracked files, for example, and you can browse the history of past +changes. There is support for cherry picking, reverting, merging, rebasing, +and other common Git operations.") (license license:gpl3+)))) (define-public emacs-magit-svn diff --git a/gnu/packages/patches/emacs-magit-log-format-author-margin.patch b/gnu/packages/patches/emacs-magit-log-format-author-margin.patch deleted file mode 100644 index fc52157a32..0000000000 --- a/gnu/packages/patches/emacs-magit-log-format-author-margin.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 94914ca4690c0cff12d600a0c8ba6bfb3fb38dc5 Mon Sep 17 00:00:00 2001 -From: Jonas Bernoulli -Date: Tue, 25 Jun 2019 21:44:32 +0200 -Subject: [PATCH] magit-log-format-author-margin: New function - -Split it from `magit-log-format-margin'. ---- - lisp/magit-log.el | 48 +++++++++++++++++++++++++---------------------- - 1 file changed, 26 insertions(+), 22 deletions(-) - -diff --git a/lisp/magit-log.el b/lisp/magit-log.el -index c8e6ef63..c0a79b19 100644 ---- a/lisp/magit-log.el -+++ b/lisp/magit-log.el -@@ -1374,28 +1374,32 @@ The shortstat style is experimental and rather slow." - (when-let ((option (magit-margin-option))) - (if magit-log-margin-show-shortstat - (magit-log-format-shortstat-margin rev) -- (pcase-let ((`(,_ ,style ,width ,details ,details-width) -- (or magit-buffer-margin -- (symbol-value option)))) -- (magit-make-margin-overlay -- (concat (and details -- (concat (propertize (truncate-string-to-width -- (or author "") -- details-width -- nil ?\s (make-string 1 magit-ellipsis)) -- 'face 'magit-log-author) -- " ")) -- (propertize -- (if (stringp style) -- (format-time-string -- style -- (seconds-to-time (string-to-number date))) -- (pcase-let* ((abbr (eq style 'age-abbreviated)) -- (`(,cnt ,unit) (magit--age date abbr))) -- (format (format (if abbr "%%2i%%-%ic" "%%2i %%-%is") -- (- width (if details (1+ details-width) 0))) -- cnt unit))) -- 'face 'magit-log-date))))))) -+ (magit-log-format-author-margin author date)))) -+ -+(defun magit-log-format-author-margin (author date &optional previous-line) -+ (pcase-let ((`(,_ ,style ,width ,details ,details-width) -+ (or magit-buffer-margin -+ (symbol-value option)))) -+ (magit-make-margin-overlay -+ (concat (and details -+ (concat (propertize (truncate-string-to-width -+ (or author "") -+ details-width -+ nil ?\s (make-string 1 magit-ellipsis)) -+ 'face 'magit-log-author) -+ " ")) -+ (propertize -+ (if (stringp style) -+ (format-time-string -+ style -+ (seconds-to-time (string-to-number date))) -+ (pcase-let* ((abbr (eq style 'age-abbreviated)) -+ (`(,cnt ,unit) (magit--age date abbr))) -+ (format (format (if abbr "%%2i%%-%ic" "%%2i %%-%is") -+ (- width (if details (1+ details-width) 0))) -+ cnt unit))) -+ 'face 'magit-log-date)) -+ previous-line))) - - (defun magit-log-format-shortstat-margin (rev) - (magit-make-margin-overlay --- -2.23.0 - -- cgit v1.2.3