emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Timothy <tecosaur@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] Add font-lock rule for inline export snippets
Date: Wed, 31 Mar 2021 23:57:49 +0800	[thread overview]
Message-ID: <87im57fh8j.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Add-font-lock-rule-for-inline-export-snippets.patch --]
[-- Type: text/x-patch, Size: 942 bytes --]

From 3584602f88381ab9624c767a83c18cfd93ffeaf0 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
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


             reply	other threads:[~2021-03-31 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 15:57 Timothy [this message]
2021-04-28  7:23 ` [PATCH] Add font-lock rule for inline export snippets Timothy
2021-05-01 10:02 ` Bastien

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=87im57fh8j.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).