emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to set faces?
@ 2010-09-27 10:24 Uwe Brauer
  2010-09-28 16:10 ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2010-09-27 10:24 UTC (permalink / raw)
  To: emacs-orgmode


Hello 

The following setting works in lisp mode

  (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
    (setq lisp-font-lock-keywords-1
	  (append lisp-font-lock-keywords-1
		  (list (list lisp-regexp-4 0
			      'font-lock-log-warn-face t)))) 
    (setq lisp-font-lock-keywords-2
	  (append lisp-font-lock-keywords-2
		  (list (list lisp-regexp-4 0
			      'font-lock-log-warn-face t)))))

Every word surrounded by an * gets highlighted by the
font-lock-log-warn-face. 

I tried something similar for org-mode, like 

  (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
    (setq org-font-lock-keywords
	  (append lisp-font-lock-keywords-1
		  (list (list lisp-regexp-4 0
			      'font-lock-comment-warn-face t)))))


Or 

(add-to-list 'org-font-lock-keywords		
'(" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" 1 'font-lock-comment-warn-face append t))

But it does not work, 

Can somebody give me a hint please?

Uwe Brauer 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to set faces?
  2010-09-27 10:24 Uwe Brauer
@ 2010-09-28 16:10 ` Carsten Dominik
  2010-09-28 17:48   ` Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-09-28 16:10 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode


On Sep 27, 2010, at 12:24 PM, Uwe Brauer wrote:

>
> Hello
>
> The following setting works in lisp mode
>
> (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
>   (setq lisp-font-lock-keywords-1
> 	  (append lisp-font-lock-keywords-1
> 		  (list (list lisp-regexp-4 0
> 			      'font-lock-log-warn-face t))))
>   (setq lisp-font-lock-keywords-2
> 	  (append lisp-font-lock-keywords-2
> 		  (list (list lisp-regexp-4 0
> 			      'font-lock-log-warn-face t)))))
>
> Every word surrounded by an * gets highlighted by the
> font-lock-log-warn-face.
>
> I tried something similar for org-mode, like
>
> (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
>   (setq org-font-lock-keywords
> 	  (append lisp-font-lock-keywords-1


Typo

> 		  (list (list lisp-regexp-4 0
> 			      'font-lock-comment-warn-face t)))))
>
>
> Or
>
> (add-to-list 'org-font-lock-keywords		
> '(" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" 1 'font-lock-comment-warn-face  
> append t))

Org-mode sets org-font-lock-keywords while the mode is turned
on, locally in each org-mode buffer, because depending on setup,
the keywords can be different in different buffers.

Please take a look at the function org-set-font-lock-defaults,
and in particular use the hook org-font-lock-set-keywords-hook
in order to append your stuff to the variable
org-font-lock-keywords-extra (no, I do not know why
it is called extra - I must have had a reason for it once :-) )

HTH

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* how to set faces?
@ 2010-09-28 16:56 Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-09-28 16:56 UTC (permalink / raw)
  To: emacs-orgmode


Hello

The following setting works in lisp mode

  (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
    (setq lisp-font-lock-keywords-1
	  (append lisp-font-lock-keywords-1
		  (list (list lisp-regexp-4 0
			      'font-lock-log-warn-face t))))
    (setq lisp-font-lock-keywords-2
	  (append lisp-font-lock-keywords-2
		  (list (list lisp-regexp-4 0
			      'font-lock-log-warn-face t)))))

Every word surrounded by an * gets highlighted by the
font-lock-log-warn-face.

I tried something similar for org-mode, like

  (let ((lisp-regexp-4 " ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)"))
    (setq org-font-lock-keywords
	  (append lisp-font-lock-keywords-1

I guess this should be org-font-lock-keywords here?

		  (list (list lisp-regexp-4 0
			      'font-lock-comment-warn-face t)))))


Or

(add-to-list 'org-font-lock-keywords		
'(" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" 1 'font-lock-comment-warn-face  
append t))

But it does not work,

Can somebody give me a hint please?

Uwe Brauer


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to set faces?
  2010-09-28 16:10 ` Carsten Dominik
@ 2010-09-28 17:48   ` Uwe Brauer
  2010-09-28 17:53     ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2010-09-28 17:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

>>>>> On Tue, 28 Sep 2010 18:10:31 +0200, Carsten Dominik <carsten.dominik@gmail.com> wrote:

   > On Sep 27, 2010, at 12:24 PM, Uwe Brauer wrote:


   >> (list (list lisp-regexp-4 0
   >> 'font-lock-comment-warn-face t)))))
   >> 
   >> 
   >> Or
   >> 
   >> (add-to-list 'org-font-lock-keywords		
   >> '(" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" 1 'font-lock-comment-warn-face
   >> append t))

   > Org-mode sets org-font-lock-keywords while the mode is turned
   > on, locally in each org-mode buffer, because depending on setup,
   > the keywords can be different in different buffers.

   > Please take a look at the function org-set-font-lock-defaults,
I am using 6.34, this function is not documented.

   > and in particular use the hook org-font-lock-set-keywords-hook
does not exist 
   > in order to append your stuff to the variable
   > org-font-lock-keywords-extra (no, I do not know why
this neither.

So I must upgrade I presume?

Uwe 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to set faces?
  2010-09-28 17:48   ` Uwe Brauer
@ 2010-09-28 17:53     ` Carsten Dominik
  2010-09-28 20:12       ` Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-09-28 17:53 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode


On Sep 28, 2010, at 7:48 PM, Uwe Brauer wrote:

>>>>>> On Tue, 28 Sep 2010 18:10:31 +0200, Carsten Dominik <carsten.dominik@gmail.com 
>>>>>> > wrote:
>
>> On Sep 27, 2010, at 12:24 PM, Uwe Brauer wrote:
>
>
>>> (list (list lisp-regexp-4 0
>>> 'font-lock-comment-warn-face t)))))
>>>
>>>
>>> Or
>>>
>>> (add-to-list 'org-font-lock-keywords		
>>> '(" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" 1 'font-lock-comment-warn-face
>>> append t))
>
>> Org-mode sets org-font-lock-keywords while the mode is turned
>> on, locally in each org-mode buffer, because depending on setup,
>> the keywords can be different in different buffers.
>
>> Please take a look at the function org-set-font-lock-defaults,
> I am using 6.34, this function is not documented.
>
>> and in particular use the hook org-font-lock-set-keywords-hook
> does not exist
>> in order to append your stuff to the variable
>> org-font-lock-keywords-extra (no, I do not know why
> this neither.
>
> So I must upgrade I presume?

Or do something more clever, like finding another hook *maybe in font- 
lock
that runs at the right time.

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to set faces?
  2010-09-28 17:53     ` Carsten Dominik
@ 2010-09-28 20:12       ` Uwe Brauer
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Brauer @ 2010-09-28 20:12 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

>>>>> On Tue, 28 Sep 2010 19:53:36 +0200, Carsten Dominik <carsten.dominik@gmail.com> wrote:


   > Or do something more clever, like finding another hook
   > *maybe in font- lock that runs at the right time.
Well for the time being I would be even happy with an
interactive function which I call and turn font-lock-mode on
and off, so I tried 

(defun my-turn-on-or-font-org ()
(interactive)
(font-lock-add-keywords 'org-mode
  '((org-activate-links (0 font-lock-keyword-face))
    ("\\<TODO\\>" (0 font-lock-warning-face t))
    ("\\<DEADLINE\\>.*" (0 font-lock-warning-face t))
    ("\\<FIXME\\>" (0 font-lock-warning-face t))
    ("\\<NOEXPORT\\>" (0 font-lock-warning-face t))
   (" ?\\(\\%[a-zA-Z]*\\%\\)" (0 font-lock-comment-warn-face append t))
   (" ?\\(\\*[a-zA-Z]*\\*\\)" (0 font-lock-comment-warn-face append t))
    (" ?\\(\\<\\*[a-zA-Z]*\\*\\>\\)" (0 font-lock-comment-warn-face append t))
;; ("^[*]+ +\\<\\(DONE\\)\\>\\(.*\\)"
;;       (1 font-lock-type-face t) (2 font-lock-string-face t))
      )
  'append))


That is from some old version of org-mode, I think.  It does
not work, and if I understand you earlier messages correctly
the reason is that in the new version there are more
keywords such as
org-font-lock-keywords-extra


Suppose I download the newest org mode, how shall I modify
the above function in order to get it to work?

Uwe 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-28 20:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 16:56 how to set faces? Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2010-09-27 10:24 Uwe Brauer
2010-09-28 16:10 ` Carsten Dominik
2010-09-28 17:48   ` Uwe Brauer
2010-09-28 17:53     ` Carsten Dominik
2010-09-28 20:12       ` Uwe Brauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).