gonewest818 / dimmer.el

Interactively highlight which buffer is active by dimming the others.
GNU General Public License v3.0
267 stars 14 forks source link

(dimmer-configure-company-box) wrong-type argument #44

Closed denis631 closed 4 years ago

denis631 commented 4 years ago

Problem is when using (dimmer-configure-company-box) in my config, it doesn't work and always shows me an error message.

I assume it has to with the fact that (dimmer-configure-company-box) puts a lambda to the list of predicates, but at https://github.com/gonewest818/dimmer.el/blob/master/dimmer.el#L490 fboundp is called on f, which fails when calling it on lambda (not sure though)

I worked around this by creating a dummy function with the same logic and adding it to the predicate list. I assume removing the fboundp check would work. Idk how crucial it is though

Config:

(use-package! dimmer
  :defer 1
  :config
  (setq dimmer-fraction 0.7)
  (dimmer-configure-company-box)
  (dimmer-configure-posframe)
  (dimmer-mode t))

Stack trace:

Debugger entered--Lisp error: (wrong-type-argument symbolp #f(compiled-function () #<bytecode 0x42e96913>))
  fboundp(#f(compiled-function () #<bytecode 0x42e96913>))
  #f(compiled-function (f) #<bytecode 0x42ea34ab>)(#f(compiled-function () #<bytecode 0x42e96913>))
  cl-some(#f(compiled-function (f) #<bytecode 0x42ea34ab>) (#f(compiled-function () #<bytecode 0x42e96913>) window-minibuffer-p))
YumiSuki commented 4 years ago

I do get this error too when I use (dimmer-configure-company-box) like above. Any idea how to fix this yet?

Debugger entered--Lisp error: (wrong-type-argument symbolp #f(compiled-function () #<bytecode 0x1558861a3229>))
  fboundp(#f(compiled-function () #<bytecode 0x1558861a3229>))
  #f(compiled-function (f) #<bytecode 0x1558861a57f9>)(#f(compiled-function () #<bytecode 0x1558861a3229>))
  cl-some(#f(compiled-function (f) #<bytecode 0x1558861a57f9>) (#f(compiled-function () #<bytecode 0x1558861a3229>) window-minibuffer-p))
  dimmer-process-all(t)
  dimmer-config-change-handler()
  redisplay_internal\ \(C\ function\)()
  message("%s" "For information about GNU Emacs and the GNU system...")
  display-startup-echo-area-message()
  command-line-1(nil)
  command-line()
  normal-top-level()
denis631 commented 4 years ago

@YumiSuki as I said, I workaround for this (without the fix) would be creating a dummy function, e.g. my conifg

(defun company-box-p ()
  (string-prefix-p " *company-box-" (buffer-name)))

(use-package! dimmer
  :config
  (setq dimmer-fraction 0.7
        dimmer-prevent-dimming-predicates '(window-minibuffer-p company-box-p))
  (dimmer-configure-posframe)
  (dimmer-mode t))
gonewest818 commented 4 years ago

pushed a fix for this. it ought to show up in the next MELPA automated build (scheduled to start in a few minutes), or the build after that, ie. in the next few hours.