Skip to content

Commit

Permalink
[todo] forge-insert-topic-state: Use forge-topic-unmerged face correctly
Browse files Browse the repository at this point in the history
Use it for closed pull-requests that have been closed without merging.
That was always the intention.
  • Loading branch information
tarsius committed Oct 6, 2023
1 parent 860449d commit 5ef8dbc
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lisp/forge-topic.el
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ implement such a function themselves. See #447.")
:group 'forge-faces)

(defface forge-topic-unmerged
'((t :inherit magit-dimmed :slant italic))
'((t :inherit magit-dimmed :strike-through t))
"Face used for number of unmerged pull-requests."
:group 'forge-faces)

Expand Down Expand Up @@ -339,13 +339,7 @@ an error. If NOT-THINGATPT is non-nil, then don't use

(defun forge--format-topic-line (topic &optional width)
(with-slots (slug title unread-p closed) topic
(concat (string-pad (magit--propertize-face
slug
(cond ((forge-issue-p topic)
'magit-dimmed)
((oref topic merged)
'forge-topic-merged)
('forge-topic-unmerged)))
(concat (string-pad (magit--propertize-face slug (forge--topic-face topic))
(or width 5))
" "
(magit-log-propertize-keywords
Expand All @@ -355,6 +349,14 @@ an error. If NOT-THINGATPT is non-nil, then don't use
(closed 'forge-topic-closed)
(t 'forge-topic-open)))))))

(defun forge--topic-face (topic)
(pcase-exhaustive (list (oref topic state)
(forge-pullreq-p forge-buffer-topic))
(`(merged ,_) 'forge-topic-merged)
('(closed nil) 'forge-topic-closed)
('(closed t) 'forge-topic-unmerged)
(`(open ,_) 'forge-topic-open)))

(defun forge--format-topic-choice (topic)
(cons (forge--format-topic-line topic)
(oref topic id)))
Expand Down Expand Up @@ -538,13 +540,8 @@ This mode itself is never used directly."
(insert (format
"%-11s%s\n" "State: "
(let ((state (oref topic state)))
(magit--propertize-face
(symbol-name state)
(pcase (list state (forge-pullreq-p (forge-topic-at-point)))
('(merged) 'forge-topic-merged)
('(closed) 'forge-topic-closed)
('(open t) 'forge-topic-unmerged)
('(open) 'forge-topic-open))))))))
(magit--propertize-face (symbol-name state)
(forge--topic-face topic)))))))

;;;;; Draft

Expand Down

0 comments on commit 5ef8dbc

Please sign in to comment.