From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: refiling : limiting the destination refile targets Date: Wed, 27 Jan 2010 14:16:18 +0100 Message-ID: <307C59F4-7249-4003-9720-16CB1EC3A37D@gmail.com> References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Na7kz-00010v-PE for emacs-orgmode@gnu.org; Wed, 27 Jan 2010 08:16:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Na7ku-0000yE-Ti for emacs-orgmode@gnu.org; Wed, 27 Jan 2010 08:16:29 -0500 Received: from [199.232.76.173] (port=34907 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na7ku-0000yB-CI for emacs-orgmode@gnu.org; Wed, 27 Jan 2010 08:16:24 -0500 Received: from mail-fx0-f216.google.com ([209.85.220.216]:65095) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Na7kt-0005tJ-Po for emacs-orgmode@gnu.org; Wed, 27 Jan 2010 08:16:24 -0500 Received: by fxm8 with SMTP id 8so4898747fxm.26 for ; Wed, 27 Jan 2010 05:16:22 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Richard Riley Cc: emacs-orgmode@gnu.org Hi Richard, On Jan 27, 2010, at 3:11 AM, Richard Riley wrote: > > Here is a slight extension of the previously discussed ability to > restrict what are considered valid refile targets. You can simply > modify the > restricted list org-no-refile-targets (which can be a list as below or > simply a string tag such as "norefile". > > ,---- > | (defun org-contains-tags (tags) > | "returns t if the currnt org item is tagged with tags wher tags > can be a single tag or a list of tags" > | (interactive) > | (let ((matched nil) > | (tagslist (org-split-string (org-get-tags-string) ":"))) > | (when tagslist > | (if (nlistp tags) > | (setq matched (member tags tagslist)) > | (catch 'break > | (dolist(tag tags) > | (if(member tag tagslist) > | (progn (setq matched t) > | (throw 'break t))))))) > | matched)) > | > | (defvar org-no-refile-tags `("NOTE" ,org-archive-tag) "org items > | containing one of these tags will not be considered for refile > targets") > | (setq org-refile-target-verify-function `(lambda()(not(org- > contains-tags org-no-refile-tags)))) > `---- > > As an elisp beginner, it pains me to tell you it took me about 2 hours > to get the right quoting sequences for the org-archive-tag to evaluate > properly .... I have significantly less hair now ... ;) > > r. You can also use the function org-get-local-tags to get the tags. Your variable definition can be simplified to (defvar org-no-refile-tags (list "NOTE" org-archive-tag)) - Carsten