Nick Dokos <ndo...@gmail.com> wrote: > jorge.alfaro-muri...@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