Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Currently, the caption of a picture (here the text "Description of the
piture") has the face `org-block':

    #+CAPTION: Description of the picture.
    #+RESULTS:
    [[file:./picture.png]]

I don't see any reason for the caption to use the same face as code
inside blocks as captions are expected to be human-readable text.

Attached patch introduces a new `org-caption' face applied on captions.
For conservative reasons, the new face inherits from `org-block' but I
can change that if you want.

Best

Emacs  : GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
Package: Org mode version 9.6.21 ( @ /home/cassou/.emacs.d/lib/org/lisp/)
-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
>From 9535fa8c078ca5ecb583ec4862f84028de018ae9 Mon Sep 17 00:00:00 2001
From: Damien Cassou <dam...@cassou.me>
Date: Sun, 10 Mar 2024 14:11:43 +0100
Subject: [PATCH] Use new face org-caption for #+caption lines

* lisp/org-faces.el: Add face `org-caption'.
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Use `org-caption'
instead of `org-block' as face for #+caption content.
---
 lisp/org-faces.el | 5 +++++
 lisp/org.el       | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 0e20de51a..633d539db 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -454,6 +454,11 @@ (defface org-block `((t :inherit shadow
   :group 'org-faces
   :version "26.1")
 
+(defface org-caption '((t (:inherit org-block)))
+  "Face used for #+caption content."
+  :group 'org-faces
+  :version "30.1")
+
 (defface org-block-begin-line '((t (:inherit org-meta-line)))
   "Face used for the line delimiting the begin of source blocks."
   :group 'org-faces)
diff --git a/lisp/org.el b/lisp/org.el
index d7d6a98b1..e3e12095c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5592,7 +5592,7 @@ (defun org-fontify-meta-lines-and-blocks-1 (limit)
 	  (add-text-properties (line-beginning-position) (match-end 1)
 			       '(font-lock-fontified t face org-meta-line))
 	  (add-text-properties (match-end 0) (line-end-position)
-			       '(font-lock-fontified t face org-block))
+			       '(font-lock-fontified t face org-caption))
 	  t)
 	 ((member dc3 '(" " ""))
 	  ;; Just a comment, the plus was not there
-- 
2.43.2

Reply via email to