emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: "François Pinard" <pinard@iro.umontreal.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: Weight of headers
Date: Sun, 26 Feb 2012 21:52:30 -0700	[thread overview]
Message-ID: <CAJcAo8ujquda5SiQ-UWH0CkvE2EqG42G-ikc2dzer-Xz1hVZLA@mail.gmail.com> (raw)
In-Reply-To: <871uphlzfs.fsf@iro.umontreal.ca>

Great way of doing it.

Another option is to create a new buffer and sort the headers by the
weight.  Ideally each header in the new buffer would be a link.

Yet another is to use the agenda.  I think it might have a new format
string option for the weight.  Then use the agenda to sort.

And another possibility is to gather weights recursively vs. for each
header.  This works for bytes.

Samuel

P.S.  Code from years ago.  Might or might not work.

;;(alpha-org-dus-tree)
(defun* alpha-org-dus-tree (&optional same (n 10))
  "Show the biggest subtrees in agenda files.  SAME says whether
to measure each node vs. each subtree."
  (interactive)
  ;;(show-all)
  ;;(with-current-buffer ...
  (switch-to-buffer "*alpha-org-dus-tree*")
  (erase-buffer)
  (insert
;;;  (cl-prettyprint
   (subseq (sort* (alpha-org-dus-tree-1 same)
                  #'>
                  :key #'car)
           0
           n)))
(defun alpha-org-dus-tree-1 (same)
  (org-map-entries #'(lambda ()
                       ;;(message "doing %s"
                       (cons (alpha-org-get-size same)
                             (org-get-heading)))
                   t
                   'agenda))
(defun alpha-org-get-size (&optional same)
  ;;(current-buffer)
  (- (save-excursion
       (ignore-errors
         (funcall (if same
                      ;;org-end-of-subtree t t
                      'org-forward-same-level
                    'outline-next-heading)
                  1))
       (point))
     (point)))

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

      parent reply	other threads:[~2012-02-27  6:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-26  2:42 Weight of headers François Pinard
2012-02-26 12:30 ` Nicolas Goaziou
2012-02-27  3:36   ` François Pinard
2012-02-27  3:56     ` François Pinard
2012-02-27  4:12       ` Nick Dokos
2012-02-27  4:52     ` Samuel Wales [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=CAJcAo8ujquda5SiQ-UWH0CkvE2EqG42G-ikc2dzer-Xz1hVZLA@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pinard@iro.umontreal.ca \
    /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).