From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: Inline code block syntax highlighting absence Date: Sat, 27 Oct 2018 10:57:31 +0800 Message-ID: <87y3akp04k.fsf@gmail.com> References: <87k1m8q2sb.fsf@portable.galex-713.eu> <874ldct386.fsf@gmail.com> <87d0rzyer6.fsf@nicolasgoaziou.fr> <877ei6r7fh.fsf@gmail.com> <87ftwsg12n.fsf@nicolasgoaziou.fr> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGEnE-0005ak-9n for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 22:57:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGEnB-00061J-2O for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 22:57:40 -0400 Received: from [61.175.244.13] (port=33590 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGEnA-00060q-IT for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 22:57:36 -0400 In-reply-to: <87ftwsg12n.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: org-mode , "Garreau, Alexandre" Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> I did a search of "font-lock-add-keywords", "begin_src", "src_" etc in >> Org Mode source code, but have not found exact place where fontify >> function are. So I don't know where to modify the source code. Now I put >> my current config here: > > [...] > >> (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) > > The first thing is to define new faces, or re-use existing one, instead > of creating them ad-hoc. > > Then you need to create a function like `org-fontify-entities'. > > For example: > > --8<---------------cut here---------------start------------->8--- > (defun org-fontify-inline-code (limit) > (when (re-search-forward "src_..." limit t) > ;; here you need to make as sure as possible that you are really > ;; at some inline code. You cannot really parse inline source code > ;; or inline Babel calls with a regexp only. > (org-remove-flyspell-overlays-in beg end) > (add-text-properties beg end (list 'font-lock-fontified t 'face ...)) > t)) > --8<---------------cut here---------------end--------------->8--- > > You then register the function above in `org-set-font-lock-defaults. > > Do you want to implement this? > > Regards, I will take a try. Maybe later in few days. -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3