emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [Refile] Make agenda-files and current file targets


From: Alexander Baier
Subject: Re: [O] [Refile] Make agenda-files and current file targets
Date: Wed, 30 Oct 2013 17:44:45 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]