emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Fontify text between quotes?


From: Will Pierce
Subject: Re: [O] Fontify text between quotes?
Date: Wed, 21 Nov 2018 14:50:37 -0600

Ahah! Thanks for the tip!

Added the following to my init:

;; use org-block face in verse/quote blocks
(setq org-fontify-quote-and-verse-blocks t)

;; use org-block for smart-quoted text
(defun my-org-smart-quote-fontify ()
  "Use org-block face for text between smart quotes."
  (font-lock-add-keywords nil
                          '(("“\\(.*?\\)”" . 'org-block))))
(add-hook 'org-mode-hook 'my-org-smart-quote-fontify)
;; (remove-hook 'org-mode-hook 'my-org-smart-quote-fontify)

It doesn't work across newlines, but that's alright for now.

On Wed, 21 Nov 2018 at 13:38, Jeremie Juste <address@hidden> wrote:
Hello,

You can in principle tap directly into font lock-mode.
For instance something like

 (add-hook 'org-mode-hook
           (lambda ()
             (font-lock-add-keywords nil
                                     '(("\\<\\(FIXME\\):" 1 'font-lock-warning-face prepend)
                                       ("\\<\\(and\\|or\\|not\\)\\>" .
                                        'font-lock-keyword-face)))))




would fontify [FIXME:], [and] [or] ,and [not], without the [], in org-mode, See the
doc of font-lock-add-keywords (just stole the code above from it)

I could not achieve what you want though. Don't have enough time and energy
to think about it now, and I'm very bad with regex. :-). But in
principle it should do the job,

Hope this helps,

Jeremie



> Hi all,
>
> I'd like to add a function that changes the face of any text in quotation
> marks. I looked a bit into adapting the existing org code for emphasis, but
> got bogged down. I'd like "text like this" to use the org-block face.
>
> Any help pointing me in the right direction on this would be much
> appreciated!
>
> –W

reply via email to

[Prev in Thread] Current Thread [Next in Thread]