unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to let hl-line-mode ignore text with non-default background color?
@ 2018-01-09  2:25 zhang cc
  2018-01-09  3:45 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: zhang cc @ 2018-01-09  2:25 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

Text with face custom background color or with inverse-video be set.

These text usually is important ones like TODO in org-mode or matched words in search result. But hl-line-mode makes them can’t be seen clearly which is annoying.


[-- Attachment #2: Type: text/html, Size: 712 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
       [not found] <3d53b7ae-a4cf-4405-8669-706781bb4889@Spark>
@ 2018-01-09  2:42 ` zhang cc
  0 siblings, 0 replies; 8+ messages in thread
From: zhang cc @ 2018-01-09  2:42 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Problem like this: https://stackoverflow.com/questions/6562424/emacs-hl-line-mode-conflicts-with-highlight-phrase

[-- Attachment #2: Type: text/html, Size: 527 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-09  2:25 How to let hl-line-mode ignore text with non-default background color? zhang cc
@ 2018-01-09  3:45 ` Eli Zaretskii
  2018-01-09  6:21   ` zhang cc
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-09  3:45 UTC (permalink / raw)
  To: zhang cc; +Cc: emacs-devel

> From: zhang cc <ccsmile2008@outlook.com>
> Date: Tue, 9 Jan 2018 02:25:10 +0000
> 
> Text with face custom background color or with inverse-video be set. 
> 
> These text usually is important ones like TODO in org-mode or matched words in search result. But
> hl-line-mode makes them can’t be seen clearly which is annoying.

Please show an example of this.  I don't see a problem with the
default face definitions, at least not with display of search matches.
(I've read the stack-overflow question, and I still am not sure what
is the problem, since hl-line's background is rather light, and should
be very different from any reasonable foreground.)  Maybe you use some
theme that is a factor here, or maybe your face customizations are
involved.

IOW, please show a complete recipe for reproducing the problem (it is
also advisable to post that with "M-x report-emacs-bug RET", so the
issue is recorded by the Emacs issue tracker).

Thanks.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-09  3:45 ` Eli Zaretskii
@ 2018-01-09  6:21   ` zhang cc
  2018-01-09 19:12     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: zhang cc @ 2018-01-09  6:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]


On 9 Jan 2018, 11:46 AM +0800, Eli Zaretskii <eliz@gnu.org>, wrote:
From: zhang cc <ccsmile2008@outlook.com
Date: Tue, 9 Jan 2018 02:25:10 +0000

Text with face custom background color or with inverse-video be set.

These text usually is important ones like TODO in org-mode or matched words in search result. But
hl-line-mode makes them can’t be seen clearly which is annoying.

Please show an example of this. I don't see a problem with the
default face definitions, at least not with display of search matches.
(I've read the stack-overflow question, and I still am not sure what
is the problem, since hl-line's background is rather light, and should
be very different from any reasonable foreground.) Maybe you use some
theme that is a factor here, or maybe your face customizations are
involved.

IOW, please show a complete recipe for reproducing the problem (it is
also advisable to post that with "M-x report-emacs-bug RET", so the
issue is recorded by the Emacs issue tracker).

Thanks.


Yes, it is face related. And hl-line can dim good faces (often for highlight use).

1. Open emacs with “-Q” arg
2. In the scratch buffer, eval the following form:

(progn
  (text-mode)
  (hl-line-mode)
  (defface test-face
'((((class color) (background light))
       :foreground "darkseagreen2" :background "black")
      (((class color) (background dark))
       :foreground "darkolivegreen" :background "white")
      (t :inverse-video t))
"test face")
  (set-text-properties (point-min) (point-max) `(face test-face)))

3. Then move cursor across lines in buffer. Foreground color of text is the same as background color set by hl-line-mode, and text can’t be seen.



