Skip to content

Highlight overlong JJ descriptions and auto-fill body#61

Open
ArthurHeymans wants to merge 1 commit into
0WD0:mainfrom
ArthurHeymans:commitMaxLineLength
Open

Highlight overlong JJ descriptions and auto-fill body#61
ArthurHeymans wants to merge 1 commit into
0WD0:mainfrom
ArthurHeymans:commitMaxLineLength

Conversation

@ArthurHeymans

@ArthurHeymans ArthurHeymans commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Add configurable JJ description summary length highlighting using Magit's 68-column default, and configure fill-column for description buffers.

Enable auto-fill during JJ description setup while skipping the summary line, mirroring git-commit behavior. Document the new options and cover summary highlighting/fill-column setup with tests.

Summary by CodeRabbit

  • New Features
    • Added new options to control overlong summary highlighting (with a configurable max-length) in JJ description buffers
    • Added an optional fill column setting for consistent wrapping
    • Improved auto-fill behavior to maintain correct formatting of the summary line
  • Documentation
    • Documented the new configuration options in the manual
  • Tests
    • Added coverage for overlong summary highlighting behavior and fill-column setup
  • Bug Fixes
    • Ensured these description behaviors are consistently refreshed on major mode changes

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a05ea123-1533-4bac-bcc3-7a1933a0dde6

📥 Commits

Reviewing files that changed from the base of the PR and between de7a73d and 14d68aa.

📒 Files selected for processing (4)
  • docs/majutsu.org
  • docs/majutsu.texi
  • majutsu-jjdescription.el
  • test/majutsu-jjdescription-test.el
✅ Files skipped from review due to trivial changes (2)
  • docs/majutsu.texi
  • docs/majutsu.org
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/majutsu-jjdescription-test.el
  • majutsu-jjdescription.el

Walkthrough

This PR extends JJ description buffer editing with two new user-configurable options: majutsu-jjdescription-summary-max-length to control overlong-summary highlighting width, and majutsu-jjdescription-fill-column to set a local fill-column. Auto-fill mode is enabled while protecting the summary line from automatic filling.

Changes

JJ description customization options

Layer / File(s) Summary
Configuration definitions and auto-fill setup
majutsu-jjdescription.el
Two defcustom options define the summary max-length (default 68) and optional fill-column override, with helper functions majutsu-jjdescription-setup-auto-fill and majutsu-jjdescription--auto-fill-except-summary to enable auto-fill while skipping the summary line.
Summary regexp and font-lock highlighting
majutsu-jjdescription.el
New majutsu-jjdescription--summary-regexp function builds a regex matching summary text beyond the configured max-length. Font-lock keyword construction updated to apply git-commit-overlong-summary face conditionally when max-length is an integer.
Setup flow integration
majutsu-jjdescription.el
majutsu-jjdescription-setup and its major-mode-change refresh path now apply the optional fill-column and enable auto-fill configuration after comment setup completes.
Documentation
docs/majutsu.org, docs/majutsu.texi
Both new customization variables documented under "Description Options" with their defaults and purposes in Org and Texinfo manual formats.
Test coverage
test/majutsu-jjdescription-test.el
Two new ERT tests verify overlong-summary highlighting respects max-length boundaries and that fill-column is properly configured in description buffers.

🎯 2 (Simple) | ⏱️ ~12 minutes

Ears twitch with joy—two toggles spring to life!
Max-length glows, fill-column flows,
Auto-fill, yet the summary respects the height—
JJ's words now dance as writers write. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: highlighting overlong JJ descriptions and enabling auto-fill for the description body, matching the PR's core objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
majutsu-jjdescription.el (1)

655-660: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Re-apply fill/auto-fill settings after major-mode changes.

majutsu-jjdescription-setup now configures fill-column and auto-fill (Line 625-629), but majutsu-jjdescription-setup-font-lock-in-buffer (Line 655-660) only reapplies comments/font-lock. After a major-mode switch, JJ description buffers can lose the new fill behavior.

Suggested fix
 (defun majutsu-jjdescription-setup-font-lock-in-buffer ()
   "Refresh JJ description font-lock after major-mode changes."
   (when (and buffer-file-name
              (string-match-p majutsu-jjdescription-regexp buffer-file-name))
     (majutsu-jjdescription-setup-comments)
+    (when majutsu-jjdescription-fill-column
+      (setq-local fill-column majutsu-jjdescription-fill-column))
+    (majutsu-jjdescription-setup-auto-fill)
     (majutsu-jjdescription-setup-font-lock)))

Also applies to: 625-629

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@majutsu-jjdescription.el` around lines 655 - 660, majutsu-jjdescription-setup
currently configures fill-column and auto-fill; ensure those same settings are
reapplied after major-mode changes by updating
majutsu-jjdescription-setup-font-lock-in-buffer to call the fill/auto-fill
reconfiguration (the same logic used in majutsu-jjdescription-setup, e.g.,
setting fill-column and enabling/disabling auto-fill-mode) in addition to
calling majutsu-jjdescription-setup-comments and
majutsu-jjdescription-setup-font-lock; also verify the fill/auto-fill setup code
in majutsu-jjdescription-setup is factored into a helper (or made idempotent) so
both majutsu-jjdescription-setup and
majutsu-jjdescription-setup-font-lock-in-buffer can reuse it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@majutsu-jjdescription.el`:
- Around line 88-89: Constrain the customization
majutsu-jjdescription-summary-max-length to non-negative integers (e.g. change
its defcustom :type to an integer with :min 0 or add a :validate to reject
negatives) so majutsu-jjdescription--summary-regexp and
majutsu-jjdescription--build-font-lock-keywords never receive a negative value;
also ensure after-change-major-mode-hook invokes the full setup by calling
majutsu-jjdescription-setup (not just
majutsu-jjdescription-setup-font-lock-in-buffer) so fill-column and auto-fill
setup run in new buffers.

---

Outside diff comments:
In `@majutsu-jjdescription.el`:
- Around line 655-660: majutsu-jjdescription-setup currently configures
fill-column and auto-fill; ensure those same settings are reapplied after
major-mode changes by updating majutsu-jjdescription-setup-font-lock-in-buffer
to call the fill/auto-fill reconfiguration (the same logic used in
majutsu-jjdescription-setup, e.g., setting fill-column and enabling/disabling
auto-fill-mode) in addition to calling majutsu-jjdescription-setup-comments and
majutsu-jjdescription-setup-font-lock; also verify the fill/auto-fill setup code
in majutsu-jjdescription-setup is factored into a helper (or made idempotent) so
both majutsu-jjdescription-setup and
majutsu-jjdescription-setup-font-lock-in-buffer can reuse it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 08b7616e-e045-437a-b14e-775934d15a85

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1de14 and de7a73d.

📒 Files selected for processing (4)
  • docs/majutsu.org
  • docs/majutsu.texi
  • majutsu-jjdescription.el
  • test/majutsu-jjdescription-test.el

Comment thread majutsu-jjdescription.el Outdated
@ArthurHeymans ArthurHeymans force-pushed the commitMaxLineLength branch from de7a73d to 044ce96 Compare June 3, 2026 12:57
Add configurable JJ description summary length highlighting using
Magit's 68-column default, and configure fill-column for description
buffers.

Enable auto-fill during JJ description setup while skipping the summary
line, mirroring git-commit behavior. Document the new options and cover
summary highlighting/fill-column setup with tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant