Re: [PATCH] Add font-lock rule for inline export snippets
Hi Timothy, Timothy writes: > The latest in my visually-oriented (mostly) short patch series, adding > basic fontification to inline export snippets --- @@comment:these > things@@. Applied in master with commit eef9027c, thanks! I also added a note in etc/ORG-NEWS. -- Bastien
Re: [PATCH] Add font-lock rule for inline export snippets
Timothy writes: > Hello, > > The latest in my visually-oriented (mostly) short patch series, adding > basic fontification to inline export snippets --- @@comment:these things@@. > > I think fontification for stuff like this is nice because it visually > indicates to the user that they've written out an Org construct, and > haven't just mis-remembered / imagined some syntax. > > In future this could be extended to use native fontification for > recognised export formats (like src blocks do), but I think this is a > nice improvement over nothing. This addition to the font-lock regexps is quite simple, and doesn't contain anything fancy/expensive (like backtracking), so I don't expect there to be any performance concerns --- but it would be good to hear from others :) I considered limiting this to no-newlines, but https://orgmode.org/worg/dev/org-syntax.html says anything other than @@ is allowed. -- Timothy
[PATCH] Add font-lock rule for inline export snippets
Hello, The latest in my visually-oriented (mostly) short patch series, adding basic fontification to inline export snippets --- @@comment:these things@@. I think fontification for stuff like this is nice because it visually indicates to the user that they've written out an Org construct, and haven't just mis-remembered / imagined some syntax. In future this could be extended to use native fontification for recognised export formats (like src blocks do), but I think this is a nice improvement over nothing. -- Timothy >From 3584602f88381ab9624c767a83c18cfd93ffeaf0 Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 31 Mar 2021 23:47:58 +0800 Subject: [PATCH] org: Add font-lock rule for inline export snippets * lisp/org.el (org-set-font-lock-defaults): Add font-lock rule for inline export snippets. --- lisp/org.el | 5 + 1 file changed, 5 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index f4d069504..240f745c7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5719,6 +5719,11 @@ (defun org-set-font-lock-defaults () ;; Description list items '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)" 1 'org-list-dt prepend) + ;; Inline export snippets + '("\\(@@\\)\\([a-z-]+:\\).*?\\(@@\\)" + (1 'font-lock-comment-face t) + (2 'org-tag t) + (3 'font-lock-comment-face t)) ;; ARCHIVEd headings (list (concat org-outline-regexp-bol -- 2.30.1