[-- Attachment #2: Type: text/html, Size: 2930 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-09  6:21   ` zhang cc
@ 2018-01-09 19:12     ` Eli Zaretskii
  2018-01-10  9:23       ` zhang cc
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-09 19:12 UTC (permalink / raw)
  To: zhang cc; +Cc: emacs-devel

> From: zhang cc <ccsmile2008@outlook.com>
> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> Date: Tue, 9 Jan 2018 06:21:47 +0000
> 1. Open emacs with “-Q” arg
> 2. In the scratch buffer, eval the following form:
> 
> (progn
>   (text-mode)
>   (hl-line-mode)
>   (defface test-face
> '((((class color) (background light))
>        :foreground "darkseagreen2" :background "black")
>       (((class color) (background dark))
>        :foreground "darkolivegreen" :background "white")
>       (t :inverse-video t))
> "test face")
>   (set-text-properties (point-min) (point-max) `(face test-face)))
> 
> 3. Then move cursor across lines in buffer. Foreground color of text is the same as background color set by hl-line-mode, and text can’t be seen.

If you must set the foreground of the text the same as the background
of the hl-line face, then customize the hl-line face to define the
"distant foreground" color for it.  E.g., I defined the "distant
foreground" to be black, and the problem went away.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-09 19:12     ` Eli Zaretskii
@ 2018-01-10  9:23       ` zhang cc
  2018-01-10 15:38         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: zhang cc @ 2018-01-10  9:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel@gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 600 bytes --]


On 10 Jan 2018, 3:12 AM +0800, Eli Zaretskii <eliz@gnu.org>, wrote:

If you must set the foreground of the text the same as the background
of the hl-line face, then customize the hl-line face to define the
"distant foreground" color for it. E.g., I defined the "distant
foreground" to be black, and the problem went away.


Tried with some colors. It didn’t always work well. For example, in the following picture, the left is the test code, the right is the details of the face hl-line, the highlighted one line in the left window is the result.
[cid:5EBA4A6DE49D4C27A93FF932987C8227]

[-- Attachment #1.2: Type: text/html, Size: 1268 bytes --]

[-- Attachment #2: distant_foreground-1.png --]
[-- Type: image/png, Size: 601715 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-10  9:23       ` zhang cc
@ 2018-01-10 15:38         ` Eli Zaretskii
  2018-01-11  0:29           ` zhang cc
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-10 15:38 UTC (permalink / raw)
  To: zhang cc; +Cc: emacs-devel

> From: zhang cc <ccsmile2008@outlook.com>
> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> Date: Wed, 10 Jan 2018 09:23:46 +0000
> 
> On 10 Jan 2018, 3:12 AM +0800, Eli Zaretskii <eliz@gnu.org>, wrote: 
> 
>  If you must set the foreground of the text the same as the background
>  of the hl-line face, then customize the hl-line face to define the
>  "distant foreground" color for it. E.g., I defined the "distant
>  foreground" to be black, and the problem went away. 
> 
> Tried with some colors. It didn’t always work well. For example, in the following picture, the left is the test
> code, the right is the details of the face hl-line, the highlighted one line in the left window is the result.

That's because you've chosen the distant foreground poorly.

Look, you can always shoot yourself in the foot if you intentionally
arrange your colors to produce bad contrast.  That doesn't prove
anything, certainly not that there's a bug or a missing feature.  If
you play with colors, you need to choose them carefully, that's all.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to let hl-line-mode ignore text with non-default background color?
  2018-01-10 15:38         ` Eli Zaretskii
@ 2018-01-11  0:29           ` zhang cc
  0 siblings, 0 replies; 8+ messages in thread
From: zhang cc @ 2018-01-11  0:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]


On 10 Jan 2018, 11:38 PM +0800, Eli Zaretskii <eliz@gnu.org>, wrote:

That's because you've chosen the distant foreground poorly.

Look, you can always shoot yourself in the foot if you intentionally
arrange your colors to produce bad contrast. That doesn't prove
anything, certainly not that there's a bug or a missing feature. If
you play with colors, you need to choose them carefully, that's all.

Even it works, it is not a perfect solution. I think let hl-line ignoring text with non-default background color will be better. I will file a bug for it.

Thanks.


[-- Attachment #2: Type: text/html, Size: 1127 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-11  0:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09  2:25 How to let hl-line-mode ignore text with non-default background color? zhang cc
2018-01-09  3:45 ` Eli Zaretskii
2018-01-09  6:21   ` zhang cc
2018-01-09 19:12     ` Eli Zaretskii
2018-01-10  9:23       ` zhang cc
2018-01-10 15:38         ` Eli Zaretskii
2018-01-11  0:29           ` zhang cc
     [not found] <3d53b7ae-a4cf-4405-8669-706781bb4889@Spark>
2018-01-09  2:42 ` zhang cc

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).