I use variable-pitch-mode
with org
buffers. Normally I set org-block
to fixed-pitch
and the code between #+BEGIN_SRC
and #+END_SRC
are properly rendered as fixed width fonts, also with proper syntax highlighting. However starting from last week, for some reason, although the code block font still had proper syntax highlighting, the face became the same as the variable-pitch-face
as normal org-mode texts. I update my packages periodically and I think an update in org-mode
caused the issue but I'm not sure what happened.
Update:
Turns out this is actually related to org-block-background
face, which has been removed in org version 8.3.1 in commit f8b42e8
, thus the bug. Not sure if there's a solution yet. https://stackoverflow.com/questions/26290924/fontify-r-code-blocks-in-org-mode-8 https://lists.gnu.org/archive/html/emacs-orgmode/2015-08/msg00510.html
I'm currently just locking my org-mode version to the older one.
Update 2:
The newest org-mode release, version 9.0.0, apparently lets src-blocks
inherit org-block
face, while the org-block-background
face becomes obsolete. So now just by setting org-block
face you should be able to have fixed-width fonts for all codes.
#BEGIN_EXAMPLE
block, but doesn't work in#BEGIN_SRC language_name
? Once the language should have its own syntax highlighting, the font reverts to variable-pitch in my case.#BEGIN_SRC lang_name
and#END_SRC
should be something other thandefault
, right? Currently when I rundescribe-face
inside of the block, I getdefault
, which is the same font as normal text of orgmode. While between#BEGIN_EXAMPLE
and#END_EXAMPLE
it'sorg-block
and for~text~
it'sorg-code
, for=text=
it'sorg-verbatim
, and thus those texts are displayed as fixed-pitch correctly.default
face beween#BEGIN_SRC lang_name
and#END_SRC
, it seems impossible to set it to fixed-pitch while keeping the normal content variable-pitch. I'm not sure I've correctly installed the master branch though.