> From: James Cloos <cloos@jhcloos.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 10 Jul 2017 01:35:12 -0400
>
> >>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
> EZ> The doc string for the 'line-number' face explicitly tells to use
> EZ> fixed-pitch font for the face.
>
> I hadn't gotten that far; I only called M-x set-variable in a buffer
> which was already in variable-pitch-mode, and then toggled v-p-m a
> couple of time to compare w/ and w/o. I hadn't gone looking for the
> name of the face used by the line numbers.
The line-number face by default inherits from the 'default' face. So
how did you get into a situation where the frame's default face uses a
variable-pitch font? Did you invoke Emacs with -fn option, or do you
have some mode which creates a frame with the face parameter that
specifies a variable-pitch font?
> Perhaps what I should have written is that the default face for line-
> number should not be affected by enabling variable-pitch-mode.
I didn't think people would have frames whose default face is
variable-pitch.
Does the patch below give good results?
> >> The code might need to check whether the current face provides a glyph
> >> for FIGURE SPACE.
>
> EZ> And if not?
>
> Then it would have had to ignore FIGURE SPACE and fall back to SPACE...
Btw, I don't really see how FIGURE SPACE could solve the problem at
hand anyway. AFAIU, that character is simply a space whose width is
the same as that of digits. So it's appropriate for when thousands
separator is a space, but it cannot magically align a number displayed
with a variable-pitch font. Am I missing something?
Here's the patch I propose to fix your variable-pitch problem:
diff --git a/lisp/faces.el b/lisp/faces.el
index c3693d1..52a4db5 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2467,7 +2467,7 @@ trailing-whitespace
;; Definition stolen from linum.el.
(defface line-number
- '((t :inherit (shadow default)))
+ '((t :inherit (shadow default) :family "Monospace Serif"))
"Face for displaying line numbers.
This face is used when `display-line-numbers' is non-nil.