emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Philipp Kiefer <phil.kiefer@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: [Bug] 'org-font-lock-extra-keywords' appear next to the parent heading when its subtree is folded.
Date: Tue, 24 Jan 2023 18:37:48 +0100	[thread overview]
Message-ID: <6595faf6-08d8-bffc-de28-a46dc46923e3@gmail.com> (raw)
In-Reply-To: <875ycw5fpu.fsf@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 2258 bytes --]


On 24.01.2023 12:34, Ihor Radchenko wrote:
> Philipp Kiefer<phil.kiefer@gmail.com>  writes:
>
>> Org mode version 9.6.1, GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)
>>
>> Please see the two screenshots here for illustration:
>>
>> https://imgur.com/a/7EuUi0J  <https://imgur.com/a/7EuUi0J>
>>
>> (I'm assuming it's not a good idea - or not even possible - to send
>> e-mail attachments to the list?)
> Quite the opposite - attachments are preferred when they do not have
> large size. With attachments, the thread can be understood by the
> readers years later, when whichever image hosting you use dwindles.

Great, attaching the screenshots in question. Also attaching an .org 
file illustrating the previously reported bug plus another related (and 
more serious as it impedes org functionality) one.


>> This is the relevant code from my init.el that seems to be causing this
>> issue:
>>
>> (require 'org-habit nil t) ; relevant?
>> (defun org-add-my-extra-fonts ()
>>     "Add alert and overdue fonts."
>>     (add-to-list 'org-font-lock-extra-keywords
>> '("\\(³\\)\\([^\n\r\t]+\\)\\(³\\)" (1 '(face org-habit-alert-face
>> invisible nil)) (2 'org-habit-alert-face t) (3 '(face
>> org-habit-alert-face invisible nil))) t)
> You set 'invisible text property to nil, which tells Emacs - make the
> text visible. Emacs obeys.

Well, with Orgmode version 9.5, Emacs was never *this* obedient, i. e. 
this problem only began after I updated Orgmode to 9.6, which is why I 
considered it a bug in the first place. I am aware I have set the 
keywords to be visible but would not expect them to appear at the end of 
the parent heading for a folded subtree! (see the screenshots and the 
explanatory .org file). Showing them there does not make any sense in my 
opinion. I would expect Orgmode to hide these keywords when they are in 
a collapsed subtree, regardless of the 'invisible text' setting, which 
is how it was handled pre 9.6 unless I'm much mistaken.

The other bug illustrated in the .org file (also requiring specific 
settings, see the init.el section in the file) breaks 
'|org-previous-visible-heading' and probably some other upwards motion 
commands||in connection with parent items having  emphasis markers as 
well as subitems.
|

[-- Attachment #1.2: Type: text/html, Size: 3370 bytes --]

[-- Attachment #2: scr--c-Users-PK-Documents-Org-EL-13-org-23012023-223335.jpg --]
[-- Type: image/jpeg, Size: 9967 bytes --]

[-- Attachment #3: scr--c-Users-PK-Documents-Org-EL-13-org-23012023-223340.jpg --]
[-- Type: image/jpeg, Size: 4459 bytes --]

[-- Attachment #4: bugs illustrated and explained.org --]
[-- Type: text/plain, Size: 2407 bytes --]

* 
* Export options: (ignore - but necessary to show problem 1)
#+title: En-GK 12
#+options: ':t *:t -:t ::t <:t H:0 \n:nil ^:nil arch:headline
#+options: author:nil broken-links:nil c:nil creator:nil
#+options: d:(not "LOGBOOK") date:nil e:t email:nil f:nil inline:t num:0
#+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
#+options: timestamp:nil title:t toc:nil todo:nil |:nil html-postamble:nil
#+HTML_HEAD_EXTRA: <style>*{font-family: Garamond !important}</style>
#+HTML_HEAD_EXTRA: <style>*{font-size: medium;}</style>
#+EXCLUDE_TAGS: NE
;; [[https://www.w3schools.com/cssref/pr_font_font-size.asp][CSS font-size property]]* 
* 
* =problem 1: (repeatedly press C-c C-p starting at the bottom of the file until you get up here -> point jumps up towards 'Export options' before it reaches this line - or the line below. Seems to be caused by the emphasis used on this line plus the fact that this heading has subitems)=
** top child 1
* +top+
** top child 1
* 
* 
* 
* problem 2: the keywords appear at the end of the parent heading when the subtree is folded under the parent.
** ³one child with font lock extra keyword³
** @another child with further font lock extra keyword@
* 
* 
* 
* init.el code causing *problem 1*:
(setq org-emphasis-alist   
(quote (
("*" bold)
("/" org-verbatim)
; ("/" italic)
; ("_" underline)
("_" (:strike-through t))
("~" org-code)
; ("~" org-code verbatim)
("=" (:foreground "white" :background "dimgray"))
("+" (:foreground "white" :background "darkslateblue"))
; ("+" (:strike-through t))
)))
* 
* init.el code causing *problem 2*:

(defun org-add-my-extra-fonts ()
  "Add alert and overdue fonts."
  (add-to-list 'org-font-lock-extra-keywords '("\\(³\\)\\([^\n\r\t]+\\)\\(³\\)" (1 '(face org-habit-alert-face invisible nil)) (2 'org-habit-alert-face t) (3 '(face org-habit-alert-face invisible nil))) t)
  (add-to-list 'org-font-lock-extra-keywords '("\\(§\\)\\([^\n\r\t]+\\)\\(§\\)" (1 '(face org-habit-overdue-face invisible nil)) (2 'org-habit-overdue-face t) (3 '(face org-habit-overdue-face invisible nil))) t)
  (add-to-list 'org-font-lock-extra-keywords '("\\(@\\)\\([^\n\r\t]+\\)\\(@\\)" (1 '(face org-habit-clear-face invisible nil)) (2 'org-habit-clear-face t) (3 '(face org-habit-clear-face invisible nil))) t))
(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-fonts)
* 
* 

  reply	other threads:[~2023-01-24 17:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 21:58 [Bug] 'org-font-lock-extra-keywords' appear next to the parent heading when its subtree is folded Philipp Kiefer
2023-01-24  3:52 ` Ruijie Yu via General discussions about Org-mode.
2023-01-24 11:36   ` Ihor Radchenko
2023-01-24 14:13   ` Philipp Kiefer
2023-01-24 11:34 ` Ihor Radchenko
2023-01-24 17:37   ` Philipp Kiefer [this message]
2023-01-24 17:56     ` Ihor Radchenko
2023-01-25 10:37       ` Philipp Kiefer
2023-01-24 18:07     ` Ihor Radchenko
     [not found]       ` <29a87ef7-c094-8885-6ae6-2548563c7583@gmail.com>
     [not found]         ` <78025786-639a-9ddd-bd7c-400f5e84da53@gmail.com>
     [not found]           ` <87y1ppwt9v.fsf@localhost>
2023-02-16 21:26             ` Philipp Kiefer
2023-02-17 12:01               ` Ihor Radchenko
2023-02-17 17:55                 ` Philipp Kiefer
2023-02-17 18:25                   ` Ihor Radchenko
2023-02-17 20:11                     ` Philipp Kiefer
2023-02-18 10:41                       ` Ihor Radchenko
2023-02-18 11:20                         ` Philipp Kiefer

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6595faf6-08d8-bffc-de28-a46dc46923e3@gmail.com \
    --to=phil.kiefer@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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/org-mode.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).