all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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/)]
@ 2019-04-14 11:54 Kévin Le Gouguec
  2019-04-27 16:55 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Kévin Le Gouguec @ 2019-04-14 11:54 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

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).

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-do-emphasis-faces.patch --]
[-- Type: text/x-diff, Size: 573 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 7735 bytes --]


C-u C-x = 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…

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… 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évin



[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.11)
 of 2019-04-13
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/27.0.50/lisp/org/)

current state:
==============
(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)
 )

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-28 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-14 11:54 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/)] Kévin Le Gouguec
2019-04-27 16:55 ` Nicolas Goaziou
2019-04-28 16:31   ` Kévin Le Gouguec

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.