From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Dunsmore Subject: Exclude all TODO keywords from refile targets Date: Thu, 15 Nov 2012 10:15:45 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZ26Y-0003Yy-5x for emacs-orgmode@gnu.org; Thu, 15 Nov 2012 11:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZ26V-000678-3p for emacs-orgmode@gnu.org; Thu, 15 Nov 2012 11:15:50 -0500 Received: from mail-ob0-f169.google.com ([209.85.214.169]:52783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZ26U-00066z-TA for emacs-orgmode@gnu.org; Thu, 15 Nov 2012 11:15:47 -0500 Received: by mail-ob0-f169.google.com with SMTP id lz20so2036345obb.0 for ; Thu, 15 Nov 2012 08:15:45 -0800 (PST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I found a bit of code to exclude DONE keywords from refile targets here: http://orgmode.org/worg/org-hacks.html#sec-2-3 Since I try to keep all headings with keywords as end nodes, I wanted to exclude all TODO (and DONE) keywords. However, the member function doesn't work on a sequence data type, so I couldn't use org-todo-keywords the same way the org-hacks code used org-done-keywords. Furthermore, org-todo-keywords contains extraneous characters in parenthesis that define "selection characters". I ended up creating a new variable, org-todo-keywords-list, and converting the data from org-todo-keywords into a similar format as org-done-keywords. Perhaps a org-todo-keywords-list variable would be a useful addition to org-mode. Here's the code I'm using: (setq org-todo-keywords '((sequence "TODO(t)" "DELEGATE(l)" "STARTED(s@)" "WAITING(w@)" "|" "DONE(d)" "CANCELLED(c)" "DELEGATED(e@)" "POSTPONED(p@)"))) ;; define a new variable (defvar org-todo-keywords-list nil "A list version of org-todo-keywords, without the selection characters in parenthesis.") ;; create org-todo-keywords-list from org-todo-keywords-list, using a ;; similar format to org-done-keywords (dolist (keyword (first org-todo-keywords)) (when (and (stringp keyword) (not (equal keyword "|"))) (add-to-list 'org-todo-keywords-list (replace-regexp-in-string "(.*)" "" keyword)))) (defun jbd-verify-refile-target () "Exclude todo keywords with a done state from refile targets" (not (member (nth 2 (org-heading-components)) org-todo-keywords-list))) (setq org-refile-target-verify-function 'jbd-verify-refile-target)