From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Subject: Bug: Strike-through messes with heading face [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/27.0.50/lisp/org/)] Date: Sun, 14 Apr 2019 13:54:01 +0200 Message-ID: <87r2a4ztt2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:54183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFdoG-0002Th-IZ for emacs-orgmode@gnu.org; Sun, 14 Apr 2019 08:00:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFdi2-000398-J4 for emacs-orgmode@gnu.org; Sun, 14 Apr 2019 07:54:08 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:53615) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFdi1-00037c-Vi for emacs-orgmode@gnu.org; Sun, 14 Apr 2019 07:54:06 -0400 Received: by mail-wm1-x332.google.com with SMTP id q16so16889646wmj.3 for ; Sun, 14 Apr 2019 04:54:05 -0700 (PDT) Received: from nc10-laptop (2a01cb04010fc800083de311af8cbc61.ipv6.abo.wanadoo.fr. [2a01:cb04:10f:c800:83d:e311:af8c:bc61]) by smtp.gmail.com with ESMTPSA id a4sm29529522wmf.45.2019.04.14.04.54.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 04:54:02 -0700 (PDT) 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.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, Unless I am mistaken, +strike-through+ markers in headings cause the heading face to disappear. To reproduce, in an Org buffer, add the following heading: * foo *bar* /baz/ _quux_ +corge+ Testing this with emacs -Q, on commit f9694a7 of the master branch, bar (resp. baz and quux) displays the org-level-1 face as well as the bold (resp. italics and underlined) decoration, but not corge: the latter only shows the strike-through decoration, not the header face. I poked at org-do-emphasis-faces with the silly patch attached, and the issue went away (corge shows both the header face and the strike-through decoration). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org-do-emphasis-faces.patch diff --git a/lisp/org.el b/lisp/org.el index b5b9798ad..94713a7e5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5064,7 +5064,7 @@ stacked delimiters is N. Escaping delimiters is not possible." (not (and (save-match-data (org-match-line "[ \t]*|")) (string-match-p "|" (match-string 4)))))) (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist))) - (font-lock-prepend-text-property + (font-lock-append-text-property (match-beginning 2) (match-end 2) 'face face) (when verbatim? (org-remove-flyspell-overlays-in --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable C-u C-x =3D on corge says this before my change: face (:strike-through t org-level-1) With the patch, this becomes: face (org-level-1 :strike-through t) tl;dr: I have no idea=E2=80=A6 1. whether this patch is correct, 2. what undesirable side-effects it may have, 3. how to write a test for this issue. In more details: 1. whether this patch is correct: (elisp) Special Properties says that the'face property can be many things; I guess in this situation, the relevant "thing" is this one: > A list of faces. Each list element should be either a face name > or an anonymous face. This specifies a face which is an > aggregate of the attributes of each of the listed faces. Faces > occurring earlier in the list have higher priority. Nothing in this paragraph suggests that ":striketrough t" should prevent org-level-1's face attributes (e.g. foreground) from showing up=E2=80=A6 unless anonymous faces implicitly contain ":attribute nil" for every unspecified attribute?[1] 2. what undesirable side-effects it may have: I tried running the Org test suite (on commit 3375f039d) to check for regressions, but a cursory glance at the results does not help much[2]. I'll have to dig deeper later. 3. how to write a test for this issue: asserting whether the face text property contains the correct attributes is not useful, since this assertion is true regardless of whether these attributes are actually displayed to the user; I could check the *order* of the attributes, but I am still not convinced that this order should matter. I am not sure of what the next steps should be. I hope I did not miss clues in the documentation; if there is indeed an issue, I don't know if the patch should be applied as-is, if a more robust patch could be crafted, or if this should be turned into a core-Emacs issue. Thanks in advance for your advice. K=C3=A9vin [1]: FWIW, I played with add-text-properties to try to pinpoint the problem, which does not seem to be specific to Org: - C-x b anewbuffer RET - insert some text - M-: (add-text-properties 1 3 '(face '(org-level-1 :strike-through t))) RET - the text shows both the org-level-1 foreground and the strike-through decoration - M-< C-o - insert some text - M-: (add-text-properties 1 3 '(face '(:strike-through t org-level-1))) RET - the text only shows the strike-through decoration [2]: I ran "make test" after adding my changes and got 3 failures: > 3 unexpected results: > FAILED ob-tangle/jump-to-org > FAILED test-ob-shell/session > FAILED test-org-src/coderef-format After reverting my changes, I got 6 failures: > 6 unexpected results: > FAILED ob-emacs-lisp/dynamic-lexical-edit > FAILED ob-tangle/jump-to-org > FAILED test-ob-shell/session > FAILED test-org-src/coderef-format > FAILED test-org-src/indented-blocks > FAILED test-org/comment-dwim Applying my changes again, I got 6 failures. Five of them match the ones from the previous run; one failure went away and a new one appeared: > 6 unexpected results: > FAILED ob-emacs-lisp/dynamic-lexical-edit > FAILED ob-tangle/jump-to-org > FAILED test-ob-shell/session > FAILED test-org-src/coderef-format > FAILED test-org-src/indented-blocks > FAILED test-org/indent-region I can't really conclude from these results; I will have to look at each test case individually at some point. Emacs : GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.22.1= 1) of 2019-04-13 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/shar= e/emacs/27.0.50/lisp/org/) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq org-after-todo-state-change-hook '(org-clock-out-if-current) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-archive-hook '(org-attach-archive-delete-maybe) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-startup-indented t org-occur-hook '(org-first-headline-recenter) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300.\236A\207" [:title] 3 "\n\= n(fn ENTRY)"] org-confirm-shell-link-function 'yes-or-no-p org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-parameters '(("id" :follow org-id-open) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs") ("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link) ("file" :complete org-file-complete-link) ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path))) ) ("help" :follow org--open-help-link) ("http" :follow (lambda (path) (browse-url (concat "http:" path))) ) ("https" :follow (lambda (path) (browse-url (concat "https:" path))) ) ("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path))) ) ("news" :follow (lambda (path) (browse-url (concat "news:" path))) ) ("shell" :follow org--open-shell-link)) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-elisp-link-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) ) --=-=-=--