tcw165 / hl-anything

Emacs - Highlight thing at point, selection and more
MIT License
22 stars 4 forks source link

Colors lost in `list-colors-display` #14

Open kaushalmodi opened 9 years ago

kaushalmodi commented 9 years ago

Hi,

I use M-x list-colors-display to look at the colors available in emacs.

I noticed that that buffer doesn't show the colors after I require hl-anything.

I am unable to replicate that in an emacs -Q session but I can confirm for sure that the issue returns as soon as I uncomment the use-package block for hl-anything in my init.

hl-anything uses many defadvices. So probably you can give a hint as to what can can be causing issues with list-colors-display.

I am using emacs 25.0.50.2. I can replicate the issue on emacs 24.4 too.

kaushalmodi commented 9 years ago

Here is my commit to my emacs setup in which I tested out an alternative highlighting package and did not require hl-anything and the above issue did not occur.

Here is the relevant code without the diff view.

As soon as I eval the (hl-highlight-mode +1) line for hl-anything all color is lost from the *Color* buffer opened by list-colors-display and I can't figure out any way of restoring those colors other than emacs reset.

tcw165 commented 9 years ago

Thanks for your feedback. I'll check it out as soon as possible. (Busy of preparing wedding at March)

kaushalmodi commented 9 years ago

No worries! Congratulations! :)

tcw165 commented 9 years ago

Hi @kaushalmodi

What is the version of your Emacs? What O.S. are you using? Can you provide the snapshot of M-x list-colors-display?

This is mine. I'm using window version of Emacs 24.4 on OSX.

screen shot 2015-02-25 at 6 23 33 pm

kaushalmodi commented 9 years ago

I am able to repeat this issue on both emacs 24.4 and 25.0.50.2 (built from the trunk 2 days back). The OS is RHEL 5.10.

Here's an interesting thing I noted,

That indicates that the hl-highlight-mode is conflicting with the way the *Colors* buffer is drawing the various color highlights. The highlight-global package also does global highlighting.

I've noticed that when I highlight any string using highlight-global, the colors are wiped off from the *Colors* buffer. But the colors return when I call list-colors-display again. For hl-anything, it seems that the hl-highlight-mode is overpowering and repeated calls of list-colors-display result in a black and white *Colors* buffer even when I have toggled off the hl-anything global highlight display.

kaushalmodi commented 9 years ago

I'll update with the screen shot in few hours when I get to my computer.

tcw165 commented 9 years ago

Sorry, I'v been away for couple months. Do you found the root cause?

kaushalmodi commented 9 years ago

Hey, thanks for the reply. The issue is that the hl-*global functions force the highlights on all the buffers and in the process, it removes any pre-existing highlight.

The best way to demonstrate that is by following the below steps:

Few suggestions:

If I already have the highlighting on using hl-highlight-thingatpt-global, then the faces in the Magit status buffer do not show correctly (even if M-x magit-status is launched after doing the highlighting.)

I am on the latest emacs version from the master git branch.

windrg commented 8 years ago

I have a same problem. Do you have any updates for this?

kaushalmodi commented 8 years ago

@windrg I now use my personal fork of a different package ( highlight-global ) which resolves this problem.

windrg commented 8 years ago

@kaushalmodi , it sounds very pleasant but highlight-global doesn't provide an interface to search that word back and forth. Somehow could you please share your fork with us?

kaushalmodi commented 8 years ago

@windrg The link in my previous post points to the fork ( https://github.com/kaushalmodi/highlight-global ). You can clone/fork it and try it out.

This probably doesn't fit your use case. But when I need to jump to prev/next symbols matching the symbol under point, I do M-s . and then C-s/C-r.

I also use M-s h . to highlight symbols at times instead of highlight-global functions.

windrg commented 8 years ago

@kaushalmodi Thank you very much. It's helping a lot.

windrg commented 8 years ago

Getting back to the point of this thread, this symptom happens in most of modes I'm using like as logview-mode, org-mode. And an another remarkable thing is that it's recoverable by invoking such major mode functions. Indeed sometimes it maintains the highlighted words by this packages. I look forward this would be helpful for you to solve.

tcw165 commented 8 years ago

@kaushalmodi @windrg Thank you all. It'd be nice that some of you create the PR for above and I could give you authority to merge it. 👍

tcw165 commented 8 years ago

BTW, I'm considering to move this repo to a public organization so that everyone who loves this project could be more free to help to maintain.

tcw165 commented 8 years ago

Hi guys, I just moved the repo to hl-anything/hl-anything-emacs and am waiting for the update from MELPA.

kaushalmodi commented 8 years ago

@boyw165 Thanks for doing this. As of now, I don't have bandwidth to study/update hl-anything. But I will keep that as a TODO project at the back of my mind and work on it if someone hasn't already fixed it. I currently don't have a PR for this fix. I simply took up global-highlight and modified it to my needs.

tcw165 commented 8 years ago

I see. I think MELPA has granted the migration. https://github.com/melpa/melpa/pull/3796