emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edouard Debry <edouard.debry@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Samuel Wales <samologist@gmail.com>,
	 "DEBRY.Edouard" <edouard.debry@mbda-systems.com>,
	 emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Orgmode plain list bullet : change automatically with list depth
Date: Sun, 19 Jun 2022 16:49:24 +0200	[thread overview]
Message-ID: <86k09ck8sr.fsf@gmail.com> (raw)
In-Reply-To: <87y1xsoim6.fsf@localhost> (Ihor Radchenko's message of "Sun, 19 Jun 2022 22:03:45 +0800")


Thanks for your information complement. Indeed, I know too few about
emacs to guess that by myself.

And it works !

For anyone interested, here are the settings :

(font-lock-add-keywords 'org-mode
                        '(("^ *\\([-]\\) "
                           (0 (let* ((depth (org-list--depth (save-match-data (org-element-at-point))))
                                     (bullet (cond ((= depth 1) "●")
                                                   ((= depth 2) "◆")
                                                   ((= depth 3) "▪")
                                                   ((= depth 4) "▸")
                                                   ((= depth 5) "•")
                                                   ((= depth 6) "↪")
                                                   (t "↪"))))
                                (prog1 () (compose-region (match-beginning 1) (match-end 1) bullet)))))))

Many thanks for your help.

Regards

Ihor Radchenko <yantar92@gmail.com> writes:

> Edouard Debry <edouard.debry@gmail.com> writes:
>
>> The key point is the regexp. I do not know if it is possible to capture
>> the depth level with a regexp. That is why I tried to use
>> org-list--depth in :
>>
>> ...
>> but it seems that "org-element-at-point" messes things.
>
> Sorry, I though that I gave you enough information to fix the issue.
>
> Just wrap (org-element-at-point) into save-match-data:
> (save-match-data (org-element-at-point))
>
> That's it.
>
> P.S. I actually plan to fix `org-element-at-point' modifying match data
> (which is not documented), but it will probably be a part of a bigger
> font-lock-related patchset.
>
> Best,
> Ihor


  reply	other threads:[~2022-06-19 14:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 15:03 Orgmode plain list bullet : change automatically with list depth DEBRY.Edouard
2022-06-15  4:31 ` Ihor Radchenko
2022-06-16  9:14   ` DEBRY.Edouard
2022-06-16  9:59     ` Ihor Radchenko
2022-06-16 23:26   ` Samuel Wales
2022-06-16 23:27     ` Samuel Wales
2022-06-17 11:54     ` Ihor Radchenko
2022-06-17 23:27       ` Samuel Wales
2022-06-18  0:17         ` Tim Cross
2022-06-19 13:40           ` Edouard Debry
2022-06-19 22:50             ` Tim Cross
2022-06-19 13:55         ` Edouard Debry
2022-06-19 14:03           ` Ihor Radchenko
2022-06-19 14:49             ` Edouard Debry [this message]
2022-06-24 14:28               ` DEBRY.Edouard
2022-06-25  3:27                 ` Ihor Radchenko
2022-06-29 12:42                   ` DEBRY.Edouard

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=86k09ck8sr.fsf@gmail.com \
    --to=edouard.debry@gmail.com \
    --cc=edouard.debry@mbda-systems.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    --cc=yantar92@gmail.com \
    /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).