unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* text properties in tex mode
@ 2008-10-04 15:40 Kostas Oikonomou
  0 siblings, 0 replies; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-04 15:40 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I use Emacs's plain TeX mode (i.e. not AucTeX), with 
font-lock deactivated. (And Emacs 22.3.)

I'd like to be able to change the background color of a 
piece of text to, say, yellow, by selecting it with the 
mouse, and then doing Edit -> Text Properties -> Background 
Color.

However this fails with a message "Face ((:background 
yellow)) not configured for latex mode".
How do I get around this?

Thanks very much.

						Kostas




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

* Re: text properties in tex mode
@ 2008-10-04 17:02 martin rudalics
  0 siblings, 0 replies; 15+ messages in thread
From: martin rudalics @ 2008-10-04 17:02 UTC (permalink / raw)
  To: k.oikonomou; +Cc: help-gnu-emacs

 > I use Emacs's plain TeX mode (i.e. not AucTeX), with font-lock deactivated. (And Emacs 22.3.)
 >
 > I'd like to be able to change the background color of a piece of text
 > to, say, yellow, by selecting it with the mouse, and then doing Edit ->
 > Text Properties -> Background Color.
 >
 > However this fails with a message "Face ((:background yellow)) not
 > configured for latex mode".  How do I get around this?

How about using

