Here's the solution: (defun my-org-files-list () (delq nil (mapcar (lambda (buffer) (buffer-file-name buffer)) (org-buffer-list 'files t)))) On Wed, May 4, 2016 at 1:20 PM, Peter Salazar wrote: > Hello, I use org-refile quite a bit, but for my use-case, I want to refile > my org-mode subtrees not to an org-agenda file, but to the current file or > another file I'm currently visiting. > > I had a way of doing this that was working correctly, but now has stopped > working. I'm not sure what I changed that broke it. > > Here's the code I'm using for org-refile: > > (setq org-outline-path-complete-in-steps nil) ; Refile in a single go > (setq org-completion-use-ido nil) > (setq org-refile-use-outline-path t) ; Show full paths for refiling > (setq org-refile-allow-creating-parent-nodes (quote confirm)) ; allow > refile to create parent tasks with confirmation > > (defun my-org-files-list () > (mapcar (lambda (buffer) > (buffer-file-name buffer)) > (org-buffer-list 'files t))) > > (setq org-refile-targets '((my-org-files-list :maxlevel . 3))) > > Again, this used to work. But now when I run org-refile, I get this: > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > get-file-buffer(nil) > org-find-base-buffer-visiting(nil) > org-get-agenda-file-buffer(nil) > org-refile-get-targets(nil (#("this" 0 4 (fontified t face > org-level-1)))) > org-refile-get-location("Refile subtree \"this\" to" nil confirm nil) > org-refile(nil) > call-interactively(org-refile record nil) > command-execute(org-refile record) > execute-extended-command(nil "org-refile") > call-interactively(execute-extended-command nil nil) > command-execute(execute-extended-command) > > Any suggestions on how to fix this? Thanks! > >