dimmer.el icon indicating copy to clipboard operation
dimmer.el copied to clipboard

dimmer-configure-company-box isn't working

Open WhatDothLife opened this issue 4 years ago • 6 comments

I just installed company-box and for me the above mentioned function doesn't prevent dimmer from dimming the current buffer I'm editing. Providing screenshots isn't possible, since it resets the dimming configuration. Is anyone able to reproduce this?

WhatDothLife avatar Sep 03 '20 13:09 WhatDothLife

My personal configuration is a bit unstable because I'm finally getting around to setting up emacs-lsp, pyls, and clangd, also upgraded to 27.1, and I'm working on Windows for the first time in years ... but let me make sure I have company-box enabled and I'll report back what happens for me.

gonewest818 avatar Sep 03 '20 14:09 gonewest818

And as expected my configuration is just broken enough that I can't confirm this easily ... it's the middle of a work day and then a holiday weekend so I'll get back to you next week.

gonewest818 avatar Sep 03 '20 19:09 gonewest818

Ok, there's no hurry.

WhatDothLife avatar Sep 03 '20 19:09 WhatDothLife

I've run into a (maybe) similar problem with company-posframe. The issue is that the company popup triggers window-configuration-change-hook which calls (dimmer-process-all t) with the force argument set.

I've hacked this function into the following, which fixed my issue. I haven't noticed any downsides so far (though there probably are some).

(defun dimmer-process-all (&optional force)
  "Process all buffers and dim or un-dim each.

When FORCE is true some special logic applies.  Namely, we must
process all buffers regardless of the various dimming predicates.
While performing this scan, any buffer that would have been
excluded due to the predicates before should be un-dimmed now."
  (dimmer--dbg-buffers 1 "dimmer-process-all")
  (let* ((selected (current-buffer))
         (ignore   (cl-some (lambda (f) (and (fboundp f) (funcall f)))
                            dimmer-prevent-dimming-predicates))
         (visbufs  (dimmer-visible-buffer-list))
         (filtbufs (dimmer-filtered-buffer-list visbufs)))
    (dimmer--dbg 1 "dimmer-process-all: force %s" force)
    (when (or force (not ignore))
      (dolist (buf (if force visbufs filtbufs))
        (dimmer--dbg 2 "dimmer-process-all: buf %s" buf)
        (if (or (eq buf selected)
                (and force (not (memq buf filtbufs)))
		(and (eq buf dimmer-last-buffer) (not (memq selected filtbufs)))) ;; changed
            (dimmer-restore-buffer buf)
          (dimmer-dim-buffer buf dimmer-fraction))))
    (setq dimmer-last-buffer selected))) ;; changed

sebmiq avatar Oct 19 '20 16:10 sebmiq

Somewhere along the way I added lsp, lsp-pyright and company-box to my configuration and I'm definitely seeing this. Still need to find time to address but at least I am living with the reproducible case all day long.

gonewest818 avatar Jan 25 '21 00:01 gonewest818

Leaving a note here that its possible window-configuration-change-hook is too general, and what I really need to do is take a moment to inspect what specifically has changed before forcing dimmer-process-all. For instance, a size change doesn't matter, nor does a change of the buffer contents. But changing which frame or window was selected definitely does matter. That sort of thing.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Hooks.html

gonewest818 avatar Jan 25 '21 00:01 gonewest818