0

I use C-x8space to insert a non-breakable space. In recent Emacs (I'm on 28.2 now), it started being displayed much narrower than in older versions.

I use a monospace font called monofur, but the space is not displayed in it. C-uC-x= on the space shows

             position: 268 of 269 (99%), column: 1
            character:   (displayed as  ) (codepoint 160, #o240, #xa0)
              charset: latin-iso8859-2 (Right-Hand Part of ISO/IEC 8859/2 (Latin-2): ISO-IR-101)
code point in charset: 0x20
               script: latin
               syntax:      which means: whitespace
             category: .:Base, b:Arabic, j:Japanese, l:Latin
             to input: type "C-x 8 RET a0" or "C-x 8 RET NO-BREAK SPACE"
          buffer code: #xC2 #xA0
            file code: #xA0 (encoded by coding system iso-latin-2-unix)
              display: by this font (glyph code):
    ftcrhb:-unknown-Caladea-normal-normal-normal-*-21-*-*-*-*-0-iso10646-1 (#x62)
       hardcoded face: nobreak-space

Character code properties: customize what to show
  name: NO-BREAK SPACE
  old-name: NON-BREAKING SPACE
  general-category: Zs (Separator, Space)
  decomposition: (noBreak 32) (noBreak ' ')

There is an overlay here:
 From 267 to 270
  face                 hl-line
  priority             -50
  window               #<window 27 on *scratch*>


There are text properties here:
  fontified            t

Why is Caladea used and how can I change it? Setting a different font for the nobreak-space face doesn't change anything.

5
  • 1
    If there is no glyph for the non-breaking space in your monospace font, then Emacs will pick a font that does and use it. The details of how it does that are beyond me, but they might explain why Caladea is chosen. If you can, try Liberation Mono Regular which is what I use: it displays the nbsp with no problem.
    – NickD
    Jun 21, 2023 at 21:17
  • @nickd: Yes, on a different machine where it works I don't have Caladea installed and Emacs picks Computer Modern where the space has the same width as in the default font.
    – choroba
    Jun 21, 2023 at 21:23
  • What is the default font? See if face-font-family-alternatives can help.
    – NickD
    Jun 21, 2023 at 22:18
  • 1
    @NickD: Yes! I use monofur as the default font, and I was able to find an alternative whose nonbreakable space is of the correct width (Latin Modern Mono Light). If you could turn this into an answer, I'd accept it.
    – choroba
    Jun 22, 2023 at 11:04
  • I'm glad that I didn't lead you astray, but you are more qualified to write the answer: I don't know what you did exactly and I didn't reproduce the problem myself, so it's going to take much longer for me to figure out an answer than for you to describe what you did. If you write it up, I'll upvote :-)
    – NickD
    Jun 22, 2023 at 12:05

1 Answer 1

0

I don't see that. What Emacs version are you using?

Do you see that if you start Emacs with emacs -Q (no init file)? If not, then bisect your init file to find the culprit. If yes, then click the linked text hardcoded face: nobreak-space to see how that face is defined, for you. For me it shows only this, with hl-line-mode enabled or disabled:

Face for displaying nobreak space.

Defined in ‘faces.el’.

           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: unspecified
            Slant: unspecified
       Foreground: unspecified
DistantForeground: unspecified
       Background: unspecified
        Underline: t
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: unspecified
          Inherit: escape-glyph

You commented here that using emacs -Q there's no such problem. In that case, bisect your init file to find the culprit. IOW, find out how you are shooting yourself in the foot -- that's the first step to solving that problem.

2
  • It doesn't happen with -Q. When I run -Q and change the frame font to monofur, the space becomes narrow again. In the previous version of Emacs, I used the same font and the space had a normal width.
    – choroba
    Jun 21, 2023 at 18:35
  • Bisect your init file to find the culprit, in that case.
    – Drew
    Jun 21, 2023 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.