Skip to content

fix: lazy initialization for clipboard enable flag - #2017

Merged
cxxxr merged 2 commits into
mainfrom
refactor/clipboard-lazy-init
Dec 8, 2025
Merged

fix: lazy initialization for clipboard enable flag#2017
cxxxr merged 2 commits into
mainfrom
refactor/clipboard-lazy-init

Conversation

@cxxxr

@cxxxr cxxxr commented Dec 8, 2025

Copy link
Copy Markdown
Member

Summary

  • Fix clipboard initialization issue on Nix builds
  • Change *enable-clipboard-p* from defparameter to defvar for lazy initialization
  • Move platform detection logic into enable-clipboard-p function

Problem

On Nix builds, the clipboard enable flag was incorrectly initialized at compile time rather than runtime. This caused the platform detection (macOS SBCL version check, WSL detection) to evaluate in the build environment instead of the execution environment, resulting in incorrect clipboard behavior.

Solution

Defer the platform detection to runtime by initializing the flag lazily on first access to enable-clipboard-p.

@code-contractor-app

code-contractor-app Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

✅ Code Contractor Validation: PASSED

✓ Code Contractor Validation Result
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Statistics:
  Files Changed:    1
  Lines Added:      11
  Lines Deleted:    5
  Total Changed:    16
  Delete Ratio:     0.31 (31%)

Status: PASSED ✅

🤖 AI Providers:
  - codex — model: (Codex default)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Validation Rules:

✅ max_files_changed
✅ max_total_changed_lines
✅ max_delete_ratio
✅ defpackage_rule
✅ trim_whitespace_rule
✅ docstring_rule
✅ Alexandria and other utility libraries
✅ dynamic_symbol_call_rule
✅ functional_style_rule
✅ loop_keywords_rule
✅ variable_placement_rule
✅ keybinding_placement_rule
✅ error_handling_rule
✅ macro_style_rule
✅ user_variable_naming_rule

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎉 No violations detected. Great job!
📚 About Code Contractor

Declarative Code Standards That Learn and Improve

Define domain-specific validation rules in YAML.
Your contracts document team knowledge and evolve into more accurate AI enforcement.

Want this for your repo?
Install Code Contractor

On Nix builds, the clipboard enable flag was incorrectly initialized
at compile time rather than runtime. This caused the platform detection
(macOS SBCL version check, WSL detection) to evaluate in the build
environment instead of the execution environment.

Change *enable-clipboard-p* from defparameter to defvar and move the
initialization logic into enable-clipboard-p function to ensure
platform detection happens at runtime.
@cxxxr
cxxxr force-pushed the refactor/clipboard-lazy-init branch from f931254 to 7607dea Compare December 8, 2025 23:28
@cxxxr cxxxr changed the title refactor: lazy initialization for clipboard enable flag fix: lazy initialization for clipboard enable flag Dec 8, 2025
Explain why defvar is used instead of defparameter to ensure
platform detection runs at runtime, not compile time on Nix builds.
@cxxxr
cxxxr merged commit e038aad into main Dec 8, 2025
1 of 2 checks passed
@cxxxr
cxxxr deleted the refactor/clipboard-lazy-init branch December 8, 2025 23:32
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