branch: elpa/fj
commit e6615985e2968825a06069aad00733a2399336da
Merge: 835050814e 3edfc8f0bd
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    Merge branch 'dev'
---
 fj-transient.el |  5 +++++
 fj.el           | 25 +++++++++++++++++++------
 test/fj-test.el | 18 +++++++++++++-----
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/fj-transient.el b/fj-transient.el
index dbd988c0b3..0c1dfa2fb4 100644
--- a/fj-transient.el
+++ b/fj-transient.el
@@ -199,6 +199,11 @@ Designed to be used in a transient called from the repo."
     (with-current-buffer (car (buffer-list)) ;transient--original-buffer
       (let* ((repo (fj--get-buffer-spec :repo))
              (owner (fj--get-buffer-spec :owner)))
+        ;; if not in a fj.el buffer, assume source buffer and fetch from git:
+        (when (or (not repo) (not owner))
+          (let ((pair (fj-repo-+-owner-from-git)))
+            (setq repo (cadr pair)
+                  owner (car pair))))
         (fj-repo-settings-patch repo owner parsed)))))
 
 (transient-define-suffix fj-update-topics ()
diff --git a/fj.el b/fj.el
index 89b261f72e..5fc9460dbf 100644
--- a/fj.el
+++ b/fj.el
@@ -6,7 +6,7 @@
 ;; Package-Requires: ((emacs "29.1") (fedi "0.2") (tp "0.8") (transient 
"0.10.0") (magit "4.3.8"))
 ;; Keywords: git, convenience
 ;; URL: https://codeberg.org/martianh/fj.el
-;; Version: 0.31
+;; Version: 0.32
 ;; Separator: -
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -3766,6 +3766,11 @@ Returns annotation for CAND, a candidate."
   'action 'fj-repo-tl-stargazers
   'help-echo "RET: View stargazers.")
 
+(defun fj-get-languages (repo owner)
+  "Get languages data for REPO by OWNER."
+  (let ((endpoint (format "repos/%s/%s/languages" owner repo)))
+    (fj-get endpoint)))
+
 (defun fj-repo-tl-entries (repos &optional no-owner)
   "Return tabluated list entries for REPOS.
 NO-OWNER means don't display owner column (user repos view)."
@@ -3776,7 +3781,11 @@ NO-OWNER means don't display owner column (user repos 
view)."
      (let* ((fork (if (eq .fork :json-false) "ℹ" "⑂"))
             (updated (date-to-time .updated_at))
             (updated-str (format-time-string "%s" updated))
-            (updated-display (fedi--relative-time-description updated nil 
:brief)))
+            (updated-display
+             (fedi--relative-time-description updated nil :brief))
+            ;; just get first lang:
+            (lang (symbol-to-string
+                   (caar (fj-get-languages .name .owner.username)))))
        `(nil ;; TODO: id
          [(,.name face fj-item-face
                   id ,.id
@@ -3799,7 +3808,7 @@ NO-OWNER means don't display owner column (user repos 
view)."
           (,(number-to-string .open_issues_count)
            id ,.id face fj-figures-face
            item repo)
-          ,.language
+          (,lang) ;; .language
           (,updated-str
            display ,updated-display
            face default
@@ -3886,7 +3895,10 @@ The default sort value is \"latest\"."
   ;; - from an unrelated buffer (without repo being set)
   (interactive)
   (let* ((owner (fj--repo-owner))
-         (repo (fj--repo-name)))
+         (repo (or (fj--repo-name)
+                   ;; if we fail (source file) try git:
+                   (cadr
+                    (fj-repo-+-owner-from-git)))))
     (fj-issue-compose)
     (setq fj-compose-repo repo
           fj-compose-repo-owner owner)
@@ -4399,8 +4411,9 @@ LIMIT is for `re-search-forward''s bound argument."
   "Read a label in the issue compose buffer."
   (interactive)
   ;; we store conses of (name . id), then fedi.el
-  ;; displays nanmes in the compose docs but submits the id.
-  (cl-pushnew (fj-issue-read-label fj-compose-repo nil nil :id)
+  ;; displays names in the compose docs but submits the id.
+  (cl-pushnew (fj-issue-read-label fj-compose-repo
+                                   fj-compose-repo-owner nil :id)
               fj-compose-issue-labels
               :test #'equal)
   (fedi-post--update-status-fields))
diff --git a/test/fj-test.el b/test/fj-test.el
index 9085246ec7..5ea134466f 100644
--- a/test/fj-test.el
+++ b/test/fj-test.el
@@ -1738,11 +1738,19 @@ the webUI only completes names in the issue.")
          (face fj-item-byline-face))))
 
 (exemplify-ert fj-test-format-comment
-  ;; test comment:
-  (substring-no-properties
-   ;; properties are nuts/fragemented due to inclusion of header!
-   (fj-format-comment "fj.el" "martianh" fj-test-timeline-comment))
-  => "martianh  owner 9 weeks ago\n\n\n<p dir=\"auto\">it could also serve as 
destination of the fork-jump-to-parent 
cmd.</p>\n\n――――――――――――――――――――――――――――――――")
+  (with-mock
+    (mock (current-time) => (27038 64936 599389 582000))
+    ;; test comment:
+    (substring-no-properties
+     ;; properties are nuts/fragemented due to inclusion of header!
+     (fj-format-comment "fj.el" "martianh" fj-test-timeline-comment))
+    => "\
+martianh  owner 36 weeks ago
+
+
+<p dir=\"auto\">it could also serve as destination of the fork-jump-to-parent 
cmd.</p>
+
+――――――――――――――――――――――――――――――――"))
 
 (exemplify-ert fj-test-string-number>
   (fj-string-number> "34" "12") => t

Reply via email to