1
0
Fork
You've already forked fj.el
0
forked from martianh/fj.el
A basic Emacs client for Forgejo instances (such as Codeberg).
  • Emacs Lisp 100%
2025年05月16日 11:08:09 +02:00
Cask add Cask file 2024年10月31日 16:26:26 +01:00
fj-transient.el fix revert all changes binding string 2025年01月03日 15:35:33 +01:00
fj.el nav: item-next: add fj-item-view-more refresh function. #141 . 2025年05月16日 10:47:23 +02:00
LICENSE license 2024年10月14日 13:18:43 +02:00
readme.org readme performance 2025年04月22日 15:29:57 +02:00
Screenshot-issues.png add screenshots 2024年07月02日 15:58:15 +02:00
Screenshot-search.png add screenshots 2024年07月02日 15:58:15 +02:00
Screenshot-transient.png readme: transient settings screenshot 2025年01月03日 16:23:30 +01:00
Screenshot-user.png add screenshots 2024年07月02日 15:58:15 +02:00

fj.el

This repo contains some basic functions for interacting with a Forgejo instance (such as codeberg.org) from within Emacs.

It doesn't interact with forge / magit, which don't implement Gitea/Forgejo support and likely never will (see https://github.com/magit/forge/discussions/557). Nor does it attempt to follow their wonderful design (for now).

It just aims to cover a few of the bread and butter functions that will save you switching to the browser 80% of the time.

getting started

authentication

To get going, first set fj-host, and fj-user.

To authorize your account, call fj-create-token, which will prompt you for your password, create an API access token, and copy it to your kill ring. Alternatively you can obtain an access token from your profile settings on your Forgejo instance (in user settings, under "applications").

Once you have your token, call fj-token (or any interactive function such as fj-list-issues). You will be prompted for your access token, and when you enter it, fj.el will also offer to save it in your auth-sources file (~/.authinfo.gpg or similar; see variable auth-sources). Once saved, you should be good to go.

Alternatively, you can set fj-token-use-auth-source to nil and simply set fj-token to your token (unencrypted option).

Finally, if you were previously using the unencrypted fj-token method and want to use auth sources, simply remove the code that sets fj-token in your init config, and follow the steps above.

If you run into any auth issues, feel free to open an issue or contact me.

basic views

Once you are authenticated, try fj-list-own-repos to view your repos, or fj-list-issues to view issues of the current repo, or with completing-read of a repo is no repo is found.

If you are already viewing a repo and want to force the prompt to choose another, call fj-list-issues with a prefix arg (C-u).

You can also call fj-list-own-issues to view all issues across your repos, and fj-watched-repos to see your watched repos.

To use a different instance for a given repo, set fj-host, fj-user, and fj-token in your .dir-locals.el file.

repositories

Current repository detection should work partially automatically. If you find you are still being asked for the repo when calling a command from inside a repo with a Forgejo remote, check to make sure the local root directory matches the name of the Forgejo repo!

features

Forgejo's API is vast. Currently fj.el just implements a few basic things:

repos and repo listings

  • create new repo
  • delete a repo
  • search and list instance repos
  • list a user's repos
  • fork a repo
  • star a repo
  • copy clone URL of repo
  • view a repo's readme
  • view a repo's commit log
  • list repo's stargazers
  • list repo's watchers

rich create/edit issue/comment interface

issues/PRs as listings

  • list repo issues and PRs
  • list issues in any repo you own
  • cycle between issues/PRs/all
  • cycle between open/closed/all issues/PRs
  • quick jump to any issue/PR or repo in a listing with imenu.
  • search in repo issues/PRs
  • act on an issue/PR from the listing (edit, edit title, comment, close, reopen, delete)

viewing issues/PRs

  • view issue/PR discussion
  • act on issue/PR (as above, plus reply or delete comment)
  • jump to mentioned user, issue or commit.
  • display all issue/PR timeline items (references, commits, merges, close/reopen, edit, etc.)
  • display diff of any commit
  • display diff of entire PR
  • merge PR
  • browse URL of view or entry at point

notifications

  • view your notifications
  • jump to relevant item
  • toggle between viewing unread and all notifications

user/repo settings

  • update repo settings transient menu
  • update user settings transient menu
  • view followers
  • view users followed

other features

If you want to insert a link to a line in your source files, consider using https://github.com/sshaw/git-link.

dependencies

  • magit-post, magit-process (for obtaining current repo)
  • fedi.el
  • markdown command
  • tp.el

limitations

performance

Unfortunately fj.el is pretty slow at loading issues/PRs with lots of comments and other timeline elements. The relevant code was recently re-written to be partly async, but the performance is still terrible. Any ideas or assistance here would be welcome.

contributions

Contributions are welcome, as is feedback about your needs.

Please PR into branch dev (main is for releases), and let me know if you're hacking on something.

Currently the project has just evolved organically out of my own needs (and my own libraries), which are likely different to yours.

screenshots

User repos listing:

/rahguzar/fj.el/media/branch/main/Screenshot-user.png

Issue view followed by repo issues listing:

/rahguzar/fj.el/media/branch/main/Screenshot-issues.png

Repo search listing:

/rahguzar/fj.el/media/branch/main/Screenshot-search.png

Repo settings transient:

/rahguzar/fj.el/media/branch/main/Screenshot-transient.png

commands index

Binding Command Description
fj-add-issue-to-milestone Add issue at point or in current view to milestone.
fj-add-reaction Add reaction to issue, PR or comment at point.
fj-browse-commit Browse commit with SHA in REPO by OWNER.
b fj-browse-view Brose URL of view at point.
fj-commits-mode Major mode for viewing repo commits.
C-c C-k fj-compose-cancel Kill new-post buffer/window. Does not POST content.
fj-compose-comment-mode Minor mode for composing comments.
fj-compose-mode Minor mode for composing issues.
C-c C-l fj-compose-read-labels Read a label in the issue compose buffer.
C-c RET fj-compose-read-milestone Read an existing milestone in the compose buffer.
C-c C-r fj-compose-read-repo Read a repo for composing a issue or comment.
C-c C-t fj-compose-read-title Read an issue title.
C-c C-S-l fj-compose-remove-labels Remove labels from item being composed.
C-c S-RET fj-compose-remove-milestone Remove milestone from item being composed.
fj-compose-send Submit the issue or comment to your Forgejo instance.
C fj-copy-item-url Copy URL of current item, either issue or PR.
fj-copy-pr-url Copy upstream Pull Request URL with branch name.
c fj-create-issue Create issue in current repo or repo at point in tabulated listing.
fj-create-milestone Create a milestone for REPO by OWNER.
fj-create-token Create an access token for `fj-user' on `fj-host'.
C-c C-c fj-cycle-state Cycle item state listing of open, closed, and all.
C-c C-s fj-cycle-type Cycle item type listing of issues, pulls, and all.
fj-delete-repo Delete repo at point, if you are its owner.
fj-delete-repo-tag Prompt for a repo tag and delete it on the server.
<return> fj-do-link-action Do the action of the link at POS.
<mouse-2> fj-do-link-action-mouse Do the action of the link at point.
fj-fetch-pull-as-branch From a PR view, fetch it as a new git branch using magit.
fj-get-pull-commits Return the data for the commits of the current pull.
fj-inspect-item-data Browse the JSON data of item at point.
fj-issue-close Close ISSUE in REPO or set to STATE.
fj-issue-comment Add COMMENT to ISSUE in REPO.
fj-issue-comment-edit Edit comment with ID in REPO.
fj-issue-compose Compose a new post.
fj-issue-delete Delete ISSUE in REPO of OWNER.
fj-issue-edit Edit ISSUE body in REPO.
fj-issue-edit-title Edit ISSUE title in REPO.
fj-issue-get-labels Get labels on ISSUE in REPO by OWNER.
fj-issue-label-add Add a label to ISSUE in REPO by OWNER.
fj-issue-label-remove Remove label from ISSUE in REPO by OWNER.
fj-issue-tl-mode Major mode for browsing a tabulated list of issues.
fj-issue-view-edit-title Edit the title of the item being viewed.
k fj-issues-tl-close Close current issue from tabulated issues listing.
fj-issues-tl-comment Comment on issue from tabulated issues listing.
K fj-issues-tl-delete Delete current issue from tabulated issues listing.
e fj-issues-tl-edit Edit issue from tabulated issues listing.
t fj-issues-tl-edit-title Edit issue title from issues tabulated list view.
l fj-issues-tl-label-add Add label to issue from tabulated issues listing.
o fj-issues-tl-reopen Reopen current issue from tabulated issues listing.
v fj-issues-tl-view View current issue from tabulated issues listing.
n fj-item-next Go to next item or notification.
p fj-item-prev Goto previous item or notification.
fj-item-view View item NUMBER from REPO of OWNER.
fj-item-view-close Close item being viewed, or set to STATE.
fj-item-view-comment Comment on the item currently being viewed.
fj-item-view-comment-delete Delete comment at point.
fj-item-view-edit Edit the item currently being viewed.
fj-item-view-edit-comment Edit the comment at point.
fj-item-view-edit-item-at-point Edit issue or comment at point in item view mode.
fj-item-view-mode Major mode for viewing items.
fj-item-view-more Append more timeline items to the current view, asynchronously.
fj-item-view-reopen Reopen item being viewed.
C-M-q fj-kill-all-buffers Kill all fj buffers.
I fj-list-issues List issues for current REPO.
fj-list-issues-+-pulls List issues and pulls for REPO by OWNER, filtered by STATE.
fj-list-issues-all Display all ISSUES for REPO by OWNER in tabulated list view.
fj-list-issues-by-label List issues in REPO by OWNER, filtering by label.
fj-list-issues-by-milestone List issues in REPO by OWNER, filtering by milestone.
fj-list-issues-closed Display closed ISSUES for REPO by OWNER in tabulated list view.
fj-list-issues-do Display ISSUES in a tabulated list view.
fj-list-issues-search Search current repo issues for QUERY.
fj-list-items List pulls for REPO by OWNER, filtered by STATE and TYPE.
W fj-list-own-issues List issues in repos owned by `fj-user'.
fj-list-own-items List items of TYPE in repos owned by `fj-user'.
fj-list-own-pulls List pulls in repos owned by `fj-user'.
O fj-list-own-repos List repos for `fj-user'.
P fj-list-pulls List pulls for REPO by OWNER, filtered by STATE.
fj-list-repos List repos for `fj-user' extended by `fj-extra-repos'.
fj-list-user-repos View repos of current entry user from tabulated repos listing.
fj-mark-notification-read Mark notification at point as read.
fj-mark-notification-unread Mark notification at point as unread.
fj-mark-notifs-read Mark all notifications read.
M fj-merge-pull Merge pull request of current view or at point.
. fj-next-page Load the next page of the current view.
<tab> fj-next-tab-item Jump to next tab item.
fj-notifications-mode Major mode for viewing notifications.
fj-notifications-subject-cycle Cycle notifications by `fj-notifications-subject-types'.
fj-notifications-unread-toggle Switch between showing all notifications, and only showing unread.
fj-owned-issues-list-repo-issues View issues of current repo from tabulated repos listing.
fj-owned-issues-tl-mode Major mode for browsing a tabulated list of issues.
, fj-prev-page Load the previous page.
<backtab> fj-prev-tab-item Jump to prev tab item.
fj-pull-req-comment Add comment to PULL in REPO.
fj-remove-reaction Remove a reaction from issue, PR or comment at point.
fj-repo-commit-log Render log of commits for REPO by OWNER.
L, u fj-repo-copy-clone-url Add the clone_url of repo at point to the kill ring.
fj-repo-create Create a new repo.
fj-repo-get-labels Return labels JSON for REPO by OWNER.
fj-repo-search Search repos for QUERY.
s, S fj-repo-search-tl Search repos for QUERY, and display a tabulated list of results.
fj-repo-search-tl-topic Search repo topics for QUERY, and display a tabulated list.
fj-repo-stargazers Render stargazers for REPO by OWNER.
fj-repo-tl-fork Fork repo entry at point.
RET fj-repo-tl-list-issues View issues of current repo from tabulated repos listing.
M-RET fj-repo-tl-list-pulls View issues of current repo from tabulated repos listing.
fj-repo-tl-mode Mode for displaying a tabulated list of repo search results.
r fj-repo-tl-readme Display readme file of current repo.
* fj-repo-tl-star-repo Star or UNSTAR current repo from tabulated user repos listing.
fj-repo-tl-unstar-repo Unstar current repo from tabulated user repos listing.
R fj-repo-update-settings A transient for setting current repo settings.
fj-repo-watchers Render watchers for REPO by OWNER.
fj-stargazers-completing Prompt for a repo stargazer, and view their repos.
fj-starred-repos List your starred repos.
/ fj-switch-to-buffer Switch to a live fj buffer.
B fj-tl-browse-entry Browse URL of tabulated list entry at point.
fj-token Fetch user access token from auth source, or try to add one.
fj-update-repo Update current repo settings.
fj-update-topics Update repo topics on the server.
U fj-update-user-settings Update current user settings on the server.
fj-user-followers View users who follow USER or `fj-user'.
fj-user-following View users that USER or `fj-user' is following.
fj-user-repo-tl-mode Mode for displaying a tabulated list of user repos.
fj-user-repos-tl View a tabulated list of respos for USER.
fj-user-update-settings A transient for setting current user settings.
fj-users-mode Major mode for viewing users.
fj-view-commit-diff View a diff of a commit at point.
N fj-view-notifications View notifications for `fj-user'.
fj-view-notifications-all View all notifications for `fj-user'.
D fj-view-pull-diff View a diff of the entire current PR.
g fj-view-reload Try to reload the current view based on its major-mode.
fj-watch-repo Watch repo at point or in current view.
fj-watched-repos List your watched repos.