GNU bug report logs - #35481
25.2; table.el should use 'font-lock-face' instead of 'face'

Previous Next

Package: emacs;

Reported by: Sebastian Urban <mrsebastianurban <at> gmail.com>

Date: Sun, 28 Apr 2019 21:32:02 UTC

Severity: minor

Tags: confirmed, easy, fixed, patch

Found in version 25.2

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Sebastian Urban <mrsebastianurban <at> gmail.com>
Cc: 35481 <at> debbugs.gnu.org
Subject: bug#35481: 25.2; table.el should use 'font-lock-face' instead of 'face'
Date: Wed, 30 Oct 2019 20:44:14 +0100
Sebastian Urban <mrsebastianurban <at> gmail.com> writes:

> In short "table.el" uses text property 'face' (table-cell) which causes
> losing of cell highlight when user switches from modes like "Text" or
> "Fundamental" to modes that use "Font lock", like "Outline".  Also when
> user switches back, 'face' is not applied immediately in every cell, but
> one by one, when cursor is moved from cell to cell.
>
> For both problems a solution seems to be an update to "table.el", which
> will change 'face' to 'font-lock-face'.
>
> If it helps, I found 4 places in code that probably need to be changed:
> - 'defface table-cell' at line 680,
> - 'defun table--put-cell-face-property' at line 5172,
> - 'defun table--remove-cell-properties' at line 5189,
> - 'defun table--update-cell-face' at line 5209.

The patch below does this, but I'm not sure it's right.  When we're
using font-lock-face instead of face, then things work as normal when
we're using global-font-lock-mode, but if that's off, then we won't get
any faces at all.

Which would be bad.

I grepped around, but other modes don't seem to care about that.  But I
guess it's somewhat unusual for a minor mode to do stuff like this?

I think putting both font-lock-face and face on the text would do the
trick here, but is that the way to go?

diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 839df035d2..92aaa46ad6 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -5151,7 +5151,7 @@ table--put-cell-indicator-property
 
 (defun table--put-cell-face-property (beg end &optional object)
   "Put cell face property."
-  (put-text-property beg end 'face 'table-cell object))
+  (put-text-property beg end 'font-lock-face 'table-cell object))
 
 (defun table--put-cell-keymap-property (beg end &optional object)
   "Put cell keymap property."
@@ -5178,7 +5178,7 @@ table--remove-cell-properties
 				   'table-cell nil
 				   'table-justify nil
 				   'table-valign nil
-				   'face nil
+				   'font-lock-face nil
 				   'rear-nonsticky nil
 				   'cursor-sensor-functions nil
 				   'keymap nil)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.