1

System Info

  • Windows 10
  • emacs 27.1 64-bit

Description

Basically, when I open a new org file, it appears to be a plain text document. However, I can clearly see that org-mode is activated, and this is confirmed by M-x describe-variable major-mode.

enter image description here

As you can see in the picture above, I don't see any coloring of my example headlines despite clearly being in Org-Mode. However, once I M-x org-mode, the colors are rendered. How do I go about debugging?

Another weird thing I noticed in my message buffer was the following line: (Shell command succeeded with no output). I've never seen this before, so I don't know if it's related. Google searches don't yield anything helpful.

4
  • Try C-u C-x = with your cursor on a character in the headline and see what the resulting output says about text properties. E.g. does it say that the face is org-level-1? It may be that the faces are not set, or it may be that the faces are set but the fontification fails. This might help to narrow things down a bit. Also, what happens if you do M-x org-mode by hand? Does it look better? Does it fail? Does anything happen? – NickD Feb 6 at 2:27
  • I have the exact same issue. When I do M-x org-mode then the colors are then applied. – Tahir Hassan Feb 6 at 16:59
  • @NickD yes- as my post explains. M-X org-mode produces the colors and everything works fine. It's just that I'd like to have the colors render when I open my file – treefiddy Feb 7 at 2:16
  • So do you have an entry for Org mode files in your auto-mode-alist? – NickD Feb 7 at 13:39
0

I have a simple work-around that runs org-mode when an *.org is opened. It uses the information found in https://emacs.stackexchange.com/a/12401

Though I don't believe this is a good fix as there must be something not right that the colors are not being applied. Anyhow, I added this to my init.el:

(add-hook 'find-file-hook 'my-org-mode-file-hook)
(defun my-org-mode-file-hook ()
  (when (string= (file-name-extension buffer-file-name) "org")
    (org-mode)))
3
  • 1
    As the details in my post explains, I am indeed in "org-mode" when I open my files. it's just that the colors are not rendering. Also, there is a much more elegant way to reproduce what you're trying to do via: (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) – treefiddy Feb 7 at 2:13
  • Yeah, I have the exact same problem as you do, down to the message "Shell command succeeded with no output". Too, I am in "org-mode" when the file opens, but without any colors. This was my simple solution to not having to do M-x org-mode each time I open an org file. I'll probably monitor this question for a legit solution and will edit my answer pointing to the real solution once it appears. – Tahir Hassan Feb 7 at 8:13
  • @treefiddy I am also getting a "File exists but cannot be read" message when opening files from a network drive. But then it opens after about 5 seconds(!) – Tahir Hassan Feb 7 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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