Fix ghostel-debug advice arity for redraw-now's FORCE argument#463
Merged
Conversation
#460 gave `ghostel--redraw-now' an optional FORCE argument, but the debug advices that wrap it still declared the old single-argument arity. When debug logging or latency profiling is active, the forced redraw paths (`ghostel-force-redraw', the reappear hook) then signal `wrong-number-of-arguments': - `ghostel-debug--log-redraw' (:around) received three args into a two-parameter lambda, and dropped FORCE when forwarding to the original. - `ghostel-debug--latency-on-render' (:after) received two args into a one-parameter lambda. Accept and forward FORCE in the :around advice (folding it into the skip prediction and the force=... log column so the log stays truthful), and let the :after advice ignore it via `&rest'. `ghostel-debug--log-resize' (:around on `ghostel--adjust-size') had the same latent bug: `ghostel--adjust-size' already took an optional FORCE (a text-scale change passes it), so the advice would crash there too. Fix it the same way. Refresh the stale `declare-function' arity in ghostel-ime-test, and add a regression test asserting both redraw-now advices tolerate and forward FORCE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#460 gave
ghostel--redraw-nowan optionalFORCEargument ((buffer)→(buffer &optional force)). Adding an&optionalarg is safe for plain callers, but advices capture arity — and theghostel-debugadvices that wrapghostel--redraw-nowstill declared the old single-argument form. When debug logging or latency profiling is active, the forced redraw paths (ghostel-force-redraw, the reappear hookghostel--window-buffer-change) signalwrong-number-of-arguments:ghostel-debug--log-redraw(:around) received three args into a two-parameter lambda, and droppedFORCEwhen forwarding to the original.ghostel-debug--latency-on-render(:after) received two args into a one-parameter lambda.This was reported in #456 (review of #460).
Beyond the regression,
ghostel-debug--log-resize(:aroundonghostel--adjust-size) had the same latent bug already:ghostel--adjust-sizehas taken an optionalFORCEfor a while (a text-scale change passes it), so the resize advice would crash there too.Notably, this also blocks diagnosing the other open parts of #456:
ghostel-debug-startinstalls these advices, so switching workspaces (→ forced reappear redraw) throws before any useful log is produced. This fix is a precondition for debugging the rest.Changes
ghostel-debug--log-redraw: accept&optional force, forward it, and fold it into the skip prediction and theforce=…log column so the log stays truthful for arg-forced redraws.ghostel-debug--latency-on-render: accept&rest _(ignores the arg).ghostel-debug--log-resize: accept and forward&optional force(the pre-existing latent bug).test/ghostel-ime-test.el: refresh the staledeclare-functionarity.test/ghostel-debug-test.el: regression test asserting both redraw-now advices tolerate and forwardFORCE.Only affects sessions with
ghostel-debug-start/ latency profiling active; normal sessions were unaffected.make -j8 allis green.