* Re: Face precedence
[not found] <mailman.6011.1099067730.2017.help-gnu-emacs@gnu.org>
@ 2004-10-29 21:53 ` Oliver Scholz
0 siblings, 0 replies; 8+ messages in thread
From: Oliver Scholz @ 2004-10-29 21:53 UTC (permalink / raw)
Matthew Calhoun <calhounm@mac.com> writes:
> Hello,
>
> I'm trying to figure out what determines the order in which faces are
> applied to a block of text.
See (info "(elisp)Merging Faces")
> I have highlight face, which is applied to whatever line point is
> on, defined as white text on a dark background. But in programming
> modes I also have some syntax-related faces defined with a light
> background. Strangely, in some of these modes the highlight face's
> light foreground is applied, but not its dark background. Instead,
> the syntax face's light background is displayed, resulting in light
> text on a light background. What I would like to do is make sure
> that highlight face always takes precedence over whatever other
> faces are applied to the text.
Hm. If the highlighted line is implemented with an overlay and those
"syntax related faces" are implemented via text properties, then the
overlay should actually take precedence. Hm.
(progn (switch-to-buffer (generate-new-buffer "*tmp*"))
(font-lock-mode -1)
(insert (propertize "lirum larum"
'face '(face :background "magenta")))
(overlay-put (make-overlay (point-min) (point-max))
'face '(face :background "blue")))
Works here. How exactly is your highligted line implemented?
Oliver
--
8 Brumaire an 213 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.281.1099431126.8225.help-gnu-emacs@gnu.org>]
* Re: Face precedence
[not found] <mailman.281.1099431126.8225.help-gnu-emacs@gnu.org>
@ 2004-11-06 7:01 ` Oliver Scholz
2004-11-06 18:13 ` Matthew Calhoun
[not found] ` <mailman.1102.1099775064.8225.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Oliver Scholz @ 2004-11-06 7:01 UTC (permalink / raw)
Matthew Calhoun <calhounm@mac.com> writes:
[...]
> Thanks for your reply. I think when I said I was "defining faces" I
> gave you the impression that I was doing something more complicated
> than what I'm actually doing. I'm only setting the attributes of
> existing faces with custom-set-faces, like this:
[...]
> The highlight face I was referring to isn't something I implemented
> myself; it's just an existing face that I've customized.
Well, in that case, I have to change my question: how do you turn that
highlight-line feature on? Do you use some package which comes with
Emacs or something which you found on the web? If the latter: what
package is that?
Oliver
--
16 Brumaire an 213 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Face precedence
2004-11-06 7:01 ` Oliver Scholz
@ 2004-11-06 18:13 ` Matthew Calhoun
[not found] ` <mailman.1102.1099775064.8225.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Matthew Calhoun @ 2004-11-06 18:13 UTC (permalink / raw)
The documentation string for highlight is "Basic face for
highlighting." When I turn on HL Line mode (which is part of Emacs, I
believe) with:
(global-hl-line-mode 1)
this face is used to highlight the line the cursor is on. It sounds
like it's meant to be used for other purposes as well, but that's the
only place it shows up under my configuration.
The documentation you pointed out to me seems to indicate that overlay
priorities are the way to control this, but I haven't been able to
figure out how to set them, or if it's even possible to set them
outside of the original source files.
Thanks,
Matt
El Nov 5, 2004, a las 11:01 PM, Oliver Scholz escribió:
> Matthew Calhoun <calhounm@mac.com> writes:
>
> [...]
>> Thanks for your reply. I think when I said I was "defining faces" I
>> gave you the impression that I was doing something more complicated
>> than what I'm actually doing. I'm only setting the attributes of
>> existing faces with custom-set-faces, like this:
> [...]
>> The highlight face I was referring to isn't something I implemented
>> myself; it's just an existing face that I've customized.
>
> Well, in that case, I have to change my question: how do you turn that
> highlight-line feature on? Do you use some package which comes with
> Emacs or something which you found on the web? If the latter: what
> package is that?
>
> Oliver
> --
> 16 Brumaire an 213 de la Révolution
> Liberté, Egalité, Fraternité!
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.1102.1099775064.8225.help-gnu-emacs@gnu.org>]
* Re: Face precedence
[not found] ` <mailman.1102.1099775064.8225.help-gnu-emacs@gnu.org>
@ 2004-11-07 7:31 ` Oliver Scholz
2004-11-07 16:48 ` Matthew Calhoun
[not found] ` <mailman.1228.1099846667.8225.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Oliver Scholz @ 2004-11-07 7:31 UTC (permalink / raw)
Matthew Calhoun <calhounm@mac.com> writes:
[...]
> (global-hl-line-mode 1)
Ah! Yes, `hl-line-mode' is part of Emacs. It is a buffer-local minor
mode that highlights the line where point is in. It is implemented
with an overlay.
> this face is used to highlight the line the cursor is on. It sounds
> like it's meant to be used for other purposes as well, but that's the
> only place it shows up under my configuration.
Yes, that face is also used for mouse-highlighting in some places, for
example in *Help* buffers.
> The documentation you pointed out to me seems to indicate that overlay
> priorities are the way to control this [...]
Unless you know more than you told, I would think that this conclusion
is premature. Maybe there is something going wrong in your setup and
we should figure out what it is.
If I understand you correctly, you have a light background and a dark
foreground for the default face and a dark background and a light
foreground for the highlight face. You said that in some cases the
dark background of the highlight face does not take effect. Is that
/everywhere/, where a face other than the default face is in the
buffer? Or does this apply only for a few faces? Or only in some
modes? If the latter: which mode?
If the former: you can examine the text properties a point with M-x
list-text-properties-at (assuming you are using a released version of
Emacs 21). Please post that together with a description of what you
see.
Finally, can you reproduce the behaviour you described starting from
emacs -q --no-site-file? Can you set up a small test case so that I can
reproduce that behaviour?
FYI, hl-line-mode works as expected here.
[Please don't top-post. For people who read or skim hundreds of
netnews postings a day this makes more work in getting the context of
a posting. Please do rather cut out everything but the most relevant
parts of a quoting and write your answers below.]
Oliver
--
17 Brumaire an 213 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Face precedence
2004-11-07 7:31 ` Oliver Scholz
@ 2004-11-07 16:48 ` Matthew Calhoun
[not found] ` <mailman.1228.1099846667.8225.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Matthew Calhoun @ 2004-11-07 16:48 UTC (permalink / raw)
El Nov 6, 2004, a las 11:31 PM, Oliver Scholz escribió:
> If I understand you correctly, you have a light background and a dark
> foreground for the default face and a dark background and a light
> foreground for the highlight face. You said that in some cases the
> dark background of the highlight face does not take effect.
Yes, that's exactly what is happening.
> Is that
> /everywhere/, where a face other than the default face is in the
> buffer? Or does this apply only for a few faces? Or only in some
> modes? If the latter: which mode?
I see this when I'm using mmm-mode (Multiple Major Mode Mode) with
html-helper and cperl as the two major modes in effect. I use mmm-mode
to edit HTML files which have Perl embedded in them; giving the Perl
code a yellow background makes it easy to find. But with hl-line
enabled, the current line has white text on a yellow background.
I do remember seeing this happen once before, but if I remember
correctly, whatever caused it wasn't useful enough to spend time trying
to fix it, so I quit using it. I can't remember what it was at the
moment.
> If the former: you can examine the text properties a point with M-x
> list-text-properties-at (assuming you are using a released version of
> Emacs 21). Please post that together with a description of what you
> see.
I'm using a version I built from CVS for Mac OS X Carbon a couple of
months ago (emacs-version says it's 21.3.50.1). I don't have a
list-text-properties-at command, but I do have
describe-text-properties. Here is its output when point is in some Perl
code in mmm-mode:
Text content at position 13268:
There are 2 overlays here:
From 13267 to 13316
mmm t
beg-sticky t
end-sticky t
evaporate t
mmm-evap t
priority 1
name nil
display-name nil
mmm-mode cperl-mode
face mmm-declaration-submode-face
mmm-local-variables ((font-lock-cache-state nil)
(font-lock-cache-position #<marker in no buffer>))
From 13268 to 13281
window nil
face highlight
There are text properties here:
fontified t
As described above, what I am seeing here is a block of Perl code with
a yellow background, where the text on the current line is white. What
I would *like* to see is exactly this, except with a blue background on
the current line.
Thanks again,
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.1228.1099846667.8225.help-gnu-emacs@gnu.org>]
* Re: Face precedence
[not found] ` <mailman.1228.1099846667.8225.help-gnu-emacs@gnu.org>
@ 2004-11-08 8:29 ` Oliver Scholz
0 siblings, 0 replies; 8+ messages in thread
From: Oliver Scholz @ 2004-11-08 8:29 UTC (permalink / raw)
Matthew Calhoun <calhounm@mac.com> writes:
> El Nov 6, 2004, a las 11:31 PM, Oliver Scholz escribió:
>
[hl-line-mode face attributes not properly applied]
>> Is that
>> /everywhere/, where a face other than the default face is in the
>> buffer? Or does this apply only for a few faces? Or only in some
>> modes? If the latter: which mode?
>
> I see this when I'm using mmm-mode (Multiple Major Mode Mode) with
> html-helper and cperl as the two major modes in effect.
You were right. mmm-mode uses overlays and setting overlay priorities
seems to be the way to fix the problem. I can reproduce something
along the lines of what you described, when I specify a mmm-submode
region *after* I turned hl-line-mode on.
Shooting from the hips, this seems to fix it:
(add-hook 'hl-line-mode-hook
(lambda ()
(overlay-put hl-line-overlay
'priority most-positive-fixnum)))
Oliver
--
18 Brumaire an 213 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Face precedence
@ 2004-11-02 21:23 Matthew Calhoun
0 siblings, 0 replies; 8+ messages in thread
From: Matthew Calhoun @ 2004-11-02 21:23 UTC (permalink / raw)
Hi Oliver,
Thanks for your reply. I think when I said I was "defining faces" I
gave you the impression that I was doing something more complicated
than what I'm actually doing. I'm only setting the attributes of
existing faces with custom-set-faces, like this:
(custom-set-faces
'(mode-line ((((type x w32 mac) (class color)) (:background "white"
:foreground "black" :weight extra-bold))))
'(mode-line-inactive ((t (:slant oblique :weight light))))
'(region ((((class color)) (:background "#b5d5ff"))))
'(isearch ((t (:inherit region :weight bold))))
'(isearch-lazy-highlight-face ((((class color) (background light))
(:background "#d4d4d4" :foreground "black" :weight bold))))
'(highlight-changes-face ((((class color)) (:inherit highlight))))
'(highlight-changes-delete-face ((((class color)) (:box (:line-width
1 :color "#3d80df")))))
'(highlight-changes-face-1 ((t (:background "gray80"))) t)
'(highlight-changes-face-2 ((t (:background "gray90"))) t)
'(highlight-changes-face-3 ((t (:background "gray95"))) t)
'(show-paren-match-face ((((class color)) (:foreground "saddle
brown"))))
'(show-paren-mismatch-face ((((class color)) (:foreground "red"))))
'(font-lock-builtin-face ((((class color)) (:foreground "black"))))
'(font-lock-comment-face ((((class color)) (:foreground "gray50"))))
'(font-lock-constant-face ((((class color)) (:foreground "black"))))
'(font-lock-function-name-face ((((class color)) (:foreground "black"
:weight bold))))
'(font-lock-keyword-face ((((class color)) (:foreground "black"))))
'(font-lock-string-face ((((class color)) (:foreground "forest
green"))))
'(font-lock-type-face ((((class color)) (:foreground "black"))))
'(font-lock-variable-name-face ((((class color)) (:foreground
"blue"))))
'(font-lock-warning-face ((((class color)) (:foreground "red"))))
'(html-tag-face ((t (:foreground "dodger blue"))))
'(html-helper-bold-face ((t (:foreground "black"))))
'(html-helper-builtin-face ((t (:foreground "black"))))
'(html-helper-italic-face ((t (:foreground "black"))))
'(html-helper-underline-face ((t (:foreground "black"))))
'(cperl-array-face ((((class color) (background light)) (:foreground
"orange"))))
'(cperl-hash-face ((((class color) (background light)) (:foreground
"chocolate4"))))
'(cperl-nonoverridable-face ((((class color) (background light))
nil)))
'(mmm-default-submode-face ((t (:background "yellow"))))
'(mmm-cleanup-submode-face ((t (:background "yellow"))))
'(mmm-code-submode-face ((t (:background "yellow"))))
'(mmm-comment-submode-face ((t (:background "yellow"))))
'(mmm-declaration-submode-face ((t (:background "yellow"))))
'(mmm-output-submode-face ((t (:background "yellow"))))
'(mmm-special-submode-face ((t (:background "yellow"))))
'(mmm-init-submode-face ((t (:background "yellow"))))
'(highlight ((((class color)) (:background "#3d80df" :foreground
"white"))))
)
The highlight face I was referring to isn't something I implemented
myself; it's just an existing face that I've customized. What I'm
finding confusing is the way in which these faces are applied when more
than 1 of them is in effect. I would appreciate any light you can shed
on this subject.
Thanks,
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Face precedence
@ 2004-10-29 16:26 Matthew Calhoun
0 siblings, 0 replies; 8+ messages in thread
From: Matthew Calhoun @ 2004-10-29 16:26 UTC (permalink / raw)
Hello,
I'm trying to figure out what determines the order in which faces are
applied to a block of text. I have highlight face, which is applied to
whatever line point is on, defined as white text on a dark background.
But in programming modes I also have some syntax-related faces defined
with a light background. Strangely, in some of these modes the
highlight face's light foreground is applied, but not its dark
background. Instead, the syntax face's light background is displayed,
resulting in light text on a light background. What I would like to do
is make sure that highlight face always takes precedence over whatever
other faces are applied to the text.
I'm sure this is possible, but I haven't been able to find or figure
out how. Can anyone point me in the right direction?
Thanks,
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-11-08 8:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.6011.1099067730.2017.help-gnu-emacs@gnu.org>
2004-10-29 21:53 ` Face precedence Oliver Scholz
[not found] <mailman.281.1099431126.8225.help-gnu-emacs@gnu.org>
2004-11-06 7:01 ` Oliver Scholz
2004-11-06 18:13 ` Matthew Calhoun
[not found] ` <mailman.1102.1099775064.8225.help-gnu-emacs@gnu.org>
2004-11-07 7:31 ` Oliver Scholz
2004-11-07 16:48 ` Matthew Calhoun
[not found] ` <mailman.1228.1099846667.8225.help-gnu-emacs@gnu.org>
2004-11-08 8:29 ` Oliver Scholz
2004-11-02 21:23 Matthew Calhoun
-- strict thread matches above, loose matches on Subject: below --
2004-10-29 16:26 Matthew Calhoun
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).