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 Sep 23, 2023
1 parent f69d3f0 commit 3b3d16e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 14 additions & 1 deletion lisp/forge-pullreq.el
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,20 @@ Also see option `forge-topic-list-limit'."
(oref pullreq number))
'font-lock-face (if (oref pullreq merged)
'forge-topic-merged
'forge-topic-unmerged)))
'forge-topic-unmerged)
;;'font-lock-face (forge--topic-face pullreq)
))

;; TODO we're gonna need more faces

(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))))))))


(cl-defmethod forge--topic-type-prefix ((pullreq forge-pullreq))
(if (forge--childp (forge-get-repository pullreq) 'forge-gitlab-repository)
Expand Down
8 changes: 2 additions & 6 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 @@ -524,11 +524,7 @@ an error."
(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))))))))
))))))

(defvar-keymap forge-topic-draft-section-map
"<remap> <magit-edit-thing>" #'forge-edit-topic-draft)
Expand Down

0 comments on commit 3b3d16e

Please sign in to comment.