jkitchin / ov-highlight

A persistent highlighter for Emacs
57 stars 6 forks source link

ov-highlight-color give an error #4

Closed martinleduc closed 6 years ago

martinleduc commented 6 years ago

Hi,

When trying to choose a color using ov-highlight-color, I get the following message for any color I choose:

"Invalid face attribute :background nil"

However, if I use the same color name to define a highlight, it works well:

(ov-highlight-make "blue" '(:background "CadetBlue1"))

Many thanks for helping.

Martin

jkitchin commented 6 years ago

hm. I am not able to reproduce this on my system (MacOS or Windows) in an org-file. Can you say anymore about what you are doing when this fails?

martinleduc commented 6 years ago
  1. I select a part of text using C-space
  2. I run ov-highlight/body on the selected region
  3. I type "c" to choose color
  4. The color menu appears, I select any color by clicking on it or typing the color name
  5. And then I see that the region where highlighting was applied has no highlighting color at all, but the message buffer says "Invalid face attribute :background nil" after the color was chosen.
  6. Interesting enough, if then I run ov-highlight/body + 'l' for listing, the region I just selected appears there, but with no highlighting color as well.
jkitchin commented 6 years ago

Thanks for the extra details. Those steps work fine for me. I am not sure what to tell you.

martinleduc commented 6 years ago

Hi again, I decided to start with a clean emacs configuration, and I still get the same error.

I downloaded the latest version of the required packages from github:

My emacs version is 25.2.2.

Here is the content of my simplified .emacs file:

(add-to-list 'load-path "/home/leduc/.emacs.d/downloaded-packages/hydra/") (add-to-list 'load-path "/home/leduc/.emacs.d/downloaded-packages/ov.el/") (add-to-list 'load-path "/home/leduc/.emacs.d/downloaded-packages/dash.el/") (add-to-list 'load-path "/home/leduc/.emacs.d/downloaded-packages/s.el/") (add-to-list 'load-path "/home/leduc/.emacs.d/downloaded-packages/ov-highlight/") (require 'hydra) (require 'ov) (require 'dash) (require 's) (require 'ov-highlight)

Any idea ? Thanks.

martinleduc commented 6 years ago

... and I'm running Ubuntu 18.04.1 LTS.

jkitchin commented 6 years ago

Still no ideas, it works fine for me on a clean emacs and clean scimax. I guess it is happening in the ov-highlight-color macro, which uses completing read. I have ivy setup to do that, which works for me. Maybe it doesn't work with the default completing read?

martinleduc commented 6 years ago

Does it still work for you with the default completing read ?

Or how can I change it to an ivy setup ?

jkitchin commented 6 years ago

It looks like it will not work with the default completing read in the current ov-highlight. The way this works is it uses as the collection of strings a propertized list of colors from (list-colors-display), then it gets the actual color from the :background property of the selected string. The default completing read does not appear to show the propertized strings however, so they have no :background property, hence the nil value.

you can change to an ivy-setup I think by just adding (ivy-mode) to your init file, or M-x ivy-mode in the buffer (assuming you have installed ivy from Melpa).

I have added a fix for this that seems to work for me in both the default and with ivy. That might resolve your problem. Thanks for your persistence in explaining the problem!

martinleduc commented 6 years ago

Many thanks, now it works fine with both ivy and the default completion mode.