unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: linum and AUCTeX: line number face
       [not found] <46ea83d1$0$16117$9b4e6d93@newsspool1.arcor-online.net>
@ 2007-09-16 10:30 ` Stephan Hennig
  2007-09-16 21:11   ` Stephen Berman
  0 siblings, 1 reply; 11+ messages in thread
From: Stephan Hennig @ 2007-09-16 10:30 UTC (permalink / raw)
  To: emacs-devel

[This question has formerly been sent to gnu.emacs.help.  Resending now
to gmane.emacs.devel (with test case).]

Hi,

when linum-mode is activated in LaTeX-mode, line numbers are not set in
uniform face, but it seems their face is inherited from the current
line's face, at least with regard to font weight.

That is, if a line starts with copy printed in bold face the line number
is printed in bold face, too.  I find this very distracting.

Steps to reproduce:
1. File .emacs contains these lines:

(progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
(require 'linum)

2. Start Emacs by typing 'emacs'.

3. C-x C-f test.tex
(On my installation this switches to LaTeX-mode.)

4. Type 'text RET \bfseries text RET'.

5. M-x linum-mode


Symptoms:
Both line numbers have different font weight.


Expected behaviour:
Both line numbers are printed in medium weight.  Is there any way to
configure linum to do what I want?

Best regards,
Stephan Hennig


System:
GNU Emacs 22.1.50.1 (i386-mingw-nt5.1.2600) of 2007-07-07 on NEUTRINO
AUCTeX 11.84
linum.el 0.9n

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

* Re: linum and AUCTeX: line number face
  2007-09-16 10:30 ` linum and AUCTeX: line number face Stephan Hennig
@ 2007-09-16 21:11   ` Stephen Berman
  2007-09-17 13:57     ` Stephan Hennig
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2007-09-16 21:11 UTC (permalink / raw)
  To: emacs-devel

On Sun, 16 Sep 2007 12:30:46 +0200 Stephan Hennig <mailing_list@arcor.de> wrote:

> [This question has formerly been sent to gnu.emacs.help.  Resending now
> to gmane.emacs.devel (with test case).]
>
> Hi,
>
> when linum-mode is activated in LaTeX-mode, line numbers are not set in
> uniform face, but it seems their face is inherited from the current
> line's face, at least with regard to font weight.
[...]
> Is there any way to configure linum to do what I want?

If you customize the linum face to default, then all line numbers have
the default face.  It seems the default face does not "inherit" the
face properties of the string that the linum display property is on,
whereas, for example, the shadow face, used by default by linum.el
version 0.9n and later, does inherit at least some face properties or
attributes.  You can also see the difference with parenthesis
highlighting, for example: if linum face is shadow, then highlighting
a parenthesis in column 0 also highlights the line number, but not if
linum face is default.  I don't know just which other faces behave
like default and which like shadow (though the face (not just the
weight) bold seems to inherit even more attributes than shadow), nor
do I know why there is this difference.  But I do know that this has
to do generally with display properties and display margins, not just
with linum.el.

Steve Berman

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

* Re: linum and AUCTeX: line number face
  2007-09-16 21:11   ` Stephen Berman
@ 2007-09-17 13:57     ` Stephan Hennig
  2007-09-17 15:02       ` David Kastrup
  2007-09-17 22:54       ` Stephen Berman
  0 siblings, 2 replies; 11+ messages in thread
From: Stephan Hennig @ 2007-09-17 13:57 UTC (permalink / raw)
  To: emacs-devel

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

Stephen Berman schrieb:

> If you customize the linum face to default, then all line numbers 
> have the default face.  It seems the default face does not "inherit" 
> the face properties of the string that the linum display property is 
> on, whereas, for example, the shadow face, used by default by 
> linum.el version 0.9n and later, does inherit at least some face 
> properties or attributes.

Thanks!  For \bfseries using default face works for all fonts I've
tried.  But for \section commands the behaviour is even more strange.

As long as default face refers to, e.g., 'Courier New' or 'Bitstream
Vera Sans Mono' all seems to be well.  But when default refers to, e.g.,
'Outline-Consolas' or 'Lucida Sans Typewriter' weight is still inherited
from line's face if there's a \section command in that line.

To reproduce the problem, put the following lines into file .emacs:

(progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
(require 'linum)
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:stipple nil :background "SystemWindow" :foreground
"SystemWindowText" :inverse-video nil :box nil :strike-through nil
:overline nil :underline nil :slant normal :weight normal :height 108
:width normal :family "Bitstream Vera Sans Mono"))))
 '(linum ((t (:inherit default))))
)

1. Start emacs by typing 'emacs'.
2. C-x C-f test.tex (or activate LaTeX-mode by other means).
3. Type '2 RET \section{test} RET 2 RET'.
4. M-x linum-mode
5. Compare the '2' printed by linum and the two '2's in the buffer.
Both are rendered differently.

I've additionally attached a small screen shot, where the problem can
also be seen for a number '8' (try zooming in).

System:
GNU Emacs 22.1.50.1 (i386-mingw-nt5.1.2600) of 2007-07-07 on NEUTRINO
AUCTeX 11.84
linum.el 0.9t


> I don't know just which other faces behave like default and which
> like shadow (though the face (not just the weight) bold seems to
> inherit even more attributes than shadow), nor do I know why there is
> this difference.

Hm, could it be that 'default' in general refers to a specific font
whereas 'shadow' doesn't (Font Family is *)?  I agree that 'shadow'
shouldn't be an explicit face definition, but modify "what's already
there", e.g., change a property of text set in default face.  But
inheriting font-locking related properties (and only for /some/ fonts)
is bad, IMHO.  Are there means to toggle that behaviour?


> But I do know that this has to do generally with display properties
> and display margins, not just with linum.el.

I guess, I've never met those 'display margins' before.  Could you
please give a hint about what you're speaking to somebody not so good at
managing Emacs (yet)?

Best regards,
Stephan Hennig


[-- Attachment #2: linum-vera.png --]
[-- Type: image/png, Size: 2599 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: linum and AUCTeX: line number face
  2007-09-17 13:57     ` Stephan Hennig
@ 2007-09-17 15:02       ` David Kastrup
  2007-09-17 16:20         ` Stefan Monnier
  2007-09-17 17:38         ` Stephan Hennig
  2007-09-17 22:54       ` Stephen Berman
  1 sibling, 2 replies; 11+ messages in thread
From: David Kastrup @ 2007-09-17 15:02 UTC (permalink / raw)
  To: Stephan Hennig; +Cc: emacs-devel

Stephan Hennig <mailing_list@arcor.de> writes:

> Stephen Berman schrieb:
>
>> If you customize the linum face to default, then all line numbers 
>> have the default face.  It seems the default face does not "inherit" 
>> the face properties of the string that the linum display property is 
>> on, whereas, for example, the shadow face, used by default by 
>> linum.el version 0.9n and later, does inherit at least some face 
>> properties or attributes.
>
> Thanks!  For \bfseries using default face works for all fonts I've
> tried.  But for \section commands the behaviour is even more strange.
>
> As long as default face refers to, e.g., 'Courier New' or 'Bitstream
> Vera Sans Mono' all seems to be well.  But when default refers to, e.g.,
> 'Outline-Consolas' or 'Lucida Sans Typewriter' weight is still inherited
> from line's face if there's a \section command in that line.
>
> To reproduce the problem, put the following lines into file .emacs:
>
> (progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
> (require 'linum)
> (custom-set-faces
>   ;; custom-set-faces was added by Custom.
>   ;; If you edit it by hand, you could mess it up, so be careful.
>   ;; Your init file should contain only one such instance.
>   ;; If there is more than one, they won't work right.
>  '(default ((t (:stipple nil :background "SystemWindow" :foreground
> "SystemWindowText" :inverse-video nil :box nil :strike-through nil
> :overline nil :underline nil :slant normal :weight normal :height 108
> :width normal :family "Bitstream Vera Sans Mono"))))
>  '(linum ((t (:inherit default))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That is not the default face.

Try (copy-face 'default 'linum) or (put 'linum 'face-alias 'default instead).

Inheriting will, of course, be overridden by any new properties.
That's the whole point of it.

-- 
David Kastrup

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

* Re: linum and AUCTeX: line number face
  2007-09-17 15:02       ` David Kastrup
@ 2007-09-17 16:20         ` Stefan Monnier
  2007-09-17 22:54           ` Stephen Berman
  2007-09-17 17:38         ` Stephan Hennig
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-09-17 16:20 UTC (permalink / raw)
  To: David Kastrup; +Cc: Stephan Hennig, emacs-devel

>> '(linum ((t (:inherit default))))
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> That is not the default face.

> Try (copy-face 'default 'linum) or (put 'linum 'face-alias 'default instead).

> Inheriting will, of course, be overridden by any new properties.
> That's the whole point of it.

I don't think I agree: the inherited `default' should only be overridden by
new properties set *in the linum face* and in his above example there
are none so there sould be no difference between those two cases and using
inherit is a lot cleaner.


        Stefan

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

* Re: linum and AUCTeX: line number face
  2007-09-17 15:02       ` David Kastrup
  2007-09-17 16:20         ` Stefan Monnier
@ 2007-09-17 17:38         ` Stephan Hennig
  2007-09-17 22:54           ` Stephen Berman
  1 sibling, 1 reply; 11+ messages in thread
From: Stephan Hennig @ 2007-09-17 17:38 UTC (permalink / raw)
  To: emacs-devel

David Kastrup schrieb:
> Stephan Hennig <mailing_list@arcor.de> writes:
>
>> As long as default face refers to, e.g., 'Courier New' or 'Bitstream
>> Vera Sans Mono' all seems to be well.  But when default refers to, e.g.,
>> 'Outline-Consolas' or 'Lucida Sans Typewriter' weight is still inherited
>> from line's face if there's a \section command in that line.

First, let me correct myself (too much testing).  Bold line numbers can
be seen with any of the fonts 'Bitstream Vera Sans Mono', 'Lucida Sans
Typewriter' or 'Outline-Consolas'.  Only for 'Courier' or 'Courier New'
there are uniform medium weight line numbers.


>> To reproduce the problem, put the following lines into file .emacs:
>>
>> (progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
>> (require 'linum)
>> (custom-set-faces
>>   ;; custom-set-faces was added by Custom.
>>   ;; If you edit it by hand, you could mess it up, so be careful.
>>   ;; Your init file should contain only one such instance.
>>   ;; If there is more than one, they won't work right.
>>  '(default ((t (:stipple nil :background "SystemWindow" :foreground
>> "SystemWindowText" :inverse-video nil :box nil :strike-through nil
>> :overline nil :underline nil :slant normal :weight normal :height 108
>> :width normal :family "Bitstream Vera Sans Mono"))))
>>  '(linum ((t (:inherit default))))
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> That is not the default face.
> 
> Try (copy-face 'default 'linum) or (put 'linum 'face-alias 'default instead).

Thanks for taking a look at that, David!  Since I'm a bit lost could you
please give me step-by-step instructions where to put those line(s) and
what lines to remove?  I've tried removing the line you've underlined
and added

(copy-face 'default 'linum)

after loading linum, but that results in even more font-locking related
properties, e.g., some italic line numbers.


> Inheriting will, of course, be overridden by any new properties.
> That's the whole point of it.

Well, I'd love to do without any inheritance at all.  With the following
.emacs I've tried to set line numbers to be black, upright, medium
weight.  The result are black and upright line numbers, but weight seems
still to be "inherited" (don't know if that's the correct term here)
from font-locking properties.

Note, if colour or slant aren't set, they are inherited from
font-locking properties, too.  That is, setting them explicitly to
"black" and "normal" _does override_ font-locking properties.  But an
explicit weight value is ignored.  Is that intended behaviour?

Best regards,
Stephan Hennig


(progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
(require 'linum)
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:stipple nil :background "SystemWindow" :foreground
"SystemWindowText" :inverse-video nil :box nil :strike-through nil
:overline nil :underline nil :slant normal :weight normal :height 108
:width normal :family "Bitstream Vera Sans Mono"))))
 '(linum ((t (:foreground "black" :slant normal :weight normal)))))
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

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

* Re: linum and AUCTeX: line number face
  2007-09-17 13:57     ` Stephan Hennig
  2007-09-17 15:02       ` David Kastrup
@ 2007-09-17 22:54       ` Stephen Berman
  1 sibling, 0 replies; 11+ messages in thread
From: Stephen Berman @ 2007-09-17 22:54 UTC (permalink / raw)
  To: emacs-devel

On Mon, 17 Sep 2007 15:57:02 +0200 Stephan Hennig <mailing_list@arcor.de> wrote:

> Stephen Berman schrieb:
[...]
>> I don't know just which other faces behave like default and which
>> like shadow (though the face (not just the weight) bold seems to
>> inherit even more attributes than shadow), nor do I know why there is
>> this difference.
>
> Hm, could it be that 'default' in general refers to a specific font
> whereas 'shadow' doesn't (Font Family is *)?  I agree that 'shadow'
> shouldn't be an explicit face definition, but modify "what's already
> there", e.g., change a property of text set in default face.  But
> inheriting font-locking related properties (and only for /some/ fonts)
> is bad, IMHO.  Are there means to toggle that behaviour?

I don't know exactly what (inheriting from) default means with respect
to faces.  But in any case, a specific font doesn't have color
attributes, yet the default foreground (on a light background) is
black, and as you observed in another post, explicitly setting the
foreground to black shows the problem.  I'm convinced this is a bug,
though I have no idea just what causes it.

>> But I do know that this has to do generally with display properties
>> and display margins, not just with linum.el.
>
> I guess, I've never met those 'display margins' before.  Could you
> please give a hint about what you're speaking to somebody not so good at
> managing Emacs (yet)?

The left display margin (by default to the left of the left fringe) is
where you see the line numbers in linum-mode (starting with version
0.9a).  For info type `C-h i RET m elisp m Display Property' and from
there `m Display Margins'.

Steve Berman

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

* Re: linum and AUCTeX: line number face
  2007-09-17 16:20         ` Stefan Monnier
@ 2007-09-17 22:54           ` Stephen Berman
  2007-10-11 16:30             ` Stephan Hennig
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2007-09-17 22:54 UTC (permalink / raw)
  To: emacs-devel

On Mon, 17 Sep 2007 12:20:07 -0400 Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>>> '(linum ((t (:inherit default))))
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>> That is not the default face.
>
>> Try (copy-face 'default 'linum) or (put 'linum 'face-alias 'default instead).
>
>> Inheriting will, of course, be overridden by any new properties.
>> That's the whole point of it.
>
> I don't think I agree: the inherited `default' should only be overridden by
> new properties set *in the linum face* and in his above example there
> are none so there sould be no difference between those two cases and using
> inherit is a lot cleaner.

There are indeed no difference AFAICT, and the same goes for faces
that exhibit the problem, e.g., (copy-face 'shadow 'linum) shows it
just as does customizing linum face to inherit from shadow face.

Steve Berman

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

* Re: linum and AUCTeX: line number face
  2007-09-17 17:38         ` Stephan Hennig
@ 2007-09-17 22:54           ` Stephen Berman
  2007-09-18  9:51             ` Stephan Hennig
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2007-09-17 22:54 UTC (permalink / raw)
  To: emacs-devel

On Mon, 17 Sep 2007 19:38:46 +0200 Stephan Hennig <mailing_list@arcor.de> wrote:

> David Kastrup schrieb:
>> Stephan Hennig <mailing_list@arcor.de> writes:
[...]
>>> To reproduce the problem, put the following lines into file .emacs:
>>>
>>> (progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
>>> (require 'linum)
>>> (custom-set-faces
>>>   ;; custom-set-faces was added by Custom.
>>>   ;; If you edit it by hand, you could mess it up, so be careful.
>>>   ;; Your init file should contain only one such instance.
>>>   ;; If there is more than one, they won't work right.
>>>  '(default ((t (:stipple nil :background "SystemWindow" :foreground
>>> "SystemWindowText" :inverse-video nil :box nil :strike-through nil
>>> :overline nil :underline nil :slant normal :weight normal :height 108
>>> :width normal :family "Bitstream Vera Sans Mono"))))
>>>  '(linum ((t (:inherit default))))
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 
>> That is not the default face.
>> 
>> Try (copy-face 'default 'linum) or (put 'linum 'face-alias 'default instead).
>
> Thanks for taking a look at that, David!  Since I'm a bit lost could you
> please give me step-by-step instructions where to put those line(s) and
> what lines to remove?  I've tried removing the line you've underlined
> and added
>
> (copy-face 'default 'linum)
>
> after loading linum, but that results in even more font-locking related
> properties, e.g., some italic line numbers.

All you have to do is evaluate that sexp, e.g. type M-: and at the
prompt enter (copy-face 'default 'linum) and then hit the return key.
But as Stefan Monnier surmised and I confirmed in another reply, this
doesn't do anything different than customizing the inherit attribute
of the face.
>
>> Inheriting will, of course, be overridden by any new properties.
>> That's the whole point of it.
>
> Well, I'd love to do without any inheritance at all.  With the following
> .emacs I've tried to set line numbers to be black, upright, medium
> weight.  The result are black and upright line numbers, but weight seems
> still to be "inherited" (don't know if that's the correct term here)
> from font-locking properties.

Yes, black seems to behave like shadow.  Perhaps this is generally the
case, and inheriting from default (whatever that means precisely; I
don't know) is the exception.

> Note, if colour or slant aren't set, they are inherited from
> font-locking properties, too.  That is, setting them explicitly to
> "black" and "normal" _does override_ font-locking properties.  But an
> explicit weight value is ignored.  Is that intended behaviour?

Again, not just weight, but also at least the highlighting done by
matching parentheses.

Steve Berman

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

* Re: linum and AUCTeX: line number face
  2007-09-17 22:54           ` Stephen Berman
@ 2007-09-18  9:51             ` Stephan Hennig
  0 siblings, 0 replies; 11+ messages in thread
From: Stephan Hennig @ 2007-09-18  9:51 UTC (permalink / raw)
  To: emacs-devel

Stephen Berman schrieb:
> On Mon, 17 Sep 2007 19:38:46 +0200 Stephan Hennig wrote:
> 
> All you have to do is evaluate that sexp, e.g. type M-: and at the 
> prompt enter (copy-face 'default 'linum) and then hit the return key.
>  But as Stefan Monnier surmised and I confirmed in another reply,
> this doesn't do anything different than customizing the inherit
> attribute of the face.

Ok, thanks!


>> But an explicit weight value is ignored. Is that intended 
>> behaviour?
> 
> Again, not just weight, but also at least the highlighting done by 
> matching parentheses.

Yes, I didn't notice that so far.  This is really annoying when using
inverse video for matching parentheses (I do):

 '(show-paren-match ((((class color) (background light)) (:foreground
"#4488FF" :inverse-video t))))
 '(show-paren-mismatch ((((class color)) (:foreground "red"
:inverse-video t))))

Best regards,
Stephan Hennig

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

* Re: linum and AUCTeX: line number face
  2007-09-17 22:54           ` Stephen Berman
@ 2007-10-11 16:30             ` Stephan Hennig
  0 siblings, 0 replies; 11+ messages in thread
From: Stephan Hennig @ 2007-10-11 16:30 UTC (permalink / raw)
  To: emacs-devel

Stephen Berman schrieb:
> Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>>> Inheriting will, of course, be overridden by any new properties.
>>> That's the whole point of it.
>>
>> I don't think I agree: the inherited `default' should only be overridden by
>> new properties set *in the linum face* and in his above example there
>> are none so there sould be no difference between those two cases and using
>> inherit is a lot cleaner.
> 
> There are indeed no difference AFAICT, and the same goes for faces
> that exhibit the problem, e.g., (copy-face 'shadow 'linum) shows it
> just as does customizing linum face to inherit from shadow face.

I didn't really understand all of the discussion and if the problem is
in linum or in Emacs.  Actually, I don't really know if (all of) you
agree there is a bug.  Is the current behaviour considered a bug or is
it intentional?

Best regards,
Stephan Hennig

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

end of thread, other threads:[~2007-10-11 16:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <46ea83d1$0$16117$9b4e6d93@newsspool1.arcor-online.net>
2007-09-16 10:30 ` linum and AUCTeX: line number face Stephan Hennig
2007-09-16 21:11   ` Stephen Berman
2007-09-17 13:57     ` Stephan Hennig
2007-09-17 15:02       ` David Kastrup
2007-09-17 16:20         ` Stefan Monnier
2007-09-17 22:54           ` Stephen Berman
2007-10-11 16:30             ` Stephan Hennig
2007-09-17 17:38         ` Stephan Hennig
2007-09-17 22:54           ` Stephen Berman
2007-09-18  9:51             ` Stephan Hennig
2007-09-17 22:54       ` Stephen Berman

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