emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Help: how to extend org-mode markup?


From: Pierre-Henry F.
Subject: Re: Help: how to extend org-mode markup?
Date: Fri, 25 Sep 2020 09:52:59 +0000

Well, this works!
Thank you all!

    (defun user-custom-keywords ()
      ;; M-x list-faces-display
      (let ((user-custom-keywords
              '((":next:" . 'org-habit-clear-face)
                 (":wait:" . 'org-habit-alert-face)
                 (":failed:" . 'org-habit-overdue-face)
                 (":success:" . 'org-habit-ready-face)
                 (":unscheduled:" . 'avy-lead-face-0))))

        (dolist (elt user-custom-keywords)
          (let ((regex (car elt))
                 (face (cdr elt)))
            (font-lock-add-keywords
              nil
              `((,regex 0 ,face t))
              'append)))))


Cordialement,
Pierre-Henry FRÖHRING
+33 6 34 48 17 57
contact@phfrohring.com
Skype: pierre.henry.frohring

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, September 25, 2020 10:31 AM, Pierre-Henry F. 
<contact@phfrohring.com> wrote:

> Thank you Ihor,
>
> It does work... too good now :-)
>
> all the other faces are gone
>
> Well, OK...
>
> I will check that an other time.
>
> Thank you all for your replies !
>
> PHF
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Friday, September 25, 2020 10:13 AM, Ihor Radchenko yantar92@gmail.com 
> wrote:
>
> > > As suggested by Ihor, I tried:
> >
> > > (font-lock-add-keywords 'org-mode
> > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
> >
> > You need to fontify itafter all other org-mode font settings:
> > (font-lock-add-keywords 'org-mode
> > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append))
> > Best,
> > Ihor
> > "Pierre-Henry F." contact@phfrohring.com writes:
> >
> > > Thank you very much for your replies.
> > > Here is the use case:
> > > |-----------+--------|
> > > | something | :next: |
> > > |-----------+--------|
> > > I would like :next: to show up using an arbitrary face.
> > > As suggested by Ihor, I tried:
> > > (font-lock-add-keywords 'org-mode
> > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend)))
> > > in my init.el
> > > It does not work either.
> > > @Christian yes, it's the same syntax as tags, I would like to extend it 
> > > eventually.
> > > Thanks,
> > > PHF
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > > On Friday, September 25, 2020 9:26 AM, Ihor Radchenko yantar92@gmail.com 
> > > wrote:
> > >
> > > > > (add-to-list 'org-font-lock-extra-keywords
> > > >
> > > > It is internal variable. You should not use it.
> > > > Simply use font-lock-add-keywords instead.
> > > > Best,
> > > > Ihor
> > > > "Pierre-Henry F." contact@phfrohring.com writes:
> > > >
> > > > > Hello,
> > > > > I would like to extend the org-mode markup.
> > > > > For example, I would like to change the face of a keyword, say: 
> > > > > :next: .
> > > > > Whenever :next: is displayed from an org-mode buffer, it should show 
> > > > > up in using an arbitrary face.
> > > > > I tried this:
> > > > > (defun org-add-my-extra-markup ()
> > > > > (add-to-list 'org-font-lock-extra-keywords
> > > > > '("[^\\w]\\(:next:\\)[^\\w]"
> > > > > (1 font-lock-warning-face t))))
> > > > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)
> > > > > But it does not work.
> > > > > So: how to extend org-mode markup?
> > > > > Many thanks,
> > > > > PHF





reply via email to

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