From: "Mattias Engdegård" <mattiase@acm.org>
To: 50041@debbugs.gnu.org
Subject: bug#50041: Add font-lock-doc-markup-face
Date: Fri, 13 Aug 2021 12:53:04 +0200 [thread overview]
Message-ID: <EA330445-BA21-4C4C-AFF7-020C2ACEE212@acm.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]
Add a standard face for mark-up syntax and keywords inside code documentation (doc comments/strings) whose body text is typically set in font-lock-doc-face. This could include various tags, brackets, quotes, keywords or other syntactically special characters.
Justification:
- A standard face means that users and theme authors can set it once for all modes needing it.
- Having a face that harmonises with font-lock-doc-face reduces the risk of bad ergonomics and aesthetics.
- Setting doc mark-up in a distinct face makes in-source documentation more readable.
- It also aids writing documentation by providing feed-back to the programmer in the same way as fontifying regular language constructs.
The CC modes have the foresight of already using `font-lock-doc-markup-face` if defined, anticipating its eventual addition, defaulting to `font-lock-constant-face`. I therefore propose that the new face will inherit from `font-lock-constant-face` by default.
Proposed patch attached.
[-- Attachment #2: 0001-Add-font-lock-doc-markup-face.patch --]
[-- Type: application/octet-stream, Size: 3863 bytes --]
From 6265617a428a60db9ca932a2bff33c70a94a9bc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Fri, 13 Aug 2021 12:47:39 +0200
Subject: [PATCH] Add font-lock-doc-markup-face
This face is intended for mark-up syntax and constructs inside text
using font-lock-doc-face; ie, documentation comments and strings.
* lisp/font-lock.el (font-lock-doc-markup-face): New face and variable.
* lisp/cus-theme.el (custom-theme--listed-faces): Add it to the list.
* doc/lispref/modes.texi (Faces for Font Lock): Document it.
* etc/NEWS: Mention it.
---
doc/lispref/modes.texi | 5 +++++
etc/NEWS | 7 +++++++
lisp/cus-theme.el | 2 +-
lisp/font-lock.el | 8 ++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index d48c9cc1af..7a651b6390 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3447,6 +3447,11 @@ Faces for Font Lock
for documentation strings in the code. This inherits, by default, from
@code{font-lock-string-face}.
+@item font-lock-doc-markup-face
+@vindex font-lock-doc-markup-face
+for mark-up constructs in text using @code{font-lock-doc-face}.
+This inherits, by default, from @code{font-lock-constant-face}.
+
@item font-lock-negation-char-face
@vindex font-lock-negation-char-face
for easily-overlooked negation characters.
diff --git a/etc/NEWS b/etc/NEWS
index 26ede71523..6fce7c6a43 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -149,6 +149,13 @@ invoked with the '--declarations' command-line option.
** New command 'font-lock-update', bound to 'C-x x f'.
This command updates the syntax highlighting in this buffer.
++++
+** A new standard face 'font-lock-doc-markup-face'.
+Intended for documentation mark-up syntax and tags inside text that
+uses 'font-lock-doc-face'. This would typically be used in
+documentation comments for systems such as Doxygen, Haddock, Javadoc etc.
+By default this face inherits from 'font-lock-constant-face'.
+
** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA.
+++
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index f4885d0f52..7457d9e323 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -66,7 +66,7 @@ custom-theme--listed-faces
shadow secondary-selection trailing-whitespace
font-lock-builtin-face font-lock-comment-delimiter-face
font-lock-comment-face font-lock-constant-face
- font-lock-doc-face font-lock-function-name-face
+ font-lock-doc-face font-lock-doc-markup-face font-lock-function-name-face
font-lock-keyword-face font-lock-negation-char-face
font-lock-preprocessor-face font-lock-regexp-grouping-backslash
font-lock-regexp-grouping-construct font-lock-string-face
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 4dc42d9cf6..32b7819533 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -312,6 +312,9 @@ font-lock-string-face
(defvar font-lock-doc-face 'font-lock-doc-face
"Face name to use for documentation.")
+(defvar font-lock-doc-markup-face 'font-lock-doc-markup-face
+ "Face name to use for documentation mark-up.")
+
(defvar font-lock-keyword-face 'font-lock-keyword-face
"Face name to use for keywords.")
@@ -2006,6 +2009,11 @@ font-lock-doc-face
"Font Lock mode face used to highlight documentation."
:group 'font-lock-faces)
+(defface font-lock-doc-markup-face
+ '((t :inherit font-lock-constant-face))
+ "Font Lock mode face used to highlight documentation mark-up."
+ :group 'font-lock-faces)
+
(defface font-lock-keyword-face
'((((class grayscale) (background light)) :foreground "LightGray" :weight bold)
(((class grayscale) (background dark)) :foreground "DimGray" :weight bold)
--
2.21.1 (Apple Git-122.3)
next reply other threads:[~2021-08-13 10:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-13 10:53 Mattias Engdegård [this message]
2021-08-13 12:15 ` bug#50041: Add font-lock-doc-markup-face Lars Ingebrigtsen
2021-08-13 13:08 ` Eli Zaretskii
2021-08-13 14:08 ` Mattias Engdegård
2021-08-13 14:12 ` Eli Zaretskii
2021-08-13 14:34 ` Mattias Engdegård
2021-08-13 15:57 ` Eli Zaretskii
2021-08-13 17:41 ` Mattias Engdegård
2021-08-13 18:31 ` Eli Zaretskii
2021-08-13 21:24 ` Mattias Engdegård
2021-08-14 5:56 ` Eli Zaretskii
2021-08-14 9:01 ` Mattias Engdegård
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EA330445-BA21-4C4C-AFF7-020C2ACEE212@acm.org \
--to=mattiase@acm.org \
--cc=50041@debbugs.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.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).