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

Does not work with well with helm #15

Closed azzamsa closed 5 years ago

azzamsa commented 6 years ago

Dimmer dim the helm pop-up. and does not dim other window when switching between them.

GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian
Helm 20180224.337
gonewest818 commented 6 years ago

I'll need to get some time to look at this, because I keep thinking the dimmer-exclusion-regexp should cover this but perhaps it does not. So how would you like it to work? Is it

azzamsa commented 6 years ago

Now it dim the right buffer. The active buffer not bright as yours, even I set dimmer-fraction to 0.83

(use-package dimmmer
  :ensure nil
  :config
  (setq dimmer-fraction 0.83)
  (dimmer-mode t))

This is the figure. dimmer.el dim my helm pop-up, and dim-and-bright when helm updates the content.

anim

gonewest818 commented 6 years ago

What theme are you using?

On Feb 24, 2018, at 5:31 PM, azzamsa notifications@github.com wrote:

Now it dim the right buffer. The active buffer not bright as yours, even I set dimmer-fraction to 0.83

(use-package dimmmer :ensure nil :config (setq dimmer-fraction 0.83) (dimmer-mode t)) This is the figure. dimmer.el dim my helm pop-up, and dim-and-bright when helm updates the content.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

azzamsa commented 6 years ago

I use zenburn-theme, version 20180222.1757.

gonewest818 commented 6 years ago

Ok, first of all I'm noticing the package name "dimmer" is spelled incorrectly in your use-package statement (including in your screen capture it says "dimmmer" with 3 m's.). Secondly, setting dimmer-fraction to 0.83 should make the text nearly invisible. That's really high.

I'm not saying this is the reason dimmer isn't dealing with "helm" properly, but there's something else funny about your configuration. Can you fix the spelling in use-package and also set :ensure t and (setq dimmer-fraction 0.50), remove the dimmer package in ~/.emacs.d/elpa/, and restart emacs to reinstall the latest dimmer release? That should look a little more sane.

And then we can go back to the helm thing.

azzamsa commented 6 years ago

Ok, first of all I'm noticing the package name "dimmer" is spelled incorrectly in your use-package

Oh, really sorry. I don't notice it. Sorry.

Can you fix the spelling in use-package and also set :ensure t and (setq dimmer-fraction 0.50), remove the dimmer package in ~/.emacs.d/elpa/, and restart emacs to reinstall the latest dimmer release? That should look a little more sane.

Done.

anim

gonewest818 commented 6 years ago

Try adding (setq dimmer-exclusion-regexp "^\*helm.*")

That should prevent any of the helm buffers from being dimmed, for example if you switch to buffer C-x b the helm list of buffers should be highlighted. Unfortunately whatever buffer was active when you typed C-x b will still be dimmed. I'm not sure what your preference is, but give this a try and let me know.

screen shot 2018-02-26 at 4 29 45 pm
gonewest818 commented 6 years ago

To prevent dimming the helm buffers and the minibuffer, the regex is this:

(setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*")

To make this change I needed to disable and re-enable dimmer, or you can change your config and restart Emacs.

(dimmer-mode 0)
(setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*")
(dimmer-mode 1)
azzamsa commented 6 years ago

To prevent dimming the helm buffers and the minibuffer, the regex is this:

I put this in my config, am I missing something ?

(use-package dimmer
  :ensure t
  :config
  (setq dimmer-fraction 0.50)
  (setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*")
  (dimmer-mode t))

anim

azzamsa commented 6 years ago

I will try to use this setting and report the updates here.

gonewest818 commented 6 years ago

One adjustment you could make is to exclude the "echo area" as well as the minibuffer like so:

  (setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*\\|^ \*Echo.*")
azzamsa commented 6 years ago

I don't know what's wrong with my emacs. but using this

 (setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*\\|^ \*Echo.*")

makes my minibuffer dimmed since emacs started.

azzamsa commented 6 years ago

Thanks lot for the help, gonewest818.

Nothing change in my emacs, the minibuffer dimmer since emacs started. I think the error was in my init.el.

I will disabled this extension for while, and inspect what's wrong with my init.el .

Thanks lot.

azzamsa commented 6 years ago

put the setq in :init also does not solve the problem

(use-package dimmer
  :ensure t
  :init
  (setq dimmer-exclusion-regexp "^\*helm.*\\|^ \*Minibuf-.*\\|^ \*Echo.*")
  :config
  (setq dimmer-fraction 0.50)
  (dimmer-mode t))

This is the information I can update here. Thanks.

gonewest818 commented 6 years ago

Hmm. In terms of configuration, it is ok to set dimmer-exclusion-regexp in :config before enabling dimmer-mode, exactly like you did back in this earlier comment. I have roughly the same in my config right now and it's working as expected.

However, I don't normally use helm, so all I'm doing is creating buffers named *helm xyz* by hand to make sure they're not dimmed. I suppose it's possible there is a bad interaction with the actual helm package and I'm not seeing it because I'm not using helm.... When I get some time I can setup helm again and experiment with that.

Or perhaps you could disable helm in your config, restart emacs, and then report back if dimmer handles the minibuffer correctly after that change. I don't want you to stop using helm forever, but I do need a clue what's going on in your case.

azzamsa commented 6 years ago

I tried your advice soon as you posted. I think I found the problem.

dimmer works fine in emacsclient -t (CLI). dimmer does not dim the minibuffer nor helm. The problem occur only after I switch workspace and come back to emacsclient (GUI). When I switch to other workscpase the minibuffer dimmed immediately. I just notice it.

Trying to enable super-save and helm in emacsclient -t (CLI), and dimmer still works fine.

I use i3wm. Any advice for this ?

Debian 9
Binary i3 version:  4.13 (2016-11-08, branch "4.13") © 2009 Michael Stapelberg and contributors
Running i3 version: 4.13 (2016-11-08, branch "4.13") (pid 910)
gonewest818 commented 6 years ago

Thanks for helping with that. I think that's the clue I needed.

Just now I tried M-x start-server in an existing Emacs session, then emacsclient -t foo from a shell. I got the same problem with the minibuffer. In ielm I confirmed dimmer-exclusion-regexp wasn't changed, and (dimmer-filtered-buffer-list) looks correct too. If I toggle dimmer-mode off and on, then I can get the minibuffer to behave again. So it's something to do with the initialization when emacsclient opens a new frame.

It doesn't appear to happen when I M-x make-frame in an existing Emacs session, only when the frame is created via emacsclient.

I'll need some time to debug that but at least I have the repro now.

ghost commented 6 years ago

I can reproduce this issue using ivy and company too.

azzamsa commented 6 years ago

@nealot This issue happened when you use emacs frame from emacsclient. But it's solved when you don't use emacsclient.

ghost commented 6 years ago

Really? I might be experiencing a different issue then because although I'm not using emacsclient I still can't get ivy/minibuffer/echo area to obey the regex.

I'm on i3wm too, if that's relevant.

azzamsa commented 6 years ago

Sorry. didn't pay attention to minibuffer correctly.

Yes I can confirm that the regrex way doesn't work.

ghost commented 6 years ago

Another odd thing I've noticed is that after changing workspaces or opening other applications in i3, dimmer automatically dims the foreground color. Have you experienced that too?

azzamsa commented 6 years ago

I think no.

anim

ghost commented 6 years ago

Okay I found out my problem was caused by (add-hook 'focus-in-hook 'dimmer-config-change-hook) (add-hook 'focus-out-hook 'dimmer-dim-all) So all I had to do was remove these hooks and the issue went away.

A suggestion might be to include a customize variable that allows you to set whether or not you want dimmer to work on frames aswell.

gonewest818 commented 6 years ago

Toggling that behavior with a config setting sounds totally reasonable to me. Do you want to submit a pull request for that?

azzamsa commented 6 years ago

@nealot

azzamsa commented 5 years ago

@gonewest818 nealot seems to be inactive for long time. Do you consider to add nealot's solution to master ?

ghost commented 5 years ago

Sorry, but I stopped using emacs for vscode :cry:

azzamsa commented 5 years ago

This issue solved for me. Using following config and step described by @nealot https://github.com/gonewest818/dimmer.el/issues/15#issuecomment-386820673


(use-package dimmer
  :defer 1
  :load-path "~/emacs-packages/dimmer.el/"
  :config
  (setq dimmer-exclusion-predicates '(helm--alive-p window-minibuffer-p))
  (setq dimmer-exclusion-regexp-list
        '("^\\*[h|H]elm.*\\*" "^\\*Minibuf-[0-9]+\\*"
          "^.\\*which-key\\*$" "^*Messages*" "*LV*"))
  (setq dimmer-fraction 0.50)
  (dimmer-mode t))
gonewest818 commented 4 years ago

FYI, this is much better in the most recent commits on the master branch.

AnweshGangula commented 2 months ago

This issue solved for me. Using following config and step described by @nealot #15 (comment)

(use-package dimmer
  :defer 1
  :load-path "~/emacs-packages/dimmer.el/"
  :config
  (setq dimmer-exclusion-predicates '(helm--alive-p window-minibuffer-p))
  (setq dimmer-exclusion-regexp-list
        '("^\\*[h|H]elm.*\\*" "^\\*Minibuf-[0-9]+\\*"
          "^.\\*which-key\\*$" "^*Messages*" "*LV*"))
  (setq dimmer-fraction 0.50)
  (dimmer-mode t))

Looks like this config doesn't work as is anymore.

Note that

I tried changing these, but still could not get it to work!!