emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Refile: refile to any open file.


From: Isaac
Subject: Re: [O] Refile: refile to any open file.
Date: Thu, 14 Aug 2014 14:30:59 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Kyle Meyer <kyle <at> kyleam.com> writes:



> 

> Nick Dokos <ndokos <at> gmail.com> wrote:

> > jorge.alfaro-murillo <at> yale.edu (Jorge A. Alfaro-Murillo) writes:

> [...]

> >> Perhaps you should return instead only the org mode files that are

> >> opened, something like this:

> >>

> >

> > Excellent idea: refiling to an arbitrary non-org-mode file will either

> > skip the file (if you are lucky, in which case you just pay a

> > performance penalty) or it will try to use it in which case you'll end

> > up with an error. There is no point in including arbitrary files into

> > the refile list.

> [...]

> > It might be better to check the major mode of the buffer, rather than

> > its filename: it is not necessarily true that foo.org is an org-mode

> > file, or foo.txt is not.

> 

> There's a built-in Org function that does this.

> 

> #+begin_src elisp

>   (org-buffer-list 'files)  

> #+end_src    

> 

> 



Thanks Kyle, Jorge, Nick and everybody!



Below is the working piece, I take pieces here and there,

grateful to everyone's help:



(defun ixp/org-buffer-files ()

  "Return list of opened orgmode buffer files"

  (mapcar (function buffer-file-name)

          (org-buffer-list 'files)))



(setq org-refile-targets

      (quote ((nil :maxlevel . 3)

              (ixp/org-buffer-files :maxlevel . 1)

              (org-agenda-files :maxlevel . 3))))



It's posted on emacs wiki as well 
http://www.emacswiki.org/emacs/OrgMode#toc20








reply via email to

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