emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: emacs-orgmode@gnu.org
Subject: [BUG] [PATCH] Use new face org-caption for #+caption lines [9.6.21 ( @ /home/cassou/.emacs.d/lib/org/lisp/)]
Date: Sun, 10 Mar 2024 14:18:10 +0100	[thread overview]
Message-ID: <87le6q5ip9.fsf@cassou.me> (raw)

[-- 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


             reply	other threads:[~2024-03-10 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 13:18 Damien Cassou [this message]
2024-03-12 13:16 ` [BUG] [PATCH] Use new face org-caption for #+caption lines [9.6.21 ( @ /home/cassou/.emacs.d/lib/org/lisp/)] Ihor Radchenko

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=87le6q5ip9.fsf@cassou.me \
    --to=damien@cassou.me \
    --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).