GNU bug report logs - #35452
Line number faces should check for remapping of the default face

Previous Next

Package: emacs;

Reported by: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>

Date: Sat, 27 Apr 2019 15:49:02 UTC

Severity: minor

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35452 in the body.
You can then email your comments to 35452 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35452; Package emacs. (Sat, 27 Apr 2019 15:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Apr 2019 15:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Line number faces should check for remapping of the default face
Date: Sat, 27 Apr 2019 14:52:10 +0200
Currently, the line number faces do not check for remapping of the
default face and use its attributes directly.  In the default
configuration, this has no adverse effects since the `line-number' face
inherits from `default' explicitly, so any remapping is considered there.

However, there is no need to have `line-number' inherit from `default'
explicitly since it already merges DEFAULT_FACE_ID.  Instead, we can
check for remapping of DEFAULT_FACE_ID prior to merging the faces.

The patch shown below accomplishes that.

diff --git a/src/xdisp.c b/src/xdisp.c
index d52d1333a0..1e7e31fb8a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21176,9 +21176,10 @@ maybe_produce_line_number (struct it *it)
   char lnum_buf[INT_STRLEN_BOUND (ptrdiff_t) + 1];
   bool beyond_zv = IT_BYTEPOS (*it) >= ZV_BYTE ? true : false;
   ptrdiff_t lnum_offset = -1; /* to produce 1-based line numbers */
-  int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID);
+  int base_face_id = lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
+  int lnum_face_id = merge_faces (it->w, Qline_number, 0, base_face_id);
   int current_lnum_face_id
