1

I am trying to use the enriched-mode for my personal documentation. I would like to colorize specific sections of my text for clarity. I can successfully do it with Edit/Text Properties/Foreground Color. The saved files seam to contain the right tags etc. but the colors do not show up by reloading the file. Other features like italic/bold/etc. work fine. I cannot figure out why and how to solve this. The original emacs buffer : "bold" is ... in bold font and "yellow" is yellow

standard
bold
yellow
end

The content of the file:

Content-Type: text/enriched
Text-Width: 98

standard

<bold>bold

</bold><x-color><param>yellow</param>yellow</x-color>

end

When reloading, only the "bold" line has the right face, the color is gone.

4
  • Are you using a theme for Emacs? I know one of the themes I use doesn't allow for bold fonts, so they do not show up with enriched text. Also check the variable enriched-translations, since the docs say "Enriched mode does not save all Emacs text properties, only those specified in the variable enriched-translations. These include properties for fonts, colors, indentation, and justification." Commented Aug 10, 2018 at 20:17
  • No, I just tried the enriched mode. The colors are actually saved in the file but do not get restored when re-reading.
    – Pierre
    Commented Aug 11, 2018 at 22:33
  • It is hard to see what is happening without having more information about what you have in your file. Colors work fine for me. I suggest you edit your question to add the text you are having trouble with. Additionally, read this page and follow the example: emacswiki.org/emacs/EnrichedMode Commented Aug 12, 2018 at 15:16
  • Thank you Ghuilherme. I have updated my post. Hope it is understandable. Th e example in your link says nothing about colors.
    – Pierre
    Commented Aug 13, 2018 at 16:20

2 Answers 2

2

your example works fine for me with Emacs version 26.1. I'll tell you what I did and try to follow along.

C-x C-f a new file, say test.txt, and copy the contents below into it:

Content-Type: text/enriched
Text-Width: 98

standard

<bold>bold

</bold><x-color><param>yellow</param>yellow</x-color>

end

Then do M-x enriched-mode and C-x C-s to save the file. Then C-x C-v RET to reload the test.txt file, and it should show you this: enter image description here

Now, I've noticed that depending on the theme the bold face may be hardly noticeable, and, if you are on a Mac, that it works better on some versions of Emacs than others (better in Macports version, for example).

If it is not working for you, maybe try dropping your init.el file, if you have one, or try another Emacs version.

4
  • Thank you for your time, Guilherme. No way, I cannot get the color to work. I am using Emacs 25.2.2 on Ubuntu 18.04. I have tried dropping my .emacs config file which contains a few personal staff but no change. Anyway, I think I will switch to the org-mode that offers a lot of nice features and forget about the enriched-mode. Thanks again.
    – Pierre
    Commented Aug 14, 2018 at 19:07
  • 1
    @Pierre I don't personally use enriched-mode, and I think you can achieve most of what you need in orgmode. And, if you need colored text, you can export your files to html for example, or use the markups available in orgmode. Still, I find it weird that it is not working on your Emacs, try updating it to 26.1. Commented Aug 14, 2018 at 19:10
  • @GuilhermeSalomé Your suggestion to use Emacs 26.1 works for Eduardo as answer to his question. I transferred this important information from your comment to the answer. I hope the answer is correct in this form and you agree with the edit. I have marked the other question as duplicate of this one.
    – Tobias
    Commented Feb 25, 2019 at 16:12
  • @Tobias thanks for the edit, it's better now. Commented Feb 26, 2019 at 13:30
0

I know it might be an old question, but the lack of color might come from font lock mode. Try to disable it and check colors

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.