Re: [BUG] org-fold :extend face backgrounds break with trailing newlines [9.7-pre (release_9.6.20-1267-gb0c3c9 @ /home/st/.config/emacs/.local/straight/build-30.0.50/org/)]

2024-03-12 Thread Ihor Radchenko
StrawberryTea  writes:

> I've noticed that when using the :extend face property with org-fold,
> the background color of the headline face will sometimes be left behind
> after unfolding a heading. I have finally determined that this is
> happening when the heading has a trailing newline and the heading is
> after the last non-whitespace character in the heading's body.
>
> Here is a minimal example to reproduce this issue from emacs -Q:

Thanks for reporting, but I am unable to reproduce the problem on my
side using the latest main. May you please provide more detailed
instruction about what exactly do I need fold/unfold to see the problem?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[BUG] org-fold :extend face backgrounds break with trailing newlines [9.7-pre (release_9.6.20-1267-gb0c3c9 @ /home/st/.config/emacs/.local/straight/build-30.0.50/org/)]

2024-03-09 Thread StrawberryTea


Hello Org mode developer,

I've noticed that when using the :extend face property with org-fold,
the background color of the headline face will sometimes be left behind
after unfolding a heading. I have finally determined that this is
happening when the heading has a trailing newline and the heading is
after the last non-whitespace character in the heading's body.

Here is a minimal example to reproduce this issue from emacs -Q:

(let ((default-directory (file-name-directory load-file-name)))
  (when (file-exists-p (expand-file-name "default.el" default-directory))
(load-file (expand-file-name "default.el" default-directory

(straight-use-package 'org)

(require 'org)
(load-theme 'leuven t)

(dolist (face '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5
org-level-6 org-level-7 org-level-8))
  (set-face-attribute face nil :extend t))

(setq org-fontify-whole-heading-line t)
(setq org-startup-folded t)

(defvar org-extend-faces-bug-4-file "/tmp/org-extend-faces-bug-4.org"
  "The file to be used for the bug demo.")

(with-temp-buffer
  (insert
   (string-join
'("* First heading"
  "Body text of the first heading"
  ""
  "* Second heading"
  "Body text of the second heading"
  "* Last heading"
  "Body text of the last heading")
"\n"))
  (write-file org-extend-faces-bug-4-file))

(find-file org-extend-faces-bug-4-file)

Sincerely,
StrawberryTea

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.18.0)
 of 2024-03-09
Package: Org mode version 9.7-pre (release_9.6.20-1267-gb0c3c9 @ 
/home/st/.config/emacs/.local/straight/build-30.0.50/org/)

current state:
==
(setq
 org-special-ctrl-a/e t
 org-yank-image-file-name-function 'org-yank-image-autogen-filename
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-clock-persist 'history
 org-indirect-buffer-display 'current-window
 org-preview-latex-image-directory 
"/home/st/.config/emacs/.local/cache/org/latex/"
 org-after-todo-state-change-hook '(parrot--todo-party)
 org-default-notes-file "/home/st/org/notes.org"
 org-directory "~/org/"
 org-list-demote-modify-bullet '(("+" . "-") ("-" . "+") ("*" . "+") ("1." . 
"a."))
 org-M-RET-may-split-line nil
 org-clock-in-resume t
 org-clock-out-remove-zero-time-clocks t
 org-roam-list-files-commands '(fd fdfind rg find)
 org-display-remote-inline-images 'download
 org-roam-db-node-include-function #[0 "\300\207" [t] 1]
 org-roam-log-setup-hook '(org-roam--register-completion-functions-h)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-archive-subtree-save-file-p t
 org-id-locations-file "/home/st/org/.orgids"
 org-ai-talk-say-words-per-minute 210
 org-agenda-finalize-hook '(+org-exclude-agenda-buffers-from-workspace-h 
+org-defer-mode-in-agenda-buffers-h)
 org-roam-preview-function 'org-roam-preview-default-function
 org-log-done 'time
 org-agenda-window-setup 'current-window
 org-file-apps '((remote . emacs) (auto-mode . emacs) (directory . emacs) 
("\\.mm\\'" . default) ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))
 org-mode-hook '(doom--setq-yas-triggers-in-field-for-org-mode-h 
turn-on-org-cdlatex er/add-org-mode-expansions
 +lookup--init-org-mode-handlers-h (closure (t) ( _) 
(add-hook 'before-save-hook 'org-encrypt-entries nil t))
 #[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-fold-show-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
 #[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2] beginend-org-mode
 #[0 "\303\302!\210\304\305\n\300\"\301\"\211\207"
   [nil ((eri/mark-inside-org-table-cell 
eri/mark-outside-org-table-cell)) eri/try-expand-list make-local-variable append
seq-difference]
   4]
 #[0 "\303\302!\210\304\305\n\300\"\301\"\211\207"
   [nil
(org-mark-subtree '(er/mark-org-element 
er/mark-org-element-parent) er/mark-org-code-block er/mark-sentence
 er/mark-paragraph)
eri/try-expand-list make-local-variable append 
seq-difference]
   4]
 iscroll-mode org-ai-mode locally-defer-font-lock 
org-appear-mode cae-unpackaged-org-fix-blank-lines-before-save
 org-cdlatex-mode doom-disable-show-paren-mode-h 
doom-disable-show-trailing-whitespace-h +org-make-last-point-visible-h
 evil-org-mode org-eldoc-load toc-org-enable 
embrace-org-mode-hook +corfu-add-cape-elisp-block-h
 (closure (t) ( _) (set (make-local-variable 'tab-width) 
8)))