feat: hover mode, configurable global predicate, :weight; drop render cache - #10
Merged
Conversation
… cache - svg-margin-hover-mode: a global minor mode that installs the show-help-function wrapper (chaining any prior) and sets svg-margin-hover-highlight, so the hover highlight no longer needs hand-wired boilerplate. - svg-margin-note-help: the former private svg-margin--note-help, now public (old name kept as an obsolete alias) for custom show-help wrappers. - svg-margin-global-predicate: choose which buffers global-svg-margin-mode enables in (default: file-visiting buffers). - :weight indicator key sets the :text font-weight (default bold). - Drop the unused per-render svg-margin--render-cache (no in-package consumer; it was per-render overhead). - Document the whole-buffer per-render provider cost.
There was a problem hiding this comment.
Pull request overview
This PR is an ergonomics/polish pass for svg-margin ahead of publishing, adding batteries-included hover highlight wiring, making global-svg-margin-mode buffer selection configurable, and extending text indicators with a configurable SVG font-weight, while removing an unused render cache.
Changes:
- Add
:weightsupport for:textindicators (default"bold") and tests validating forwarding/behavior. - Introduce
svg-margin-hover-mode(global) to wireshow-help-functionand exposesvg-margin-note-help(with an obsolete alias for the old private name), with corresponding tests. - Add
svg-margin-global-predicate(default file-visiting buffers) and document the new predicate + hover mode in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/svg-margin-test.el |
Adds ERT coverage for :weight, hover-mode wiring/chaining, obsolete alias behavior, and the new global predicate. |
svg-margin.el |
Implements :weight, publicizes hover help tracking + adds svg-margin-hover-mode, adds svg-margin-global-predicate, and drops the render cache. |
README.md |
Documents the new global predicate, :weight, and the simplified hover highlight setup via svg-margin-hover-mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+978
to
+981
| (setq svg-margin-hover-highlight t) | ||
| (unless (eq show-help-function #'svg-margin--show-help) | ||
| (setq svg-margin--prev-show-help show-help-function | ||
| show-help-function #'svg-margin--show-help))) |
Comment on lines
+976
to
+981
| (if svg-margin-hover-mode | ||
| (progn | ||
| (setq svg-margin-hover-highlight t) | ||
| (unless (eq show-help-function #'svg-margin--show-help) | ||
| (setq svg-margin--prev-show-help show-help-function | ||
| show-help-function #'svg-margin--show-help))) |
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.
Ergonomics + polish pass ahead of publishing.
P0 — hover is now batteries-included.
svg-margin-hover-mode(global) installs theshow-help-functionwrapper itself (chaining any prior one) and setssvg-margin-hover-highlight, so enabling the hover highlight is one line instead of hand-wired boilerplate. The former privatesvg-margin--note-helpis now the publicsvg-margin-note-help(old name kept as an obsolete alias) for anyone composing their own wrapper.P1
svg-margin-global-predicate— choose which buffersglobal-svg-margin-modeenables in (default: file-visiting buffers), instead of a hardwired predicate.svg-margin--render-cache(it had no in-package consumer and cost work on every render).P2
:weightindicator key for:textfont-weight (default bold).Tests added for weight, the hover mode (wiring + chaining), the alias, and the predicate.
package-lint/checkdocclean, 39 tests pass.