emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Clean up org-faces.el
Date: Sun, 08 Apr 2018 23:53:32 +0800	[thread overview]
Message-ID: <87fu45bsoz.fsf@gmail.com> (raw)
In-Reply-To: <871sfpg75y.fsf@gmx.us>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Add face for inline src: src_ruby{require 'library'}

Here is my custom face:

;; inline code face => src_ruby{require 'something'}
;;
;; (REGEXP . FACE)
;;     Highlight REGEXP with FACE
;; (REGEXP N FACE)
;;     Highlight group N in REGEXP with FACE
;; (REGEXP (N1 FACE1) (N2 FACE2) (N3 FACE3) …)
;;     Highlight group Ni in REGEXP with FACEi
;;
;; src_lang{code...}[:header arguments] / NOTE: override by `org-verbatim'.
;; result in following =[result]=

;; src_
(font-lock-add-keywords
 'org-mode
 '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\)\\({\\)\\([^}]*\\)\\(}\\)"
    (1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part
    (2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light gray"))) ; "lang" part.
    (3 '(:foreground "#555555" :height 0.7)) ; [:header arguments] part.
    (4 '(:foreground "#333333")) ; {
    (5 'org-code) ; "code..." part.
    (6 '(:foreground "#333333")) ; }
    ))
 'append)

;; src without arguments
(font-lock-add-keywords
 'org-mode
 '(("\\(src_\\)\\([^[{]+\\)\\({\\)\\([^}]*\\)\\(}\\)"
    (1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part
    (2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light gray"))) ; "lang" part.
    (3 '(:foreground "#333333")) ; {
    (4 'org-code) ; "code..." part.
    (5 '(:foreground "#333333")) ; }
    ))
 'append)

;; inline babel call
;; ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))\\[\\(.*\\)\\]"
    ;; "\\(call_\\)\\([^[(]*\\)\\([([][^)]*]\\)+"
    (1 '(:foreground "orange red" :height 0.6)) ; call_
    (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; <name>
    (3 '(:foreground "gray" :height 0.6)) ; [<inside header arguments>]
    (4 '(:foreground "cyan" :weight 'bold)) ; (<arguments>)
    (5 '(:foreground "gray" :height 0.6)) ; [<end header arguments>]
    ))
 'append)

;; call_<name>[<inside header arguments>](<arguments>)
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))"
    (1 '(:foreground "orange red" :height 0.6)) ; call_
    (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; <name>
    (3 '(:foreground "gray" :height 0.6)) ; [<inside header argument>]
    (4 '(:foreground "cyan" :weight 'bold)) ; (<arguments>)
    ))
 'append)

;; call_<name>(arguments)
(font-lock-add-keywords
 'org-mode
 '(("\\(call_\\)\\([^[(]*\\)\\((.*)\\)"
    (1 '(:foreground "orange red" :height 0.6)) ; call_
    (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; <name>
    (3 '(:foreground "cyan" :weight 'bold)) ; (<arguments>)
    ))
 'append)

- -- 
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrKOvwACgkQG13xyVro
msPuAwf/WNhzQi6UNCfO/Oeb6Mh5O+OwXK9wDU8rZI+pxN17XrBhGEqsLgDUO3RF
W/vmMs49a1C45Id5xlRZXiZ16oC6nuIWjP4W7syorf7WIZismk6AncsATin5DfiG
TzrmZ2jjpHhucr8kjbCji3r5/ch/JZUJ52MQVsmD4MqyG/RSVUknbDRJD0qWsaxJ
AComyyaNqQbtWPwi0s896RKa+aWPTXg62Yq26Z0k5ANwh022APRu/ona4FIVMmbN
fEGflIgfXmDPkqZg9O8v9WPVwq0ZhA4kc+3+Efkatwf9nmPW2BtHi2eTo/+c50Jh
WgwPhqMf7CYdUUEOaxx4UdqcDe1JUQ==
=bJNn
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2018-04-08 15:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 13:27 Clean up org-faces.el Rasmus
2018-04-08 14:03 ` Nicolas Goaziou
2018-04-08 14:54 ` Daniele Nicolodi
2018-04-08 17:33   ` Rasmus
2018-04-08 19:02     ` Daniele Nicolodi
2018-04-08 15:53 ` stardiviner [this message]
2018-04-08 17:34   ` Rasmus
2018-04-09  2:46     ` stardiviner
2018-04-08 19:08 ` Samuel Wales
2018-04-08 19:54   ` Diego Zamboni
2018-04-08 20:02     ` Samuel Wales
2018-04-08 20:21       ` Samuel Wales
2018-04-08 20:30         ` Diego Zamboni
2018-04-09  3:01         ` Vikas Rawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fu45bsoz.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).