Skip to content

Commit 1414ede

Browse files
committed
forge--topic-parse-config-buffer: New function
Replacing `forge--topic-parse-config-buffer' and `forge--topic-parse-yaml-links'.
1 parent aca829b commit 1414ede

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

lisp/forge-topic.el

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,23 +1894,16 @@ When point is on the answer, then unmark it and mark no other."
18941894
`((title . ,(string-trim title))
18951895
(body . ,(string-trim body)))))
18961896

1897-
(defun forge--topic-parse-link-buffer ()
1898-
(save-match-data
1899-
(save-excursion
1900-
(goto-char (point-min))
1901-
(mapcar (lambda (alist)
1902-
(cons (cons 'prompt (concat (alist-get 'name alist) " -- "
1903-
(alist-get 'about alist)))
1904-
alist))
1905-
(forge--topic-parse-yaml-links)))))
1906-
1907-
(defun forge--topic-parse-yaml-links ()
1908-
(alist-get 'contact_links
1909-
(yaml-parse-string (buffer-substring-no-properties
1910-
(point-min)
1911-
(point-max))
1912-
:object-type 'alist
1913-
:sequence-type 'list)))
1897+
(defun forge--topic-parse-config-buffer ()
1898+
(let-alist (save-match-data
1899+
(yaml-parse-string
1900+
(buffer-substring-no-properties (point-min) (point-max))
1901+
:object-type 'alist
1902+
:sequence-type 'list))
1903+
(mapcar (lambda (link)
1904+
`(,@link
1905+
(prompt ,(let-alist link (concat .name " -- " .about)))))
1906+
.contact_links)))
19141907

19151908
(cl-defgeneric forge--topic-template-files (repo class)
19161909
"Return a list of topic template files for REPO and a topic of CLASS.")
@@ -1927,7 +1920,7 @@ alist, containing just `text' and `position'.")
19271920
(with-temp-buffer
19281921
(magit-git-insert "cat-file" "-p" (concat branch ":" f))
19291922
(if (equal (file-name-nondirectory f) "config.yml")
1930-
(forge--topic-parse-link-buffer)
1923+
(forge--topic-parse-config-buffer)
19311924
(list (forge--topic-parse-buffer f)))))
19321925
(forge--topic-template-files repo class))))
19331926

0 commit comments

Comments
 (0)