unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Sebastian Urban <mrsebastianurban@gmail.com>
Cc: 35481@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	[thread overview]
Message-ID: <87d0eeow6p.fsf@gnus.org> (raw)
In-Reply-To: <89093c47-6449-8518-1d77-d43ba9b68891@gmail.com> (Sebastian Urban's message of "Sun, 28 Apr 2019 23:31:27 +0200")

Sebastian Urban <mrsebastianurban@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





  parent reply	other threads:[~2019-10-30 19:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28 21:31 bug#35481: 25.2; table.el should use 'font-lock-face' instead of 'face' Sebastian Urban
2019-04-28 22:04 ` Noam Postavsky
2019-05-13  7:16   ` Sebastian Urban
2019-08-04 12:09   ` Sebastian Urban
2019-10-30 19:44 ` Lars Ingebrigtsen [this message]
2019-11-17  9:07   ` Lars Ingebrigtsen
2019-11-28 23:27   ` Noam Postavsky
2019-12-05  9:55     ` Lars Ingebrigtsen

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=87d0eeow6p.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=35481@debbugs.gnu.org \
    --cc=mrsebastianurban@gmail.com \
    /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).