emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "DEBRY.Edouard" <edouard.debry@mbda-systems.com>
Cc: Edouard Debry <edouard.debry@gmail.com>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: *** BULK *** Re: How to set priority of a heading with the highest one among its children
Date: Mon, 24 Apr 2023 12:31:46 +0000	[thread overview]
Message-ID: <87cz3ttqa5.fsf@localhost> (raw)
In-Reply-To: <yu1m354pcvsz.fsf@mbda-systems.com>

DEBRY.Edouard <edouard.debry@mbda-systems.com> writes:

> Here is something working, probably not yet all cases proof
>
> (defun local/set-priority1 ()
>   (org-with-wide-buffer
>    (when (org-goto-first-child)
>      (let ((ls (remove nil (cl-loop collect (local/set-priority1) while (org-goto-sibling)))))
>        (outline-up-heading 1)

I recommend using org-* functions, when you can. outline-* functions are
not always compatible with Org.

> (defun local/set-priority2 ()
>   (save-excursion
>     (outline-up-heading (- (org-element-property :level (org-element-at-point)) 1))

Note that parent heading may or may not be just one level lower.
Consider
* heading 1
****** child 

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


      reply	other threads:[~2023-04-24 12:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 11:04 How to set priority of a heading with the highest one among its children Edouard Debry
2023-04-23 18:07 ` Ihor Radchenko
2023-04-24 12:24   ` *** BULK *** " DEBRY.Edouard
2023-04-24 12:31     ` Ihor Radchenko [this message]

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=87cz3ttqa5.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=edouard.debry@gmail.com \
    --cc=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).