2

I find that font-lock-mode are doing something wrong with the width of single spaces no matter what monospace font I'm using.

Here are some screenshots:

  • Using DejaVu Sans Mono:

    font-lock-mode on:

    djv1

    font-lock-mode off:

    djv2

  • Using Luculent:

    font-lock-mode on:

    lu1

    font-lock-mode off:

    lu2

Related (maybe) lines in my emacs init file:

(custom-set-variables
 ...
(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 (:inherit nil :stipple nil :inverse-video nil
                :box nil :strike-through nil :overline nil
                :underline nil :slant normal :weight normal
                :height 120 :width normal 
                :foundry "unknown" :family "Luculent")))))

Edit: Thanks to @Boojum 's help, I did C-u C-x = on 3 different style of characters. This is the result. I guess the problem is SPC does not have a "face" property.

In addition, I also tried switching to other major modes and found that this problem only happens in haskell-mode.

Lindydancer
  • 25,428
  • 4
  • 49
  • 68
Javran
  • 3,394
  • 2
  • 23
  • 40

1 Answers1

1

I'm not sure what's going on, offhand, but it looks like the bold text is set to a size that's slightly larger than the default. Do you have any customizations on font-lock-keyword-face? Do you have a site configuration file that might be customizing the faces?

One thing that may help to debug this is to place the point on some of the bold text in your example and type C-u C-x = This will give you some more information on what's contributing to how it's displayed. Also do this on some of the default (non-bold) text. If you post the replies here we might be able to help you better.

Boojum
  • 6,592
  • 1
  • 30
  • 34
  • thanks for your help, I picked up 3 chars and [here](http://i.imgur.com/UotNF2M.png) is the result. I guess the problem is SPC does not have a "face" property. – Javran Mar 18 '14 at 06:04
  • Another thing is that I found this only happens in haskell-mode, if I switch to other modes like scheme-mode, everything will be fine. I think the related file in haskell-mode is [this one](https://github.com/haskell/haskell-mode/blob/master/haskell-font-lock.el), hope it's helpful. – Javran Mar 18 '14 at 06:09
  • @Javran - If you look in the upper right window, you'll see that it's using 18pt (see the xft line) for `font-lock-function-name-face`. The other two window's show that they're using 16pt. So the next thing is to check for any customizations of `font-lock-function-name-face` that you might have. That haskell mode looks like it just uses the standard face (and the screen shot confirms that's what it's using). But if it's only appearing in that mode, you might want to check for any hooks. Do you have anything for `'haskell-font-lock-hook` or `'haskell-mode-hook`? – Boojum Mar 18 '14 at 07:20
  • Finally I figured that out! but it has nothing to do with hooks: I clicked the button "font-lock-function-name" and proceed to examine the values, and I find the scale is defaulted to 1.1. Either changing it to 1.0 or switching to another theme will do. – Javran Mar 18 '14 at 08:22
  • the theme is "manoj-dark" shipped with emacs, google search bring me to the source code [here](https://github.com/tovbinm/emacs-24-mac/blob/master/etc/themes/manoj-dark-theme.el#L86). Still not sure why but now it looks like an issue of a particular emacs theme? – Javran Mar 18 '14 at 08:25
  • 1
    @Javran Yes, it's an issue with that specific theme, because it uses a larger font size for function names, which breaks the visual code layout. You may want to report a bug with `M-x report-emacs-bug`. By the way, the actual Emacs source code is not hosted on Github, but on [Savannah](http://savannah.gnu.org/projects/emacs#). –  Mar 18 '14 at 10:55
  • More precisely it's this line: `'(font-lock-function-name-face ((t (:foreground "mediumspringgreen" :weight bold :height 1.1))))` – Boojum Mar 18 '14 at 18:03