emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexander Baier <lexi.baier@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [Refile] Make agenda-files and current file targets
Date: Wed, 30 Oct 2013 17:44:45 +0100	[thread overview]
Message-ID: <87r4b23dz6.fsf@gmail.com> (raw)
In-Reply-To: 87vc0f2aju.fsf@gmail.com

Hello, it's me again,

I figured out, what was wrong with the original code.  I had gotten the
parentheses  of the lambda wrong, which messed all this up.

I modified the code and refactored the lambda out into a proper
function, as you can see below:

----------------------------------------------------------------
(defun dl-org-refile-targets ()
  (unless (member (buffer-file-name) org-agenda-files)
    (buffer-file-name)))

(setq org-refile-targets
      (quote ((org-agenda-files      :maxlevel . 4)
              (dl-org-refile-targets :regexp . ".*"))))
----------------------------------------------------------------

This does not throw any error anymore.  I have, however, come upon
another problem that manifests itself when calling org-refile with the
cursor upon a heading in a file that is not a member of
org-agenda-files: I see "Getting targets..." in the modeline, which
takes a long time (I canceled it after ~2 minutes).

What exactly does :regexp . ".*" do? I thought it would simply take
_all_ headlines in the file indicated by dl-org-refile-targets.  The
file I testet this with has less than 100 headlines and I have no
idea why this takes so long.

After changing the contraint to :maxlevel 4 as you can the below, it
works just fine.  (Note: The file in question has only headlines with
levels <= 2)

----------------------------------------------------------------
#+begin_src emacs-lisp
  (defun dl-org-refile-targets ()
    (unless (member (buffer-file-name) org-agenda-files)
      (buffer-file-name)))
  
  (setq org-refile-targets
        (quote ((org-agenda-files      :maxlevel . 4)
                (dl-org-refile-targets :maxlevel . 4))))
----------------------------------------------------------------

What did I miss here? Any help is appreciated.


Regards,
  Alex

      reply	other threads:[~2013-10-30 16:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 12:44 [Refile] Make agenda-files and current file targets Alexander Baier
2013-10-30 16:44 ` Alexander Baier [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=87r4b23dz6.fsf@gmail.com \
    --to=lexi.baier@gmail.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).