[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Orgmode plain list bullet : change automatically with list depth
From: |
DEBRY . Edouard |
Subject: |
Re: Orgmode plain list bullet : change automatically with list depth |
Date: |
Fri, 24 Jun 2022 14:28:54 +0000 |
The only trouble with this is that if I have a list with both numbers
and bullets :
1. first
- ssdsd
- mmdffff
2. second
if I perform Alt-leftarrow on mmdffff, this element is shift on the left
but then the whole list is turned into :
- first
- ssdsd
- mmdffff
- second
Is there a way to avoid that ?
Regards
Edouard Debry <edouard.debry@gmail.com> writes:
>
> 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
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
___________________________________________________________________________________________________________________________________
This email and any attachments are confidential to the intended recipient and
may also be privileged.
If you are not the intended recipient please delete it from your system and
notify the sender.
You should not copy it or use it for any purpose nor disclose or distribute its
contents to any other person.
Ce courriel et ses pieces-jointes sont envoyes de maniere confidentielle et
doivent etre traites avec attention.
Si vous n'etes pas le destinataire, merci de le detruire et d'en informer son
auteur.
Vous ne devez pas copier, utiliser, reveler ou diffuser son contenu a quiconque.
- Re: Orgmode plain list bullet : change automatically with list depth, (continued)
- Re: Orgmode plain list bullet : change automatically with list depth, Samuel Wales, 2022/06/16
- Re: Orgmode plain list bullet : change automatically with list depth, Samuel Wales, 2022/06/16
- Re: Orgmode plain list bullet : change automatically with list depth, Ihor Radchenko, 2022/06/17
- Re: Orgmode plain list bullet : change automatically with list depth, Samuel Wales, 2022/06/17
- Re: Orgmode plain list bullet : change automatically with list depth, Tim Cross, 2022/06/17
- Re: Orgmode plain list bullet : change automatically with list depth, Edouard Debry, 2022/06/19
- Re: Orgmode plain list bullet : change automatically with list depth, Tim Cross, 2022/06/19
- Re: Orgmode plain list bullet : change automatically with list depth, Edouard Debry, 2022/06/19
- Re: Orgmode plain list bullet : change automatically with list depth, Ihor Radchenko, 2022/06/19
- Re: Orgmode plain list bullet : change automatically with list depth, Edouard Debry, 2022/06/19
- Re: Orgmode plain list bullet : change automatically with list depth,
DEBRY . Edouard <=
- Re: Orgmode plain list bullet : change automatically with list depth, Ihor Radchenko, 2022/06/24
- Re: Orgmode plain list bullet : change automatically with list depth, DEBRY . Edouard, 2022/06/29