-    = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID);
+    = merge_faces (it->w, Qline_number_current_line, 0, base_face_id);
   /* Compute point's line number if needed.  */
   if ((EQ (Vdisplay_line_numbers, Qrelative)
        || EQ (Vdisplay_line_numbers, Qvisual)

-- 
Dario Gjorgjevski :: +389 (0)70 784 142




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35452; Package emacs. (Fri, 03 May 2019 09:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 35452 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
Cc: 35452 <at> debbugs.gnu.org
Subject: Re: bug#35452: Line number faces should check for remapping of the
 default face
Date: Fri, 03 May 2019 12:01:07 +0300
> From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
> Date: Sat, 27 Apr 2019 14:52:10 +0200
> 
> Currently, the line number faces do not check for remapping of the
> default face and use its attributes directly.  In the default
> configuration, this has no adverse effects since the `line-number' face
> inherits from `default' explicitly, so any remapping is considered there.
> 
> However, there is no need to have `line-number' inherit from `default'
> explicitly since it already merges DEFAULT_FACE_ID.  Instead, we can
> check for remapping of DEFAULT_FACE_ID prior to merging the faces.
> 
> The patch shown below accomplishes that.

Thanks, but I don't think I understand the advantages of this approach
vs the current one.  Concretely, why would we want not to inherit
from the 'default' face?

Also, doesn't your change force the line-number face to change
together with 'default', even if the user defines the face to not
inherit from 'default'?  With the current code, users are free to
define the face without inheritance, and that will stop update the
line-number face together with 'default', e.g. when the user enlarges
the default face's font or makes it smaller.  With your proposal, the
size changes in 'default' will always be propagated to line-number,
right?

And finally, if we do make the proposed change, shouldn't we stop
inheriting from 'default' at the same time?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35452; Package emacs. (Thu, 16 May 2019 13:59:01 GMT) Full text and rfc822 format available.

Message #11 received at 35452 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
Cc: 35452 <at> debbugs.gnu.org
Subject: Re: bug#35452: Line number faces should check for remapping of the
 default face
Date: Thu, 16 May 2019 16:57:53 +0300
[Forwarding to the bug tracker; please use Reply All in the future.]

> From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
> Date: Thu, 16 May 2019 11:00:50 +0200
> 
> > Thanks, but I don't think I understand the advantages of this approach
> > vs the current one.  Concretely, why would we want not to inherit
> > from the 'default' face?
> 
> Indeed, there is no reason not to inherit from the default face.  In
> fact, what I suggested was making the inheritance _always hold_, i.e.,
> despite of the user's definitions of the line number faces.  Which
> brings us to the next point you brought up...
> 
> > Also, doesn't your change force the line-number face to change
> > together with 'default', even if the user defines the face to not
> > inherit from 'default'?  With the current code, users are free to
> > define the face without inheritance, and that will stop update the
> > line-number face together with 'default', e.g. when the user enlarges
> > the default face's font or makes it smaller.  With your proposal, the
> > size changes in 'default' will always be propagated to line-number,
> > right?
> 
> I agree with you.  In fact, this is exactly the reason why I had
> suggested the change -- I was using a theme were the line number faces
> were not set to inherit from default, and realized that
> text-scale-adjust does not affect them.
> 
> > And finally, if we do make the proposed change, shouldn't we stop
> > inheriting from 'default' at the same time?
> 
> Absolutely.
> 
> With all this being said, I agree with you that it is best to let the
> user choose whether he or she wants the line number faces to inherit
> from the default one.

So you agree that this bug should be closed without changing the
current code?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35452; Package emacs. (Thu, 16 May 2019 14:31:02 GMT) Full text and rfc822 format available.

Message #14 received at 35452 <at> debbugs.gnu.org (full text, mbox):

From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
To: 35452 <at> debbugs.gnu.org
Subject: Fwd: bug#35452: Line number faces should check for remapping of the
 default face
Date: Thu, 16 May 2019 11:05:06 +0200
> Thanks, but I don't think I understand the advantages of this approach
> vs the current one.  Concretely, why would we want not to inherit
> from the 'default' face?

Indeed, there is no reason not to inherit from the default face.  In
fact, what I suggested was making the inheritance _always hold_, i.e.,
despite of the user's definitions of the line number faces.  Which
brings us to the next point you brought up...

> Also, doesn't your change force the line-number face to change
> together with 'default', even if the user defines the face to not
> inherit from 'default'?  With the current code, users are free to
> define the face without inheritance, and that will stop update the
> line-number face together with 'default', e.g. when the user enlarges
> the default face's font or makes it smaller.  With your proposal, the
> size changes in 'default' will always be propagated to line-number,
> right?

I agree with you.  In fact, this is exactly the reason why I had
suggested the change -- I was using a theme were the line number faces
were not set to inherit from default, and realized that
text-scale-adjust does not affect them.

> And finally, if we do make the proposed change, shouldn't we stop
> inheriting from 'default' at the same time?

Absolutely.

With all this being said, I agree with you that it is best to let the
user choose whether he or she wants the line number faces to inherit
from the default one.

--
Dario Gjorgjevski :: dario.gjorgjevski <at> gmail.com :: +389 (0)70 784 142




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35452; Package emacs. (Thu, 16 May 2019 14:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 35452 <at> debbugs.gnu.org (full text, mbox):

From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35452 <at> debbugs.gnu.org
Subject: Re: bug#35452: Line number faces should check for remapping of the
 default face
Date: Thu, 16 May 2019 16:07:25 +0200
> [Forwarding to the bug tracker; please use Reply All in the future.]

Sorry for that.

> So you agree that this bug should be closed without changing the
> current code?
>
> Thanks.

Yes.  Thank you likewise.

-- 
Dario Gjorgjevski :: dario.gjorgjevski <at> gmail.com :: +389 (0)70 784 142




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 16 May 2019 14:34:01 GMT) Full text and rfc822 format available.

Notification sent to Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>:
bug acknowledged by developer. (Thu, 16 May 2019 14:34:01 GMT) Full text and rfc822 format available.

Message #22 received at 35452-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
Cc: 35452-done <at> debbugs.gnu.org
Subject: Re: bug#35452: Line number faces should check for remapping of the
 default face
Date: Thu, 16 May 2019 17:32:56 +0300
> From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
> Cc: 35452 <at> debbugs.gnu.org
> Date: Thu, 16 May 2019 16:07:25 +0200
> 
> > So you agree that this bug should be closed without changing the
> > current code?
> >
> > Thanks.
> 
> Yes.  Thank you likewise.

Thanks, done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.