unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Highlight text
@ 2022-02-09 13:38 Anand Tamariya
  2022-02-09 14:05 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anand Tamariya @ 2022-02-09 13:38 UTC (permalink / raw)
  To: Emacs Devel

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

Can somebody point me to a piece of code in the display engine which is
responsible for highlighting text upon selection? Or the general logic on
what causes it to display in a different face than normal text?

Thanks.

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

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

* Re: Highlight text
  2022-02-09 13:38 Highlight text Anand Tamariya
@ 2022-02-09 14:05 ` Eric S Fraga
  2022-02-09 14:48 ` Eli Zaretskii
  2022-02-09 15:41 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2022-02-09 14:05 UTC (permalink / raw)
  To: emacs-devel

On Wednesday,  9 Feb 2022 at 19:08, Anand Tamariya wrote:
> Can somebody point me to a piece of code in the display engine which is
> responsible for highlighting text upon selection? Or the general logic on
> what causes it to display in a different face than normal text?

It's the "region" face?  I don't know where the code that makes the
selected text use that face, mind you.

-- 
Eric S Fraga with org 9.5.2 in Emacs 29.0.50 on Debian 11.2




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

* Re: Highlight text
  2022-02-09 13:38 Highlight text Anand Tamariya
  2022-02-09 14:05 ` Eric S Fraga
@ 2022-02-09 14:48 ` Eli Zaretskii
  2022-02-09 15:41 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-02-09 14:48 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: emacs-devel

> From: Anand Tamariya <atamariya@gmail.com>
> Date: Wed, 9 Feb 2022 19:08:54 +0530
> 
> Can somebody point me to a piece of code in the display engine which is responsible for highlighting text
> upon selection? Or the general logic on what causes it to display in a different face than normal text?

It's not in the display engine (it was once).  It's in simple.el, see
redisplay--update-region-highlight there.  Basically, we nowadays
implement region highlight as an overlay.



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

* Re: Highlight text
  2022-02-09 13:38 Highlight text Anand Tamariya
  2022-02-09 14:05 ` Eric S Fraga
  2022-02-09 14:48 ` Eli Zaretskii
@ 2022-02-09 15:41 ` Stefan Monnier
  2022-02-11  4:11   ` Anand Tamariya
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2022-02-09 15:41 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: Emacs Devel

> Can somebody point me to a piece of code in the display engine which is
> responsible for highlighting text upon selection?

It's not in the display engine (any more).
It's in `redisplay--update-region-highlight`.


        Stefan




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

* Re: Highlight text
  2022-02-09 15:41 ` Stefan Monnier
@ 2022-02-11  4:11   ` Anand Tamariya
  2022-02-11  4:46     ` Po Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Tamariya @ 2022-02-11  4:11 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Devel

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

Thanks Eli and Stefan. Your suggestion helped a lot. Missing the ability to
see the text that's highlighted can be quite nightmarish. Thankfully it
works now.
https://lifeofpenguin.blogspot.com/2022/02/zen-emacs.html

On Wed, Feb 9, 2022 at 9:12 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > Can somebody point me to a piece of code in the display engine which is
> > responsible for highlighting text upon selection?
>
> It's not in the display engine (any more).
> It's in `redisplay--update-region-highlight`.
>
>
>         Stefan
>
>

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

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

* Re: Highlight text
  2022-02-11  4:11   ` Anand Tamariya
@ 2022-02-11  4:46     ` Po Lu
  0 siblings, 0 replies; 6+ messages in thread
From: Po Lu @ 2022-02-11  4:46 UTC (permalink / raw)
  To: Anand Tamariya; +Cc: Stefan Monnier, Emacs Devel

Anand Tamariya <atamariya@gmail.com> writes:

> https://lifeofpenguin.blogspot.com/2022/02/zen-emacs.html

It's not okay to compare GCs to determine whether or not a string is
being drawn in the default face.

Lots of code makes ad-hoc modifications to a GC in order to achieve
various effects, and I'm sure many of those are done to the normal GC.



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

end of thread, other threads:[~2022-02-11  4:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 13:38 Highlight text Anand Tamariya
2022-02-09 14:05 ` Eric S Fraga
2022-02-09 14:48 ` Eli Zaretskii
2022-02-09 15:41 ` Stefan Monnier
2022-02-11  4:11   ` Anand Tamariya
2022-02-11  4:46     ` Po Lu

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).