[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gited 9989d95 05/73: Fix sort of columns when gited-hid
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gited 9989d95 05/73: Fix sort of columns when gited-hide-details-mode is enabled |
Date: |
Sun, 29 Nov 2020 00:00:27 -0500 (EST) |
branch: externals/gited
commit 9989d95167e8f96a53f7b90c644e3b946baba46c
Author: Tino Calancha <tino.calancha@gmail.com>
Commit: Tino Calancha <tino.calancha@gmail.com>
Fix sort of columns when gited-hide-details-mode is enabled
When gited-hide-details-mode is enabled, and we want to sort
by another column, disable gited-hide-details-mode
and enable it after all columns have being printed out.
* gited.el (gited--advice-sort-by-column): New defun. Use it
to advice `tabulated-list-col-sort'.
(gited-list-branches): Use gited-branch-exists-p.
* .travis.yml: Gited requires Emacs version >= 24.4.
---
.travis.yml | 2 +-
gited.el | 36 ++++++++++++++++++++++++++----------
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 098eca7..8f189c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,7 +6,7 @@ notifications:
on_failure: always
env:
- - EVM_EMACS=emacs-24.3-travis
+# - EVM_EMACS=emacs-24.3-travis # advice-add requires >= 24.4
- EVM_EMACS=emacs-24.4-travis
- EVM_EMACS=emacs-24.5-travis
- EVM_EMACS=emacs-git-snapshot-travis
diff --git a/gited.el b/gited.el
index 9bb18a2..6244872 100644
--- a/gited.el
+++ b/gited.el
@@ -10,9 +10,9 @@
;; Compatibility: GNU Emacs: 24.4
;; Version: 0.2.0
;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Sun Jun 04 12:00:04 JST 2017
+;; Last-Updated: Sun Jun 04 12:46:33 JST 2017
;; By: calancha
-;; Update #: 637
+;; Update #: 638
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -141,14 +141,15 @@
;;
;; Non-interactive functions defined here:
;;
-;; `gited--bisect-after-run', `gited--bisect-executable-p',
-;; `gited--case-ref-kind', `gited--check-unmerged-marked-branches',
-;; `gited--clean-previous-patches', `gited--fill-branch-alist',
-;; `gited--fontify-current-row', `gited--get-branches-from-command',
-;; `gited--get-column', `gited--get-merged-branches',
-;; `gited--get-patch-or-commit-buffers', `gited--get-unmerged-branches',
-;; `gited--goto-column', `gited--goto-first-branch',
-;; `gited--handle-new-or-delete-files', `gited--list-format-init',
+;; `gited--advice-sort-by-column', `gited--bisect-after-run',
+;; `gited--bisect-executable-p', `gited--case-ref-kind',
+;; `gited--check-unmerged-marked-branches', `gited--clean-previous-patches',
+;; `gited--fill-branch-alist', `gited--fontify-current-row',
+;; `gited--get-branches-from-command', `gited--get-column',
+;; `gited--get-merged-branches', `gited--get-patch-or-commit-buffers',
+;; `gited--get-unmerged-branches', `gited--goto-column',
+;; `gited--goto-first-branch', `gited--handle-new-or-delete-files',
+;; `gited--list-files', `gited--list-format-init',
;; `gited--mark-branches-in-region',
;; `gited--mark-merged-or-unmerged-branches',
;; `gited--mark-merged-or-unmerged-branches-spec', `gited--merged-branch-p',
@@ -191,6 +192,7 @@
;; `gited-modified-branch', `gited-section-highlight',
;; `gited-status-branch-local', `gited-status-tag'.
;;
+;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Code:
@@ -3238,6 +3240,20 @@ Mode to edit Git branches as Dired."
(add-hook 'tabulated-list-revert-hook 'gited-tabulated-list-entries nil t)
(setq tabulated-list-sort-key (or tabulated-list-sort-key '("Date"))))
+;; We need this advice to sort by one of the last columns
+;; when `gited-hide-details-mode' is enabled.
+(defun gited--advice-sort-by-column (orig-fun &rest args)
+ (if (not (derived-mode-p 'gited-mode))
+ (apply orig-fun args)
+ (cond (gited-hide-details-mode
+ (gited-hide-details-mode 0)
+ (apply orig-fun args)
+ (gited-hide-details-mode 1))
+ (t (apply orig-fun args)))
+ (when (gited-branch-exists-p gited-current-branch)
+ (gited-fontify-current-branch))))
+
+(advice-add 'tabulated-list-col-sort :around 'gited--advice-sort-by-column)
(provide 'gited)
;;; gited.el ends here
- [elpa] externals/gited 0be4308 12/73: Prefer user-error on errors with origin in the user, (continued)
- [elpa] externals/gited 0be4308 12/73: Prefer user-error on errors with origin in the user, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 44498a6 22/73: Add commands to add/delete tags, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 37fe689 25/73: * gited.el (gited--fill-branch-alist): Silence harmless warning., Stefan Monnier, 2020/11/29
- [elpa] externals/gited d26d8c4 11/73: Simplify code using gited-branch-exists-p, Stefan Monnier, 2020/11/29
- [elpa] externals/gited d928e5f 29/73: * screenshots/gited-tags-screenshot.png: Update screenshot., Stefan Monnier, 2020/11/29
- [elpa] externals/gited 790c20c 09/73: gited-mark-branches-by-date: Use less verbose default, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 046dffd 20/73: Update documentation, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 5f57f01 21/73: * gited.el (gited-mode-map): Use prefix '* s' for all stash commands., Stefan Monnier, 2020/11/29
- [elpa] externals/gited 8db1633 04/73: gited-update: Don't overwrite `tabulated-list-sort-key', Stefan Monnier, 2020/11/29
- [elpa] externals/gited 5138dee 01/73: Add new library gited.el, Stefan Monnier, 2020/11/29
- [elpa] externals/gited 9989d95 05/73: Fix sort of columns when gited-hide-details-mode is enabled,
Stefan Monnier <=
- [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, 2020/11/29