emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gustavo Barros <gusbrs.2016@gmail.com>
To: Nathan Neff <nathan.neff@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-refile-target-verify-function - use inherited tag & todo
Date: Sat, 02 Nov 2019 10:06:49 -0300	[thread overview]
Message-ID: <874kzma0ly.fsf@gmail.com> (raw)
In-Reply-To: <CAC=HedB438dezZSrsRWFY=2oRC7o+k929ksFpGBcc1WN6cd13w@mail.gmail.com>

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.

  reply	other threads:[~2019-11-02 13:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27 20:03 Nathan Neff
2019-10-27 22:58 ` Gustavo Barros
2019-11-02  0:47   ` Nathan Neff
2019-11-02 13:06     ` Gustavo Barros [this message]
2021-02-28 23:00       ` Nathan Neff

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=874kzma0ly.fsf@gmail.com \
    --to=gusbrs.2016@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nathan.neff@gmail.com \
    /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).