Closed aagon closed 3 years ago
:+1: Sounds good to me. Shouldn't we inherit from hl-line instead of highlight? (and won't we inherit :extend
from it? Of if it doesn't have :extend
then why do we need it?)
Also, I prefer setq-local over set
+ make-local-variable
(It would be great to add a test for this, but it's not super high priority)
Shouldn't we inherit from hl-line instead of highlight?
Stock emacs makes hl-line
inherit from highlight
, but some themes (doom-themes in particular) set the background of each face differently : hl-line
with low contrast to the normal background, to be used in an environment where the cursor is still visible, and highlight
with high contrast to the normal background, perfect for environments where the cursor is hidden and the line highlighting is the only clue as to where the point is, as in biblio-selection-mode
. In fact, I started this issue because with my theme (doom-molokai), the selected biblio entry was nigh-indistinguishable from the others, and setting a new face required modifying the minor mode.
So IMO best to inherit from highlight
than from hl-line
: doesn't change a thing for stock, but behaves better with some themes. And because we inherit from highlight
, explicit :extend
makes sense (I wanted to make the inheritance from highlight
as similar as the of hl-line
from highlight
, which explicitly uses :extend
).
Also, I prefer
setq-local
overset
+make-local-variable
Done.
(It would be great to add a test for this, but it's not super high priority)
The only test I can think of would be to check whether the face is the right one in biblio-selection-mode
, like this :
(it "has the right major mode"
(with-current-buffer results-buffer
(expect major-mode :to-equal 'biblio-selection-mode)))
;; New test :
(it "has the right face"
(with-current-buffer results-buffer
(expect (face-at-point) :to-equal 'biblio-highlight-extend-face)))
Let me know if you agree with this.
All of this makes complete sense. Thanks a lot.
Closed by #44
For the moment, defining a specific face and trying to set it as buffer local for
hl-line-face
in thebiblio-selection-mode-hook
does not work : the face used byhl-line-mode
is stillhl-line
when we arrive in thebiblio-selection-mode
buffer.It only works if the buffer-local setting is made in
buffer-selection-mode
beforehl-line-mode
is activated.I propose the following :
It will inherit the highlight face, set by most themes (hence always with a high contrast to the non highlighted background), but will still be easily customizable.
hl-line-face
in the definition of the minor mode, as such :This produces clearly visible and theme-consistent highlighting, regardless of theme.
If you agree, I can prepare the trivial PR with the changes.
Thanks again for this wonderful package,
Aymeric Agon-Rambosson