From dbaa829ec680a2c19c8860a5e3f30c428f99f531 Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Mon, 14 Oct 2019 21:40:16 -0700 Subject: [PATCH] gnu: emacs-magit: Add patch for compatibility with emacs-forge. * gnu/local.mk (emacs-magit-format-author-margin.patch): Add patch. * gnu/packages/emacs-xyz.scm: Add. * gnu/packages/patches/emacs-magit-log-format-author-margin.patch: Add. --- gnu/local.mk | 1 + gnu/packages/emacs-xyz.scm | 5 ++ ...emacs-magit-log-format-author-margin.patch | 72 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 gnu/packages/patches/emacs-magit-log-format-author-margin.patch diff --git a/gnu/local.mk b/gnu/local.mk index 6ec1bbf2e4..ba8cc1ee1f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -794,6 +794,7 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ %D%/packages/patches/emacs-json-reformat-fix-tests.patch \ %D%/packages/patches/emacs-highlight-stages-add-gexp.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-undohist-ignored.patch \ diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index 3d8aafd3e6..ddaaa01727 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -281,6 +281,11 @@ on stdout instead of using a socket as the Emacsclient does.") (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 diff --git a/gnu/packages/patches/emacs-magit-log-format-author-margin.patch b/gnu/packages/patches/emacs-magit-log-format-author-margin.patch new file mode 100644 index 0000000000..fc52157a32 --- /dev/null +++ b/gnu/packages/patches/emacs-magit-log-format-author-margin.patch @@ -0,0 +1,72 @@ +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 + -- 2.20.1