LionyxML / auto-dark-emacs

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS, Linux or Windows Dark Mode settings
GNU General Public License v2.0
140 stars 34 forks source link

issue "Could not determine a viable theme detection mechanism!" on macOS with doom emacs #45

Closed marceloexc closed 6 months ago

marceloexc commented 7 months ago

when running auto-dark-mode via M-x, i get the following message:

auto-dark--determine-detection-method: Could not determine a viable theme detection mechanism!

doom doctor prompt:

> Checking Doom Emacs...
  x There was an unexpected runtime error
    Message: Could not determine a viable theme detection mechanism!
    Backtrace:
      (signal error ("Could not determine a viable theme detection mechanism...
      (error "Could not determine a viable theme detection mechanism!")
      (auto-dark--determine-detection-method)
      (auto-dark-mode 1)
      ((closure (t) nil (progn (funcall (or (get 'auto-dark-dark-theme 'cust...
      (eval-after-load doom-ui (closure (t) nil (progn (funcall (or (get 'au...
      (eval-buffer #<buffer  *load*-416067> nil "/Users/marceloexc/.config/d...
      (load-with-code-conversion "/Users/marceloexc/.config/doom/config.el" ...
      (load "~/.config/doom/config" nil nomessage)
      (condition-case e (load path noerror 'nomessage) ((debug doom-error) (...
      (doom-load "~/.config/doom/config")
      (let ((doom-module-context [1 105 -105 :user nil nil nil])) (doom-load...
    ! Wrote extended backtrace to ~/.config/emacs/.local/state/logs/cli.doom.240115213447.50825.error

this is on a 2019 macbook pro running ventura 13.6.3

marceloexc commented 7 months ago

this might be helpful too

$ ./doom --version
GNU Emacs     v29.1            nil
Doom core     v3.0.0-pre       HEAD -> master 03d692f1 2023-12-08 15:11:45 -0500
Doom modules  v23.12.0-pre     HEAD -> master 03d692f1 2023-12-08 15:11:45 -0500

Copyright (c) 2014-2022 Henrik Lissner.

Sorry, it might be nooby question. I only installed doom-emacs yesterday

LionyxML commented 7 months ago

Hello there!

Nice, let's try some stuff:

1.) Did you check the README for the notes on installing it with Doom Emacs? https://github.com/LionyxML/auto-dark-emacs?tab=readme-ov-file#doom-emacs

2.) I see you're under macOS. How did you installed it? We strongly recommend you use "emacs plus" formulae, since it provides a faster method of detection, if not, you need to set OSAScript support, allow Emacs to run scripts and other stuff.

If you could just try Emacs Plus Formulae, it would be great:

brew install \
  --ignore-dependencies \
  emacs-plus \
  --with-native-comp \
  --with-xwidgets \
  --with-imagemagick \
  --with-mailutils \
  --with-poll \
  --with-no-frame-refocus

All --with are optionals, I just pasted what I usually call to install Emacs on MacOS.

Let me know how it goes.

CsBigDataHub commented 7 months ago

@LionyxML please see - https://www.reddit.com/r/emacs/comments/19bf6sj/please_help_me_understand_why_modus_themes_are/

i am quoting this from reddit -

This is a bug in auto-dark, which calls ns-do-applescript exclusively. On the emacs-mac (Carbon) port, the command is mac-do-applescript. auto-dark can tell which build it's on using window-system, which is either ns or mac. Please report this.

CsBigDataHub commented 7 months ago

@marceloexc try to enable '(auto-dark-allow-osascript t). should work for you.

LionyxML commented 6 months ago

@CsBigDataHub thanks for pointing (setq auto-dark-allow-osascript t), this somewhat "older" method is a bit slower as it depends on a pooling timer, but if set, can be used in a wider variety of emacs ports for macOS.

Regarding your post on Reddit, I like the idea of supporting more macOS Emacs ports. Could you provide me with the installer for your port of Emacs (Carbon Emacs)?

CsBigDataHub commented 6 months ago

@CsBigDataHub thanks for pointing (setq auto-dark-allow-osascript t), this somewhat "older" method is a bit slower as it depends on a pooling timer, but if set, can be used in a wider variety of emacs ports for macOS.

Regarding your post on Reddit, I like the idea of supporting more macOS Emacs ports. Could you provide me with the installer for your port of Emacs (Carbon Emacs)?

https://github.com/railwaycat/homebrew-emacsmacport

Chicker commented 6 months ago

I allowed Emacs to access system events and the problem fixed

Go to and toggle on:

 Settings -> Privacy & Security -> Emacs -> System Events 
LionyxML commented 6 months ago

@CsBigDataHub,

I just merged emacs-mac support into master, it should soon be available on Melpa (package version: 0.12).

Thanks for pointing that out!

CsBigDataHub commented 6 months ago

@CsBigDataHub,

I just merged emacs-mac support into master, it should soon be available on Melpa (package version: 0.12).

Thanks for pointing that out!

Thank you. Tested and working great.