emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edouard Debry <edouard.debry@gmail.com>
To: Samuel Wales <samologist@gmail.com>
Cc: Ihor Radchenko <yantar92@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 15:55:53 +0200	[thread overview]
Message-ID: <86sfo092qe.fsf@gmail.com> (raw)
In-Reply-To: <CAJcAo8u670vkkMFhZgPej=9cMkXD4xiFLgBioCSk2q6qk0+QeQ@mail.gmail.com> (Samuel Wales's message of "Fri, 17 Jun 2022 16:27:01 -0700")


What I am looking forward to is
1) not modifying the true "bullet" in the raw text, it will always be
"-" I just want the appearance to look "nicer"
2) having a bullet appearance level depth specific, e.g.
▪ this is first level of a list
▪ still first level
  ➤ this is the second level
  ➤ this is again the second level
    • a third level
  ➤ yet another second level

which means that de facto a specific bullet appearance would be
associated to a specifc list level depth, e.g. • is 3, ▪ is 1 (I assume
index begins at 1 ?)

Built like this, putting this list into the first level of another one
would shift all levels depth by +1 and consequently change the
appearance.

Currently, appearance is changed by :

(font-lock-add-keywords 'org-mode
                        '(("^ *\\([-]\\) "
                           (0 (prog1
                                  ()
                                (setq bullet "•")
                                (compose-region (match-beginning 1) (match-end 1) bullet))))))

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 :

(font-lock-add-keywords 'org-mode
                         '(("^ *\\([-]\\) "
                            (0 (let* ((depth (org-list--depth (org-element-at-point)))
                                      (bullet (cond ((= depth 1) "•")
                                                    ((= depth 2) "▸")
                                                    (t "-"))))
                                 (prog1 () (compose-region (match-beginning 1) (match-end 1) bullet)))))))

but it seems that "org-element-at-point" messes things.





Samuel Wales <samologist@gmail.com> writes:

> sure.
>
> iiuc i think op wants 2 things:
>
>   1] graphical bullets.  i.e. not the - + etc. that are in the org
> plain text as saved to disk.
>   2] each level of a list to have the same bullet style
>
> examples of 2]:
>
> a conforming list:
>
> - this is level 1.  for this list, we always want level 1 to
>   use the - bullet style in the org plain text.
>   + this is level 2.  for this list, we always want level 2
>     to use the + bullet style in the org plain text.
>   + another level 2
> - another level 1
>   + another level 2
>   + the + is CONSISTENT with the + in the level 2 of the
>     previous list item
>
> a non-conforming list:
>
> - this is level 1.  for this list, we always want level 1 to
>   use the - bullet style in the org plain text.
>   + this is level 2.  for this list, we always want level 2
>     to use the + bullet style in the org plain text.
>   + another level 2
> - another level 1
>   * another level 2
>   * these * markers are INCONSISTENT with the + markers in
>     the level 2 previous list item.
>
> the idea is for org [as opposed to fontification] to enforce this
> level correspondence.  whenever we do a bullet style change at any
> level, org could change ALL BULLETS AT THE SAME LEVEL.  this keeps the
> list conforming.
>
> currently, org does not do this.  instead, it allows you to
> say that /demotion/ makes a + when you have a -.  but
> without enforcement, the list can quickly become
> non-conforming after the user edits it.
>
> this idea is independent (orthogonal) to fontification /
> displayed graphical glyph.  i think op's 2] idea can make
> sense.  and then fontification / displayed graphical glyph
> can be done perhaps with a fontification package.
>
> in any case, fontification can merely say that + looks
> like 😺 or so.  orthogonal to levels.
>
> On 6/17/22, Ihor Radchenko <yantar92@gmail.com> wrote:
>> Samuel Wales <samologist@gmail.com> writes:
>>
>>> i wonder if org could do the semantics in the text, while
>>> fontification could do the appearance only.
>>>
>>> org allows you to change the bullet style [real text bullets rather
>>> than fontification] upon demotion.
>>>
>>> thus, you can have it consistent that demoting + from top level will
>>> create - on level 2 for 1 item.  until you change it.
>>>
>>> but org does not enforce by level.  so you can't keep the results of
>>> your demotion strategy in the rest of the list.  an enforced scheme
>>> would have it so that a change to new bullet style at a level, or
>>> level 1 otherwise, would style that level.
>>
>> Could you please provide an example. I do not understand what you are
>> trying to suggest.
>>
>> Best,
>> Ihor
>>


  parent reply	other threads:[~2022-06-19 13:56 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 [this message]
2022-06-19 14:03           ` Ihor Radchenko
2022-06-19 14:49             ` Edouard Debry
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=86sfo092qe.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).