emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: DEBRY.Edouard <edouard.debry@mbda-systems.com>
To: Emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Orgmode plain list bullet : change automatically with list depth
Date: Fri, 24 Jun 2022 14:28:54 +0000	[thread overview]
Message-ID: <yu1mbkui9luh.fsf@mbda-systems.com> (raw)
In-Reply-To: <86k09ck8sr.fsf@gmail.com> (Edouard Debry's message of "Sun, 19 Jun 2022 16:49:24 +0200")


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.


  reply	other threads:[~2022-06-24 14:47 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
2022-06-24 14:28               ` DEBRY.Edouard [this message]
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=yu1mbkui9luh.fsf@mbda-systems.com \
    --to=edouard.debry@mbda-systems.com \
    --cc=emacs-orgmode@gnu.org \
    /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).