0

I want to change the color and font style in my template. I use custom-set-variable and cannot set, for example, italic style

(custom-set-variables
 '(org-capture-templates
   (backquote
    (("d"
      "diary"
      entry
      (file+olp+datetree ,(concat org-directory "diary.org"))
      ,(propertize "* [%<%H:%M>] test %?" (quote face) (quote italic)))))))   

My goal is to get this: * [20:32] test
Org-capture works, but the font is not italic: * [20:32] test

UPD I missed an important part of my question. I need to change the styles just for the time mark. Is it possible to color this time mark as a timestamp?
enter image description here

  • What is your question? Do you want to italicize the time stamp, or color it, or both? – Tyler Dec 20 '18 at 14:39
  • I want both color and italics – dmin Dec 20 '18 at 16:37
  • Just in the capture template, or do you want the formatting to be permanent in your org file? – Tyler Dec 20 '18 at 17:05
  • Only for this “diary” template – dmin Dec 20 '18 at 17:35
1

I suspect that org-mode is only using the actual text of your template, and ignores the text properties. Properties are generally used for short-term formatting. Even if you add the italics property to your capture template, it won't persist between Emacs sessions.

org-mode does provide support for markup though, and that is persistent. The markup for italics is to wrap your text in / characters:

(custom-set-variables
 '(org-capture-templates
   (backquote
    (("d"
      "diary"
      entry
      (file+olp+datetree ,(concat org-directory "diary.org"))
      "* /[%<%H:%M>] test/ %?")))))

If you want to all of your org headlines (in capture buffers and elsewhere) to appear in italics, you can accomplish this by customizing the faces for headlines: M-x customize-face org-level-4 (and other numbers for headings of different levels).

  • Sorry, I missed an important part of my question. I need to stylize only part of the headline. I updated the question – dmin Dec 20 '18 at 0:11
  • so move the second / to just after the timestamp – Tyler Dec 20 '18 at 3:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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