From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gustavo Barros Subject: Re: org-refile-target-verify-function - use inherited tag & todo Date: Sat, 02 Nov 2019 10:06:49 -0300 Message-ID: <874kzma0ly.fsf@gmail.com> References: <87h83tokxy.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:35924) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iQt7O-0000hE-Gx for emacs-orgmode@gnu.org; Sat, 02 Nov 2019 09:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iQt7L-0003vo-Ug for emacs-orgmode@gnu.org; Sat, 02 Nov 2019 09:07:02 -0400 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:33742) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iQt7J-0003tT-GQ for emacs-orgmode@gnu.org; Sat, 02 Nov 2019 09:06:58 -0400 Received: by mail-qt1-x834.google.com with SMTP id y39so16935249qty.0 for ; Sat, 02 Nov 2019 06:06:55 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nathan Neff Cc: emacs-orgmode Hi Nate, On Fri, Nov 01 2019, Nathan Neff wrote: > Indeed, I do use org-refile-use-outline-path 'file. However, I have a > simple > directory specified for my org-agenda-files. ("~/org-mode") > Therefore > I'll need to > do something a bit different. > > It appears that your solution creates "targets" which is the targets > list > of course, and > then it creates "agenda-files" which goes through org-agenda-files and > finds all the filenames > in org-agenda files. > > It then mutates "targets", and removes any entry which is a filename > from > org-agenda-files. > > Since my org-agenda-files is simply ("~/org-mode/") none of the > entries > match. > > Hmmm, let me ask: Why not simply go through targets and remove any > entry > whose value is > a simple filename? Why search org-agenda-files first? This function > also > assumes that the org-refile-targets > always comes from org-agenda-files. > > I'll play with your function and see what I can get -- thank you for > the > head-start! > > Thanks > --Nate I'm glad this might be useful to you. And you are correct in all of observations. My main point is simply that, as things stand, you won't be able to trim the file level candidates with `org-refile-target-verify-function`, as they are hardcoded. But this simple function is the sketch of a (hackish) way. `org-refile-get-targets`' main purpose is to return the list of targets. The advice function grabs this return value, filters the list and returns the filtered list. How it filters may depend, as you noted. I've chosen a simple criterion which meets my use case (`org-agenda-files`, as I specify the individual files directly there, and use only those as refile targets). Indeed, it does make some presumptions, as you noted. (The function does not "search org-agenda-files" though, it just gets the list of their names, which is contained in the variable). In your case, you will certainly have to devise another filtering criterion. I think the one you suggest is a good one too. Best regards, Gustavo.