emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Simon Thum <simon.thum@gmx.de>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: More helm awesomeness
Date: Sun, 18 Jan 2015 23:15:21 +0100	[thread overview]
Message-ID: <54BC3079.1030706@gmx.de> (raw)

Hi all,

I recently updated my helm install so it includes 
helm-org-agenda-headings which is just AWESOME (to me at least). A bit 
like org-goto but across all agenda files at once, with goto, refile, 
linking built in. If you haven't tried it, I definitely recommend to do so.


Yet I'm missing a few things so far, I would like to have different 
datasources differentiated by tags, in particular the ARCHIVE tag, and 
the infamous FILETAGS so I cannot just regex my way through as the 
current approach does.

This requires making more use of org-ode when filling helm's buffers. My 
elisp isn't great but I might be able to get there if the approach is sane.

Any pointers are welcome! If you might help me please read on.

I would like to ask what would be the best approach for better utilising 
org infrastructure so I may have separate helm sources for 
live/archived, private/work, the clocking history, stuff like that.

The helm-org definition looks deceptively simple:

https://github.com/emacs-helm/helm/blob/master/helm-org.el

(defun helm-org-agenda-files-headings ()
(interactive)
(helm :sources (helm-source-org-headings-for-files (org-agenda-files))
:candidate-number-limit 99999
:buffer "*helm org headings*"))


FWICT, in effect helm-org is chewing itself through the buffers:

(defun helm-get-org-candidates-in-file (filename min-depth max-depth
&optional fontify)
(with-current-buffer (find-file-noselect filename)
(and fontify (jit-lock-fontify-now))
(let ((match-fn (if fontify 'match-string 'match-string-no-properties)))
(save-excursion
(goto-char (point-min))
(cl-loop while (re-search-forward org-complex-heading-regexp nil t)
if (let ((num-stars (length (match-string-no-properties 1))))
(and (>= num-stars min-depth) (<= num-stars max-depth)))
collect `(,(funcall match-fn 0) . ,(point-marker)))))))

I don't really get what it does but I have a hunch that org-element or 
other org-mode functions could be used to achieve the same with more 
precision. That's what I would need to do. FWIW I'd be happy to take a 
performance hit.

Thanks in advance,

Simon

             reply	other threads:[~2015-01-18 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 22:15 Simon Thum [this message]
2015-01-19 15:57 ` More helm awesomeness John Kitchin
2015-01-19 20:46   ` Simon Thum
2015-01-19 21:01     ` John Kitchin

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=54BC3079.1030706@gmx.de \
    --to=simon.thum@gmx.de \
    --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).