[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/gited 162a177: Fix sort of columns when gited-hide-detail
From: |
Tino Calancha |
Subject: |
[elpa] scratch/gited 162a177: Fix sort of columns when gited-hide-details-mode is enabled |
Date: |
Sat, 3 Jun 2017 23:49:15 -0400 (EDT) |
branch: scratch/gited
commit 162a177b5596014bca7395d704fbdd5b47a4eb4a
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>
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.
---
packages/gited/.travis.yml | 2 +-
packages/gited/gited.el | 36 ++++++++++++++++++++++++++----------
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/packages/gited/.travis.yml b/packages/gited/.travis.yml
index 098eca7..8f189c2 100644
--- a/packages/gited/.travis.yml
+++ b/packages/gited/.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/packages/gited/gited.el b/packages/gited/gited.el
index 9bb18a2..6244872 100644
--- a/packages/gited/gited.el
+++ b/packages/gited/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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] scratch/gited 162a177: Fix sort of columns when gited-hide-details-mode is enabled,
Tino Calancha <=