org: Fontify whole table rows with `org-table-row' face

* lisp/org-faces.el (org-table-row): New face.
* lisp/org.el (org-set-font-lock-defaults): Use ~org-table-row~ face
to fontify the whole table rows, including indentation and newlines.
* etc/ORG-NEWS (Org mode now fontifies whole table lines (including
newline) according to ~org-table~ face): Announce the change.
This commit is contained in:
Ihor Radchenko 2024-02-01 15:29:21 +01:00
parent 788af56753
commit 14acf626fe
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
3 changed files with 23 additions and 1 deletions

View File

@ -13,6 +13,23 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
* Version 9.7 (not released yet)
** Important announcements and breaking changes
*** Org mode now fontifies whole table lines (including newline) according to ~org-table~ face
Previously, leading indentation and trailing newline in table rows
were not fontified using ~org-table~ face. ~default~ face was used instead.
This made it impossible to scale line height when ~org-table~ face has
smaller height than default (Emacs calculates line height using the tallest face).
Now, new ~org-table-row~ face is used on the whole table row lines,
including indentation and the final newline. This face, by default,
inherits from ~org-table~ face.
If the new behavior is not desired, ~org-table-row~ face can be
changed to inherit from ~default~ face.
~org-table~ takes precedence over ~org-table-row~ for the parts of
table rows without indentation and newline.
*** =ox-latex=: ~org-latex-line-break-safe~ is deprecated
~org-latex-line-break-safe~ constant was previously introduced to deal

View File

@ -389,6 +389,10 @@ changes."
"Face used for tables."
:group 'org-faces)
(defface org-table-row '((t :inherit org-table))
"Face used to fontify whole table rows (including newlines and indentation)."
:group 'org-faces)
(defface org-table-header '((t :inherit org-table
:background "LightGray"
:foreground "Black"))

View File

@ -5849,7 +5849,8 @@ needs to be inserted at a specific position in the font-lock sequence.")
(2 (org-get-level-face 2))
(3 (org-get-level-face 3)))
;; Table lines
'("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
'("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)\n?"
(0 'org-table-row t)
(1 'org-table t))
;; Table internals
'("^[ \t]*|\\(?:.*?|\\)? *\\(:?=[^|\n]*\\)" (1 'org-formula t))