SystemCrafters / crafted-emacs

A sensible base Emacs configuration.
MIT License
733 stars 115 forks source link

[bug] unsafe variable crafted-ui-use-doom-modeline #248

Closed cfclavijo closed 1 year ago

cfclavijo commented 1 year ago

I had to enable this variable right before requiring crafted-ui in order to make it work, otherwise, it crashes the initialization. I tried adding it directly to custom.el and even emacs/init.el but still crashes It's also crashing if I set the variable to nil before requiring crafted-ui

Funny thing, the message points to helm-ag-show-status-function

Stack trace

Debugger entered--Lisp error: (void-variable helm-ag-show-status-function)
  doom-modeline-mode(-1)
  (if val (doom-modeline-mode 1) (doom-modeline-mode -1))
  (closure (t) (sym val) (set-default sym val) (if val (doom-modeline-mode 1) (doom-modeline-mode -1)))(crafted-ui-use-doom-modeline nil)
  custom-initialize-reset(crafted-ui-use-doom-modeline (funcall #'(closure (t) nil "" nil)))
  custom-declare-variable(crafted-ui-use-doom-modeline (funcall #'(closure (t) nil "" nil)) "Use doom-modeline-mode." :group crafted-ui :type boolean :tag "Use Doom Modeline" :set (closure (t) (sym val) (set-default sym val) (if val (doom-modeline-mode 1) (doom-modeline-mode -1))))
  load-with-code-conversion("/home/carlosrendon/.config/emacs/modules/crafted-u..." "/home/carlosrendon/.config/emacs/modules/crafted-u..." nil t)
  require(crafted-ui)
  load-with-code-conversion("/home/carlosrendon/.config/crafted-emacs/config.el" "/home/carlosrendon/.config/crafted-emacs/config.el" nil t)
  load("/home/carlosrendon/.config/crafted-emacs/config.el" nil nomessage)
  (progn (load crafted-config-file nil 'nomessage))
  (if (file-exists-p crafted-config-file) (progn (load crafted-config-file nil 'nomessage)))
  load-with-code-conversion("/home/carlosrendon/.config/emacs/init.el" "/home/carlosrendon/.config/emacs/init.el" t t)
  load("/home/carlosrendon/.config/emacs/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x60388c9ec7a8e6c>) #f(compiled-function () #<bytecode 0x4d12c0e0e454f0b>) t)
  command-line()
  normal-top-level()

Commit that introduces the bug https://github.com/SystemCrafters/crafted-emacs/commit/383d7c2c42ecb4da0dc40d483e652f0dce6d0118

jeffbowman commented 1 year ago

Well, shucks... I had tested this several different ways and they all worked. I was using a very minimal configuration though, ie only using (require 'crafted-ui) and nothing else. Let me see what I can figure out.

jeffbowman commented 1 year ago

Can you share a link to your config? Then I can try to duplicate this directly and work through the issues from the perspective of your config. I have installed helm-ag as well (which is where that particular variable is defined) but I'm not running into this problem still. This could be an ordering issue as using the doom-modeline seems to have configuration for those who use helm but which may have issues. One possible solution is to use (with-eval-after-load 'helm-ag (require 'crafted-ui)), but that depends on how you are configuring helm-ag.

jeffbowman commented 1 year ago

Ah... you seem to be using the development version of doom-modeline. The stable version does not exhibit this behavior. You might consider installing the current stable version (3.3.2 at the moment) of doom-modeline, unless you have a need for some feature of the development version (currently 20221111.711 from MELPA). Otherwise, you should probably log an issue with the doom-modeline project. Here is a minimal config you can use to report this with them:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-refresh-contents)
(package-install 'helm-ag)
(package-install 'doom-modeline)
(package-initialize)
(doom-modeline-mode -1)

put this in a file like doom-modeline-bug.el and then load it with the following command:

emacs -Q -l doom-modeline-bug.el

The error will be in the *Messages* buffer.

I'll leave this open for a few days, but will close this a "not a bug" after that time.

@cfclavijo Hope this helps you.

cfclavijo commented 1 year ago

You are completely right!, the 3.3.2 version works as expected!

jeffbowman commented 1 year ago

Not a bug with Crafted Emacs, see comments in this issue for more information.