- Emacs Lisp 100%
| .gitignore | ||
| ajj-core.el | ||
| ajj-diff.el | ||
| ajj-log.el | ||
| ajj-mode-line.el | ||
| ajj.el | ||
| CLAUDE.md | ||
| README.md | ||
ajj
Wanna use jj but like magit? Yea me too.
Claude has been used heavily for creating this package, do with that information what you will.
Install
Needs Emacs 29.1, magit-section and jj (tested with 0.44).
(use-package ajj
:ensure nil
:load-path "~/Code/Emacs/ajj"
:commands (ajj-status ajj-show-revision ajj-log ajj-log-file
ajj-diff-unpushed ajj-diff-range ajj-interdiff)
:hook (after-init . ajj-mode-line-mode))
Buffers
| Command | Shows |
|---|---|
ajj-status |
The working copy and its parents, its changes, and jj's default log |
ajj-log |
The log of all(), or of a revset with a prefix argument |
ajj-log-file |
The history of the current file |
ajj-show-revision |
One change: its description and diff |
ajj-diff-unpushed |
Everything not pushed to a remote yet, against the last pushed ancestor |
ajj-diff-range |
The changes between two revisions |
ajj-interdiff |
How the changes two revisions make differ, like before and after a rewrite |
Keys in all of them:
| Key | |
|---|---|
RET |
Open the commit, or visit the file or line, at point |
d |
Describe the commit at point, or the working copy |
c |
Commit: describe the working copy and start a new change on top |
N |
Start a new change on the marked commits, merging them, or on the commit at point |
s |
Squash the marked commits, or the working copy, into the commit at point |
m |
Mark the commit at point, or unmark it |
ESC |
Unmark all commits, once there's no region |
b |
Set a bookmark on the commit at point, C-u allows moving it backwards |
w |
Copy the change id or file path at point, the commit id with C-u |
L |
Log |
D |
Unpushed changes |
g |
Snapshot the working copy and refresh |
q |
Quit |
In log buffers, r changes the revset and + shows more commits.
In the Operations section of status, u reverts the operation at point.
The graph follows jj's ui.graph.style, or ajj-log-graph-style if set.
Rarer commands have no key yet:
| Command | |
|---|---|
ajj-abandon |
Abandon the marked commits, those in the region, or the one at point |
ajj-absorb |
Move each change in the working copy into the commit that last touched its lines |
Marks
Marks pick the commits a command works on, across buffers: mark in a log, fire in a revision buffer. Commands that take several commits use the marks if there are any, and those that change the repo unmark what they used. Marked commits say so in the log.
N on marks starts a merge of them, like the base of a megamerge.
ajj-diff-range and ajj-interdiff compare two marks, or one mark and the
commit at point, and only ask without marks.
s squashes the marks into the commit at point. Without marks it squashes the
working copy instead, into its parent if point is on it or outside any commit.
When more than one side has a description, you're asked for the combined one.
Refreshing
Every jj operation, from anywhere, writes a file to .jj/repo/op_heads/heads.
ajj watches that directory and refreshes visible buffers when it changes, and
hidden ones when they are shown again. jj runs in the background, so Emacs
doesn't wait on it.
ajj only snapshots the working copy when you ask for it: opening a buffer,
pressing g, or running a command like d or s. File edits show up with the
next jj command from anywhere, or with g.
Mode line
ajj-mode-line-mode keeps the change id of each repo's working copy, plus its
bookmarks, in the ajj-mode-line construct. Like the buffers it is updated when
the repo changes, never on redisplay. Put it where vc-mode would go, or call
ajj-mode-line-string from your own mode line.
ajj-mode-line-marks shows how many commits are marked, in ajj buffers:
(add-to-list 'mode-line-misc-info '(t ajj-mode-line-marks))
Faces
Diffs highlight syntax and changed words. Hunks other than the current one use
ajj-diff-added, ajj-diff-removed and ajj-diff-context; the current one uses
the -highlight variants. These default to the diff-* faces, so themes should
set them to tell the two apart.
ajj buffers have no fringes, so diff colours reach the window edge.
Hacking
M-x ajj-reload kills ajj's buffers and reloads every file from source,
keeping your option values.