emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] [PATCH] Use new face org-caption for #+caption lines [9.6.21 ( @ /home/cassou/.emacs.d/lib/org/lisp/)]
@ 2024-03-10 13:18 Damien Cassou
  2024-03-12 13:16 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2024-03-10 13:18 UTC (permalink / raw)
  To: emacs-orgmode

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



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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-new-face-org-caption-for-caption-lines.patch --]
[-- Type: text/x-patch, Size: 1570 bytes --]

From 9535fa8c078ca5ecb583ec4862f84028de018ae9 Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-12 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-10 13:18 [BUG] [PATCH] Use new face org-caption for #+caption lines [9.6.21 ( @ /home/cassou/.emacs.d/lib/org/lisp/)] Damien Cassou
2024-03-12 13:16 ` Ihor Radchenko

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).