[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gited 0a303a1 70/73: Make code more compact by using pc
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gited 0a303a1 70/73: Make code more compact by using pcase-dolist |
Date: |
Sun, 29 Nov 2020 00:00:41 -0500 (EST) |
branch: externals/gited
commit 0a303a1648670dcbae514f5585eca21ea0d532aa
Author: Tino Calancha <tino.calancha@gmail.com>
Commit: Tino Calancha <tino.calancha@gmail.com>
Make code more compact by using pcase-dolist
* packages/gited/gited.el (gited-tabulated-list-entries)
(gited-get-last-commit-time)
(gited-mark-branches-containing-regexp): Use pcase-dolist
---
gited.el | 41 ++++++++++++++---------------------------
1 file changed, 14 insertions(+), 27 deletions(-)
diff --git a/gited.el b/gited.el
index fd5a22b..ec283b9 100644
--- a/gited.el
+++ b/gited.el
@@ -10,9 +10,9 @@
;; Compatibility: GNU Emacs: 24.4
;; Version: 0.5.6
;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Thu Sep 05 05:44:27 CEST 2019
+;; Last-Updated: Sat Sep 14 15:57:45 CEST 2019
;; By: calancha
-;; Update #: 700
+;; Update #: 701
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -835,13 +835,10 @@ Thus, use \\[backward-page] to find the beginning of a
group of errors."
(defun gited-get-last-commit-time (branch)
"Return last commit time of BRANCH."
- (date-to-time
- (cadr
- (cdr
- (nth
- (cl-position-if
- (lambda (x) (equal branch (nth 3 x))) gited-branch-alist)
- gited-branch-alist)))))
+ (cl-block nil
+ (pcase-dolist (`(_ _ ,date ,cur-branch _ _) gited-branch-alist)
+ (when (equal cur-branch branch)
+ (cl-return (date-to-time date))))))
(defun gited--get-column (col)
(mapcar (lambda (x)
@@ -3226,14 +3223,12 @@ In interactive calls, a prefix C-u C-u prompts for
DAYS."
(gited-mark-if
(and (not (eolp))
(gited-get-branchname)
- (let* ((fn (gited-get-branchname))
+ (let* ((branch-name (gited-get-branchname))
(time-max
- (date-to-time
- (car
- (cddr
- (cl-find-if
- (lambda (x)
- (string= (nth 3 x) fn)) gited-branch-alist)))))
+ (cl-block nil
+ (pcase-dolist (`(_ _ ,date ,cur-branch _ _)
gited-branch-alist)
+ (when (equal cur-branch branch-name)
+ (cl-return (date-to-time date))))))
(time-min (time-subtract time-max (days-to-time (or days
30))))
(args (list "log"
(format "--after=%s"
@@ -3241,7 +3236,7 @@ In interactive calls, a prefix C-u C-u prompts for DAYS."
(format "--before=%s"
(format-time-string "%F" time-max))
(format "--grep=%s" regexp)
- fn "--")))
+ branch-name "--")))
(with-temp-buffer
(gited-git-command args (current-buffer))
(not (string= "" (buffer-string))))))
@@ -3673,16 +3668,8 @@ of column descriptors."
(defun gited-tabulated-list-entries ()
(let ((alist (gited--fill-branch-alist gited-ref-kind))
- mark author date branch commit id values result)
- (while alist
- (setq id (caar alist)
- values (cdr (car alist))
- mark (nth 0 values)
- author (nth 3 values)
- date (nth 1 values)
- branch (nth 2 values)
- commit (nth 4 values)
- alist (cdr alist))
+ result)
+ (pcase-dolist (`(,id . (,mark ,date ,branch ,author ,commit)) alist)
(push (list id (vector mark author date branch commit)) result))
(setq tabulated-list-entries (nreverse result))
(tabulated-list-init-header)))
- [elpa] externals/gited 9989d95 05/73: Fix sort of columns when gited-hide-details-mode is enabled, (continued)
- [elpa] externals/gited 9989d95 05/73: Fix sort of columns when gited-hide-details-mode is enabled, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 861281e 06/73: * gited.el (gited-mark-branches-regexp): Fix docstring., Stefan Monnier, 2020/11/29
- [elpa] externals/gited eeadd65 26/73: Add missing docstrings for several commands, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 239ac36 31/73: * gited.el: Bump version to 0.2.3., Stefan Monnier, 2020/11/29
- [elpa] externals/gited fd28d69 48/73: * gited-tests.el (gited-test1): Use gited--last-commit-title., Stefan Monnier, 2020/11/29
- [elpa] externals/gited 09c79b9 64/73: Separate versions from file names with --, Stefan Monnier, 2020/11/29
- [elpa] externals/gited ed83468 59/73: * packages/gited/gited.el: Bump version to v5.0.1, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 8502d7c 53/73: Handle multi remote repositories, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 55fc368 54/73: Fix gited-push bug from previous commit, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 8241ee5 41/73: gited-checkout-branch: Set right faces for marked branches, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 0a303a1 70/73: Make code more compact by using pcase-dolist,
Stefan Monnier <=
- [elpa] externals/gited 40e57eb 60/73: * gited/gited.el: Don't require `gited-ci`, which isn't found., Stefan Monnier, 2020/11/29
- [elpa] externals/gited b5fdc7e 61/73: Add missing file gited-ci.el, Stefan Monnier, 2020/11/29
- [elpa] externals/gited ad074e1 49/73: * packages/gited/gited.el (gited-stash-branch): Update Gited buffer on success, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 36ec8fa 34/73: ; * packages/gited/gited.el: Update file header., Stefan Monnier, 2020/11/29
- [elpa] externals/gited f81463e 44/73: gited-git-checkout: New function, Stefan Monnier, 2020/11/29
- [elpa] externals/gited d78161b 56/73: * packages/gited/gited.el (gited-pull): Delete unused variable, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 475e297 72/73: Support Gited buffers over a tramp connection, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 8f6722e 66/73: * gited.el: Bump version to 0.5.4, Stefan Monnier, 2020/11/29
- [elpa] externals/gited e8f116d 02/73: Default to beginning of epoch when no commit time info, Stefan Monnier, 2020/11/29
- [elpa] externals/gited cc4d5f7 17/73: Use taggerdate/taggername when listing tags, Stefan Monnier, 2020/11/29