-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify osascript
handling
#61
base: master
Are you sure you want to change the base?
Conversation
This makes a few changes, somewhat independent, but all related: * defaults `auto-dark-allow-osascript` to true[^1]; * falls back to `osascript` on-demand if neither `ns-do-applescript` nor `mac-do-applescript` is available[^2]; and * removes `osascript` as a separate `auto-dark-detection-method`[^3]. These can be easily separated depending on which, if any, you think are improvements. [^1]: I don’t know why this is even a variable. If it’s not allowed, then there is no way to use Auto-Dark on systems that require it, and the failure mode is opaque (“Could not determine a viable theme detection mechanism!”). [^2]: If this change isn’t made, then the error message “Try setting `auto-dark-allow-osascript` to t” doesn’t make sense, as it’s only reported in a location where the value of `auto-dark-allow-osascript` has no effect. The alternative is to change the error message to something like “`auto-dark-detection-method` indicates that this Emacs build has AppleScript support, but none could be found. Either rebuild Emacs with AppleScript support or change the detection method and set `auto-dark-allow-osascript`”. [^3]: With LionyxML#59, the two `fboundp` checks added before falling back to `osascript` should be more than outweighed by the removal of shell invocation.
cd56b90
to
a6172e1
Compare
Another question I had somewhat related to this … I had considered unifying the |
Rather than just saying that we _couldn’t_ determine the detection method, this indicates why and makes some suggestions. Probably even longer errors with concrete steps to remedy each case would be helpful. This includes an alternative approach to the first bullet point in LionyxML#61 – changing where we suggest that `auto-dark-allow-osascript` should be enabled (although this does not change the error that suggests it in the wrong place).
you can have |
This makes a few changes, somewhat independent, but all related:
auto-dark-allow-osascript
to true1;osascript
on-demand if neitherns-do-applescript
normac-do-applescript
is available2; andosascript
as a separateauto-dark-detection-method
3.These can be easily separated depending on which, if any, you think are improvements.
Footnotes
I don’t know why this is even a variable. If it’s not allowed, then there is no way to use Auto-Dark on systems that require it, and the failure mode is opaque (“Could not determine a viable theme detection mechanism!”). There’s probably something I’m overlooking, but if so, it should be documented. ↩
If this change isn’t made, then the error message “Try setting
auto-dark-allow-osascript
to t” doesn’t make sense, as it’s only reported in a location where the value ofauto-dark-allow-osascript
has no effect. The alternative is to change the error message to something like “auto-dark-detection-method
indicates that this Emacs build has AppleScript support, but none could be found. Either rebuild Emacs with AppleScript support or change the detection method and setauto-dark-allow-osascript
”. ↩With Simplify AppleScript handling #59, the two
fboundp
checks added before falling back toosascript
should be more than outweighed by the removal of shell invocation. ↩