[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gited 8241ee5 41/73: gited-checkout-branch: Set right f
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gited 8241ee5 41/73: gited-checkout-branch: Set right faces for marked branches |
Date: |
Sun, 29 Nov 2020 00:00:36 -0500 (EST) |
branch: externals/gited
commit 8241ee5e7689082620d461a24ac52cff4bf1ef32
Author: Tino Calancha <tino.calancha@gmail.com>
Commit: Tino Calancha <tino.calancha@gmail.com>
gited-checkout-branch: Set right faces for marked branches
* gited.el (gited--fontify-current-row-1): Renamed from
gited--fontify-current-row.
(gited--fontify-current-row): Renamed from gited-fontify-marked-branch-name.
(gited-checkout-branch): Use `gited--fontify-current-row' to handle the
case when
the branch is marked.
---
gited.el | 109 ++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 55 insertions(+), 54 deletions(-)
diff --git a/gited.el b/gited.el
index e9c3f29..e84e33b 100644
--- a/gited.el
+++ b/gited.el
@@ -10,9 +10,9 @@
;; Compatibility: GNU Emacs: 24.4
;; Version: 0.2.5
;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
-;; Last-Updated: Sat Jul 01 15:51:52 JST 2017
+;; Last-Updated: Sun Jul 02 12:05:42 JST 2017
;; By: calancha
-;; Update #: 672
+;; Update #: 673
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -180,13 +180,13 @@
;; `gited--bisect-executable-p', `gited--case-ref-kind',
;; `gited--check-unmerged-marked-branches', `gited--clean-previous-patches',
;; `gited--col-branch-name', `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--list-refs-format',
-;; `gited--mark-branches-in-region',
+;; `gited--fontify-current-row', `gited--fontify-current-row-1',
+;; `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--list-refs-format', `gited--mark-branches-in-region',
;; `gited--mark-merged-or-unmerged-branches',
;; `gited--mark-merged-or-unmerged-branches-spec', `gited--merged-branch-p',
;; `gited--move-to-end-of-column', `gited--output-buffer',
@@ -199,12 +199,12 @@
;; `gited-commit-title', `gited-current-branch',
;; `gited-current-branches-with-marks', `gited-current-state-list',
;; `gited-dir-under-Git-control-p', `gited-edit-commit',
-;; `gited-fontify-current-branch', `gited-fontify-marked-branch-name',
-;; `gited-format-columns-of-files', `gited-get-branchname',
-;; `gited-get-commit', `gited-get-date',
-;; `gited-get-element-in-row', `gited-get-last-commit-time',
-;; `gited-get-mark', `gited-get-marked-branches',
-;; `gited-git-command', `gited-git-command-on-region',
+;; `gited-fontify-current-branch', `gited-format-columns-of-files',
+;; `gited-get-branchname', `gited-get-commit',
+;; `gited-get-date', `gited-get-element-in-row',
+;; `gited-get-last-commit-time', `gited-get-mark',
+;; `gited-get-marked-branches', `gited-git-command',
+;; `gited-git-command-on-region',
;; `gited-hide-details-update-invisibility-spec',
;; `gited-insert-marker-char', `gited-internal-do-deletions',
;; `gited-last-commit-title', `gited-listed-branches',
@@ -723,7 +723,7 @@ Return value is the number of files marked, or nil if none
were marked."
(if ,predicate
(progn
(gited-insert-marker-char)
- (gited-fontify-marked-branch-name)
+ (gited--fontify-current-row)
(cl-incf count)))
(forward-line))
(if ,msg (message "%s %s%s %s%s."
@@ -1436,7 +1436,7 @@ If optional arg OTHER-WINDOW is non-nil, then use another
window."
(dired default-directory))
(dired-revert)))))
-(defun gited--fontify-current-row ()
+(defun gited--fontify-current-row-1 ()
(remove-text-properties
(point-at-bol) (point-at-eol) '(face))
(let ((inhibit-read-only t) pos)
@@ -1460,6 +1460,36 @@ If optional arg OTHER-WINDOW is non-nil, then use
another window."
(put-text-property
pos (point-at-eol) 'face gited-commit-msg-face))))
+(defun gited--fontify-current-row (&optional mark)
+ "Fontify the current row."
+ (let ((marker (or mark (string-to-char (gited-get-mark))))
+ (inhibit-read-only t))
+ (gited-move-to-branchname)
+ (remove-text-properties
+ (point-at-bol) (point-at-eol) '(face))
+ (cond ((eq marker ?\s)
+ (if (string= (gited-get-branchname)
+ gited-current-branch)
+ (put-text-property
+ (point-at-bol)
+ (point-at-eol)
+ 'face gited-section-highlight-face)
+ (gited--fontify-current-row-1)))
+ ((eq marker gited-marker-char)
+ (put-text-property
+ (point-at-bol) (1+ (point-at-bol)) 'face gited-flag-mark-face)
+ (put-text-property
+ (1+ (point-at-bol))
+ (point-at-eol)
+ 'face gited-flag-mark-line-face))
+ ((eq marker gited-del-char)
+ (put-text-property
+ (point-at-bol) (1+ (point-at-bol)) 'face gited-deletion-face)
+ (put-text-property
+ (1+ (point-at-bol))
+ (point-at-eol)
+ 'face gited-deletion-branch-face)))))
+
(defun gited-checkout-branch (branch)
"Checkout BRANCH.
If the gited buffer lists local branches and BRANCH is not
@@ -1482,7 +1512,8 @@ local, then prompt for a branch name where to check out
BRANCH."
branch)))
(save-excursion
(gited-goto-branch cur-br)
- (gited--fontify-current-row)
+ ;; Fontify the previous current branch correctly.
+ (let ((gited-current-branch "")) (gited--fontify-current-row))
(if (not new-branch-p)
(vc-git-checkout nil branch)
(gited-git-command `("checkout" "-b" ,local-branch ,branch))
@@ -2835,7 +2866,7 @@ Each element of ALIST looks like (BRANCH . MARKERCHAR)."
(when (gited-goto-branch branch)
(beginning-of-line)
(gited-insert-marker-char chr)
- (gited-fontify-marked-branch-name chr))))))
+ (gited--fontify-current-row chr))))))
(defun gited-fontify-current-branch ()
"Set font for current branch."
@@ -2854,36 +2885,6 @@ Each element of ALIST looks like (BRANCH . MARKERCHAR)."
(point-at-eol)
'face gited-section-highlight-face)))))
-(defun gited-fontify-marked-branch-name (&optional mark)
- "Set font for a marked branch."
- (let ((marker (or mark (string-to-char (gited-get-mark))))
- (inhibit-read-only t))
- (gited-move-to-branchname)
- (remove-text-properties
- (point-at-bol) (point-at-eol) '(face))
- (cond ((eq marker ?\s)
- (if (string= (gited-get-branchname)
- gited-current-branch)
- (put-text-property
- (point-at-bol)
- (point-at-eol)
- 'face gited-section-highlight-face)
- (gited--fontify-current-row)))
- ((eq marker gited-marker-char)
- (put-text-property
- (point-at-bol) (1+ (point-at-bol)) 'face gited-flag-mark-face)
- (put-text-property
- (1+ (point-at-bol))
- (point-at-eol)
- 'face gited-flag-mark-line-face))
- ((eq marker gited-del-char)
- (put-text-property
- (point-at-bol) (1+ (point-at-bol)) 'face gited-deletion-face)
- (put-text-property
- (1+ (point-at-bol))
- (point-at-eol)
- 'face gited-deletion-branch-face)))))
-
(defun gited-insert-marker-char (&optional marker)
(tabulated-list-set-col gited-mark-idx
(char-to-string (or marker gited-marker-char))
@@ -2914,7 +2915,7 @@ As always, hidden subdirs are not affected."
(t nil))))
(when flag
(gited-insert-marker-char flag)
- (gited-fontify-marked-branch-name flag)))
+ (gited--fontify-current-row flag)))
(forward-line))))
(defun gited-kill-line (&optional arg)
@@ -3188,7 +3189,7 @@ this subdir."
(lambda ()
(when (ignore-errors (gited-get-branchname))
(gited-insert-marker-char mark)
- (gited-fontify-marked-branch-name mark))))))))
+ (gited--fontify-current-row mark))))))))
(defun gited--mark-branches-in-region (start end mark)
(when (> start end)
@@ -3197,7 +3198,7 @@ this subdir."
(while (< (point) end)
(when (gited-get-branchname)
(gited-insert-marker-char mark)
- (gited-fontify-marked-branch-name mark))
+ (gited--fontify-current-row mark))
(forward-line)))
(defun gited-unmark-backward ()
@@ -3206,7 +3207,7 @@ this subdir."
(forward-line -1)
(when (gited-get-branchname)
(gited-insert-marker-char ?\s)
- (gited-fontify-marked-branch-name ?\s)
+ (gited--fontify-current-row ?\s)
(gited-move-to-branchname)))
(defun gited-unmark-all-branches (mark)
@@ -3221,7 +3222,7 @@ this subdir."
(or (and (eq mark ?\r) (not (string= str " ")))
(string= (char-to-string mark) str)))
(gited-insert-marker-char ?\s)
- (gited-fontify-marked-branch-name ?\s))
+ (gited--fontify-current-row ?\s))
(forward-line)))))
(defun gited-unmark-all-marks ()
- [elpa] externals/gited 5138dee 01/73: Add new library gited.el, (continued)
- [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, 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 <=
- [elpa] externals/gited 0a303a1 70/73: Make code more compact by using pcase-dolist, Stefan Monnier, 2020/11/29
- [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