aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-07-01Release version 4.3.7v4.3.7Jonas Bernoulli
2025-07-01magit-after-save-refresh-status: Consult correct inhibit variableJonas Bernoulli
2025-06-30Restore window-start after refreshing a bufferJonas Bernoulli
2025-06-30magit-section-equal: New functionJonas Bernoulli
2025-06-30magit--refresh-buffer*: Handle undisplayed buffer case more explicitlyJonas Bernoulli
2025-06-30magit--refresh-buffer-set-positions: CosmeticsJonas Bernoulli
2025-06-30make authors: Show no diff if no commit was createdJonas Bernoulli
2025-06-30Update changelogJonas Bernoulli
2025-06-29magit--refresh-buffer-set-positions: No longer suppress unused hookJonas Bernoulli
`magit-section-goto-successor' no longer runs `magit-section-movement-hook', so we don't have to suppress it in `magit--refresh-buffer-set-positions'. Since that hook was why we wanted to handle the selected window last, when it displayed the buffer being refreshed, we can also stop changing the order of the windows returned by ``magit--refresh-buffer-get-positions'.
2025-06-29magit-refresh-buffer: Use different debug message when creating bufferJonas Bernoulli
2025-06-29magit-refresh-buffer: Avoid resetting when first creating bufferJonas Bernoulli
2025-06-29magit-refresh-buffer: Spin out magit--refresh-buffer-functionJonas Bernoulli
2025-06-29magit-refresh-buffer: Reduce extend of a bindingJonas Bernoulli
2025-06-29magit-refresh-buffer: Spin out magit--refresh-buffer-{get,set}-positionsJonas Bernoulli
2025-06-28magit-refresh-buffer: Reset magit-section-focused-sectionsJonas Bernoulli
This variable is also reset in `magit-section-pre-command-hook' but that only affects the current buffer. We also have to reset this cache when refreshing a buffer, otherwise it would continue to track sections from the previous generation, which no longer exist. For example, if point is on an unstage hunk in the status and the user invokes a commit command, then the commit message buffer is current when the commit is finalized. In that case `magit-section-update-paint' was called for two section in the status buffer; the previous generation hunk (which ended up being a noop) and the actually focused hunk (which was not included in the value returned by `magit-focused-sections', because that cache had not been invalidated yet, and thus got painted as unfocused).
2025-06-22magit-save-repository-buffers: Compile two more lambdaJonas Bernoulli
There appears to be a change in Emacs 31 compared to 28.2, which makes this unnecessary, but on the older release we otherwise get an error about the `##' forms being invalid functions. Even for newer releases it's better to use code instead of data. Closes #5399.
2025-06-16manual: Fix minor typoJacob Ilsø
2025-06-16magit-show-process-buffer-hint: New optionJonas Bernoulli
2025-06-16magit-process-finish: Show usage hint even if error is signaledJonas Bernoulli
Inform the user that the process buffer contains the full error (and other output), regardless of whether `message' or `signal' is used to show a short error message in the echo area. Closes #5396.
2025-06-16magit-process-finish: Look up key binding in current bufferJonas Bernoulli
2025-06-16magit-process-finish: Remove unnecessary commentsJonas Bernoulli
2025-06-16manual: Correct and refine information about process outputJonas Bernoulli
2025-06-10magit-log-remove-graph-args: Remove --grep from listJonas Bernoulli
We don't know since when "--grep" and "--graph" are no longer mutually exclusive, but it is since before Git v2.25.0, which is the minimal version required by Magit. Closes #5391.
2025-06-10Clarify that commands run magit-section-movement-hook explicitlyJonas Bernoulli
Closes #5394.
2025-06-10magit-section-update-paint: Register already painted expanded hunkJonas Bernoulli
When we navigate to a collapsed hunk, whose body is secretly already highlighted and expand it, we can (and already do) avoid painting it again. However, we failed to register it as painted again, which is necessary to cause it to be unhighlighted once we move away from it, regardless of how far back the painting as highlighted occurred. We do not just leave the section registered as painted, after collapsing it and then moving away, because `magit-section-update-highlight' would then have to consider its state after every command. Closes #5393. Suggested-by: Eliza Velasquez
2025-06-06Use higher overlay priority for selection highlighting overlaysJonas Bernoulli
Since v4.3.7 the overlays used for section highlighting and section selection conflicted, if both of these faces relied on the same face property (likely the foreground color). The usual way to theme these faces is to use the background for highlighting and the foreground for the selection. Closes #5389.
2025-06-05git-rebase--insert-descriptions: Consistently use comment-startJonas Bernoulli
Closes #5388.
2025-06-05magit-bookmark-get-value: New generic functionJonas Bernoulli
This makes it possible to use Magit's bookmark support in Forge.
2025-06-01Release version 4.3.6v4.3.6Jonas Bernoulli
2025-05-31magit-apply-patch: Respect buffers context limitJonas Bernoulli
Applying the region used to fail, even if the changes withing would apply but some other part of the hunk, outside the region, conflicts with the target.
2025-05-31Bring back a variant of delayed hunk refinementJonas Bernoulli
The old variant broke with [1: 95ee9d8c51], which cannot be fixed simply be reverting that commit, because it was in preparation of subsequent changes, which heavily refactored section highlighting making it both simpler and more generic, and also to improve performance. Delayed hunk refinement conflicts with the former, and due to the latter it might not be necessary anymore. This commit does not fully restore the old behavior. Previously delayed refinement meant that only the current hunk was ever refined; when another section became current, the refinement of the previously current section was removed again. Now, once a hunk has been refined, it remains refined, until the buffer is refreshed. The reason any form of delayed hunk refinement was implemented in the first place, was to avoid the upfront cost of completely refining a large diff. I never considered this a desirable feature; just a kludge that was sadly necessary for performance reasons. IMO the new behavior is an improvement; though always refining all hunks is of course even better, unless it is too slow of course. Closes #5385. 1: 2025-04-26 95ee9d8c5102bc5619f0e2c6d50104cae17b2009 magit-diff-paint-hunk: Only refine if actually painting
2025-05-31magit-diff-update-hunk-refinement: CosmeticsJonas Bernoulli
2025-05-31magit-rebase--todo: Prevent false-positivesJonas Bernoulli
Previously, if `git-rebase-show-instructions' was non-nil, it was possible that a line containing usage information was mistaken for a rebase action. Alternatively we could use `with-editor-pre-finish-hook' to flush the usage information after the user has seen them, just like we flush them earlier in `git-rebase-mode', iff `git-rebase-show-instructions' is nil.
2025-05-31git-rebase-{alter,squish}: New commandsJonas Bernoulli
2025-05-28git-rebase-drop: New commandJonas Bernoulli
Closes #4690.
2025-05-28git-rebase-current-line: CosmeticsJonas Bernoulli
2025-05-27magit-show-commit: CosmeticsJonas Bernoulli
2025-05-20Update changelogJonas Bernoulli
2025-05-19magit-stash-read-message: Fix previous commitJonas Bernoulli
The first default/future-history-element is also *the* default.
2025-05-18magit-stash-read-message: Also offer "On branch: " as history elementJonas Bernoulli
2025-05-18Generalize section paintingJonas Bernoulli
Hunks are still the only sections whose bodies have to painted when they are highlighted and unhighlighted. The reason this is necessary is that highlighting is done by using (an) overlay(s) to change the background color of selected sections, which shadows an significant background color used in section bodies. Hunks use different background colors to indicate added and removed lines. Instead of using overlays, the background colors of these lines (and also of context lines) are changed using text properties, when a hunk gains or loses focus. I.e., they are "painted". Such painting is more expensive than merely removing or adding one or more overlays, because the text has to be parsed again, so we have to avoid doing it unless actually necessary. We do not only want to avoid needlessly painting hunks when moving around in the buffer, we also want to avoid it for (hunk) sections whose bodies are not visible yet. To accomplish that the `washer' section slot was added. Its purpose is to delay "washing" until the section is expanded. This slot was originally added specifically for hunk sections, but by now it is used by many other sections too. In most cases it is even used to not only delay washing (~= "parsing" and "painting") but to even delay inserting any section content until that time. With this commit, we *stop* using the function from the `washer' slot for hunk painting, and replace that with a new mechanism that is inspired by the old washer mechanism, but incorporates lessons learned since. The two drivers are still `magit-section-update-highlight' and `magit-section-show'. These two functions are the main driving forces behind the two events that make *might* make it necessary to repaint. Replace the hook `magit-section-unhighlight-hook' with a new generic function `magit-section-paint'. Create such a method for diffs, using the hunk-specific parts of removed `magit-diff-paint-hunk'. The parts that function are not hunk-specific, are replaced with similar logic in new `magit-section-update-paint'. `magit-section-update-paint' is where we now decide whether repainting is actually necessary.
2025-05-18Generalize selective section highlightingJonas Bernoulli
Most sections are highlighted using a single overlay that covers the complete section, including child sections, if any. Nearly as simple to highlight are sections that use two overlays, one for its own heading and the other for its body (again covering all children). Selective highlighting is necessary when the headings of child sections ought to like different from their body, or when their bodies use faces that set the background and that should not be shadowed by highlighting. Until recently both was only needed for diff-related sections, the later only for hunks. So the implementation was also diff-specific and treated this problem as a collection of special cases. Add a new implementation that can be used by other sections as well. The section slots `heading-highlight-face' already existed, but some sections did not used it and instead propertized their headings using custom code. Now this slot should be used, as that makes it possible to detect when selective highlighting is necessary. If that is undesirable for some reason the new `selective-highlight' can be set to a non-nil value instead. The new `magit-section-selective-highlight-p' function is used to detect the need for selective highlighting. Its implementation should be trivial to understand. For consistency add a new slot `heading-selection-face', similar to `heading-highlight-face'. Note that the value of this option does not influence the decision whether selective highlighting is needed. Add a third new slot `painted', which is unbound by default. If it is bound to any value, that indicates that the section has to be painted. Starting with the next commit the actual value will indicated whether it has already been painted, and if so, what kind of paint was used.
2025-05-18Replace magit-section-highlight-hook with two boolean optionsJonas Bernoulli
Replace the hook `magit-section-highlight-hook' with a generic function `magit-section-highlight'. To preserve the ability to disable highlighting of the current section and/or section selection highlighting, add new options, `magit-section-highlight-current' and `magit-section-highlight-selection'. Do not replace the related `magit-section-unhighlight-hook' just yet. In two commits that will also be replace with a generic function (though in that case its not an exact replacement).
2025-05-18Call magit-status-goto-initial-section before highlightingJonas Bernoulli
`magit-post-create-buffer-hook' is called right after `magit-refresh-buffer' returned, i.e., after that called `magit-section-update-highlight'. Move `magit-status-goto-initial-section' from that hook to the new `magit--initial-section-hook', which `magit-refresh-buffer' calls, but only when the buffer is being created, not merely refreshed. This avoids highlighting the wrong section before highlighting the correct one. Using such a hook is a bit of a hack. It might be better to instead add an option that maps modes to initial sections, instead of a hook, but let's not commit to that just yet.
2025-05-18Finalize inserted sections after moving to the current sectionJonas Bernoulli
After refreshing a buffer, and thus (re-)creating all sections, `magit-section-show' has to be called on the root section to set the correct visibility of all sections. That function may also highlight the current section. But when called at this time, point is at the beginning of the buffer, so the wrong section gets highlighted. Then, back in `magit-refresh-buffer' point is moved to the correct section, before `magit-section-update-highlight' is called, and since a different section is current now, highlighting has to be updated. Avoiding to highlight twice was the motivation for this change, but a later commit prevents it differently. Despite that making this change not strictly necessary, it feels right to move the `magit-section-show' call to `magit-refresh-buffer'.
2025-05-18Coordinate highlighting between refresh and post-command phasesJonas Bernoulli
1. When a buffer is refreshed, section highlighting has to be updated. 2. More than one buffer may be refreshed at the same time and the current buffer may or may not be among them. 3. Therefore highlighting has to happen during the refresh phase. 4. However, re-highlighting can also be necessary when not refresh took place (or at least the current buffer wasn't refreshed. 5. Therefore re-highlighting has to happen during the post-command phase, which happens after every command in a Magit buffer. We may therefore end up refreshing the same buffer twice. To avoid that record when a buffer is refreshed and during the post-command phase skip highlighting such buffers before zpping the list of refreshed buffers. A weaker attempt to accomplish this was already in place, but checking whether `this-command' is a refresh command does not cast a wide enough net. Instead of recording buffers that have been refreshed and highlighted, we could not highlight during the refresh phase and instead record buffers as needing to be highlighted during the post-command phase.
2025-05-18magit-diff--goto-position: Do not needlessly update highlightingJonas Bernoulli
2025-05-18magit-section--opportunistic-wash: Move renamed functionJonas Bernoulli
2025-05-18magit-section-highlight-range: Tweak renamed functionJonas Bernoulli
Now that this isn't used for the selection anymore, just section highlighting, rename it accordingly. Do not use "region" in the name to avoid confusing it with `magit-section--highlight-region' which highlights *the* region. Make FACE optional and default to `magit-section-highlight'.
2025-05-18Track highlighting and selection overlays separatelyJonas Bernoulli
That isn't actually necessary but is conceptually cleaner.