[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 8a8ac32def 12/15: magit--transient-args-and-fil
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 8a8ac32def 12/15: magit--transient-args-and-files: New function |
Date: |
Mon, 31 Jul 2023 10:00:21 -0400 (EDT) |
branch: elpa/git-commit
commit 8a8ac32def48799d532b392449e60eedeb54b428
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit--transient-args-and-files: New function
---
lisp/magit-diff.el | 8 ++------
lisp/magit-log.el | 8 ++------
lisp/magit-transient.el | 9 +++++++++
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 233534f154..745b203db6 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -836,9 +836,7 @@ and `:slant'."
(defun magit-diff-arguments (&optional mode)
"Return the current diff arguments."
(if (memq transient-current-command '(magit-diff magit-diff-refresh))
- (pcase-let ((`(,args ,alist)
- (-separate #'atom (transient-get-value))))
- (list args (cdr (assoc "--" alist))))
+ (magit--transient-args-and-files)
(magit-diff--get-value (or mode 'magit-diff-mode))))
(defun magit-diff--get-value (mode &optional use-buffer-args)
@@ -871,9 +869,7 @@ and `:slant'."
(pcase-let* ((obj (oref obj prototype))
(mode (or (oref obj major-mode) major-mode))
(key (intern (format "magit-diff:%s" mode)))
- (`(,args ,alist)
- (-separate #'atom (transient-get-value)))
- (files (cdr (assoc "--" alist))))
+ (`(,args ,files) (magit--transient-args-and-files)))
(put mode 'magit-diff-current-arguments args)
(when save
(setf (alist-get key transient-values) args)
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index c0010c20a5..60f8956d55 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -348,9 +348,7 @@ commits before and half after."
(defun magit-log-arguments (&optional mode)
"Return the current log arguments."
(if (memq transient-current-command '(magit-log magit-log-refresh))
- (pcase-let ((`(,args ,alist)
- (-separate #'atom (transient-get-value))))
- (list args (cdr (assoc "--" alist))))
+ (magit--transient-args-and-files)
(magit-log--get-value (or mode 'magit-log-mode))))
(defun magit-log--get-value (mode &optional use-buffer-args)
@@ -383,9 +381,7 @@ commits before and half after."
(pcase-let* ((obj (oref obj prototype))
(mode (or (oref obj major-mode) major-mode))
(key (intern (format "magit-log:%s" mode)))
- (`(,args ,alist)
- (-separate #'atom (transient-get-value)))
- (files (cdr (assoc "--" alist))))
+ (`(,args ,files) (magit--transient-args-and-files)))
(put mode 'magit-log-current-arguments args)
(when save
(setf (alist-get key transient-values) args)
diff --git a/lisp/magit-transient.el b/lisp/magit-transient.el
index 6dda38a2a1..364c20ac2d 100644
--- a/lisp/magit-transient.el
+++ b/lisp/magit-transient.el
@@ -219,6 +219,15 @@
'transient-value))))))
(propertize "]" 'face 'transient-inactive-value))))
+;;; Utilities
+
+(defun magit--transient-args-and-files ()
+ "Return (args files) for use by log and diff functions.
+The value derives from that returned by `transient-get-value'."
+ (let ((args (transient-get-value)))
+ (list (seq-filter #'atom args)
+ (cdr (assoc "--" args)))))
+
;;; _
(provide 'magit-transient)
;;; magit-transient.el ends here
- [nongnu] elpa/git-commit 3029f64b4a 05/15: Use seq-remove instead of -remove, (continued)
- [nongnu] elpa/git-commit 3029f64b4a 05/15: Use seq-remove instead of -remove, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 488ed2ad58 04/15: Use seq-filter instead of -filter, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit a6f9c78374 11/15: Use seq-take and seq-drop instead of -split-at, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit a5ca96edcd 02/15: Use cl-union instead of -union, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 82408757b0 03/15: Use seq-map-indexed instead of -map-indexed, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit c9fad8b58e 10/15: Use mapcar and delq instead of -keep, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit bbb0afb516 13/15: No longer use -separate, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 87afefca87 14/15: No longer use -none-p, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 95d5be9ac3 15/15: No longer use certain obscure dash functions, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit dcbef90475 09/15: Use seq-some instead of -some, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 8a8ac32def 12/15: magit--transient-args-and-files: New function,
ELPA Syncer <=
- [nongnu] elpa/git-commit ecccdfa3a4 07/15: Use cl-substitute instead of -replace, ELPA Syncer, 2023/07/31