From mboxrd@z Thu Jan 1 00:00:00 1970 From: D Subject: Re: Weird face behavior with org-hide-emphasis-markers enabled Date: Wed, 12 Feb 2020 23:47:28 +0100 Message-ID: <8f954105-a902-31b2-7871-c51faef3d7e7@posteo.net> References: <874kw63pkx.fsf@gnu.org> <7a6d6ae0-7fe2-702d-055b-b4c1eca93eda@posteo.net> <87tv3vpvm5.fsf@bzg.fr> <43dbb209-04b1-b3d8-369d-0c95739727f7@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47305) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j20n9-0001Bd-8a for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 17:47:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j20n8-0003LC-6t for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 17:47:35 -0500 Received: from mout02.posteo.de ([185.67.36.66]:38483) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j20n7-0003Ix-Mj for emacs-orgmode@gnu.org; Wed, 12 Feb 2020 17:47:34 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id DF9BE2400FB for ; Wed, 12 Feb 2020 23:47:31 +0100 (CET) In-Reply-To: <43dbb209-04b1-b3d8-369d-0c95739727f7@posteo.net> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Bastien , emacs-orgmode@gnu.org Hi, After some I found the culprit! The issue arises from org-do-emphasis-faces. The bug is caused by the line (font-lock-prepend-text-property (match-beginning 2) (match-end 2) 'face face) which makes the surrounding "~"s part of the box, combined with (add-text-properties (match-end 4) (match-beginning 5) '(invisible org-link)) setting them invisible. This appears to confuse Emacs. Anything along the lines of (let ((num (if org-hide-emphasis-markers 4 2))) (font-lock-prepend-text-property (match-beginning num) (match-end num) 'face face)) should fix the issue. To demonstrate the behavior, I created a MWE function reproducing the bug. (defun mwe (start end) "Reproduce a weird fontification behaviour cutting off boxes." (interactive "r") (font-lock-prepend-text-property start end 'face '(:box (:line-width 3 :color "grey"))) (add-text-properties (1- end) end '(invisible org-link))) Hope that is helpful, D.