(add-hook 'latex-mode-hook
	  (lambda ()
	    (set (make-local-variable 'facemenu-add-face-function) nil)))

martin




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

* Re: text properties in tex mode
       [not found] <mailman.225.1223135509.25473.help-gnu-emacs@gnu.org>
@ 2008-10-04 17:44 ` harven
  0 siblings, 0 replies; 15+ messages in thread
From: harven @ 2008-10-04 17:44 UTC (permalink / raw)
  To: help-gnu-emacs

Kostas Oikonomou <k.oikonomou@att.net> writes:

> Hello,
>
> I use Emacs's plain TeX mode (i.e. not AucTeX), with font-lock
> deactivated. (And Emacs 22.3.)
>
> I'd like to be able to change the background color of a piece of text
> to, say, yellow, by selecting it with the mouse, and then doing Edit
> -> Text Properties -> Background Color.
>
> However this fails with a message "Face ((:background yellow)) not
> configured for latex mode".
> How do I get around this?

This is probably because font-lock-mode is enabled by default in latex-mode.
Thus any face you set is overwritten by the font-lock processing.
Disabling font-lock-mode (M-x font-lock-mode) brings back the menu
you are interested in, but you will lose the coloring provided by
latex-mode.

Another solution would be to use overlays instead of faces for 
region highlighting. That's what use the highlight-regexp command;
this command highlight words matching a regexp. I think there is
an extension called highlight.el, by Drew Adams, which provides 
easy access to overlays. Have a look at the wiki
http://www.emacswiki.org/cgi-bin/wiki/HighLight

Hope that helps


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

* Re: text properties in tex mode
@ 2008-10-05 15:11 Kostas Oikonomou
  2008-10-05 17:53 ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-05 15:11 UTC (permalink / raw)
  To: help-gnu-emacs

Harven,

Thank you for the reply.

 > Thus any face you set is overwritten by the font-lock 
processing.
 > Disabling font-lock-mode (M-x font-lock-mode) brings back 
the menu
 > you are interested in, but you will lose the coloring 
provided by
 > latex-mode.

I have indeed disabled font-lock mode everywhere by

(global-font-lock-mode -1)

in my init.el file.  I don't mind losing font-lock coloring 
in my Latex buffer.
But when I then do Edit -> Text Properties -> Background 
color, I get the error I posted.
Are you saying above that this should not be happening?

 > Another solution would be to use overlays instead of 
faces for region highlighting. That's what use the 
highlight-regexp command;
 > this command highlight words matching a regexp. I think 
there is
 > an extension called highlight.el, by Drew Adams, which 
provides easy access to overlays.
 > Have a look at the wiki 
http://www.emacswiki.org/cgi-bin/wiki/HighLight

I have looked at this, but it seems too complicated to me. 
Maybe because I don't know enough about Emacs.  I would 
prefer to use the already-existing Edit -> Text Properties 
menu, unless it is not possible.

                     Kostas




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

* RE: text properties in tex mode
  2008-10-05 15:11 Kostas Oikonomou
@ 2008-10-05 17:53 ` Drew Adams
  0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2008-10-05 17:53 UTC (permalink / raw)
  To: 'Kostas Oikonomou', help-gnu-emacs

>  > Another solution would be to use overlays instead of 
>  > faces for region highlighting. That's what use the 
>  > highlight-regexp command;
>  > this command highlight words matching a regexp. I think 
>  > there is an extension called highlight.el, by Drew Adams,
>  > which provides easy access to overlays.
>  > Have a look at the wiki 
>  > http://www.emacswiki.org/cgi-bin/wiki/HighLight
> 
> I have looked at this, but it seems too complicated to me. 
> Maybe because I don't know enough about Emacs.  I would 
> prefer to use the already-existing Edit -> Text Properties 
> menu, unless it is not possible.

You can use Text Properties to do a lot. If you load library `facemenu+.el',
then you can use the Text Properties menu to do a lot more.

If you use both `facemenu+.el' and `highlight.el', then the features of
`highlight.el' are available from the Text Properties menu, submenu Highlight.

See http://www.emacswiki.org/cgi-bin/wiki/FaceMenuPlus.






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

* Re: text properties in tex mode
       [not found] <mailman.292.1223226411.25473.help-gnu-emacs@gnu.org>
@ 2008-10-05 17:57 ` harven
  0 siblings, 0 replies; 15+ messages in thread
From: harven @ 2008-10-05 17:57 UTC (permalink / raw)
  To: help-gnu-emacs

Kostas Oikonomou <k.oikonomou@att.net> writes:

> Harven,

> I have indeed disabled font-lock mode everywhere by
>
> (global-font-lock-mode -1)
>
> in my init.el file.  I don't mind losing font-lock coloring in my
> Latex buffer.
> But when I then do Edit -> Text Properties -> Background color, I get
> the error I posted.
> Are you saying above that this should not be happening?

If I disable font-lock-mode, I get back the yellow face in the
Background color menu, and it works. Do you get the error when you
click on the Background color button ? Does it give you the menu with
entries yellow/other ?

Maybe you can try to redefine the yellow face in TeX mode, by putting
in your .emacs:
(add-hook 'tex-mode-hook (lambda ()
    (make-face 'yellow)
    (set-face-background 'yellow "yellow")))

Hope that helps


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

* Re: text properties in tex mode
@ 2008-10-06  0:44 Kostas Oikonomou
  0 siblings, 0 replies; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-06  0:44 UTC (permalink / raw)
  To: harven; +Cc: help-gnu-emacs

> If I disable font-lock-mode, I get back the yellow face in the
> Background color menu, 

Same for me.

>and it works. 
Not for me.

> Do you get the error when you click on the Background color button ? 

Yes.

> Does it give you the menu with entries yellow/other ?

Yes.

> Maybe you can try to redefine the yellow face in TeX mode, by putting
> in your .emacs:
> (add-hook 'tex-mode-hook (lambda ()
>     (make-face 'yellow)
>     (set-face-background 'yellow "yellow")))

I did that, and it seems to me it should work, but I get the 
same error:
Face ((:background yellow)) not configured for TeX mode

Nevertheless, if I do Edit -> Text Properties -> Display 
Faces, the "yellow" face *does* show up,
as last in the list!

					Kostas






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

* Re: text properties in tex mode
       [not found] <mailman.320.1223253849.25473.help-gnu-emacs@gnu.org>
@ 2008-10-06  7:14 ` harven
  0 siblings, 0 replies; 15+ messages in thread
From: harven @ 2008-10-06  7:14 UTC (permalink / raw)
  To: help-gnu-emacs

Kostas Oikonomou <k.oikonomou@att.net> writes:

>> If I disable font-lock-mode, I get back the yellow face in the
>> Background color menu, 
>
> Same for me.
>
>> and it works. 
> Not for me.
>
>> Do you get the error when you click on the Background color button ? 
>
> Yes.
>
>> Does it give you the menu with entries yellow/other ?
>
> Yes.
>
>> Maybe you can try to redefine the yellow face in TeX mode, by putting
>> in your .emacs:
>> (add-hook 'tex-mode-hook (lambda ()
>>     (make-face 'yellow)
>>     (set-face-background 'yellow "yellow")))
>
> I did that, and it seems to me it should work, but I get the same
> error:
> Face ((:background yellow)) not configured for TeX mode
>
> Nevertheless, if I do Edit -> Text Properties -> Display Faces, the
> "yellow" face *does* show up,
> as last in the list!

Does Edit->Text Properties->Background Color->Other and then
entering yellow (or another color) works ?

Do you have something like (:background yellow)
in your init file ? It should be (:background "yellow")
Consider launching emacs with emacs -q and try again, to see
if the problem has to do with your config file. 
If not, I guess that the problem has to do with your installation.


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

* Re: text properties in tex mode
@ 2008-10-07  1:16 Kostas Oikonomou
  0 siblings, 0 replies; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-07  1:16 UTC (permalink / raw)
  To: harven, help-gnu-emacs

> Does Edit->Text Properties->Background Color->Other and then
> entering yellow (or another color) works ?

I should have clarified this earlier: this works fine 
(including yellow, or any other color) if the buffer is in 
fundamental mode, shell mode, emacs-lisp mode, and a bunch 
of other modes.
The only mode in which it doesn't work is TeX/LaTeX mode, 
and that's what I am having problems with.
Sorry for not making this clear earlier.

> Do you have something like (:background yellow)
> in your init file ? It should be (:background "yellow")

No.

> Consider launching emacs with emacs -q and try again, to see
> if the problem has to do with your config file. 

emacs -q makes no difference in TeX/LaTeX mode.  Problem is 
still there.

> If not, I guess that the problem has to do with your installation.






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

* Re: text properties in tex mode
@ 2008-10-07  5:33 martin rudalics
  2008-10-07 12:56 ` Kostas Oikonomou
  0 siblings, 1 reply; 15+ messages in thread
From: martin rudalics @ 2008-10-07  5:33 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: ko

 > The only mode in which it doesn't work is TeX/LaTeX mode, and that's
 > what I am having problems with.  Sorry for not making this clear
 > earlier.

Could you please either try the recipe I posted earlier, namely putting
the following form into your .emacs

(add-hook 'latex-mode-hook
           (lambda ()
             (set (make-local-variable 'facemenu-add-face-function) nil)))

or file a bug report (because this is a bug, albeit a minor one).

martin





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

* Re: text properties in tex mode
  2008-10-07  5:33 martin rudalics
@ 2008-10-07 12:56 ` Kostas Oikonomou
  2008-10-07 13:03   ` Allan Gottlieb
  2008-10-07 13:31   ` martin rudalics
  0 siblings, 2 replies; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-07 12:56 UTC (permalink / raw)
  To: martin rudalics; +Cc: help-gnu-emacs

Martin,

Yes, I tried that, it does not help.   So this is a bug in 
TeX/LaTeX mode?
I have never filed an Emacs bug report before, how do you go 
about it?

						Kostas

martin rudalics wrote:
>  > The only mode in which it doesn't work is TeX/LaTeX mode, and that's
>  > what I am having problems with.  Sorry for not making this clear
>  > earlier.
> 
> Could you please either try the recipe I posted earlier, namely putting
> the following form into your .emacs
> 
> (add-hook 'latex-mode-hook
>           (lambda ()
>             (set (make-local-variable 'facemenu-add-face-function) nil)))
> 
> or file a bug report (because this is a bug, albeit a minor one).
> 
> martin
> 




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

* Re: text properties in tex mode
  2008-10-07 12:56 ` Kostas Oikonomou
@ 2008-10-07 13:03   ` Allan Gottlieb
  2008-10-07 13:31   ` martin rudalics
  1 sibling, 0 replies; 15+ messages in thread
From: Allan Gottlieb @ 2008-10-07 13:03 UTC (permalink / raw)
  To: help-gnu-emacs

At Tue, 07 Oct 2008 08:56:29 -0400 Kostas Oikonomou <ko@research.att.com> wrote:

> Yes, I tried that, it does not help.   So this is a bug in TeX/LaTeX
> mode?
> I have never filed an Emacs bug report before, how do you go about it?

M-x report-emacs-bug has worked for me.
allan




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

* Re: text properties in tex mode
  2008-10-07 12:56 ` Kostas Oikonomou
  2008-10-07 13:03   ` Allan Gottlieb
@ 2008-10-07 13:31   ` martin rudalics
  2008-10-07 13:42     ` Kostas Oikonomou
  1 sibling, 1 reply; 15+ messages in thread
From: martin rudalics @ 2008-10-07 13:31 UTC (permalink / raw)
  To: Kostas Oikonomou; +Cc: help-gnu-emacs

 > Yes, I tried that, it does not help.

You should have complained instantaneously ;-)

After adding these lines to your .emacs and restarting Emacs could you
please go in a buffer in LaTeX mode, type

C-h v RET facemenu-add-face-function RET

and tell me what Emacs prints?

 > So this is a bug in TeX/LaTeX mode?

I suppose TeX mode breaks this with

   (set (make-local-variable 'facemenu-add-face-function)
        (lambda (face end)
	 (or (cdr (assq face tex-face-alist))
	     (error "Face %s not configured for %s mode" face mode-name))))

 > I have never filed an Emacs bug report before, how do you go about it?

 From the Emacs Help menu select Send Bug Report... choose an appropriate
subject and write what you did to produce the bug.  If you can't (or
don't want to) send the report from Emacs itself, copy the From:, To:,
and Subject: fields as well as the entire remaining text to the
respective fields of your preferred mail composer and send them as
usual.

martin





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

* Re: text properties in tex mode
  2008-10-07 13:31   ` martin rudalics
@ 2008-10-07 13:42     ` Kostas Oikonomou
  2008-10-07 14:00       ` martin rudalics
  0 siblings, 1 reply; 15+ messages in thread
From: Kostas Oikonomou @ 2008-10-07 13:42 UTC (permalink / raw)
  To: martin rudalics; +Cc: help-gnu-emacs



martin rudalics wrote:

> You should have complained instantaneously ;-)

I will work on that :-)

> After adding these lines to your .emacs and restarting Emacs could you
> please go in a buffer in LaTeX mode, type
> 
> C-h v RET facemenu-add-face-function RET
> 
> and tell me what Emacs prints?

facemenu-add-face-function is a variable defined in 
`facemenu.el'.
Its value is nil
Local in buffer nperf.tex; global value is nil

Documentation:
Function called at beginning of text to change or nil.
This function is passed the FACE to set and END of text to 
change, and must
return a string which is inserted.  It may set 
`facemenu-end-add-face'.

You can customize this variable.

>  > So this is a bug in TeX/LaTeX mode?
> 
> I suppose TeX mode breaks this with
> 
>   (set (make-local-variable 'facemenu-add-face-function)
>        (lambda (face end)
>      (or (cdr (assq face tex-face-alist))
>          (error "Face %s not configured for %s mode" face mode-name))))
> 
>  > I have never filed an Emacs bug report before, how do you go about it?
> 
>  From the Emacs Help menu select Send Bug Report... choose an appropriate
> subject and write what you did to produce the bug.  If you can't (or
> don't want to) send the report from Emacs itself, copy the From:, To:,
> and Subject: fields as well as the entire remaining text to the
> respective fields of your preferred mail composer and send them as
> usual.
> 
> martin
> 




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

* Re: text properties in tex mode
  2008-10-07 13:42     ` Kostas Oikonomou
@ 2008-10-07 14:00       ` martin rudalics
  0 siblings, 0 replies; 15+ messages in thread
From: martin rudalics @ 2008-10-07 14:00 UTC (permalink / raw)
  To: Kostas Oikonomou; +Cc: help-gnu-emacs

 > facemenu-add-face-function is a variable defined in `facemenu.el'.
 > Its value is nil

This means you cannot reproduce the bug reported initially any more?

So you probably should in addition to disabling `font-lock-mode' also
set `font-lock-defaults' to nil.

martin




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

end of thread, other threads:[~2008-10-07 14:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.292.1223226411.25473.help-gnu-emacs@gnu.org>
2008-10-05 17:57 ` text properties in tex mode harven
2008-10-07  5:33 martin rudalics
2008-10-07 12:56 ` Kostas Oikonomou
2008-10-07 13:03   ` Allan Gottlieb
2008-10-07 13:31   ` martin rudalics
2008-10-07 13:42     ` Kostas Oikonomou
2008-10-07 14:00       ` martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2008-10-07  1:16 Kostas Oikonomou
     [not found] <mailman.320.1223253849.25473.help-gnu-emacs@gnu.org>
2008-10-06  7:14 ` harven
2008-10-06  0:44 Kostas Oikonomou
2008-10-05 15:11 Kostas Oikonomou
2008-10-05 17:53 ` Drew Adams
     [not found] <mailman.225.1223135509.25473.help-gnu-emacs@gnu.org>
2008-10-04 17:44 ` harven
2008-10-04 17:02 martin rudalics
2008-10-04 15:40 Kostas Oikonomou

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