* Add keywords in org comments
@ 2009-01-03 8:32 firebird
2009-01-03 11:41 ` Carsten Dominik
2009-01-03 16:59 ` Carsten Dominik
0 siblings, 2 replies; 4+ messages in thread
From: firebird @ 2009-01-03 8:32 UTC (permalink / raw)
To: emacs-orgmode
Dear all,
I have used org mode as agenda for several months and was really
impressed by its great features. Now, I want to port my notes from muse
mode to org mode, in which I recorded many emacs-lisp, c/c++, ruby
snippets.
In my color theme(color-theme-dark-laptop), the comments are red.
It's OK for coding, since comments are important and worth reading.
While in org mode, #+BEGIN_SRC/#+END_SRC are only code block indicators
and not worth reading. I wish they could be in dim colors and don't
pain my eyes. (In fact, I wish the whole embedded code block could be in
a dim color if it's possible.) However, I don't want to change all
comments in org mode, because I want others of them, such as #+TITLE, in
a bright color.
I used to add some keywords in emacs lisp mode with following codes.
They works.
(font-lock-add-keywords
'emacs-lisp-mode
'((";" ("\\<\\(GM\\|NB\\|TODO\\|FIXME\\)\\>" nil nil
(0 'font-lock-warning-face t)))))
But I cannot change face of #+BEGIN_SRC/#+END_SRC with following
codes. If the first character # is in the column 0,
#+BEGIN_SRC/#+END_SRC is displayed in the default face,
font-lock-comment-face, not my org-embedded-code-face.
(defface org-embedded-code-face
'((t (:foreground "grey40")))
"Used in org-mode to indicate code block.")
(font-lock-add-keywords
'org-mode
'(("#\\+BEGIN_SRC.*$" . 'org-embedded-code-face)
("#\\+END_SRC" . 'org-embedded-code-face)))
I'm not good at emacs lisp, so I couldn't find why similar codes don't
work in org mode. Any suggestion and help are appreciated.
BTW, any body could tell me how to use `|' in a org table cell? I'm
sure it has been asked, but I couldn't find the answer in this maillist
and org faq. Thank you in advance.
-- Best Regards,
firebird
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Add keywords in org comments
2009-01-03 8:32 Add keywords in org comments firebird
@ 2009-01-03 11:41 ` Carsten Dominik
2009-01-03 16:59 ` Carsten Dominik
1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-01-03 11:41 UTC (permalink / raw)
To: firebird; +Cc: emacs-orgmode
Hi firebird,
You may want to take a look at org-mtags.el in the contrib/lisp
directory (part of the org-mode distributions, but not in Emacs).
It allows you to use a Muse-like syntax for embedded code
and many other muse constructs, for example
<src lang="emacs-lisp">
...
</src>
The tags will actually be in shadow font like in Muse.
With (require 'org-mtags), very little should be required
when moving muse data to Org.
I would like to give a fixed font to the examples as well,
but I have not been able to figure out how to fontify
large multiline chunks reliably. I know that Muse does it,
but John Wiegley is still a hell of a smart guy...
I don't know why font-lock-add-keywords doe not work, it should.
I will take a look later.
- Carsten
On Jan 3, 2009, at 9:32 AM, firebird wrote:
> Dear all,
>
> I have used org mode as agenda for several months and was really
> impressed by its great features. Now, I want to port my notes from
> muse
> mode to org mode, in which I recorded many emacs-lisp, c/c++, ruby
> snippets.
>
> In my color theme(color-theme-dark-laptop), the comments are red.
> It's OK for coding, since comments are important and worth reading.
> While in org mode, #+BEGIN_SRC/#+END_SRC are only code block
> indicators
> and not worth reading. I wish they could be in dim colors and don't
> pain my eyes. (In fact, I wish the whole embedded code block could
> be in
> a dim color if it's possible.) However, I don't want to change all
> comments in org mode, because I want others of them, such as #
> +TITLE, in
> a bright color.
>
> I used to add some keywords in emacs lisp mode with following codes.
> They works.
>
> (font-lock-add-keywords
> 'emacs-lisp-mode
> '((";" ("\\<\\(GM\\|NB\\|TODO\\|FIXME\\)\\>" nil nil
> (0 'font-lock-warning-face t)))))
>
> But I cannot change face of #+BEGIN_SRC/#+END_SRC with following
> codes. If the first character # is in the column 0,
> #+BEGIN_SRC/#+END_SRC is displayed in the default face,
> font-lock-comment-face, not my org-embedded-code-face.
>
> (defface org-embedded-code-face
> '((t (:foreground "grey40")))
> "Used in org-mode to indicate code block.")
>
> (font-lock-add-keywords
> 'org-mode
> '(("#\\+BEGIN_SRC.*$" . 'org-embedded-code-face)
> ("#\\+END_SRC" . 'org-embedded-code-face)))
>
> I'm not good at emacs lisp, so I couldn't find why similar codes
> don't
> work in org mode. Any suggestion and help are appreciated.
>
> BTW, any body could tell me how to use `|' in a org table cell? I'm
> sure it has been asked, but I couldn't find the answer in this
> maillist
> and org faq. Thank you in advance.
>
> -- Best Regards,
>
> firebird
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 4+ messages in thread
* Re: Add keywords in org comments
2009-01-03 8:32 Add keywords in org comments firebird
2009-01-03 11:41 ` Carsten Dominik
@ 2009-01-03 16:59 ` Carsten Dominik
2009-01-04 1:49 ` firebird
1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2009-01-03 16:59 UTC (permalink / raw)
To: firebird; +Cc: emacs-orgmode
On Jan 3, 2009, at 9:32 AM, firebird wrote:
>
> But I cannot change face of #+BEGIN_SRC/#+END_SRC with following
> codes. If the first character # is in the column 0,
> #+BEGIN_SRC/#+END_SRC is displayed in the default face,
> font-lock-comment-face, not my org-embedded-code-face.
>
> (defface org-embedded-code-face
> '((t (:foreground "grey40")))
> "Used in org-mode to indicate code block.")
>
> (font-lock-add-keywords
> 'org-mode
> '(("#\\+BEGIN_SRC.*$" . 'org-embedded-code-face)
> ("#\\+END_SRC" . 'org-embedded-code-face)))
>
> I'm not good at emacs lisp, so I couldn't find why similar codes
> don't
> work in org mode. Any suggestion and help are appreciated.
This does work for me:
(font-lock-add-keywords
'org-mode
'(("#\\+BEGIN_SRC.*$" (0 'org-embedded-code-face t))
("#\\+END_SRC" (0 'org-embedded-code-face t)))
t)
> BTW, any body could tell me how to use `|' in a org table cell? I'm
> sure it has been asked, but I couldn't find the answer in this
> maillist
> and org faq. Thank you in advance.
You may use \vert for this.
HTH
- Carsten
>
>
> -- Best Regards,
>
> firebird
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 4+ messages in thread
end of thread, other threads:[~2009-01-04 1:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03 8:32 Add keywords in org comments firebird
2009-01-03 11:41 ` Carsten Dominik
2009-01-03 16:59 ` Carsten Dominik
2009-01-04 1:49 ` firebird
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).