emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Isaac <isaacpei@a1make.com>
To: emacs-orgmode@gnu.org
Subject: Re: Refile: refile to any open file.
Date: Thu, 14 Aug 2014 14:30:59 +0000 (UTC)	[thread overview]
Message-ID: <loom.20140814T161930-496@post.gmane.org> (raw)
In-Reply-To: 87iolvhe71.fsf@kmlap.domain.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	other threads:[~2014-08-14 14:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-26  1:16 Refile: refile to any open file lngndvs
2012-02-26  9:11 ` suvayu ali
2014-08-13 20:15   ` Isaac
2014-08-13 21:16     ` Kyle Meyer
2014-08-13 21:24     ` Jorge A. Alfaro-Murillo
2014-08-14  3:55       ` Nick Dokos
2014-08-14  4:45         ` Kyle Meyer
2014-08-14 14:30           ` Isaac [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=loom.20140814T161930-496@post.gmane.org \
    --to=isaacpei@a1make.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).